Jump to content
The simFlight Network Forums

Mostafa

Members
  • Posts

    5
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Egypt

Mostafa's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Thank you for your support. This is the code that worked for me: #include <iostream> #include <windows.h> #include "FSUIPC_User64.h" #include <iomanip> using namespace std; int main() { DWORD dwResult; if (FSUIPC_Open(SIM_ANY, &dwResult)) { std::cout << "Connected to FSUIPC" << std::endl; double newLvarValue = 1.0; // The value you want to set // Step 1: Write the new LVAR value to user offset 0x66C0 if (!FSUIPC_Write(0x66C0, sizeof(newLvarValue), &newLvarValue, &dwResult)) { std::cout << "Failed to write new LVAR value to offset 0x66C0" << std::endl; } // Step 2: Write the offset address (0x66C0) and format specifier (0 for double) to 0x0D6C DWORD param = 0x066C0; // 0x66C0 offset + format specifier (0 = double) if (!FSUIPC_Write(0x0D6C, sizeof(param), &param, &dwResult)) { std::cout << "Failed to write parameter to offset 0x0D6C" << std::endl; } // Step 3: Write the LVAR command "::ASD_SWITCH_EXT_POWER" to 0x0D70 const char lvarCommand[] = "::ASD_SWITCH_EXT_POWER"; if (!FSUIPC_Write(0x0D70, sizeof(lvarCommand), (void*)lvarCommand, &dwResult)) { std::cout << "Failed to write LVAR command to offset 0x0D70" << std::endl; } // Step 4: Process the writes if (!FSUIPC_Process(&dwResult)) { std::cout << "FSUIPC process failed" << std::endl; } else { std::cout << "LVAR write command sent successfully" << std::endl; } FSUIPC_Close(); } else { std::cout << "Failed to connect to FSUIPC" << std::endl; } } Could you help me read an LVAR? @John Dowson
  2. Using this code as your instructions just added a FSUIPC_Read function before Close: #include <iostream> #include <windows.h> #include "FSUIPC_User64.h" #include <iomanip> using namespace std; int main() { DWORD dwResult; if (FSUIPC_Open(SIM_ANY, &dwResult)) { std::cout << "Connected to FSUIPC" << std::endl; double newLvarValue = 1.0; // The value you want to set // Step 1: Write the new LVAR value to user offset 0x66C0 if (!FSUIPC_Write(0x66C0, sizeof(newLvarValue), &newLvarValue, &dwResult)) { std::cout << "Failed to write new LVAR value to offset 0x66C0" << std::endl; } // Step 2: Write the offset address (0x66C0) and format specifier (0 for double) to 0x0D6C DWORD param = 0x66C00000; // 0x66C0 offset + format specifier (0 = double) if (!FSUIPC_Write(0x0D6C, sizeof(param), &param, &dwResult)) { std::cout << "Failed to write parameter to offset 0x0D6C" << std::endl; } // Step 3: Write the LVAR command "::ASD_SWITCH_EXT_POWER" to 0x0D70 const char lvarCommand[] = "::ASD_SWITCH_EXT_POWER"; if (!FSUIPC_Write(0x0D70, sizeof(lvarCommand), (void*)lvarCommand, &dwResult)) { std::cout << "Failed to write LVAR command to offset 0x0D70" << std::endl; } // Step 4: Process the writes if (!FSUIPC_Process(&dwResult)) { std::cout << "FSUIPC process failed" << std::endl; } else { std::cout << "LVAR write command sent successfully" << std::endl; } // Step 5: Read back the value from 0x66C0 to confirm the change double readBackValue = 0.0; if (FSUIPC_Read(0x66C0, sizeof(readBackValue), &readBackValue, &dwResult)) { FSUIPC_Process(&dwResult); std::cout << "LVAR ASD_SWITCH_EXT_POWER updated to: " << readBackValue << std::endl; } else { std::cout << "Failed to read back LVAR value" << std::endl; } FSUIPC_Close(); } else { std::cout << "Failed to connect to FSUIPC" << std::endl; } } This results in : Connected to FSUIPC LVAR write command sent successfully LVAR ASD_SWITCH_EXT_POWER updated to: 1 But the switch in the simulator doesn't change, I am sure that the switch named ASD_SWITCH_EXT_POWER as I use SPAD.next to get LVARs. Is there is something I am missing ? Thanks In Advance. @John Dowson
  3. I am trying to change a switch which has LVAR: ASD_SWITCH_EXT_POWER using C++ code, so I am using UIPC_SDK_C_version2. Could anyone give me a snippet of code on how to read the value of the switch and how to change its value to 1. Also trying to build any code using FSUIPC_User64.h results in build error ( The library was created by a different version of the compiler ) is there is something I am missing? Thanks In Advance.
  4. Using UIPC_SDK_C_version2. Is there is documentation on the library or how to use the functions? Also, Could you give just a snippet of a code that update an LVAR named : ASD_SWITCH_EXT_POWER to 1 then Read its current value? Thanks In Advance. @John Dowson
  5. Could anyone guide me on how to change the value of LVARs in Prepar3d using C++ code? I can't find FSUIPC_User.h or .cpp files. Thanks in advance.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.