Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

FSX SP1 Bug? Localized cause of CTD

Featured Replies

After 8 solid hours of testing and pulling out my hair, I have finally localized the cause of the CTD when loading the default B206 (and only the B206) after my aircraft.In my fuel valve gauge on the main panel, I define an event handlerCODE

void CALLBACK EventHandler (ID32 event, UINT32 evdata, PVOID userdata){	if (event == KEY_PAUSE_TOGGLE)	{		// User has PAUSED the sim		bPauseToggle = !bPauseToggle;	}	if (event == KEY_SOUND_TOGGLE)	{		// User has toggled sound		bSoundToggle = !bSoundToggle;	}}void CALLBACK C_GAUGE(Gcb_)(PGAUGEHDR pgauge, SINT32 service_id, UINT32 extra_data){  PCHAR	pParams		= NULL;  switch (service_id)  {    case PANEL_SERVICE_PRE_INITIALIZE:      if ( pgauge != NULL )      {	register_key_event_handler((GAUGE_KEY_EVENT_HANDLER)EventHandler, 0);    case PANEL_SERVICE_PRE_KILL:      unregister_key_event_handler((GAUGE_KEY_EVENT_HANDLER)EventHandler, 0);      break;}
And when I comment out the handler and the register and unregister calls, FSX does not crash.Anyone have any suggestions? Does this sound like a bug since the code did work? Or, do you see something I'm doing wrong here?Patrick

Try moving the register event to PANEL_SERVICE_CONNECT_TO_WINDOW, and the unregister event to PANEL_SERVICE_DISCONNECT. Alternatively, put them in module_init and module_deinit.PRE_INITIALIZE and PRE_KILL get executed when the user switches between windowed and full-screen, and when the user moves or re-sizes a panel window.Doug

Doug,>Try moving the register event to>PANEL_SERVICE_CONNECT_TO_WINDOW, and the unregister event to>PANEL_SERVICE_DISCONNECT. OMG, you are a genius! It worked!!!! Why?>Alternatively, put them in module_init and module_deinit.I will try this too see if this works too, but I'm guessing it will given your suggestion.>PRE_INITIALIZE and PRE_KILL get executed when the user>switches between windowed and full-screen, and when the user>moves or re-sizes a panel window.Ok, I open FS in a window (vs. full screen) switch from VC to 2D view, then switch to the default, and it locks up. There was never a window resize, or window move. However, it did not lock until I clicked the window, so maybe that triggered the pair.You must have spent hours analyzing when those get called.May you win the lottery this coming weekend!Patrick

I spoke to soon :(Basically, moving the registration allows other aircraft to be loaded, but the Event Handler is never called.Also, if fact, if done the other way, ALL other aircraft crash after being loaded, not just the default B206 as I originally thought.Moving it to the module_init etc. also compiles, but again the handler is never actually called, although loading of other aircraft does not cause a crash.So, not sure what to try now.Patrick

Finally solved this one totally.The secret was using: PANEL_SERVICE_PANEL_OPEN PANEL_SERVICE_PANEL_CLOSEimagine that.

  • Moderator

I'm happy you got it sorted out.There are so MANY of the PANEL_SERVICE_xxx cases and not a single one of 'em is actually explained anywhere in the SDK, so we all have to work on the "Principle of Guess and by God..." *:-* "Every rule ever made has at least as many exceptions as there are people living..." :)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Yes, it was not apparent even from looking at the order they are called when different events happen in the sim.But, it seems they are making more sense to me now. It really would be nice if they were documented somewhat.Patrick

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.