Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hello,

I am using offset 3122 to read the selected COM. This is the code I use:

byte audioSelection;

FSUIPC_Read(0x3122, 1, &audioSelection, &error);
int comSelection = 0;
if(audioSelection >= 128) comSelection = 1;
else comSelection = 2;

This works well with FSX (And P3D I assume, I didn't test it on P3D). However, with X-Plane 11 and XPUIPC, I got it flipped (COM2 instead of COM1, and vice versa). Is there any way to get it right?

Posted
1 hour ago, Abdullah Radwan said:

This works well with FSX (And P3D I assume, I didn't test it on P3D). However, with X-Plane 11 and XPUIPC, I got it flipped (COM2 instead of COM1, and vice versa). Is there any way to get it right?

First thing would be to report the error to the XPUIPC author.

To fix it in your program you'd surely just  need to set your comSelection value the other way around for your X-Plane version. If you can test whether you are talking to FSX/P3D or XPlane, then just make it conditional on that.

Pete

 

Posted

There isn't a direct way of knowing that you are connected to XPUIPC, however, I noticed that when you are connected to XPUIPC, FSUIPC_FS_VERSION reports SIM_FSX and FSUIPC_VERSION reports 5 (which is impossible). So here is the code:

bool isCom1Selected, isXPUIPC;
isXPUIPC = (0x0f & (FSUIPC_Version >> 28)) == 5 && FSUIPC_FS_Version == SIM_FSX;
if(audioSelection & 128) isCom1Selected = true;
else isCom1Selected = false;
if(isXPUIPC) isCom1Selected = !isCom1Selected;

 

Posted
7 hours ago, Abdullah Radwan said:

I noticed that when you are connected to XPUIPC, FSUIPC_FS_VERSION reports SIM_FSX and FSUIPC_VERSION reports 5 (which is impossible).

I see. So you've got a way. Well done.

Pete

 

  • 1 year later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.