Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Dear Peter, i'm currently build a dump fuel gauge for FS2004 default 744 using MS VC6. I want to read/write memory directly to do it. Because I dont know the offset, so I use one loop to read memory one by one. But I still can't find the offset, could you give me some tips?Thank you! :D

HMODULE GLOBALHANDLE;

UINT32 MEM;

GLOBALHANDLE = GetModuleHandle("GLOBAL.DLL");// I have also try to use SIM1.dll, PANELS.DLL, but all fail :?

if ((GLOBALHANDLE ) != NULL)

{

lookup_var(&FUEL_TANK_CENTER);//TokenVar:FUEL_TANK_CENTER_LEVEL

for(int i=0x0;i<0x3FFF;i++) //3FFF is big enough,i think

{

MEM = ((UINT32) GetProcAddress(GLOBALHANDLE ,"Linkage")) + i; // here is the offset

if( *(double *)MEM == FUEL_TANK_CENTER.var_value.n )

{

MessageBox(NULL,"Found","TEST",MB_OK);

}

}

}

Posted
Dear Peter, i'm currently build a dump fuel gauge for FS2004 default 744 using MS VC6. I want to read/write memory directly to do it. Because I dont know the offset, so I use one loop to read memory one by one. But I still can't find the offset, could you give me some tips?Thank you! :D

Why not use FSUIPC?

FS2004 is all a mass of C++ classes and derived classes, with private data allocated from the heap containing this stuff. It isn't in any global memory in modules, and the memory is released and reallocated every time you load a new aircraft or flight.

If you want to locate things like this you'll need to disassemble SIM1.DLL, find the routines which supply the "this" pointers for the appropriate aircraft Classes, then try to follow the pointers to the correct data. There's a LOT of code involved and it gets very *very* complicated, especially trying to keep it up to date as it moves. I use a mixture of C and ASM code and have to do some weird tricks to make it work.

Good luck!

Regards,

Pete

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.