From da2e5e76c485bb5cdb38a44e6a42d52800127a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 23 Oct 2024 13:21:41 +0200 Subject: [PATCH] Fix the Retroid controller defaults for the latest firmware. More standard now. --- Core/Config.cpp | 19 ++++++++++++++----- Core/KeyMap.cpp | 6 +++--- Core/KeyMapDefaults.cpp | 16 ++++++++++------ Core/KeyMapDefaults.h | 2 +- UI/MainScreen.cpp | 4 +++- 5 files changed, 31 insertions(+), 16 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 7bca357f3e..801aa78567 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -726,6 +726,19 @@ static bool DefaultShowTouchControls() { } } +static bool DefaultShowPauseButton() { + switch (System_GetPropertyInt(SYSPROP_DEVICE_TYPE)) { + case DEVICE_TYPE_MOBILE: + case DEVICE_TYPE_DESKTOP: + return true; + case DEVICE_TYPE_VR: + case DEVICE_TYPE_TV: + return false; + default: + return false; + } +} + static const float defaultControlScale = 1.15f; static const ConfigTouchPos defaultTouchPosShow = { -1.0f, -1.0f, defaultControlScale, true }; static const ConfigTouchPos defaultTouchPosHide = { -1.0f, -1.0f, defaultControlScale, false }; @@ -779,13 +792,9 @@ static const ConfigSetting controlSettings[] = { ConfigSetting("fcombo18X", "fcombo18Y", "comboKeyScale18", "ShowComboKey18", &g_Config.touchCustom[18], defaultTouchPosHide, CfgFlag::PER_GAME), ConfigSetting("fcombo19X", "fcombo19Y", "comboKeyScale19", "ShowComboKey19", &g_Config.touchCustom[19], defaultTouchPosHide, CfgFlag::PER_GAME), -#if defined(_WIN32) // A win32 user seeing touch controls is likely using PPSSPP on a tablet. There it makes // sense to default this to on. - ConfigSetting("ShowTouchPause", &g_Config.bShowTouchPause, true, CfgFlag::DEFAULT), -#else - ConfigSetting("ShowTouchPause", &g_Config.bShowTouchPause, false, CfgFlag::DEFAULT), -#endif + ConfigSetting("ShowTouchPause", &g_Config.bShowTouchPause, &DefaultShowPauseButton, CfgFlag::DEFAULT), #if defined(USING_WIN_UI) ConfigSetting("IgnoreWindowsKey", &g_Config.bIgnoreWindowsKey, false, CfgFlag::PER_GAME), #endif diff --git a/Core/KeyMap.cpp b/Core/KeyMap.cpp index 981633e3b9..f58f136536 100644 --- a/Core/KeyMap.cpp +++ b/Core/KeyMap.cpp @@ -418,11 +418,11 @@ const KeyMap_IntStrPair psp_button_names[] = { {VIRTKEY_AXIS_SWAP, "AxisSwap"}, {VIRTKEY_FASTFORWARD, "Fast-forward"}, + {VIRTKEY_PAUSE, "Pause"}, {VIRTKEY_SPEED_TOGGLE, "SpeedToggle"}, {VIRTKEY_SPEED_CUSTOM1, "Alt speed 1"}, {VIRTKEY_SPEED_CUSTOM2, "Alt speed 2"}, {VIRTKEY_SPEED_ANALOG, "Analog speed"}, - {VIRTKEY_PAUSE, "Pause"}, {VIRTKEY_RESET_EMULATION, "Reset"}, {VIRTKEY_FRAME_ADVANCE, "Frame Advance"}, #if !defined(MOBILE_DEVICE) @@ -734,7 +734,7 @@ void RestoreDefault() { } else if (IsMOQII7S(name)) { SetDefaultKeyMap(DEFAULT_MAPPING_MOQI_I7S, false); } else if (IsRetroid(name)) { - SetDefaultKeyMap(DEFAULT_MAPPING_RETRO_STATION_CONTROLLER, false); + SetDefaultKeyMap(DEFAULT_MAPPING_RETROID_CONTROLLER, false); } else { SetDefaultKeyMap(DEFAULT_MAPPING_ANDROID_PAD, false); } @@ -855,7 +855,7 @@ void AutoConfForPad(const std::string &name) { if (name.find("Xbox") != std::string::npos) { SetDefaultKeyMap(DEFAULT_MAPPING_ANDROID_XBOX, false); } else if (name == "Retro Station Controller") { - SetDefaultKeyMap(DEFAULT_MAPPING_RETRO_STATION_CONTROLLER, false); + SetDefaultKeyMap(DEFAULT_MAPPING_RETROID_CONTROLLER, false); } else { SetDefaultKeyMap(DEFAULT_MAPPING_ANDROID_PAD, false); } diff --git a/Core/KeyMapDefaults.cpp b/Core/KeyMapDefaults.cpp index e796bdfe52..0857e25985 100644 --- a/Core/KeyMapDefaults.cpp +++ b/Core/KeyMapDefaults.cpp @@ -200,21 +200,26 @@ static const DefMappingStruct defaultAndroidXboxControllerMap[] = { // Retroid reports its controller as "Retro Station Controller". // It's very similar to the Android Xbox mapping, just with main buttons swapped around. -static const DefMappingStruct defaultRetroStationControllerMap[] = { +static const DefMappingStruct defaultRetroidControllerMap[] = { {CTRL_CROSS , NKCODE_BUTTON_B}, {CTRL_CIRCLE , NKCODE_BUTTON_A}, {CTRL_SQUARE , NKCODE_BUTTON_Y}, {CTRL_TRIANGLE , NKCODE_BUTTON_X}, - // The hat for DPAD is standard for bluetooth pads, which is the most likely pads on Android I think. + {CTRL_LEFT , JOYSTICK_AXIS_HAT_X, -1}, {CTRL_LEFT , NKCODE_DPAD_LEFT}, + {CTRL_RIGHT , JOYSTICK_AXIS_HAT_X, +1}, {CTRL_RIGHT , NKCODE_DPAD_RIGHT}, + {CTRL_UP , JOYSTICK_AXIS_HAT_Y, -1}, {CTRL_UP , NKCODE_DPAD_UP}, + {CTRL_DOWN , JOYSTICK_AXIS_HAT_Y, +1}, {CTRL_DOWN , NKCODE_DPAD_DOWN}, {CTRL_START , NKCODE_BUTTON_START}, - {CTRL_SELECT , NKCODE_BACK}, + {CTRL_SELECT , NKCODE_BUTTON_SELECT}, {CTRL_LTRIGGER , NKCODE_BUTTON_L1}, {CTRL_RTRIGGER , NKCODE_BUTTON_R1}, + {VIRTKEY_FASTFORWARD , NKCODE_BUTTON_R2}, {VIRTKEY_FASTFORWARD , JOYSTICK_AXIS_RTRIGGER, +1}, + {VIRTKEY_PAUSE , NKCODE_BUTTON_L2}, {VIRTKEY_PAUSE , JOYSTICK_AXIS_LTRIGGER, +1}, {VIRTKEY_AXIS_X_MIN, JOYSTICK_AXIS_X, -1}, {VIRTKEY_AXIS_X_MAX, JOYSTICK_AXIS_X, +1}, @@ -222,7 +227,6 @@ static const DefMappingStruct defaultRetroStationControllerMap[] = { {VIRTKEY_AXIS_Y_MAX, JOYSTICK_AXIS_Y, -1}, }; - static const DefMappingStruct defaultPadMapAndroid[] = { {CTRL_CROSS , NKCODE_BUTTON_A}, {CTRL_CIRCLE , NKCODE_BUTTON_B}, @@ -415,8 +419,8 @@ void SetDefaultKeyMap(DefaultMaps dmap, bool replace) { case DEFAULT_MAPPING_ANDROID_XBOX: SetDefaultKeyMap(DEVICE_ID_PAD_0, defaultAndroidXboxControllerMap, ARRAY_SIZE(defaultAndroidXboxControllerMap), replace); break; - case DEFAULT_MAPPING_RETRO_STATION_CONTROLLER: - SetDefaultKeyMap(DEVICE_ID_PAD_0, defaultRetroStationControllerMap, ARRAY_SIZE(defaultRetroStationControllerMap), replace); + case DEFAULT_MAPPING_RETROID_CONTROLLER: + SetDefaultKeyMap(DEVICE_ID_PAD_0, defaultRetroidControllerMap, ARRAY_SIZE(defaultRetroidControllerMap), replace); break; case DEFAULT_MAPPING_VR_HEADSET: SetDefaultKeyMap(DEVICE_ID_XR_CONTROLLER_LEFT, defaultVRLeftController, ARRAY_SIZE(defaultVRLeftController), replace); diff --git a/Core/KeyMapDefaults.h b/Core/KeyMapDefaults.h index f38f7d7f07..90684b93cc 100644 --- a/Core/KeyMapDefaults.h +++ b/Core/KeyMapDefaults.h @@ -13,7 +13,7 @@ enum DefaultMaps { DEFAULT_MAPPING_OUYA, DEFAULT_MAPPING_XPERIA_PLAY, DEFAULT_MAPPING_MOQI_I7S, - DEFAULT_MAPPING_RETRO_STATION_CONTROLLER, + DEFAULT_MAPPING_RETROID_CONTROLLER, DEFAULT_MAPPING_VR_HEADSET, }; diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 1f92af05e3..40a3558869 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -794,7 +794,9 @@ void GameBrowser::Refresh() { topBar->Add(new Choice(ImageID("I_FOLDER_OPEN"), new LayoutParams(WRAP_CONTENT, 64.0f)))->OnClick.Handle(this, &GameBrowser::BrowseClick); #else if ((browseFlags_ & BrowseFlags::BROWSE) && System_GetPropertyBool(SYSPROP_HAS_FOLDER_BROWSER)) { - topBar->Add(new Choice(mm->T("Browse"), ImageID("I_FOLDER_OPEN"), new LayoutParams(WRAP_CONTENT, 64.0f)))->OnClick.Handle(this, &GameBrowser::BrowseClick); + // Collapse the button title on very small screens (Retroid Pocket). + std::string_view browseTitle = g_display.pixel_xres <= 640 ? "" : mm->T("Browse"); + topBar->Add(new Choice(browseTitle, ImageID("I_FOLDER_OPEN"), new LayoutParams(WRAP_CONTENT, 64.0f)))->OnClick.Handle(this, &GameBrowser::BrowseClick); } if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_TV) { topBar->Add(new Choice(mm->T("Enter Path"), new LayoutParams(WRAP_CONTENT, 64.0f)))->OnClick.Add([=](UI::EventParams &) {