mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-04 06:39:31 +00:00
SDL_GetJoysticks() follows the SDL_GetStringRule
This commit is contained in:
@@ -365,7 +365,7 @@ SDL_DYNAPI_PROC(SDL_JoystickType,SDL_GetJoystickType,(SDL_Joystick *a),(a),retur
|
||||
SDL_DYNAPI_PROC(SDL_JoystickType,SDL_GetJoystickTypeForID,(SDL_JoystickID a),(a),return)
|
||||
SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickVendor,(SDL_Joystick *a),(a),return)
|
||||
SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickVendorForID,(SDL_JoystickID a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_JoystickID*,SDL_GetJoysticks,(int *a),(a),return)
|
||||
SDL_DYNAPI_PROC(const SDL_JoystickID*,SDL_GetJoysticks,(int *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromName,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromScancode,(SDL_Scancode a, SDL_Keymod b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetKeyName,(SDL_Keycode a),(a),return)
|
||||
|
||||
@@ -89,7 +89,7 @@ typedef struct GamepadMapping_t
|
||||
typedef struct
|
||||
{
|
||||
int refcount _guarded;
|
||||
SDL_JoystickID *joysticks _guarded;
|
||||
const SDL_JoystickID *joysticks _guarded;
|
||||
GamepadMapping_t **joystick_mappings _guarded;
|
||||
|
||||
int num_changed_mappings _guarded;
|
||||
@@ -579,7 +579,6 @@ static void PopMappingChangeTracking(void)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_free(tracker->joysticks);
|
||||
SDL_free(tracker->joystick_mappings);
|
||||
SDL_free(tracker->changed_mappings);
|
||||
SDL_free(tracker);
|
||||
@@ -2358,7 +2357,7 @@ int SDL_InitGamepadMappings(void)
|
||||
int SDL_InitGamepads(void)
|
||||
{
|
||||
int i;
|
||||
SDL_JoystickID *joysticks;
|
||||
const SDL_JoystickID *joysticks;
|
||||
|
||||
SDL_gamepads_initialized = SDL_TRUE;
|
||||
|
||||
@@ -2373,7 +2372,6 @@ int SDL_InitGamepads(void)
|
||||
SDL_PrivateGamepadAdded(joysticks[i]);
|
||||
}
|
||||
}
|
||||
SDL_free(joysticks);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -2383,7 +2381,7 @@ SDL_bool SDL_HasGamepad(void)
|
||||
{
|
||||
int num_joysticks = 0;
|
||||
int num_gamepads = 0;
|
||||
SDL_JoystickID *joysticks = SDL_GetJoysticks(&num_joysticks);
|
||||
const SDL_JoystickID *joysticks = SDL_GetJoysticks(&num_joysticks);
|
||||
if (joysticks) {
|
||||
int i;
|
||||
for (i = num_joysticks - 1; i >= 0 && num_gamepads == 0; --i) {
|
||||
@@ -2391,7 +2389,6 @@ SDL_bool SDL_HasGamepad(void)
|
||||
++num_gamepads;
|
||||
}
|
||||
}
|
||||
SDL_free(joysticks);
|
||||
}
|
||||
if (num_gamepads > 0) {
|
||||
return SDL_TRUE;
|
||||
|
||||
@@ -714,7 +714,7 @@ SDL_bool SDL_HasJoystick(void)
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
SDL_JoystickID *SDL_GetJoysticks(int *count)
|
||||
const SDL_JoystickID *SDL_GetJoysticks(int *count)
|
||||
{
|
||||
int i, num_joysticks, device_index;
|
||||
int joystick_index = 0, total_joysticks = 0;
|
||||
@@ -751,7 +751,7 @@ SDL_JoystickID *SDL_GetJoysticks(int *count)
|
||||
}
|
||||
SDL_UnlockJoysticks();
|
||||
|
||||
return joysticks;
|
||||
return SDL_FreeLater(joysticks);
|
||||
}
|
||||
|
||||
const SDL_SteamVirtualGamepadInfo *SDL_GetJoystickVirtualGamepadInfoForID(SDL_JoystickID instance_id)
|
||||
@@ -1905,7 +1905,7 @@ void SDL_CloseJoystick(SDL_Joystick *joystick)
|
||||
void SDL_QuitJoysticks(void)
|
||||
{
|
||||
int i;
|
||||
SDL_JoystickID *joysticks;
|
||||
const SDL_JoystickID *joysticks;
|
||||
|
||||
SDL_LockJoysticks();
|
||||
|
||||
@@ -1916,7 +1916,6 @@ void SDL_QuitJoysticks(void)
|
||||
for (i = 0; joysticks[i]; ++i) {
|
||||
SDL_PrivateJoystickRemoved(joysticks[i]);
|
||||
}
|
||||
SDL_free(joysticks);
|
||||
}
|
||||
|
||||
while (SDL_joysticks) {
|
||||
|
||||
Reference in New Issue
Block a user