Forum

Consequences of a crash ... (mouse)

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Consequences of a crash ... (mouse)

Postby Baker » Mon Jun 20, 2011 2:39 pm

When a Quake engine crashes, a few different things can happen.

1. hardware gamma is left as is
2. mouse settings that were changed never get restored

The one I *really* find unacceptable is Quake messing with the mouse settings.

If you run Quake on Windows, eventually it will alter your mouse settings and not restore them unless you are using -dinput on the command line each and every time.

Because eventually either the engine will crash or you will have to kill the process due to a slow map or some other reason. Even if you use a crash handler like MH's code in this thread: viewtopic.php?t=2416

There are maybe 2 ways this can be handled.

A. On engine startup, create some file that proper shutdown will delete. This will make it so on startup, the engine can determined if it crashed on the previous usage and restore those settings.

B. Simply don't change the mouse settings.

Mental exercise ...

Code: Select all
void IN_Mouse_Acquire (void)
{
   if (!in_mousestarted) return;

#if SUPPORTS_DIRECTINPUT
   if (in_dinput)
      IN_Mouse_DInput_Acquire ();
   else
#endif
   {
#if ALTER_WINDOWS_MPARMS
      if (m_setparms.value && mouseparmsvalid)
      {
         m_windows_parms_altered = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0);
         Con_DPrintf ("Windows mouse parameters set.\n")
      }
#endif
      SetCursorPos (window_center_x, window_center_y);
      SetCapture (mainwindow);   Con_DPrintf ("Mouse messages captured\n");
   }
   // MH appears to use the concept that DirectInput should do this too
   ClipCursor (&window_rect);   Con_DPrintf ("Clip cursor region updated\n");
   ShowCursor (FALSE);         Con_DPrintf ("Cursor hidden.\n");

   in_mouse_acquired = true;
   Con_DPrintf ("Mouse acquired.\n");

}
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest