diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
| commit | 5a079a2d114f96d4847d1ee305d5b7c16eeec50e (patch) | |
| tree | 8926ab44f168acf787d8e19608857b3af0f82758 /contrib/SDL-3.2.8/src/joystick/dummy/SDL_sysjoystick.c | |
Initial commit
Diffstat (limited to 'contrib/SDL-3.2.8/src/joystick/dummy/SDL_sysjoystick.c')
| -rw-r--r-- | contrib/SDL-3.2.8/src/joystick/dummy/SDL_sysjoystick.c | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/joystick/dummy/SDL_sysjoystick.c b/contrib/SDL-3.2.8/src/joystick/dummy/SDL_sysjoystick.c new file mode 100644 index 0000000..8240d45 --- /dev/null +++ b/contrib/SDL-3.2.8/src/joystick/dummy/SDL_sysjoystick.c | |||
| @@ -0,0 +1,156 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #if defined(SDL_JOYSTICK_DUMMY) || defined(SDL_JOYSTICK_DISABLED) | ||
| 24 | |||
| 25 | // This is the dummy implementation of the SDL joystick API | ||
| 26 | |||
| 27 | #include "../SDL_sysjoystick.h" | ||
| 28 | #include "../SDL_joystick_c.h" | ||
| 29 | |||
| 30 | static bool DUMMY_JoystickInit(void) | ||
| 31 | { | ||
| 32 | return true; | ||
| 33 | } | ||
| 34 | |||
| 35 | static int DUMMY_JoystickGetCount(void) | ||
| 36 | { | ||
| 37 | return 0; | ||
| 38 | } | ||
| 39 | |||
| 40 | static void DUMMY_JoystickDetect(void) | ||
| 41 | { | ||
| 42 | } | ||
| 43 | |||
| 44 | static bool DUMMY_JoystickIsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name) | ||
| 45 | { | ||
| 46 | return false; | ||
| 47 | } | ||
| 48 | |||
| 49 | static const char *DUMMY_JoystickGetDeviceName(int device_index) | ||
| 50 | { | ||
| 51 | return NULL; | ||
| 52 | } | ||
| 53 | |||
| 54 | static const char *DUMMY_JoystickGetDevicePath(int device_index) | ||
| 55 | { | ||
| 56 | return NULL; | ||
| 57 | } | ||
| 58 | |||
| 59 | static int DUMMY_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) | ||
| 60 | { | ||
| 61 | return -1; | ||
| 62 | } | ||
| 63 | |||
| 64 | static int DUMMY_JoystickGetDevicePlayerIndex(int device_index) | ||
| 65 | { | ||
| 66 | return -1; | ||
| 67 | } | ||
| 68 | |||
| 69 | static void DUMMY_JoystickSetDevicePlayerIndex(int device_index, int player_index) | ||
| 70 | { | ||
| 71 | } | ||
| 72 | |||
| 73 | static SDL_GUID DUMMY_JoystickGetDeviceGUID(int device_index) | ||
| 74 | { | ||
| 75 | SDL_GUID guid; | ||
| 76 | SDL_zero(guid); | ||
| 77 | return guid; | ||
| 78 | } | ||
| 79 | |||
| 80 | static SDL_JoystickID DUMMY_JoystickGetDeviceInstanceID(int device_index) | ||
| 81 | { | ||
| 82 | return 0; | ||
| 83 | } | ||
| 84 | |||
| 85 | static bool DUMMY_JoystickOpen(SDL_Joystick *joystick, int device_index) | ||
| 86 | { | ||
| 87 | return SDL_SetError("Logic error: No joysticks available"); | ||
| 88 | } | ||
| 89 | |||
| 90 | static bool DUMMY_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) | ||
| 91 | { | ||
| 92 | return SDL_Unsupported(); | ||
| 93 | } | ||
| 94 | |||
| 95 | static bool DUMMY_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble) | ||
| 96 | { | ||
| 97 | return SDL_Unsupported(); | ||
| 98 | } | ||
| 99 | |||
| 100 | static bool DUMMY_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) | ||
| 101 | { | ||
| 102 | return SDL_Unsupported(); | ||
| 103 | } | ||
| 104 | |||
| 105 | static bool DUMMY_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size) | ||
| 106 | { | ||
| 107 | return SDL_Unsupported(); | ||
| 108 | } | ||
| 109 | |||
| 110 | static bool DUMMY_JoystickSetSensorsEnabled(SDL_Joystick *joystick, bool enabled) | ||
| 111 | { | ||
| 112 | return SDL_Unsupported(); | ||
| 113 | } | ||
| 114 | |||
| 115 | static void DUMMY_JoystickUpdate(SDL_Joystick *joystick) | ||
| 116 | { | ||
| 117 | } | ||
| 118 | |||
| 119 | static void DUMMY_JoystickClose(SDL_Joystick *joystick) | ||
| 120 | { | ||
| 121 | } | ||
| 122 | |||
| 123 | static void DUMMY_JoystickQuit(void) | ||
| 124 | { | ||
| 125 | } | ||
| 126 | |||
| 127 | static bool DUMMY_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) | ||
| 128 | { | ||
| 129 | return false; | ||
| 130 | } | ||
| 131 | |||
| 132 | SDL_JoystickDriver SDL_DUMMY_JoystickDriver = { | ||
| 133 | DUMMY_JoystickInit, | ||
| 134 | DUMMY_JoystickGetCount, | ||
| 135 | DUMMY_JoystickDetect, | ||
| 136 | DUMMY_JoystickIsDevicePresent, | ||
| 137 | DUMMY_JoystickGetDeviceName, | ||
| 138 | DUMMY_JoystickGetDevicePath, | ||
| 139 | DUMMY_JoystickGetDeviceSteamVirtualGamepadSlot, | ||
| 140 | DUMMY_JoystickGetDevicePlayerIndex, | ||
| 141 | DUMMY_JoystickSetDevicePlayerIndex, | ||
| 142 | DUMMY_JoystickGetDeviceGUID, | ||
| 143 | DUMMY_JoystickGetDeviceInstanceID, | ||
| 144 | DUMMY_JoystickOpen, | ||
| 145 | DUMMY_JoystickRumble, | ||
| 146 | DUMMY_JoystickRumbleTriggers, | ||
| 147 | DUMMY_JoystickSetLED, | ||
| 148 | DUMMY_JoystickSendEffect, | ||
| 149 | DUMMY_JoystickSetSensorsEnabled, | ||
| 150 | DUMMY_JoystickUpdate, | ||
| 151 | DUMMY_JoystickClose, | ||
| 152 | DUMMY_JoystickQuit, | ||
| 153 | DUMMY_JoystickGetGamepadMapping | ||
| 154 | }; | ||
| 155 | |||
| 156 | #endif // SDL_JOYSTICK_DUMMY || SDL_JOYSTICK_DISABLED | ||
