Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hello,

I'm training for a futur FsDevelopment using mingw32 as compiler (IDE : CodeBlocks)


FSUIPC_Read(0x0366, 2, &g, &dwResult);
FSUIPC_Process(&dwResult);
[/CODE]

I read the offset 0x0366 to know if the aircraft is on the ground or not but the value returned is random (it doesn't return value so)

I use other offset like aircraft altitude, IAS, TAS, etc... but this one does'nt work...

Thank you for answer ;)

Air3b

Posted


FSUIPC_Read(0x0366, 2, &g, &dwResult);
FSUIPC_Process(&dwResult);
[/CODE]

I do hope you aren't doing a Process call for each and every offset you want to read? You should group them all and do one Process at regular intervals.

I read the offset 0x0366 to know if the aircraft is on the ground or not but the value returned is random (it doesn't return value so)

I use other offset like aircraft altitude, IAS, TAS, etc... but this one does'nt work...

It works fine. Check it with FSUIPC logging or with FSInterogate. You don't show how you've defined "g", maybe you are interpreting it incorrectly due to a bad declaration?

Note that it isn't updated in slew mode (as documented), but it is either 0 or 1.

Regards

Pete

Posted

Hi Peter,

reading this post i put attention to your comment: 'I do hope you aren't doing a Process call for each and every offset you want to read'.

As I have written a program doing several reads and writes with 'process' calls for each one, I would understand which are the risks here and the benefits I could get modyfing the calls as you are suggesting.

Thanks ain advance and best regards

Joe

Posted

As I have written a program doing several reads and writes with 'process' calls for each one, I would understand which are the risks here and the benefits I could get modyfing the calls as you are suggesting.

The whole point of separating the processing of the requests from the actual individual read and write is to allow many reads and writes to be accumulated for processing all at once. The actual read/write calls merely add a request to a list inside your own program. Every Process call involved a Process Switch, with FS being interrupted so that FSUIPC can process the list of requests -- whilst this happens your program is frozen.

What you are doing works, but it is extremely inefficient. It slows FS down and it cripples your own program's performance. If you are writing the program only for your own use and are happy with the results, then it isn't a worry. But it makes things look worse than they should be.

Regards

Pete

Posted

Hi Peter,

thanks a lot for your prompt answer... highly useful as always.

I will update my program as suggested, effectively, even if not so visible running FSX, I had some suspect in term of efficiency considering the high number of read/write that i separately do

Best regards

Joe

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

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.