ref: 95cc910349d0aa1e39d6c0786db577b8075eeb60
parent: de482094992cf84425c5868b03abda4deea2306b
author: Simon Howard <[email protected]>
date: Sat Apr 6 11:48:31 EDT 2013
Run I_ShutdownJoystick on exit (thanks Brad Harding). Subversion-branch: /branches/v2-branch Subversion-revision: 2591
--- a/src/i_joystick.c
+++ b/src/i_joystick.c
@@ -34,6 +34,7 @@
#include "doomtype.h"
#include "d_event.h"
#include "i_joystick.h"
+#include "i_system.h"
#include "m_config.h"
@@ -66,6 +67,16 @@
static int joystick_y_axis = 1;
static int joystick_y_invert = 0;
+void I_ShutdownJoystick(void)
+{
+ if (joystick != NULL)
+ {
+ SDL_JoystickClose(joystick);
+ joystick = NULL;
+ SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
+ }
+}
+
void I_InitJoystick(void)
{
int num_axes;
@@ -118,16 +129,8 @@
// Initialized okay!
printf("I_InitJoystick: %s\n", SDL_JoystickName(joystick_index));
-}
-void I_ShutdownJoystick(void)
-{
- if (joystick != NULL)
- {
- SDL_JoystickClose(joystick);
- joystick = NULL;
- SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
- }
+ I_AtExit(I_ShutdownJoystick, true);
}
// Get a bitmask of all currently-pressed buttons