From a9760b53230c0ba87431b33d3560d3532d07d6ec Mon Sep 17 00:00:00 2001 From: MikuChan03 <39016940+MikuChan03@users.noreply.github.com> Date: Sat, 30 Sep 2023 18:27:51 +0200 Subject: [PATCH 1/3] Update key descriptions Remove the duplicate page up key entries. Also remove the x3 and x10 parts for fast forward, since that's configurable now. --- src/input_buttons.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/input_buttons.h b/src/input_buttons.h index 313b9969bb..bcc6ff4b3f 100644 --- a/src/input_buttons.h +++ b/src/input_buttons.h @@ -167,15 +167,13 @@ namespace Input { "Reset to the title screen", "Move up one page in menus", "Move down one page in menus", - "Page up key", - "Page down key", "Left mouse key", "Right mouse key", "Middle mouse key", "Scroll up key", "Scroll down key", - "Fast forward the game (x3)", - "Fast forward the game even more (x10)", + "Fast forward the game", + "Fast forward the game even more", "Toggle Fullscreen mode", "Toggle Window Zoom level", "Total Button Count"); From 2590e7f0a5e7033b82a8f0f0daed70b2b4860981 Mon Sep 17 00:00:00 2001 From: MikuChan03 <39016940+MikuChan03@users.noreply.github.com> Date: Sun, 1 Oct 2023 01:59:35 +0200 Subject: [PATCH 2/3] Fast forward renaming and adaptive descriptions --- src/game_config.cpp | 8 ++++---- src/game_config.h | 4 ++-- src/input_buttons.h | 8 ++++---- src/player.cpp | 12 ++++++------ src/player.h | 4 ++-- src/window_settings.cpp | 24 ++++++++++++++++++++++-- 6 files changed, 40 insertions(+), 20 deletions(-) diff --git a/src/game_config.cpp b/src/game_config.cpp index 93202353cb..d93df1ff82 100644 --- a/src/game_config.cpp +++ b/src/game_config.cpp @@ -418,8 +418,8 @@ void Game_Config::LoadFromStream(Filesystem_Stream::InputStream& is) { input.gamepad_swap_analog.FromIni(ini); input.gamepad_swap_dpad_with_buttons.FromIni(ini); input.gamepad_swap_ab_and_xy.FromIni(ini); - input.speed_modifier.FromIni(ini); - input.speed_modifier_plus.FromIni(ini); + input.speed_modifier_a.FromIni(ini); + input.speed_modifier_b.FromIni(ini); /** PLAYER SECTION */ player.settings_autosave.FromIni(ini); @@ -487,8 +487,8 @@ void Game_Config::WriteToStream(Filesystem_Stream::OutputStream& os) const { input.gamepad_swap_analog.ToIni(os); input.gamepad_swap_dpad_with_buttons.ToIni(os); input.gamepad_swap_ab_and_xy.ToIni(os); - input.speed_modifier.ToIni(os); - input.speed_modifier_plus.ToIni(os); + input.speed_modifier_a.ToIni(os); + input.speed_modifier_b.ToIni(os); os << "\n"; diff --git a/src/game_config.h b/src/game_config.h index 82751cee47..4c84fe8810 100644 --- a/src/game_config.h +++ b/src/game_config.h @@ -97,8 +97,8 @@ struct Game_ConfigAudio { }; struct Game_ConfigInput { - RangeConfigParam speed_modifier{ "Fast Forward: Speed", "Set fast forward speed", "Input", "SpeedModifier", 3, 2, 100 }; - RangeConfigParam speed_modifier_plus{ "Fast Forward Plus: Speed", "Set fast forward plus speed", "Input", "SpeedModifierPlus", 10, 2, 100 }; + RangeConfigParam speed_modifier_a{ "Fast Forward A: Speed", "Set fast forward A speed", "Input", "SpeedModifierA", 3, 2, 100 }; + RangeConfigParam speed_modifier_b{ "Fast Forward B: Speed", "Set fast forward B speed", "Input", "SpeedModifierB", 10, 2, 100 }; BoolConfigParam gamepad_swap_analog{ "Gamepad: Swap Analog Sticks", "Swap left and right stick", "Input", "GamepadSwapAnalog", false }; BoolConfigParam gamepad_swap_dpad_with_buttons{ "Gamepad: Swap D-Pad with buttons", "Swap D-Pad with ABXY-Buttons", "Input", "GamepadSwapDpad", false }; BoolConfigParam gamepad_swap_ab_and_xy{ "Gamepad: Swap AB and XY", "Swap A and B with X and Y", "Input", "GamepadSwapAbxy", false }; diff --git a/src/input_buttons.h b/src/input_buttons.h index bcc6ff4b3f..eb2731f1e0 100644 --- a/src/input_buttons.h +++ b/src/input_buttons.h @@ -127,8 +127,8 @@ namespace Input { "MOUSE_MIDDLE", "SCROLL_UP", "SCROLL_DOWN", - "FAST_FORWARD", - "FAST_FORWARD_PLUS", + "FAST_FORWARD_A", + "FAST_FORWARD_B", "TOGGLE_FULLSCREEN", "TOGGLE_ZOOM", "BUTTON_COUNT"); @@ -172,8 +172,8 @@ namespace Input { "Middle mouse key", "Scroll up key", "Scroll down key", - "Fast forward the game", - "Fast forward the game even more", + "PLACEHOLDER", + "PLACEHOLDER", "Toggle Fullscreen mode", "Toggle Window Zoom level", "Total Button Count"); diff --git a/src/player.cpp b/src/player.cpp index 6aa0ed70c1..e86930e007 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -131,8 +131,8 @@ namespace Player { std::string replay_input_path; std::string record_input_path; std::string command_line; - int speed_modifier; - int speed_modifier_plus; + int speed_modifier_a; + int speed_modifier_b; int rng_seed = -1; Game_ConfigPlayer player_config; Game_ConfigGame game_config; @@ -198,8 +198,8 @@ void Player::Init(std::vector args) { Input::AddRecordingData(Input::RecordingData::CommandLine, command_line); player_config = std::move(cfg.player); - speed_modifier = cfg.input.speed_modifier.Get(); - speed_modifier_plus = cfg.input.speed_modifier_plus.Get(); + speed_modifier_a = cfg.input.speed_modifier_a.Get(); + speed_modifier_b = cfg.input.speed_modifier_b.Get(); } void Player::Run() { @@ -303,10 +303,10 @@ void Player::UpdateInput() { } float speed = 1.0; if (Input::IsSystemPressed(Input::FAST_FORWARD)) { - speed = speed_modifier; + speed = speed_modifier_a; } if (Input::IsSystemPressed(Input::FAST_FORWARD_PLUS)) { - speed = speed_modifier_plus; + speed = speed_modifier_b; } Game_Clock::SetGameSpeedFactor(speed); diff --git a/src/player.h b/src/player.h index 86d0ccff2d..dc7dd13b0e 100644 --- a/src/player.h +++ b/src/player.h @@ -399,8 +399,8 @@ namespace Player { * Only used for configuring the speedup, don't read this var directly use * GetSpeedModifier() instead. */ - extern int speed_modifier; - extern int speed_modifier_plus; + extern int speed_modifier_a; + extern int speed_modifier_b; /** * The engine game logic configuration diff --git a/src/window_settings.cpp b/src/window_settings.cpp index a1c2479f83..dcd0e6de36 100644 --- a/src/window_settings.cpp +++ b/src/window_settings.cpp @@ -378,8 +378,8 @@ void Window_Settings::RefreshInput() { AddOption(cfg.gamepad_swap_ab_and_xy, [&cfg](){ cfg.gamepad_swap_ab_and_xy.Toggle(); Input::ResetTriggerKeys(); }); AddOption(cfg.gamepad_swap_analog, [&cfg](){ cfg.gamepad_swap_analog.Toggle(); Input::ResetTriggerKeys(); }); AddOption(cfg.gamepad_swap_dpad_with_buttons, [&cfg](){ cfg.gamepad_swap_dpad_with_buttons.Toggle(); Input::ResetTriggerKeys(); }); - AddOption(cfg.speed_modifier, [this, &cfg](){ auto tmp = GetCurrentOption().current_value; Player::speed_modifier = tmp; cfg.speed_modifier.Set(tmp); }); - AddOption(cfg.speed_modifier_plus, [this, &cfg](){ auto tmp = GetCurrentOption().current_value; Player::speed_modifier_plus = tmp; cfg.speed_modifier_plus.Set(tmp); }); + AddOption(cfg.speed_modifier_a, [this, &cfg](){ auto tmp = GetCurrentOption().current_value; Player::speed_modifier_a = tmp; cfg.speed_modifier_a.Set(tmp); }); + AddOption(cfg.speed_modifier_b, [this, &cfg](){ auto tmp = GetCurrentOption().current_value; Player::speed_modifier_b = tmp; cfg.speed_modifier_b.Set(tmp); }); } void Window_Settings::RefreshButtonCategory() { @@ -391,6 +391,15 @@ void Window_Settings::RefreshButtonCategory() { [this]() { Push(eInputListButtonsDeveloper, 2); }); } +const char * GetFastForwardDescription(int index){ + Game_ConfigInput& cfg = Input::GetInputSource()->GetConfig(); + RangeConfigParam config_arr[] = {cfg.speed_modifier_a, cfg.speed_modifier_b}; + static char fast_forward_strs[2][64]; + + snprintf(fast_forward_strs[index], sizeof(fast_forward_strs[index]), "Run the game at x%i speed", config_arr[index].Get()); + return fast_forward_strs[index]; +} + void Window_Settings::RefreshButtonList() { auto& mappings = Input::GetInputSource()->GetButtonMappings(); auto custom_names = Input::GetInputKeyNames(); @@ -468,6 +477,17 @@ void Window_Settings::RefreshButtonList() { value_size += cur_value_size; } + switch(button){ + case Input::FAST_FORWARD: + help = GetFastForwardDescription(0); + break; + case Input::FAST_FORWARD_PLUS: + help = GetFastForwardDescription(1); + break; + default: + break; + } + auto param = MenuItem(name, help, value); AddOption(param, [this, button](){ From 52e9869f3b93df53b76f135b2771e2e05da0decb Mon Sep 17 00:00:00 2001 From: MikuChan03 <39016940+MikuChan03@users.noreply.github.com> Date: Sun, 1 Oct 2023 22:04:00 +0200 Subject: [PATCH 3/3] Rename fast_forward(_PLUS) to fastforward(_A/_B) --- src/input_buttons.h | 8 ++++---- src/input_buttons_desktop.cpp | 8 ++++---- src/platform/3ds/input_buttons.cpp | 2 +- .../org_easyrpg_player_player_EasyRpgPlayerActivity.cpp | 2 +- src/platform/libretro/input_buttons.cpp | 4 ++-- src/platform/psp/psp_input_buttons.cpp | 2 +- src/platform/psvita/input_buttons.cpp | 2 +- src/platform/switch/input_buttons.cpp | 2 +- src/platform/wii/input_buttons.cpp | 4 ++-- src/player.cpp | 4 ++-- src/window_settings.cpp | 6 +++--- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/input_buttons.h b/src/input_buttons.h index eb2731f1e0..2d9b420af9 100644 --- a/src/input_buttons.h +++ b/src/input_buttons.h @@ -81,8 +81,8 @@ namespace Input { MOUSE_MIDDLE, SCROLL_UP, SCROLL_DOWN, - FAST_FORWARD, - FAST_FORWARD_PLUS, + FAST_FORWARD_A, + FAST_FORWARD_B, TOGGLE_FULLSCREEN, TOGGLE_ZOOM, BUTTON_COUNT @@ -189,8 +189,8 @@ namespace Input { case TAKE_SCREENSHOT: case SHOW_LOG: case TOGGLE_ZOOM: - case FAST_FORWARD: - case FAST_FORWARD_PLUS: + case FAST_FORWARD_A: + case FAST_FORWARD_B: return true; default: return false; diff --git a/src/input_buttons_desktop.cpp b/src/input_buttons_desktop.cpp index 5a917b1010..fbba83534a 100644 --- a/src/input_buttons_desktop.cpp +++ b/src/input_buttons_desktop.cpp @@ -99,8 +99,8 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() { {PAGE_UP, Keys::PGUP}, {PAGE_DOWN, Keys::PGDN}, {RESET, Keys::F12}, - {FAST_FORWARD, Keys::F}, - {FAST_FORWARD_PLUS, Keys::G}, + {FAST_FORWARD_A, Keys::F}, + {FAST_FORWARD_B, Keys::G}, #if defined(USE_MOUSE) && defined(SUPPORT_MOUSE) {MOUSE_LEFT, Keys::MOUSE_LEFT}, @@ -155,8 +155,8 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() { {N7, Keys::JOY_RSTICK_UP_LEFT}, {N8, Keys::JOY_RSTICK_UP}, {N9, Keys::JOY_RSTICK_UP_RIGHT}, - {FAST_FORWARD, Keys::JOY_RTRIGGER_SOFT}, - {FAST_FORWARD_PLUS, Keys::JOY_RTRIGGER_FULL}, + {FAST_FORWARD_A, Keys::JOY_RTRIGGER_SOFT}, + {FAST_FORWARD_B, Keys::JOY_RTRIGGER_FULL}, {DEBUG_THROUGH, Keys::JOY_LTRIGGER_SOFT}, {DEBUG_MENU, Keys::JOY_LTRIGGER_FULL}, #endif diff --git a/src/platform/3ds/input_buttons.cpp b/src/platform/3ds/input_buttons.cpp index 71aea52801..d7f17a731a 100644 --- a/src/platform/3ds/input_buttons.cpp +++ b/src/platform/3ds/input_buttons.cpp @@ -31,7 +31,7 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() { {CANCEL, Keys::JOY_X}, {SHIFT, Keys::JOY_Y}, {TOGGLE_FPS, Keys::JOY_SHOULDER_LEFT}, - {FAST_FORWARD, Keys::JOY_SHOULDER_RIGHT}, + {FAST_FORWARD_A, Keys::JOY_SHOULDER_RIGHT}, {SETTINGS_MENU, Keys::JOY_START}, {RESET, Keys::JOY_BACK}, // Touchscreen diff --git a/src/platform/android/org_easyrpg_player_player_EasyRpgPlayerActivity.cpp b/src/platform/android/org_easyrpg_player_player_EasyRpgPlayerActivity.cpp index 6f36af8d65..6809bca55a 100644 --- a/src/platform/android/org_easyrpg_player_player_EasyRpgPlayerActivity.cpp +++ b/src/platform/android/org_easyrpg_player_player_EasyRpgPlayerActivity.cpp @@ -43,7 +43,7 @@ JNIEXPORT void JNICALL Java_org_easyrpg_player_player_EasyRpgPlayerActivity_endG JNIEXPORT void JNICALL Java_org_easyrpg_player_player_EasyRpgPlayerActivity_setFastForwardMultiplier (JNIEnv *, jclass, jint ji) { - Player::speed_modifier = ji; + Player::speed_modifier_a = ji; } JNIEXPORT void JNICALL diff --git a/src/platform/libretro/input_buttons.cpp b/src/platform/libretro/input_buttons.cpp index 4e97a7181f..f7604ff05a 100644 --- a/src/platform/libretro/input_buttons.cpp +++ b/src/platform/libretro/input_buttons.cpp @@ -55,8 +55,8 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() { {N7, Keys::JOY_RSTICK_UP_LEFT}, {N8, Keys::JOY_RSTICK_UP}, {N9, Keys::JOY_RSTICK_UP_RIGHT}, - {FAST_FORWARD, Keys::JOY_RTRIGGER_SOFT}, - {FAST_FORWARD_PLUS, Keys::JOY_RTRIGGER_FULL}, + {FAST_FORWARD_A, Keys::JOY_RTRIGGER_SOFT}, + {FAST_FORWARD_B, Keys::JOY_RTRIGGER_FULL}, {DEBUG_THROUGH, Keys::JOY_LTRIGGER_SOFT}, {DEBUG_MENU, Keys::JOY_LTRIGGER_FULL}, #endif diff --git a/src/platform/psp/psp_input_buttons.cpp b/src/platform/psp/psp_input_buttons.cpp index ee7127489e..f2e657a9ec 100644 --- a/src/platform/psp/psp_input_buttons.cpp +++ b/src/platform/psp/psp_input_buttons.cpp @@ -25,7 +25,7 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() { return { {CANCEL, Keys::JOY_A}, // Cross {DECISION, Keys::JOY_B}, // Circle - {FAST_FORWARD, Keys::JOY_X}, // Square + {FAST_FORWARD_A, Keys::JOY_X}, // Square {SHIFT, Keys::JOY_Y}, // Triangle {N1, Keys::JOY_SHOULDER_LEFT}, // Left trigger diff --git a/src/platform/psvita/input_buttons.cpp b/src/platform/psvita/input_buttons.cpp index c499aaf9cd..f5611dffaf 100644 --- a/src/platform/psvita/input_buttons.cpp +++ b/src/platform/psvita/input_buttons.cpp @@ -32,7 +32,7 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() { {CANCEL, Keys::JOY_X}, {SHIFT, Keys::JOY_Y}, {TOGGLE_FPS, Keys::JOY_SHOULDER_LEFT}, - {FAST_FORWARD, Keys::JOY_SHOULDER_RIGHT}, + {FAST_FORWARD_A, Keys::JOY_SHOULDER_RIGHT}, {SETTINGS_MENU, Keys::JOY_START}, {RESET, Keys::JOY_BACK}, #endif diff --git a/src/platform/switch/input_buttons.cpp b/src/platform/switch/input_buttons.cpp index f29646e90f..dbbf0f7071 100644 --- a/src/platform/switch/input_buttons.cpp +++ b/src/platform/switch/input_buttons.cpp @@ -37,7 +37,7 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() { {TOGGLE_FPS, Keys::JOY_SHOULDER_RIGHT}, {SETTINGS_MENU, Keys::JOY_START}, {RESET, Keys::JOY_BACK}, - {FAST_FORWARD, Keys::JOY_RTRIGGER_FULL}, + {FAST_FORWARD_A, Keys::JOY_RTRIGGER_FULL}, {DEBUG_MENU, Keys::JOY_LTRIGGER_FULL}, #endif // Touchscreen diff --git a/src/platform/wii/input_buttons.cpp b/src/platform/wii/input_buttons.cpp index b2306794ed..be179df0a2 100644 --- a/src/platform/wii/input_buttons.cpp +++ b/src/platform/wii/input_buttons.cpp @@ -29,7 +29,7 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() { {CANCEL, Keys::JOY_OTHER_2}, // 1 {DECISION, Keys::JOY_OTHER_3}, // 2 {RESET, Keys::JOY_OTHER_4}, // -, shared with CC - {FAST_FORWARD, Keys::JOY_OTHER_5}, // +, shared with CC + {FAST_FORWARD_A, Keys::JOY_OTHER_5}, // +, shared with CC {SETTINGS_MENU, Keys::JOY_OTHER_6}, // Home, shared with CC // Nunchuck @@ -40,7 +40,7 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() { {SHIFT, Keys::JOY_OTHER_9}, // X {CANCEL, Keys::JOY_OTHER_10}, // Y {N0, Keys::JOY_OTHER_11}, // L - {FAST_FORWARD_PLUS, Keys::JOY_OTHER_12}, // R + {FAST_FORWARD_B, Keys::JOY_OTHER_12}, // R {N5, Keys::JOY_OTHER_13}, // ZL {TOGGLE_FPS, Keys::JOY_OTHER_14}, // ZR diff --git a/src/player.cpp b/src/player.cpp index e86930e007..058b305b37 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -302,10 +302,10 @@ void Player::UpdateInput() { DisplayUi->ToggleZoom(); } float speed = 1.0; - if (Input::IsSystemPressed(Input::FAST_FORWARD)) { + if (Input::IsSystemPressed(Input::FAST_FORWARD_A)) { speed = speed_modifier_a; } - if (Input::IsSystemPressed(Input::FAST_FORWARD_PLUS)) { + if (Input::IsSystemPressed(Input::FAST_FORWARD_B)) { speed = speed_modifier_b; } Game_Clock::SetGameSpeedFactor(speed); diff --git a/src/window_settings.cpp b/src/window_settings.cpp index dcd0e6de36..0543f2414b 100644 --- a/src/window_settings.cpp +++ b/src/window_settings.cpp @@ -414,7 +414,7 @@ void Window_Settings::RefreshButtonList() { break; case 1: buttons = {Input::SETTINGS_MENU, Input::TOGGLE_FPS, Input::TOGGLE_FULLSCREEN, Input::TOGGLE_ZOOM, - Input::TAKE_SCREENSHOT, Input::RESET, Input::FAST_FORWARD, Input::FAST_FORWARD_PLUS, + Input::TAKE_SCREENSHOT, Input::RESET, Input::FAST_FORWARD_A, Input::FAST_FORWARD_B, Input::PAGE_UP, Input::PAGE_DOWN }; break; case 2: @@ -478,10 +478,10 @@ void Window_Settings::RefreshButtonList() { } switch(button){ - case Input::FAST_FORWARD: + case Input::FAST_FORWARD_A: help = GetFastForwardDescription(0); break; - case Input::FAST_FORWARD_PLUS: + case Input::FAST_FORWARD_B: help = GetFastForwardDescription(1); break; default: