December 25, 200817 yr I have the following code in some FS9 gauge source code I was able to get from someone (and which I'd like to make work with FSX too). It determines whether or not the panel should play sound (it checks that FS sounds are enabled, that the aircraft is in an internal view, and that FS is not paused or in slew mode).It doesn't work in FSX because GLOBAL.DLL does not exist in that sim. How do I modify it to make it compatible with both sims? case PANEL_SERVICE_CONNECT_TO_WINDOW: RXPGLOBALHANDLE = GetModuleHandle("GLOBAL.DLL"); if ((RXPGLOBALHANDLE) != NULL) { SimSound = ((UINT32)(GetProcAddress(RXPGLOBALHANDLE,"Linkage")) + 0x0B20); // sound control SimPauseOrSlew = ((UINT32)(GetProcAddress(RXPGLOBALHANDLE,"Linkage")) + 0x0B24); // sound flag SimView = ((UINT32)(GetProcAddress(RXPGLOBALHANDLE,"Linkage")) + 0x0D48); // 2=tower or spot view } else { SimSound = 0; SimPauseOrSlew = 0; SimView = 0; } break;case PANEL_SERVICE_PRE_DRAW: if ((* (unsigned char *) SimView) != 2 && (* (unsigned char *) SimSound) == 1 && (* (unsigned char *) SimPauseOrSlew) == 1) { SoundFlag = TRUE; //enable sounds } else { SoundFlag = FALSE; } By the way, I've already got a BOOL in the code called IsFSX, which does exactly what it says on the tin...
January 1, 200917 yr Commercial Member Now you know the reason for not using hacks. :) Ed Wilson Mindstar AviationMy Playland - I69
January 1, 200917 yr Author As I indicated in the original message, I didn't write this code. Does anyone have any ideas for how I can write code which fulfills the same purpose, and which works in both FS9 and FSX
January 5, 200917 yr As I indicated in the original message, I didn't write this code. Does anyone have any ideas for how I can write code which fulfills the same purpose, and which works in both FS9 and FSXThe only solution I have found in FSX is to force the sound on (or off) on gauge load, and then to track occurrences of KEY_SOUND_ON, KEY_SOUND_OFF and KEY_SOUND_TOGGLE.Doug
January 6, 200917 yr Commercial Member The only solution I have found in FSX is to force the sound on (or off) on gauge load, and then to track occurrences of KEY_SOUND_ON, KEY_SOUND_OFF and KEY_SOUND_TOGGLE.DougWhy don't you all like SimConnect? It provides event notification for "Sound", for "View", for "Sim" and "Pause" modes... they do exactly what you want... Lefteris Kalamaras - Founder www.flightsimlabs.com
Create an account or sign in to comment