Procházet zdrojové kódy

fix build after commit 2c4e6ed3585ec63adee2e9a680de3c52b4db3c0c:

move SDL_UsingGameInputForXInputControllers() to core/windows/SDL_gameinput.cpp
because joystick/gdk/SDL_gameinputjoystick.cpp isn't always added to build.
Ozkan Sezer před 1 dnem
rodič
revize
4d95a63fe3

+ 18 - 2
src/core/windows/SDL_gameinput.cpp

@@ -20,11 +20,11 @@
 */
 #include "SDL_internal.h"
 
-#ifdef HAVE_GAMEINPUT_H
-
 #include "SDL_windows.h"
 #include "SDL_gameinput.h"
 
+#ifdef HAVE_GAMEINPUT_H
+
 static SDL_SharedObject *g_hGameInputDLL;
 static IGameInput *g_pGameInput;
 static int g_nGameInputRefCount;
@@ -99,4 +99,20 @@ void SDL_QuitGameInput(void)
     }
 }
 
+bool SDL_UsingGameInputForXInputControllers(void)
+{
+    if (SDL_GetHintBoolean(SDL_HINT_JOYSTICK_GAMEINPUT, SDL_GAMEINPUT_DEFAULT) &&
+        SDL_GameInputReady()) {
+        return true;
+    }
+    return false;
+}
+
+#else
+
+bool SDL_UsingGameInputForXInputControllers(void)
+{
+    return false;
+}
+
 #endif // HAVE_GAMEINPUT_H

+ 17 - 0
src/core/windows/SDL_gameinput.h

@@ -48,10 +48,27 @@ using namespace GameInput::v2;
 using namespace GameInput::v1;
 #endif
 
+// Default value for SDL_HINT_JOYSTICK_GAMEINPUT
+#if defined(SDL_PLATFORM_GDK) || (GAMEINPUT_API_VERSION >= 3)
+#define SDL_GAMEINPUT_DEFAULT true
+#else
+#define SDL_GAMEINPUT_DEFAULT false
+#endif
+
 extern bool SDL_InitGameInput(IGameInput **ppGameInput);
 extern bool SDL_GameInputReady(void);
 extern void SDL_QuitGameInput(void);
 
 #endif // HAVE_GAMEINPUT_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern bool SDL_UsingGameInputForXInputControllers(void);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif // SDL_gameinput_h_

+ 0 - 26
src/joystick/gdk/SDL_gameinputjoystick.cpp

@@ -20,8 +20,6 @@
 */
 #include "SDL_internal.h"
 
-#include "SDL_gameinputjoystick_c.h"
-
 #ifdef SDL_JOYSTICK_GAMEINPUT
 
 #include "../SDL_sysjoystick.h"
@@ -29,13 +27,6 @@
 #include "../../core/windows/SDL_windows.h"
 #include "../../core/windows/SDL_gameinput.h"
 
-// Default value for SDL_HINT_JOYSTICK_GAMEINPUT
-#if defined(SDL_PLATFORM_GDK) || (GAMEINPUT_API_VERSION >= 3)
-#define SDL_GAMEINPUT_DEFAULT true
-#else
-#define SDL_GAMEINPUT_DEFAULT false
-#endif
-
 enum
 {
     SDL_GAMEPAD_BUTTON_GAMEINPUT_SHARE = 11
@@ -1053,15 +1044,6 @@ static bool GAMEINPUT_JoystickGetGamepadMapping(int device_index, SDL_GamepadMap
     return true;
 }
 
-bool SDL_UsingGameInputForXInputControllers(void)
-{
-    if (SDL_GetHintBoolean(SDL_HINT_JOYSTICK_GAMEINPUT, SDL_GAMEINPUT_DEFAULT) &&
-        SDL_GameInputReady()) {
-        return true;
-    }
-    return false;
-}
-
 
 SDL_JoystickDriver SDL_GAMEINPUT_JoystickDriver =
 {
@@ -1088,12 +1070,4 @@ SDL_JoystickDriver SDL_GAMEINPUT_JoystickDriver =
     GAMEINPUT_JoystickGetGamepadMapping
 };
 
-
-#else
-
-bool SDL_UsingGameInputForXInputControllers(void)
-{
-    return false;
-}
-
 #endif // SDL_JOYSTICK_GAMEINPUT

+ 0 - 33
src/joystick/gdk/SDL_gameinputjoystick_c.h

@@ -1,33 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-#include "SDL_internal.h"
-
-// Set up for C function definitions, even when using C++
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern bool SDL_UsingGameInputForXInputControllers(void);
-
-// Ends C function definitions when using C++
-#ifdef __cplusplus
-}
-#endif

+ 1 - 1
src/joystick/windows/SDL_dinputjoystick.c

@@ -28,8 +28,8 @@
 #include "SDL_dinputjoystick_c.h"
 #include "SDL_rawinputjoystick_c.h"
 #include "SDL_xinputjoystick_c.h"
+#include "../../core/windows/SDL_gameinput.h"
 #include "../hidapi/SDL_hidapijoystick_c.h"
-#include "../gdk/SDL_gameinputjoystick_c.h"
 
 #ifndef DIDFT_OPTIONAL
 #define DIDFT_OPTIONAL 0x80000000

+ 1 - 1
src/joystick/windows/SDL_rawinputjoystick.c

@@ -37,8 +37,8 @@
 #include "../SDL_sysjoystick.h"
 #include "../../core/windows/SDL_windows.h"
 #include "../../core/windows/SDL_hid.h"
+#include "../../core/windows/SDL_gameinput.h"
 #include "../hidapi/SDL_hidapijoystick_c.h"
-#include "../gdk/SDL_gameinputjoystick_c.h"
 
 /* SDL_JOYSTICK_RAWINPUT_XINPUT is disabled because using XInput at the same time as
    raw input will turn off the Xbox Series X controller when it is connected via the

+ 1 - 1
src/joystick/windows/SDL_windows_gaming_input.c

@@ -24,7 +24,7 @@
 
 #include "../SDL_sysjoystick.h"
 #include "../hidapi/SDL_hidapijoystick_c.h"
-#include "../gdk/SDL_gameinputjoystick_c.h"
+#include "../../core/windows/SDL_gameinput.h"
 #include "SDL_rawinputjoystick_c.h"
 
 #include "../../core/windows/SDL_windows.h"

+ 3 - 4
src/joystick/windows/SDL_xinputjoystick.c

@@ -27,17 +27,16 @@
 #include "SDL_windowsjoystick_c.h"
 #include "SDL_xinputjoystick_c.h"
 #include "SDL_rawinputjoystick_c.h"
+#include "../../core/windows/SDL_gameinput.h"
 #include "../hidapi/SDL_hidapijoystick_c.h"
-#include "../gdk/SDL_gameinputjoystick_c.h"
 
 // Set up for C function definitions, even when using C++
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/*
- * Internal stuff.
- */
+// Internal stuff
+
 static bool s_bXInputEnabled = false;
 
 bool SDL_XINPUT_Enabled(void)