• Hi Guest!

    We have posted a new VaM2 dev log on Patreon, starting a monthly cadence of written progress updates between Beta releases. Highlights include the new Gizmos System, Selection Carousel, and Modes System with Context-Specific Editing. Beta1.2 is 15 of 21 items complete.

    Read the full post on Patreon, or follow progress on the public Trello roadmap.

VaM 1.x Console Application (win32) to force VAM to run on X3D cores in AMD processors

Threads regarding the original VaM 1.x

Italian Job

New member
Joined
Sep 8, 2024
Messages
5
Reactions
0
Hello, below is my contribution to the community.
It was developed for AMD processors with 16 cores, 8 of which feature X3D technology.
Embarcadero RAD C++ Builder 13 environment
This is a console application designed to force VAM to run on the CCD that houses the cores with X3D cache in AMD Processor. This is done without having to disable the second CCD and without sacrificing performance in other applications.
AMD Ryzen 9 5950X3D
AMD Ryzen 9 7950X3D
AMD Ryzen 9 9950X3D

C++:
// ---------------------------------------------------------------------------
#include <vcl.h>
#include <windows.h>
#include <iostream>
#include <string>
#pragma hdrstop

int main()
{
    // 1. Set your Vam directory (this is mine)
    std::string workingDir = "D:\\virt-a-mate 1.21.1.0";

    // 2. select your START command
    std::string command = "START \"VaM\" VaM.exe -vrmode None";
    //std::string command = "START \"VaM\" VaM.exe -vrmode oculus";
    //std::string command = "START \"VaM\" VaM.exe -vrmode OpenVR";
    //std::string command = "START \"VaM\" VaM.exe -vrmode None -screen-width 800 -screen-height 600 -screen-fullscreen 1";


    // 3. launch cmd
    std::string cmdLine = "cmd.exe /c " + command;

    // 4. Mask for X3D cores (core 0-15)
    DWORD_PTR affinityMask = 0x0000FFFF;  // or 0x000000FF for 8 logic cores

    STARTUPINFO si = {0};
    PROCESS_INFORMATION pi = {0};
    si.cb = sizeof(si);

    // 5. Optional: silent window
    //    for see cmd window, comment 2 row below
    si.dwFlags = STARTF_USESHOWWINDOW;
    si.wShowWindow = SW_HIDE;  // hide window

    std::cout << "START: " << cmdLine << std::endl;
    std::cout << "Directory: " << workingDir << std::endl;

    // 6. set mask (ereditarietà)
    SetProcessAffinityMask(GetCurrentProcess(), affinityMask);

    // 7. Launch cmd.exe  with START
    if (CreateProcess(NULL, cmdLine.data(), NULL, NULL, FALSE, 0, NULL,
                      workingDir.c_str(), &si, &pi))
    {
        std::cout << "Success command!" << std::endl;
        std::cout << "VAM launched (via START)." << std::endl;

        // Wait for Vam close (cmd.exe termina quando VAM si chiude)
        WaitForSingleObject(pi.hProcess, INFINITE);
        std::cout << "VAM closed." << std::endl;

        CloseHandle(pi.hThread);
        CloseHandle(pi.hProcess);
    }
    else
    {
        std::cout << "ERROR: Unable to execute the command. Code: " << GetLastError() << std::endl;
    }

    std::cout << "Push ENTER for exit..." << std::endl;
    std::cin.get();
    return 0;
}
//-------------------------------------------------------------------------------

Bye from Italy
 
CCD_X3D.png
 
Back
Top Bottom