diff --git a/Core/Config.cpp b/Core/Config.cpp index 5076c7069f..dd14d9bf9d 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -937,6 +937,7 @@ void TouchControlConfig::ResetLayout() { fDpadSpacing = 1.0f; reset(&touchStartKey); reset(&touchSelectKey); + reset(&touchHomeKey); reset(&touchFastForwardKey); reset(&touchLKey); reset(&touchRKey); @@ -1006,6 +1007,7 @@ static constexpr ConfigSetting touchControlSettings[] = { ConfigSetting("DPadSpacing", SETTING(g_Config.touchControlsLandscape, fDpadSpacing), 1.0f, CfgFlag::PER_GAME), ConfigSetting("StartKeyX", "StartKeyY", "StartKeyScale", "ShowTouchStart", SETTING(g_Config.touchControlsLandscape, touchStartKey), defaultTouchPosShow, CfgFlag::PER_GAME), ConfigSetting("SelectKeyX", "SelectKeyY", "SelectKeyScale", "ShowTouchSelect", SETTING(g_Config.touchControlsLandscape, touchSelectKey), defaultTouchPosShow, CfgFlag::PER_GAME), + ConfigSetting("HomeKeyX", "HomeKeyY", "HomeKeyScale", "ShowTouchHome", SETTING(g_Config.touchControlsLandscape, touchHomeKey), defaultTouchPosHide, CfgFlag::PER_GAME), ConfigSetting("UnthrottleKeyX", "UnthrottleKeyY", "UnthrottleKeyScale", "ShowTouchUnthrottle", SETTING(g_Config.touchControlsLandscape, touchFastForwardKey), defaultTouchPosShow, CfgFlag::PER_GAME), ConfigSetting("LKeyX", "LKeyY", "LKeyScale", "ShowTouchLTrigger", SETTING(g_Config.touchControlsLandscape, touchLKey), defaultTouchPosShow, CfgFlag::PER_GAME), ConfigSetting("RKeyX", "RKeyY", "RKeyScale", "ShowTouchRTrigger", SETTING(g_Config.touchControlsLandscape, touchRKey), defaultTouchPosShow, CfgFlag::PER_GAME), diff --git a/Core/Config.h b/Core/Config.h index 675b3be1ee..9c43205bae 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -104,6 +104,7 @@ struct TouchControlConfig : public ConfigBlock { constexpr TouchControlConfig() { // Hide all extras and custom buttons by default. touchRightAnalogStick.show = false; + touchHomeKey.show = false; for (size_t i = 0; i < CUSTOM_BUTTON_COUNT; i++) { touchCustom[i].show = false; } @@ -119,6 +120,7 @@ struct TouchControlConfig : public ConfigBlock { ConfigTouchPos touchStartKey; ConfigTouchPos touchSelectKey; + ConfigTouchPos touchHomeKey; ConfigTouchPos touchFastForwardKey; ConfigTouchPos touchLKey; ConfigTouchPos touchRKey; diff --git a/Core/KeyMap.cpp b/Core/KeyMap.cpp index 16f8c4ff80..ca753d83e8 100644 --- a/Core/KeyMap.cpp +++ b/Core/KeyMap.cpp @@ -469,6 +469,7 @@ const KeyMap_IntStrPair psp_button_names[] = { {CTRL_TRIANGLE, "Triangle"}, {CTRL_START, "Start"}, {CTRL_SELECT, "Select"}, + {CTRL_HOME, "Home"}, {CTRL_LTRIGGER, "L"}, {CTRL_RTRIGGER, "R"}, @@ -538,7 +539,6 @@ const KeyMap_IntStrPair psp_button_names[] = { {VIRTKEY_AXIS_RIGHT_X_MIN, "RightAn.Left"}, {VIRTKEY_AXIS_RIGHT_X_MAX, "RightAn.Right"}, - {CTRL_HOME, "Home"}, {CTRL_HOLD, "Hold"}, {CTRL_WLAN, "Wlan"}, {CTRL_REMOTE_HOLD, "Remote hold"}, diff --git a/UI/GamepadEmu.cpp b/UI/GamepadEmu.cpp index 79833e70d4..8e481b2e5d 100644 --- a/UI/GamepadEmu.cpp +++ b/UI/GamepadEmu.cpp @@ -940,6 +940,10 @@ void InitPadLayout(TouchControlConfig *config, DeviceOrientation orientation, fl int fast_forward_key_X = halfW; int fast_forward_key_Y = screenBottom - bottom_button_Y * scale - 100; initTouchPos(&config->touchFastForwardKey, fast_forward_key_X, fast_forward_key_Y); + + int home_key_X = halfW; + int home_key_Y = screenBottom - bottom_button_Y * scale - 150; + initTouchPos(&config->touchHomeKey, home_key_X, home_key_Y); } else { int start_key_X = halfW + bottom_key_spacing * scale; int start_key_Y = screenBottom - bottom_button_Y * scale; @@ -949,6 +953,11 @@ void InitPadLayout(TouchControlConfig *config, DeviceOrientation orientation, fl int select_key_Y = screenBottom - bottom_button_Y * scale; initTouchPos(&config->touchSelectKey, select_key_X, select_key_Y); + // Above select. + int home_key_X = halfW; + int home_key_Y = select_key_Y - 50; + initTouchPos(&config->touchHomeKey, home_key_X, home_key_Y); + int fast_forward_key_X = halfW - bottom_key_spacing * scale; int fast_forward_key_Y = screenBottom - bottom_button_Y * scale; initTouchPos(&config->touchFastForwardKey, fast_forward_key_X, fast_forward_key_Y); @@ -1076,6 +1085,7 @@ GamepadEmuView::GamepadEmuView(const TouchControlConfig &config, float xres, flo addPSPButton(CTRL_START, "Start button", rectImage, ImageID("I_RECT"), ImageID("I_START"), config.touchStartKey); addPSPButton(CTRL_SELECT, "Select button", rectImage, ImageID("I_RECT"), ImageID("I_SELECT"), config.touchSelectKey); + addPSPButton(CTRL_HOME, "Home button", rectImage, ImageID("I_RECT"), ImageID("I_HOME"), config.touchHomeKey); BoolButton *fastForward = addBoolButton(&PSP_CoreParameter().fastForward, "Fast-forward button", rectImage, ImageID("I_RECT"), ImageID("I_FAST_FORWARD_LINE"), config.touchFastForwardKey); if (fastForward) { diff --git a/UI/GamepadEmu.h b/UI/GamepadEmu.h index ce8463c100..64598bfe72 100644 --- a/UI/GamepadEmu.h +++ b/UI/GamepadEmu.h @@ -364,6 +364,7 @@ namespace CustomKeyData { { ImageID::invalid(), VIRTKEY_TOGGLE_DEBUGGER }, { ImageID::invalid(), VIRTKEY_PAUSE_NO_MENU }, { ImageID::invalid(), VIRTKEY_TOGGLE_TILT }, + { ImageID("I_HOME"), CTRL_HOME }, // IMPORTANT: Only add at the end! }; static_assert(ARRAY_SIZE(g_customKeyList) <= 64, "Too many key for a uint64_t bit mask"); @@ -421,6 +422,7 @@ namespace GestureKey { VIRTKEY_AXIS_RIGHT_Y_MAX, VIRTKEY_TOGGLE_DEBUGGER, VIRTKEY_TOGGLE_TILT, + CTRL_HOME, }; } diff --git a/UI/TouchControlLayoutScreen.cpp b/UI/TouchControlLayoutScreen.cpp index b50ad96733..c4b778f865 100644 --- a/UI/TouchControlLayoutScreen.cpp +++ b/UI/TouchControlLayoutScreen.cpp @@ -510,6 +510,7 @@ void ControlLayoutView::CreateViews() { addDragDropButton(touch.touchSelectKey, "Select button", rectImage, ImageID("I_SELECT")); addDragDropButton(touch.touchStartKey, "Start button", rectImage, ImageID("I_START")); + addDragDropButton(touch.touchHomeKey, "Home button", rectImage, ImageID("I_HOME")); addDragDropButton(touch.touchFastForwardKey, "Fast-forward button", rectImage, ImageID("I_FAST_FORWARD_LINE")); addDragDropButton(touch.touchLKey, "Left shoulder button", shoulderImage, ImageID("I_L")); diff --git a/UI/TouchControlVisibilityScreen.cpp b/UI/TouchControlVisibilityScreen.cpp index fd9a5c4d0c..5a5d79c853 100644 --- a/UI/TouchControlVisibilityScreen.cpp +++ b/UI/TouchControlVisibilityScreen.cpp @@ -92,6 +92,7 @@ void TouchControlVisibilityScreen::CreateDialogViews(UI::ViewGroup *parent) { toggles_.push_back({ "R", &touch.touchRKey.show, ImageID("I_R"), nullptr }); toggles_.push_back({ "Start", &touch.touchStartKey.show, ImageID("I_START"), nullptr }); toggles_.push_back({ "Select", &touch.touchSelectKey.show, ImageID("I_SELECT"), nullptr }); + toggles_.push_back({ "Home", &touch.touchHomeKey.show, ImageID("I_HOME"), nullptr }); toggles_.push_back({ "Dpad", &touch.touchDpad.show, ImageID::invalid(), nullptr }); toggles_.push_back({ "Analog Stick", &touch.touchAnalogStick.show, ImageID::invalid(), nullptr }); toggles_.push_back({ "Right Analog Stick", &touch.touchRightAnalogStick.show, ImageID::invalid(), [=](EventParams &e) {