From 9e505252c0ce946f693937c00eb512478026189b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 11 Feb 2024 18:03:09 -0800 Subject: [PATCH] Renamed SDL_HINT_PS2_DYNAMIC_VSYNC SDL_HINT_RENDER_PS2_DYNAMIC_VSYNC --- build-scripts/SDL_migration.cocci | 4 ++++ docs/README-migration.md | 1 + docs/README-ps2.md | 2 +- include/SDL3/SDL_hints.h | 2 +- include/SDL3/SDL_oldnames.h | 2 ++ src/render/ps2/SDL_render_ps2.c | 4 ++-- 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci index 65c431992..7cde786bc 100644 --- a/build-scripts/SDL_migration.cocci +++ b/build-scripts/SDL_migration.cocci @@ -3040,3 +3040,7 @@ typedef SDL_version, SDL_Version; @@ - SDL_HINT_LINUX_JOYSTICK_DEADZONES + SDL_HINT_JOYSTICK_LINUX_DEADZONES +@@ +@@ +- SDL_HINT_PS2_DYNAMIC_VSYNC ++ SDL_HINT_RENDER_PS2_DYNAMIC_VSYNC diff --git a/docs/README-migration.md b/docs/README-migration.md index da2b9d64a..047f9b832 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -733,6 +733,7 @@ The following hints have been renamed: * SDL_HINT_LINUX_HAT_DEADZONES => SDL_HINT_JOYSTICK_LINUX_HAT_DEADZONES * SDL_HINT_LINUX_JOYSTICK_CLASSIC => SDL_HINT_JOYSTICK_LINUX_CLASSIC * SDL_HINT_LINUX_JOYSTICK_DEADZONES => SDL_HINT_JOYSTICK_LINUX_DEADZONES +* SDL_HINT_PS2_DYNAMIC_VSYNC => SDL_HINT_RENDER_PS2_DYNAMIC_VSYNC ## SDL_init.h diff --git a/docs/README-ps2.md b/docs/README-ps2.md index ade0b6d85..cc9d245ae 100644 --- a/docs/README-ps2.md +++ b/docs/README-ps2.md @@ -17,7 +17,7 @@ cmake --install build ``` ## Hints -The PS2 port has a special Hint for having a dynamic VSYNC. The Hint is `SDL_HINT_PS2_DYNAMIC_VSYNC`. +The PS2 port has a special Hint for having a dynamic VSYNC. The Hint is `SDL_HINT_RENDER_PS2_DYNAMIC_VSYNC`. If you enabled the dynamic vsync having as well `SDL_RENDERER_PRESENTVSYNC` enabled, then if the app is not able to run at 60 FPS, automatically the `vsync` will be disabled having a better performance, instead of dropping FPS to 30. ## Notes diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index cc0eecba1..b236780d5 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -1785,7 +1785,7 @@ extern "C" { * * This hint should be set before creating a renderer. */ -#define SDL_HINT_PS2_DYNAMIC_VSYNC "SDL_PS2_DYNAMIC_VSYNC" +#define SDL_HINT_RENDER_PS2_DYNAMIC_VSYNC "SDL_RENDER_PS2_DYNAMIC_VSYNC" /** * A variable controlling texture scaling quality. diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h index 8c1e4005f..0dafc18d8 100644 --- a/include/SDL3/SDL_oldnames.h +++ b/include/SDL3/SDL_oldnames.h @@ -288,6 +288,7 @@ #define SDL_HINT_LINUX_HAT_DEADZONES SDL_HINT_JOYSTICK_LINUX_HAT_DEADZONES #define SDL_HINT_LINUX_JOYSTICK_CLASSIC SDL_HINT_JOYSTICK_LINUX_CLASSIC #define SDL_HINT_LINUX_JOYSTICK_DEADZONES SDL_HINT_JOYSTICK_LINUX_DEADZONES +#define SDL_HINT_PS2_DYNAMIC_VSYNC SDL_HINT_RENDER_PS2_DYNAMIC_VSYNC /* ##SDL_joystick.h */ #define SDL_JOYSTICK_TYPE_GAMECONTROLLER SDL_JOYSTICK_TYPE_GAMEPAD @@ -770,6 +771,7 @@ #define SDL_HINT_LINUX_HAT_DEADZONES SDL_HINT_LINUX_HAT_DEADZONES_renamed_SDL_HINT_JOYSTICK_LINUX_HAT_DEADZONES #define SDL_HINT_LINUX_JOYSTICK_CLASSIC SDL_HINT_LINUX_JOYSTICK_CLASSIC_renamed_SDL_HINT_JOYSTICK_LINUX_CLASSIC #define SDL_HINT_LINUX_JOYSTICK_DEADZONES SDL_HINT_LINUX_JOYSTICK_DEADZONES_renamed_SDL_HINT_JOYSTICK_LINUX_DEADZONES +#define SDL_HINT_PS2_DYNAMIC_VSYNC SDL_HINT_PS2_DYNAMIC_VSYNC_renamed_SDL_HINT_RENDER_PS2_DYNAMIC_VSYNC /* ##SDL_joystick.h */ #define SDL_JOYSTICK_TYPE_GAMECONTROLLER SDL_JOYSTICK_TYPE_GAMECONTROLLER_renamed_SDL_JOYSTICK_TYPE_GAMEPAD diff --git a/src/render/ps2/SDL_render_ps2.c b/src/render/ps2/SDL_render_ps2.c index 0fd29526a..1a3936ef6 100644 --- a/src/render/ps2/SDL_render_ps2.c +++ b/src/render/ps2/SDL_render_ps2.c @@ -612,7 +612,7 @@ static void PS2_DestroyRenderer(SDL_Renderer *renderer) static int PS2_SetVSync(SDL_Renderer *renderer, const int vsync) { PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; - SDL_bool dynamicVsync = SDL_GetHintBoolean(SDL_HINT_PS2_DYNAMIC_VSYNC, SDL_FALSE); + SDL_bool dynamicVsync = SDL_GetHintBoolean(SDL_HINT_RENDER_PS2_DYNAMIC_VSYNC, SDL_FALSE); data->vsync = vsync ? (dynamicVsync ? 2 : 1) : 0; return 0; } @@ -683,7 +683,7 @@ static SDL_Renderer *PS2_CreateRenderer(SDL_Window *window, SDL_PropertiesID cre gsKit_clear(gsGlobal, GS_BLACK); data->gsGlobal = gsGlobal; - dynamicVsync = SDL_GetHintBoolean(SDL_HINT_PS2_DYNAMIC_VSYNC, SDL_FALSE); + dynamicVsync = SDL_GetHintBoolean(SDL_HINT_RENDER_PS2_DYNAMIC_VSYNC, SDL_FALSE); if (SDL_GetBooleanProperty(create_props, SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) { data->vsync = (dynamicVsync ? 2 : 1); }