From 4bb5e1f0f99adcae7585f1d88c355a3a3bcf7470 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 20 Dec 2023 14:15:09 -0800 Subject: [PATCH] Added migration notes for migrating Steam Input support from SDL2 to SDL3 --- build-scripts/SDL_migration.cocci | 9 +++++++++ build-scripts/rename_api.py | 8 ++++++-- docs/README-migration.md | 2 ++ include/SDL3/SDL_oldnames.h | 8 ++++++-- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci index fb27a66f6..0455147f4 100644 --- a/build-scripts/SDL_migration.cocci +++ b/build-scripts/SDL_migration.cocci @@ -2745,3 +2745,12 @@ expression w, i, s; - SDL_RenderFlush + SDL_FlushRenderer (...) +@@ +@@ +- SDL_CONTROLLERSTEAMHANDLEUPDATED ++ SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED +@@ +@@ +- SDL_GameControllerGetSteamHandle ++ SDL_GetGamepadSteamHandle + (...) diff --git a/build-scripts/rename_api.py b/build-scripts/rename_api.py index fe0ac6785..7c02b9e94 100755 --- a/build-scripts/rename_api.py +++ b/build-scripts/rename_api.py @@ -36,6 +36,10 @@ def main(): if not header.exists(): raise Exception("Couldn't find header %s" % header) + header_name = header.name + if (header.name == "SDL_gamepad.h"): + header_name = "SDL_gamecontroller.h" + header_text = header.read_text() # Replace the symbols in source code @@ -62,8 +66,8 @@ def main(): oldname = args.args[i + 0] newname = args.args[i + 1] - add_symbol_to_oldnames(header.name, oldname, newname) - add_symbol_to_migration(header.name, args.type, oldname, newname) + add_symbol_to_oldnames(header_name, oldname, newname) + add_symbol_to_migration(header_name, args.type, oldname, newname) add_symbol_to_coccinelle(args.type, oldname, newname) i += 2 diff --git a/docs/README-migration.md b/docs/README-migration.md index 3b7a90a2f..f3dfdacdd 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -338,6 +338,7 @@ The following symbols have been renamed: * SDL_CONTROLLERDEVICEREMAPPED => SDL_EVENT_GAMEPAD_REMAPPED * SDL_CONTROLLERDEVICEREMOVED => SDL_EVENT_GAMEPAD_REMOVED * SDL_CONTROLLERSENSORUPDATE => SDL_EVENT_GAMEPAD_SENSOR_UPDATE +* SDL_CONTROLLERSTEAMHANDLEUPDATED => SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED * SDL_CONTROLLERTOUCHPADDOWN => SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN * SDL_CONTROLLERTOUCHPADMOTION => SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION * SDL_CONTROLLERTOUCHPADUP => SDL_EVENT_GAMEPAD_TOUCHPAD_UP @@ -459,6 +460,7 @@ The following functions have been renamed: * SDL_GameControllerGetSensorData() => SDL_GetGamepadSensorData() * SDL_GameControllerGetSensorDataRate() => SDL_GetGamepadSensorDataRate() * SDL_GameControllerGetSerial() => SDL_GetGamepadSerial() +* SDL_GameControllerGetSteamHandle() => SDL_GetGamepadSteamHandle() * SDL_GameControllerGetStringForAxis() => SDL_GetGamepadStringForAxis() * SDL_GameControllerGetStringForButton() => SDL_GetGamepadStringForButton() * SDL_GameControllerGetTouchpadFinger() => SDL_GetGamepadTouchpadFinger() diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h index 5e5042d9e..d0fa5da18 100644 --- a/include/SDL3/SDL_oldnames.h +++ b/include/SDL3/SDL_oldnames.h @@ -83,6 +83,7 @@ #define SDL_CONTROLLERDEVICEREMAPPED SDL_EVENT_GAMEPAD_REMAPPED #define SDL_CONTROLLERDEVICEREMOVED SDL_EVENT_GAMEPAD_REMOVED #define SDL_CONTROLLERSENSORUPDATE SDL_EVENT_GAMEPAD_SENSOR_UPDATE +#define SDL_CONTROLLERSTEAMHANDLEUPDATED SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED #define SDL_CONTROLLERTOUCHPADDOWN SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN #define SDL_CONTROLLERTOUCHPADMOTION SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION #define SDL_CONTROLLERTOUCHPADUP SDL_EVENT_GAMEPAD_TOUCHPAD_UP @@ -147,7 +148,7 @@ #define SDL_WINDOWEVENT_SIZE_CHANGED SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED #define SDL_WINDOWEVENT_TAKE_FOCUS SDL_EVENT_WINDOW_TAKE_FOCUS -/* ##SDL_gamepad.h */ +/* ##SDL_gamecontroller.h */ #define SDL_CONTROLLER_AXIS_INVALID SDL_GAMEPAD_AXIS_INVALID #define SDL_CONTROLLER_AXIS_LEFTX SDL_GAMEPAD_AXIS_LEFTX #define SDL_CONTROLLER_AXIS_LEFTY SDL_GAMEPAD_AXIS_LEFTY @@ -221,6 +222,7 @@ #define SDL_GameControllerGetSensorData SDL_GetGamepadSensorData #define SDL_GameControllerGetSensorDataRate SDL_GetGamepadSensorDataRate #define SDL_GameControllerGetSerial SDL_GetGamepadSerial +#define SDL_GameControllerGetSteamHandle SDL_GetGamepadSteamHandle #define SDL_GameControllerGetStringForAxis SDL_GetGamepadStringForAxis #define SDL_GameControllerGetStringForButton SDL_GetGamepadStringForButton #define SDL_GameControllerGetTouchpadFinger SDL_GetGamepadTouchpadFinger @@ -525,6 +527,7 @@ #define SDL_CONTROLLERDEVICEREMAPPED SDL_CONTROLLERDEVICEREMAPPED_renamed_SDL_EVENT_GAMEPAD_REMAPPED #define SDL_CONTROLLERDEVICEREMOVED SDL_CONTROLLERDEVICEREMOVED_renamed_SDL_EVENT_GAMEPAD_REMOVED #define SDL_CONTROLLERSENSORUPDATE SDL_CONTROLLERSENSORUPDATE_renamed_SDL_EVENT_GAMEPAD_SENSOR_UPDATE +#define SDL_CONTROLLERSTEAMHANDLEUPDATED SDL_CONTROLLERSTEAMHANDLEUPDATED_renamed_SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED #define SDL_CONTROLLERTOUCHPADDOWN SDL_CONTROLLERTOUCHPADDOWN_renamed_SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN #define SDL_CONTROLLERTOUCHPADMOTION SDL_CONTROLLERTOUCHPADMOTION_renamed_SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION #define SDL_CONTROLLERTOUCHPADUP SDL_CONTROLLERTOUCHPADUP_renamed_SDL_EVENT_GAMEPAD_TOUCHPAD_UP @@ -589,7 +592,7 @@ #define SDL_WINDOWEVENT_SIZE_CHANGED SDL_WINDOWEVENT_SIZE_CHANGED_renamed_SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED #define SDL_WINDOWEVENT_TAKE_FOCUS SDL_WINDOWEVENT_TAKE_FOCUS_renamed_SDL_EVENT_WINDOW_TAKE_FOCUS -/* ##SDL_gamepad.h */ +/* ##SDL_gamecontroller.h */ #define SDL_CONTROLLER_AXIS_INVALID SDL_CONTROLLER_AXIS_INVALID_renamed_SDL_GAMEPAD_AXIS_INVALID #define SDL_CONTROLLER_AXIS_LEFTX SDL_CONTROLLER_AXIS_LEFTX_renamed_SDL_GAMEPAD_AXIS_LEFTX #define SDL_CONTROLLER_AXIS_LEFTY SDL_CONTROLLER_AXIS_LEFTY_renamed_SDL_GAMEPAD_AXIS_LEFTY @@ -663,6 +666,7 @@ #define SDL_GameControllerGetSensorData SDL_GameControllerGetSensorData_renamed_SDL_GetGamepadSensorData #define SDL_GameControllerGetSensorDataRate SDL_GameControllerGetSensorDataRate_renamed_SDL_GetGamepadSensorDataRate #define SDL_GameControllerGetSerial SDL_GameControllerGetSerial_renamed_SDL_GetGamepadSerial +#define SDL_GameControllerGetSteamHandle SDL_GameControllerGetSteamHandle_renamed_SDL_GetGamepadSteamHandle #define SDL_GameControllerGetStringForAxis SDL_GameControllerGetStringForAxis_renamed_SDL_GetGamepadStringForAxis #define SDL_GameControllerGetStringForButton SDL_GameControllerGetStringForButton_renamed_SDL_GetGamepadStringForButton #define SDL_GameControllerGetTouchpadFinger SDL_GameControllerGetTouchpadFinger_renamed_SDL_GetGamepadTouchpadFinger