diff --git a/src/d_main.c b/src/d_main.c index 14b205418..7fb187317 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -166,57 +166,6 @@ UINT8 ctrldown = 0; // 0x1 left, 0x2 right UINT8 altdown = 0; // 0x1 left, 0x2 right boolean capslock = 0; // gee i wonder what this does. -static void D_PadMenuScrollInput(UINT8 input) -{ - event_t dpadev; - memset(&dpadev, 0, sizeof(event_t)); - dpadev.type = ev_keydown; - - switch (input) - { - case DPAD_UP: - dpadev.data1 = KEY_UPARROW; - break; - case DPAD_DOWN: - dpadev.data1 = KEY_DOWNARROW; - break; - case DPAD_LEFT: - dpadev.data1 = KEY_LEFTARROW; - break; - case DPAD_RIGHT: - dpadev.data1 = KEY_RIGHTARROW; - break; - } - - D_PostEvent(&dpadev); // put into eventlist -} - -#define SCROLLDELAY 19 - -// Check if any dpad button is held -// and pass it to the eventlist -static void D_GamePadMenuScrollTicker(void) -{ - UINT8 i; - static UINT8 menuInputDelayTimer = 0; - - for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) - { - if (dpadscrollstate[i]) - { - if (menuInputDelayTimer < SCROLLDELAY) - menuInputDelayTimer++; - else if (menuInputDelayTimer == SCROLLDELAY) - D_PadMenuScrollInput(i); - - return; - } - } - - menuInputDelayTimer = 0; -} -#undef SCROLLDELAY - static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {}; static void D_DeviceLEDTick(void) @@ -844,11 +793,6 @@ void D_SRB2Loop(void) if (!dedicated) { - if (menuactive) - { - D_GamePadMenuScrollTicker(); - } - D_DeviceLEDTick(); } } diff --git a/src/g_input.c b/src/g_input.c index e5cd04668..6596d1e72 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -262,9 +262,6 @@ void G_ResetControls(void) memset(joyxmove, 0, sizeof(joyxmove)); memset(joyymove, 0, sizeof(joyymove)); - - // reset those just in case the game missed the keyup event - memset(dpadscrollstate, false, sizeof(dpadscrollstate)); } // diff --git a/src/g_input.h b/src/g_input.h index ec4a9d795..c430fe7bc 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -37,7 +37,7 @@ typedef enum KEY_JOY1 = KEY_MOUSE1 + MOUSEBUTTONS, KEY_HAT1 = KEY_JOY1 + JOYBUTTONS, - KEY_DBLMOUSE1 =KEY_HAT1 + JOYHATS*4, // double clicks + KEY_DBLMOUSE1 = KEY_HAT1 + JOYHATS*4, // double clicks KEY_DBLJOY1 = KEY_DBLMOUSE1 + MOUSEBUTTONS, KEY_DBLHAT1 = KEY_DBLJOY1 + JOYBUTTONS, diff --git a/src/i_system.h b/src/i_system.h index f5187e037..b3dedd396 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -221,10 +221,6 @@ INT32 I_mkdir(const char *dirname, INT32 unixright); */ const char *I_LocateWad(void); -/** \brief Joystick events -*/ -void I_GetJoystickEvents(UINT8 index); - char *I_GetEnv(const char *name); INT32 I_PutEnv(char *variable); diff --git a/src/i_video.h b/src/i_video.h index 852645c30..ad29983fa 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -143,6 +143,8 @@ boolean I_CheckNativeRes(void); void I_SetBorderlessWindow(void); +void I_HandleControllerHatRepeat(void); + #ifdef USE_FBO_OGL void RefreshOGLSDLSurface(void); diff --git a/src/m_menu.c b/src/m_menu.c index 09a0c6350..5a6d58595 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -759,8 +759,6 @@ static void Command_Manual_f(void) itemOn = 0; } -boolean dpadscrollstate[4] = {false, false, false, false}; - // // M_Responder // @@ -807,19 +805,15 @@ boolean M_Responder(event_t *ev) break; case KEY_HAT1: ch = KEY_UPARROW; - dpadscrollstate[DPAD_UP] = true; break; case KEY_HAT1 + 1: ch = KEY_DOWNARROW; - dpadscrollstate[DPAD_DOWN] = true; break; case KEY_HAT1 + 2: ch = KEY_LEFTARROW; - dpadscrollstate[DPAD_LEFT] = true; break; case KEY_HAT1 + 3: ch = KEY_RIGHTARROW; - dpadscrollstate[DPAD_RIGHT] = true; break; } @@ -835,24 +829,6 @@ boolean M_Responder(event_t *ev) } } } - else if (ev->type == ev_keyup) - { - switch (ev->data1) // if you let go of those set those to false - { - case KEY_HAT1: - dpadscrollstate[DPAD_UP] = false; - break; - case KEY_HAT1 + 1: - dpadscrollstate[DPAD_DOWN] = false; - break; - case KEY_HAT1 + 2: - dpadscrollstate[DPAD_LEFT] = false; - break; - case KEY_HAT1 + 3: - dpadscrollstate[DPAD_RIGHT] = false; - break; - } - } else if (menuactive) { tic_t thistime = I_GetTime(); @@ -1731,6 +1707,9 @@ void M_Ticker(void) if (dedicated) return; + if (menuactive) + I_HandleControllerHatRepeat(); + if (--skullAnimCounter <= 0) skullAnimCounter = 8; diff --git a/src/m_menu.h b/src/m_menu.h index de4f3b983..22b768385 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -38,16 +38,6 @@ extern boolean forceshowhud; // Does all the real work of the menu interaction. boolean M_Responder(event_t *ev); -// for scrolling through menus with controllers -extern boolean dpadscrollstate[4]; -enum -{ - DPAD_UP, - DPAD_DOWN, - DPAD_LEFT, - DPAD_RIGHT -}; - // Called by main loop, runs for demo playback. If this returns true, nullify any further user input. boolean M_DemoResponder(event_t *ev); diff --git a/src/s_sound.c b/src/s_sound.c index 7625a3f60..1f499382e 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1832,7 +1832,7 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32 } } -void S_ChangeMusicSpecial (const char *mmusic) +void S_ChangeMusicSpecial(const char *mmusic) { if (cv_resetspecialmusic.value) S_ChangeMusic(mmusic, MUSIC_FORCERESET, true); diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index 5281a7f01..38a52f623 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -719,16 +719,13 @@ static void JoyReset(SDLJoyInfo_t *JoySet) { SDL_GameControllerClose(JoySet->dev); } + JoySet->dev = NULL; JoySet->oldjoy = -1; + JoySet->id = -1; JoySet->axises = JoySet->buttons = JoySet->hats = JoySet->balls = 0; - //JoySet->scale } -/** \brief joystick up and running -*/ -static INT32 joystick_started[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0}; - /** \brief SDL info about joystick */ SDLJoyInfo_t JoyInfo[MAXSPLITSCREENPLAYERS]; @@ -783,22 +780,26 @@ void I_UpdateJoystickDeviceIndex(UINT8 player) /////////////////////////////////////////////// if (JoyInfo[player].dev) { - cv_usejoystick[player].value = I_GetJoystickDeviceIndex(JoyInfo[player].dev) + 1; + cv_usejoystick[player].value = JoyInfo[player].id + 1; } else { UINT8 joystickID, compareJoystick; + for (joystickID = 0; joystickID < MAXSPLITSCREENPLAYERS; joystickID++) { // is this cv_usejoystick used? const INT32 value = atoi(cv_usejoystick[joystickID].string); + for (compareJoystick = 0; compareJoystick < MAXSPLITSCREENPLAYERS; compareJoystick++) { if (compareJoystick == player) continue; + if (value == JoyInfo[compareJoystick].oldjoy || value == cv_usejoystick[compareJoystick].value) break; } + if (compareJoystick == MAXSPLITSCREENPLAYERS) { // We DID make it through the whole loop, so we can use this one! @@ -806,6 +807,7 @@ void I_UpdateJoystickDeviceIndex(UINT8 player) break; } } + if (joystickID == MAXSPLITSCREENPLAYERS) { // We DID NOT make it through the whole loop, so we can't assign this joystick to anything. @@ -828,14 +830,6 @@ void I_UpdateJoystickDeviceIndices(UINT8 excludePlayer) } } -/** \brief Joystick buttons states -*/ -static UINT64 lastjoybuttons[MAXSPLITSCREENPLAYERS] = {0,0,0,0}; - -/** \brief Joystick hats state -*/ -static UINT64 lastjoyhats[MAXSPLITSCREENPLAYERS] = {0,0,0,0}; - /** \brief Shuts down joystick \return void */ @@ -847,74 +841,34 @@ void I_ShutdownJoystick(UINT8 index) event.data2 = 0; event.data3 = 0; - lastjoybuttons[index] = lastjoyhats[index] = 0; - // emulate the up of all joystick buttons for (i = 0; i < JOYBUTTONS; i++) { - event.data1=KEY_JOY1 + i; + event.data1 = KEY_JOY1 + i; D_PostEvent(&event); } // emulate the up of all joystick hats for (i = 0; i < JOYHATS*4; i++) { - event.data1=KEY_HAT1+i; + event.data1 = KEY_HAT1+i; D_PostEvent(&event); } // reset joystick position event.type = ev_joystick; + for (i = 0; i < JOYAXISSET; i++) { event.data1 = i; D_PostEvent(&event); } - joystick_started[index] = 0; JoyReset(&JoyInfo[index]); // don't shut down the subsystem here, because hotplugging } -void I_GetJoystickEvents(UINT8 index) -{ - static event_t event = {}; - INT32 i = 0; - UINT64 joyhats = 0; - - if (!joystick_started[index]) - return; - - if (!JoyInfo[index].dev) //I_ShutdownJoystick(); - return; - - joyhats |= SDL_GameControllerGetButton(JoyInfo[index].dev, SDL_CONTROLLER_BUTTON_DPAD_UP); - joyhats |= SDL_GameControllerGetButton(JoyInfo[index].dev, SDL_CONTROLLER_BUTTON_DPAD_DOWN) << 1; - joyhats |= SDL_GameControllerGetButton(JoyInfo[index].dev, SDL_CONTROLLER_BUTTON_DPAD_LEFT) << 2; - joyhats |= SDL_GameControllerGetButton(JoyInfo[index].dev, SDL_CONTROLLER_BUTTON_DPAD_RIGHT) << 3; - - if (joyhats != lastjoyhats[index]) - { - INT64 j = 1; // keep only bits that changed since last time - INT64 newhats = joyhats ^ lastjoyhats[index]; - lastjoyhats[index] = joyhats; - - for (i = 0; i < JOYHATS*4; i++, j <<= 1) - { - if (newhats & j) // hat changed state? - { - if (joyhats & j) - event.type = ev_keydown; - else - event.type = ev_keyup; - event.data1 = KEY_HAT1 + i; - D_PostEvent(&event); - } - } - } -} - /** \brief Open joystick handle \param fname name of joystick @@ -931,6 +885,7 @@ static int joy_open(int playerIndex, int joyIndex) CONS_Printf(M_GetText("Joystick subsystem not started\n")); return -1; } + if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 0) { CONS_Printf(M_GetText("Game Controller subsystem not started\n")); @@ -965,12 +920,14 @@ static int joy_open(int playerIndex, int joyIndex) if (JoyInfo[playerIndex].dev == newdev // same device, nothing to do || (newdev == NULL && SDL_GameControllerGetAttached(JoyInfo[playerIndex].dev))) // we failed, but already have a working device return SDL_CONTROLLER_AXIS_MAX; + // Else, we're changing devices, so send neutral joy events CONS_Debug(DBG_GAMELOGIC, "Joystick1 device is changing; resetting events...\n"); I_ShutdownJoystick(playerIndex); } JoyInfo[playerIndex].dev = newdev; + JoyInfo[playerIndex].id = I_GetJoystickDeviceIndex(JoyInfo[playerIndex].dev); if (JoyInfo[playerIndex].dev == NULL) { @@ -1007,8 +964,9 @@ void I_InitJoystick(UINT8 index) UINT8 i; SDL_GameController *newcontroller = NULL; - //I_ShutdownJoystick(); - //SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE); + // not sure if this is the best place to put this + SDL_SetHint(SDL_HINT_AUTO_UPDATE_SENSORS, "0"); + if (M_CheckParm("-nojoy")) return; @@ -1037,6 +995,11 @@ void I_InitJoystick(UINT8 index) } } + JoyInfo[index].dev = NULL; + JoyInfo[index].oldjoy = -1; + JoyInfo[index].id = -1; + JoyInfo[index].axises = JoyInfo[index].buttons = JoyInfo[index].hats = JoyInfo[index].balls = 0; + if (cv_usejoystick[index].value) newcontroller = SDL_GameControllerOpen(cv_usejoystick[index].value-1); @@ -1049,23 +1012,24 @@ void I_InitJoystick(UINT8 index) break; } + JoyInfo[index].id = I_GetJoystickDeviceIndex(JoyInfo[index].dev); + if (newcontroller && i < MAXSPLITSCREENPLAYERS) // don't override an active device { - cv_usejoystick[index].value = I_GetJoystickDeviceIndex(JoyInfo[index].dev) + 1; + cv_usejoystick[index].value = JoyInfo[index].id + 1; } else if (newcontroller && joy_open(index, cv_usejoystick[index].value) != -1) { // SDL's device indexes are unstable, so cv_usejoystick may not match // the actual device index. So let's cheat a bit and find the device's current index. - JoyInfo[index].oldjoy = I_GetJoystickDeviceIndex(JoyInfo[index].dev) + 1; - joystick_started[index] = 1; + JoyInfo[index].oldjoy = JoyInfo[index].id + 1; } else { if (JoyInfo[index].oldjoy) I_ShutdownJoystick(index); + cv_usejoystick[index].value = 0; - joystick_started[index] = 0; } for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) @@ -1130,8 +1094,10 @@ static void I_ShutdownInput(void) INT32 I_NumJoys(void) { INT32 numjoy = 0; + if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK) numjoy = SDL_NumJoysticks(); + return numjoy; } @@ -1142,15 +1108,18 @@ const char *I_GetJoyName(INT32 joyindex) const char *tempname = NULL; joyname[0] = 0; joyindex--; //SDL's Joystick System starts at 0, not 1 + if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK) { tempname = SDL_JoystickNameForIndex(joyindex); + if (tempname) { memcpy(joyname, tempname, 255); joyname[255] = '\0'; } } + return joyname; } diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 787ce1b07..5d1d01985 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -558,7 +558,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type) { - event_t event; + event_t event = {0}; switch (type) { @@ -586,7 +586,9 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type) } if (event.data1) + { D_PostEvent(&event); + } } static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) @@ -638,7 +640,7 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type) { - event_t event; + event_t event = {0}; // Ignore the event if the mouse is not actually focused on the window. // This can happen if you used the mouse to restore keyboard focus; @@ -651,8 +653,6 @@ static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type) /// \todo inputEvent.button.which if (USE_MOUSEINPUT) { - SDL_memset(&event, 0, sizeof(event_t)); - switch (type) { case SDL_MOUSEBUTTONUP: @@ -693,27 +693,28 @@ static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type) static void Impl_HandleMouseWheelEvent(SDL_MouseWheelEvent evt) { - event_t event; + event_t event = {0}; if (USE_MOUSEINPUT) { - SDL_memset(&event, 0, sizeof(event_t)); - if (evt.y > 0) { event.data1 = KEY_MOUSEWHEELUP; event.type = ev_keydown; } + if (evt.y < 0) { event.data1 = KEY_MOUSEWHEELDOWN; event.type = ev_keydown; } + if (evt.y == 0) { event.data1 = 0; event.type = ev_keyup; } + if (event.type == ev_keyup || event.type == ev_keydown) { D_PostEvent(&event); @@ -721,40 +722,78 @@ static void Impl_HandleMouseWheelEvent(SDL_MouseWheelEvent evt) } } +static UINT8 hatrepeattimer[MAXSPLITSCREENPLAYERS]; +#define HATREPEATDELAY 19 + +void I_HandleControllerHatRepeat(void) +{ + // why bother if theres no controllers? + if (numcontrollers == 0) + return; + + event_t event = {ev_keydown, 0, 0, 0}; + + static const SDL_GameControllerButton hatbutt[4] = + { + SDL_CONTROLLER_BUTTON_DPAD_UP, + SDL_CONTROLLER_BUTTON_DPAD_DOWN, + SDL_CONTROLLER_BUTTON_DPAD_LEFT, + SDL_CONTROLLER_BUTTON_DPAD_RIGHT + }; + + for (int i = 0; i < MAXSPLITSCREENPLAYERS; i++) + { + if (!cv_usejoystick[i].value) + continue; + + SDL_GameController *controller = JoyInfo[i].dev; + + if (!controller) + continue; + + for (UINT8 h = 0; h < JOYHATS; h++) + { + if (SDL_GameControllerGetButton(controller, hatbutt[h])) + { + if (hatrepeattimer[i] < HATREPEATDELAY) + { + hatrepeattimer[i]++; + } + else if (hatrepeattimer[i] == HATREPEATDELAY) + { + event.data1 = KEY_HAT1 + (i * JOYHATS) + h; + D_PostEvent(&event); + } + + return; + } + } + + hatrepeattimer[i] = 0; + } +} + static void Impl_HandleControllerAxisEvent(SDL_ControllerAxisEvent evt) { event_t event; - SDL_JoystickID joyid[4]; INT32 value; UINT8 i; // Determine the Joystick IDs for each current open joystick for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { - joyid[i] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo[i].dev)); + if (evt.which == JoyInfo[i].id) + { + event.type = ev_joystick + i; + break; + } } + if (i == MAXSPLITSCREENPLAYERS) + return; + event.data1 = event.data2 = event.data3 = INT32_MAX; - if (evt.which == joyid[0]) - { - event.type = ev_joystick; - } - else if (evt.which == joyid[1]) - { - event.type = ev_joystick2; - } - else if (evt.which == joyid[2]) - { - event.type = ev_joystick3; - } - else if (evt.which == joyid[3]) - { - event.type = ev_joystick4; - } - else - return; - //axis if (evt.axis > JOYAXISSET*2) return; @@ -790,47 +829,89 @@ static void Impl_HandleControllerAxisEvent(SDL_ControllerAxisEvent evt) default: return; } + D_PostEvent(&event); } -static void Impl_HandleControllerButtonEvent(SDL_ControllerButtonEvent evt, Uint32 type) +static void Impl_HandleControllerHatEvent(SDL_ControllerButtonEvent evt, Uint32 type) { - event_t event; - SDL_JoystickID joyid[4]; + event_t event = {0}; UINT8 i; + static const int hat_buttons_base[] = {KEY_HAT1, KEY_2HAT1, KEY_3HAT1, KEY_4HAT1}; // Determine the Joystick IDs for each current open joystick for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { - joyid[i] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo[i].dev)); + if (evt.which == JoyInfo[i].id) + { + event.data1 = hat_buttons_base[i]; + break; + } } - if ( evt.button == SDL_CONTROLLER_BUTTON_DPAD_UP - || evt.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN - || evt.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT - || evt.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT) + if (i == MAXSPLITSCREENPLAYERS) + return; + + switch (type) { - // dpad buttons are mapped as the hat instead + case SDL_CONTROLLERBUTTONUP: + event.type = ev_keyup; + break; + case SDL_CONTROLLERBUTTONDOWN: + event.type = ev_keydown; + break; + default: + return; + } + + switch (evt.button) + { + case SDL_CONTROLLER_BUTTON_DPAD_UP: + break; + case SDL_CONTROLLER_BUTTON_DPAD_DOWN: + event.data1 += 1; + break; + case SDL_CONTROLLER_BUTTON_DPAD_LEFT: + event.data1 += 2; + break; + case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: + event.data1 += 3; + break; + default: + return; + } + + if (event.type != ev_console) + { + D_PostEvent(&event); + } +} + +static void Impl_HandleControllerButtonEvent(SDL_ControllerButtonEvent evt, Uint32 type) +{ + event_t event = {0}; + UINT8 i; + static const int buttons_base[] = {KEY_JOY1, KEY_2JOY1, KEY_3JOY1, KEY_4JOY1}; + + // dpad special case handling + if (evt.button >= SDL_CONTROLLER_BUTTON_DPAD_UP && + evt.button <= SDL_CONTROLLER_BUTTON_DPAD_RIGHT) + { + Impl_HandleControllerHatEvent(evt, type); return; } - if (evt.which == joyid[0]) + // Determine the Joystick IDs for each current open joystick + for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { - event.data1 = KEY_JOY1; + if (evt.which == JoyInfo[i].id) + { + event.data1 = buttons_base[i]; + break; + } } - else if (evt.which == joyid[1]) - { - event.data1 = KEY_2JOY1; - } - else if (evt.which == joyid[2]) - { - event.data1 = KEY_3JOY1; - } - else if (evt.which == joyid[3]) - { - event.data1 = KEY_4JOY1; - } - else + + if (i == MAXSPLITSCREENPLAYERS) return; switch (type) @@ -853,7 +934,9 @@ static void Impl_HandleControllerButtonEvent(SDL_ControllerButtonEvent evt, Uint return; if (event.type != ev_console) + { D_PostEvent(&event); + } } static void Impl_HandleControllerAddedEvent(SDL_Event evt) @@ -1097,7 +1180,6 @@ void I_StartupMouse(void) void I_OsPolling(void) { SDL_Keymod mod; - INT32 i; if (consolevent) I_GetConsoleEvents(); @@ -1105,9 +1187,6 @@ void I_OsPolling(void) if (SDL_WasInit(SDL_INIT_JOYSTICK|SDL_INIT_GAMECONTROLLER) == (SDL_INIT_JOYSTICK|SDL_INIT_GAMECONTROLLER)) { SDL_GameControllerUpdate(); - - for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) - I_GetJoystickEvents(i); } I_GetEvent(); diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index e4e21949b..3239da9b2 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -73,7 +73,7 @@ write netcode into the sound code, OKAY? //static UINT16 BUFFERSIZE = 2048; -static UINT16 SAMPLERATE = 44100; +static const UINT16 SAMPLERATE = 44100; #ifdef HAVE_OPENMPT #include "libopenmpt/libopenmpt.h" diff --git a/src/sdl/sdlmain.h b/src/sdl/sdlmain.h index 2caafc729..0fe93953a 100644 --- a/src/sdl/sdlmain.h +++ b/src/sdl/sdlmain.h @@ -42,6 +42,8 @@ typedef struct SDLJoyInfo_s { /// Controller handle SDL_GameController *dev; + /// Controller index + INT32 id; /// number of old joystick int oldjoy; /// number of axies