diff --git a/UI/ComboKeyMappingScreen.h b/UI/ComboKeyMappingScreen.h index c2ed6396d8..54cc86607c 100644 --- a/UI/ComboKeyMappingScreen.h +++ b/UI/ComboKeyMappingScreen.h @@ -24,9 +24,9 @@ namespace UI { class CheckBox; } -class ComboKeyScreen : public UIDialogScreenWithBackground { +class ComboKeyScreen : public UIDialogScreenWithGameBackground { public: - ComboKeyScreen(int id): id_(id) {} + ComboKeyScreen(const Path &gamePath, int id) : UIDialogScreenWithGameBackground(gamePath), id_(id) {} const char *tag() const override { return "ComboKey"; } diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index b0f0651735..89b2fec756 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -279,7 +279,7 @@ void ControlMappingScreen::update() { RecreateViews(); } - UIDialogScreenWithBackground::update(); + UIDialogScreenWithGameBackground::update(); SetVRAppMode(VRAppMode::VR_MENU_MODE); } @@ -309,7 +309,7 @@ UI::EventReturn ControlMappingScreen::OnAutoConfigure(UI::EventParams ¶ms) { } UI::EventReturn ControlMappingScreen::OnVisualizeMapping(UI::EventParams ¶ms) { - VisualMappingScreen *visualMapping = new VisualMappingScreen(); + VisualMappingScreen *visualMapping = new VisualMappingScreen(gamePath_); screenManager()->push(visualMapping); return UI::EVENT_DONE; } @@ -581,7 +581,7 @@ void JoystickHistoryView::Update() { } } -AnalogSetupScreen::AnalogSetupScreen() { +AnalogSetupScreen::AnalogSetupScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) { mapper_.SetCallbacks([](int vkey) {}, [](int vkey) {}, [&](int stick, float x, float y) { analogX_[stick] = x; analogY_[stick] = y; @@ -673,7 +673,7 @@ UI::EventReturn AnalogSetupScreen::OnResetToDefaults(UI::EventParams &e) { } bool TouchTestScreen::touch(const TouchInput &touch) { - UIDialogScreenWithBackground::touch(touch); + UIDialogScreenWithGameBackground::touch(touch); if (touch.flags & TOUCH_DOWN) { bool found = false; for (int i = 0; i < MAX_TOUCH_POINTS; i++) { @@ -802,7 +802,7 @@ bool TouchTestScreen::axis(const AxisInput &axis) { } void TouchTestScreen::render() { - UIDialogScreenWithBackground::render(); + UIDialogScreenWithGameBackground::render(); UIContext *ui_context = screenManager()->getUIContext(); Bounds bounds = ui_context->GetLayoutBounds(); @@ -1161,7 +1161,7 @@ void VisualMappingScreen::CreateViews() { } void VisualMappingScreen::resized() { - UIDialogScreenWithBackground::resized(); + UIDialogScreenWithGameBackground::resized(); RecreateViews(); } diff --git a/UI/ControlMappingScreen.h b/UI/ControlMappingScreen.h index 29f1360fbe..dfb3e81ff5 100644 --- a/UI/ControlMappingScreen.h +++ b/UI/ControlMappingScreen.h @@ -32,9 +32,9 @@ class SingleControlMapper; -class ControlMappingScreen : public UIDialogScreenWithBackground { +class ControlMappingScreen : public UIDialogScreenWithGameBackground { public: - ControlMappingScreen() {} + ControlMappingScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {} const char *tag() const override { return "ControlMapping"; } protected: @@ -84,7 +84,7 @@ private: class KeyMappingNewMouseKeyDialog : public PopupScreen { public: - explicit KeyMappingNewMouseKeyDialog(int btn, bool replace, std::function callback, std::shared_ptr i18n) + KeyMappingNewMouseKeyDialog(int btn, bool replace, std::function callback, std::shared_ptr i18n) : PopupScreen(i18n->T("Map Mouse"), "", ""), callback_(callback), mapped_(false) { pspBtn_ = btn; } @@ -109,9 +109,9 @@ private: class JoystickHistoryView; -class AnalogSetupScreen : public UIDialogScreenWithBackground { +class AnalogSetupScreen : public UIDialogScreenWithGameBackground { public: - AnalogSetupScreen(); + AnalogSetupScreen(const Path &gamePath); bool key(const KeyInput &key) override; bool axis(const AxisInput &axis) override; @@ -136,9 +136,9 @@ private: JoystickHistoryView *stickView_[2]{}; }; -class TouchTestScreen : public UIDialogScreenWithBackground { +class TouchTestScreen : public UIDialogScreenWithGameBackground { public: - TouchTestScreen() { + TouchTestScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) { for (int i = 0; i < MAX_TOUCH_POINTS; i++) { touches_[i].id = -1; } @@ -175,9 +175,9 @@ protected: class MockPSP; -class VisualMappingScreen : public UIDialogScreenWithBackground { +class VisualMappingScreen : public UIDialogScreenWithGameBackground { public: - VisualMappingScreen() {} + VisualMappingScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {} const char *tag() const override { return "VisualMapping"; } diff --git a/UI/CwCheatScreen.cpp b/UI/CwCheatScreen.cpp index dee7a11166..cd6f052ab1 100644 --- a/UI/CwCheatScreen.cpp +++ b/UI/CwCheatScreen.cpp @@ -35,8 +35,7 @@ static const int FILE_CHECK_FRAME_INTERVAL = 53; CwCheatScreen::CwCheatScreen(const Path &gamePath) - : UIDialogScreenWithBackground() { - gamePath_ = gamePath; + : UIDialogScreenWithGameBackground(gamePath) { } CwCheatScreen::~CwCheatScreen() { @@ -129,7 +128,7 @@ void CwCheatScreen::update() { fileCheckCounter_ = 0; } - UIDialogScreenWithBackground::update(); + UIDialogScreenWithGameBackground::update(); } void CwCheatScreen::onFinish(DialogResult result) { diff --git a/UI/CwCheatScreen.h b/UI/CwCheatScreen.h index 27a28a1b51..b343cbd818 100644 --- a/UI/CwCheatScreen.h +++ b/UI/CwCheatScreen.h @@ -26,7 +26,7 @@ struct CheatFileInfo; class CWCheatEngine; -class CwCheatScreen : public UIDialogScreenWithBackground { +class CwCheatScreen : public UIDialogScreenWithGameBackground { public: CwCheatScreen(const Path &gamePath); ~CwCheatScreen(); @@ -56,7 +56,6 @@ private: UI::ScrollView *rightScroll_ = nullptr; CWCheatEngine *engine_ = nullptr; std::vector fileInfo_; - Path gamePath_; std::string gameID_; int fileCheckCounter_ = 0; uint64_t fileCheckHash_; diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index 5dea5e0921..9d219eb1c8 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -147,7 +147,7 @@ UI::EventReturn DevMenuScreen::OnLogConfig(UI::EventParams &e) { UI::EventReturn DevMenuScreen::OnDeveloperTools(UI::EventParams &e) { UpdateUIState(UISTATE_PAUSEMENU); - screenManager()->push(new DeveloperToolsScreen()); + screenManager()->push(new DeveloperToolsScreen(gamePath_)); return UI::EVENT_DONE; } diff --git a/UI/DevScreens.h b/UI/DevScreens.h index 0df3d73ce3..687f5e6e11 100644 --- a/UI/DevScreens.h +++ b/UI/DevScreens.h @@ -30,7 +30,7 @@ class DevMenuScreen : public PopupScreen { public: - DevMenuScreen(std::shared_ptr i18n) : PopupScreen(i18n->T("Dev Tools")) {} + DevMenuScreen(const Path &gamePath, std::shared_ptr i18n) : PopupScreen(i18n->T("Dev Tools")), gamePath_(gamePath) {} const char *tag() const override { return "DevMenu"; } @@ -47,6 +47,9 @@ protected: UI::EventReturn OnDeveloperTools(UI::EventParams &e); UI::EventReturn OnToggleAudioDebug(UI::EventParams &e); UI::EventReturn OnResetLimitedLogging(UI::EventParams &e); + +private: + Path gamePath_; }; class JitDebugScreen : public UIDialogScreenWithBackground { diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index a0b898663c..8922c05ed2 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -486,7 +486,7 @@ void EmuScreen::sendMessage(const char *message, const char *value) { RecreateViews(); } else if (!strcmp(message, "control mapping") && screenManager()->topScreen() == this) { UpdateUIState(UISTATE_PAUSEMENU); - screenManager()->push(new ControlMappingScreen()); + screenManager()->push(new ControlMappingScreen(gamePath_)); } else if (!strcmp(message, "display layout editor") && screenManager()->topScreen() == this) { UpdateUIState(UISTATE_PAUSEMENU); screenManager()->push(new DisplayLayoutScreen(gamePath_)); @@ -968,7 +968,7 @@ void EmuScreen::CreateViews() { UI::EventReturn EmuScreen::OnDevTools(UI::EventParams ¶ms) { auto dev = GetI18NCategory("Developer"); - DevMenuScreen *devMenu = new DevMenuScreen(dev); + DevMenuScreen *devMenu = new DevMenuScreen(gamePath_, dev); if (params.v) devMenu->SetPopupOrigin(params.v); screenManager()->push(devMenu); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index f22627e100..068f80618b 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -792,7 +792,7 @@ void GameSettingsScreen::CreateViews() { style->SetEnabledPtr(&g_Config.bShowTouchControls); Choice *gesture = controlsSettings->Add(new Choice(co->T("Gesture mapping"))); gesture->OnClick.Add([=](EventParams &e) { - screenManager()->push(new GestureMappingScreen()); + screenManager()->push(new GestureMappingScreen(gamePath_)); return UI::EVENT_DONE; }); gesture->SetEnabledPtr(&g_Config.bShowTouchControls); @@ -1739,7 +1739,7 @@ UI::EventReturn GameSettingsScreen::OnTextureShaderChange(UI::EventParams &e) { } UI::EventReturn GameSettingsScreen::OnDeveloperTools(UI::EventParams &e) { - screenManager()->push(new DeveloperToolsScreen()); + screenManager()->push(new DeveloperToolsScreen(gamePath_)); return UI::EVENT_DONE; } @@ -1749,17 +1749,17 @@ UI::EventReturn GameSettingsScreen::OnRemoteISO(UI::EventParams &e) { } UI::EventReturn GameSettingsScreen::OnControlMapping(UI::EventParams &e) { - screenManager()->push(new ControlMappingScreen()); + screenManager()->push(new ControlMappingScreen(gamePath_)); return UI::EVENT_DONE; } UI::EventReturn GameSettingsScreen::OnCalibrateAnalogs(UI::EventParams &e) { - screenManager()->push(new AnalogSetupScreen()); + screenManager()->push(new AnalogSetupScreen(gamePath_)); return UI::EVENT_DONE; } UI::EventReturn GameSettingsScreen::OnTouchControlLayout(UI::EventParams &e) { - screenManager()->push(new TouchControlLayoutScreen()); + screenManager()->push(new TouchControlLayoutScreen(gamePath_)); return UI::EVENT_DONE; } @@ -1991,7 +1991,7 @@ UI::EventReturn DeveloperToolsScreen::OnFramedumpTest(UI::EventParams &e) { } UI::EventReturn DeveloperToolsScreen::OnTouchscreenTest(UI::EventParams &e) { - screenManager()->push(new TouchTestScreen()); + screenManager()->push(new TouchTestScreen(gamePath_)); return UI::EVENT_DONE; } diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index 5dbe9a682f..e7ea844507 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -155,8 +155,10 @@ private: std::string oldSettingInfo_; }; -class DeveloperToolsScreen : public UIDialogScreenWithBackground { +class DeveloperToolsScreen : public UIDialogScreenWithGameBackground { public: + DeveloperToolsScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {} + void update() override; void onFinish(DialogResult result) override; @@ -247,8 +249,9 @@ private: }; -class GestureMappingScreen : public UIDialogScreenWithBackground { +class GestureMappingScreen : public UIDialogScreenWithGameBackground { public: + GestureMappingScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {} void CreateViews() override; const char *tag() const override { return "GestureMapping"; } diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index 0516286f5d..df75236e9a 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -416,7 +416,7 @@ void HandleCommonMessages(const char *message, const char *value, ScreenManager currentMIPS->UpdateCore((CPUCore)g_Config.iCpuCore); } else if (!strcmp(message, "control mapping") && isActiveScreen && std::string(activeScreen->tag()) != "ControlMapping") { UpdateUIState(UISTATE_MENU); - manager->push(new ControlMappingScreen()); + manager->push(new ControlMappingScreen(Path())); } else if (!strcmp(message, "display layout editor") && isActiveScreen && std::string(activeScreen->tag()) != "DisplayLayout") { UpdateUIState(UISTATE_MENU); manager->push(new DisplayLayoutScreen(Path())); diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 4df138ec1e..055d1ead17 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -826,7 +826,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch screenManager->switchScreen(new LogoScreen(AfterLogoScreen::TO_GAME_SETTINGS)); } else if (gotoTouchScreenTest) { screenManager->switchScreen(new MainScreen()); - screenManager->push(new TouchTestScreen()); + screenManager->push(new TouchTestScreen(Path())); } else if (skipLogo) { screenManager->switchScreen(new EmuScreen(boot_filename)); } else { diff --git a/UI/TouchControlLayoutScreen.cpp b/UI/TouchControlLayoutScreen.cpp index 2094400a42..3432d76d26 100644 --- a/UI/TouchControlLayoutScreen.cpp +++ b/UI/TouchControlLayoutScreen.cpp @@ -557,8 +557,6 @@ DragDropButton *ControlLayoutView::getPickedControl(const int x, const int y) { return bestMatch; } -TouchControlLayoutScreen::TouchControlLayoutScreen() {} - void TouchControlLayoutScreen::resized() { RecreateViews(); } @@ -568,7 +566,7 @@ void TouchControlLayoutScreen::onFinish(DialogResult reason) { } UI::EventReturn TouchControlLayoutScreen::OnVisibility(UI::EventParams &e) { - screenManager()->push(new TouchControlVisibilityScreen()); + screenManager()->push(new TouchControlVisibilityScreen(gamePath_)); return UI::EVENT_DONE; } diff --git a/UI/TouchControlLayoutScreen.h b/UI/TouchControlLayoutScreen.h index 9834f217f0..0c3f328f96 100644 --- a/UI/TouchControlLayoutScreen.h +++ b/UI/TouchControlLayoutScreen.h @@ -23,9 +23,9 @@ class ControlLayoutView; -class TouchControlLayoutScreen : public UIDialogScreenWithBackground { +class TouchControlLayoutScreen : public UIDialogScreenWithGameBackground { public: - TouchControlLayoutScreen(); + TouchControlLayoutScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {} virtual void CreateViews() override; virtual void dialogFinished(const Screen *dialog, DialogResult result) override; diff --git a/UI/TouchControlVisibilityScreen.cpp b/UI/TouchControlVisibilityScreen.cpp index a9110810ee..8bfb3c90d5 100644 --- a/UI/TouchControlVisibilityScreen.cpp +++ b/UI/TouchControlVisibilityScreen.cpp @@ -84,48 +84,48 @@ void TouchControlVisibilityScreen::CreateViews() { toggles_.push_back({ "Dpad", &g_Config.touchDpad.show, ImageID::invalid(), nullptr }); toggles_.push_back({ "Analog Stick", &g_Config.touchAnalogStick.show, ImageID::invalid(), nullptr }); toggles_.push_back({ "Right Analog Stick", &g_Config.touchRightAnalogStick.show, ImageID::invalid(), [=](EventParams &e) { - screenManager()->push(new RightAnalogMappingScreen()); + screenManager()->push(new RightAnalogMappingScreen(gamePath_)); return UI::EVENT_DONE; }}); toggles_.push_back({ "Fast-forward", &g_Config.touchFastForwardKey.show, ImageID::invalid(), nullptr }); toggles_.push_back({ "Custom 1", &g_Config.touchCombo0.show, ImageID::invalid(), [=](EventParams &e) { - screenManager()->push(new ComboKeyScreen(0)); + screenManager()->push(new ComboKeyScreen(gamePath_, 0)); return UI::EVENT_DONE; }}); toggles_.push_back({ "Custom 2", &g_Config.touchCombo1.show, ImageID::invalid(), [=](EventParams &e) { - screenManager()->push(new ComboKeyScreen(1)); + screenManager()->push(new ComboKeyScreen(gamePath_, 1)); return UI::EVENT_DONE; }}); toggles_.push_back({ "Custom 3", &g_Config.touchCombo2.show, ImageID::invalid(), [=](EventParams &e) { - screenManager()->push(new ComboKeyScreen(2)); + screenManager()->push(new ComboKeyScreen(gamePath_, 2)); return UI::EVENT_DONE; }}); toggles_.push_back({ "Custom 4", &g_Config.touchCombo3.show, ImageID::invalid(), [=](EventParams &e) { - screenManager()->push(new ComboKeyScreen(3)); + screenManager()->push(new ComboKeyScreen(gamePath_, 3)); return UI::EVENT_DONE; }}); toggles_.push_back({ "Custom 5", &g_Config.touchCombo4.show, ImageID::invalid(), [=](EventParams &e) { - screenManager()->push(new ComboKeyScreen(4)); + screenManager()->push(new ComboKeyScreen(gamePath_, 4)); return UI::EVENT_DONE; }}); toggles_.push_back({ "Custom 6", &g_Config.touchCombo5.show, ImageID::invalid(), [=](EventParams &e) { - screenManager()->push(new ComboKeyScreen(5)); + screenManager()->push(new ComboKeyScreen(gamePath_, 5)); return UI::EVENT_DONE; }}); toggles_.push_back({ "Custom 7", &g_Config.touchCombo6.show, ImageID::invalid(), [=](EventParams &e) { - screenManager()->push(new ComboKeyScreen(6)); + screenManager()->push(new ComboKeyScreen(gamePath_, 6)); return UI::EVENT_DONE; }}); toggles_.push_back({ "Custom 8", &g_Config.touchCombo7.show, ImageID::invalid(), [=](EventParams &e) { - screenManager()->push(new ComboKeyScreen(7)); + screenManager()->push(new ComboKeyScreen(gamePath_, 7)); return UI::EVENT_DONE; }}); toggles_.push_back({ "Custom 9", &g_Config.touchCombo8.show, ImageID::invalid(), [=](EventParams &e) { - screenManager()->push(new ComboKeyScreen(8)); + screenManager()->push(new ComboKeyScreen(gamePath_, 8)); return UI::EVENT_DONE; }}); toggles_.push_back({ "Custom 10", &g_Config.touchCombo9.show, ImageID::invalid(), [=](EventParams &e) { - screenManager()->push(new ComboKeyScreen(9)); + screenManager()->push(new ComboKeyScreen(gamePath_, 9)); return UI::EVENT_DONE; }}); diff --git a/UI/TouchControlVisibilityScreen.h b/UI/TouchControlVisibilityScreen.h index 52d6d00eea..c21efbde8f 100644 --- a/UI/TouchControlVisibilityScreen.h +++ b/UI/TouchControlVisibilityScreen.h @@ -31,8 +31,9 @@ struct TouchButtonToggle { std::function handle; }; -class TouchControlVisibilityScreen : public UIDialogScreenWithBackground { +class TouchControlVisibilityScreen : public UIDialogScreenWithGameBackground { public: + TouchControlVisibilityScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {} void CreateViews() override; void onFinish(DialogResult result) override; @@ -46,8 +47,9 @@ private: bool nextToggleAll_ = true; }; -class RightAnalogMappingScreen : public UIDialogScreenWithBackground { +class RightAnalogMappingScreen : public UIDialogScreenWithGameBackground { public: + RightAnalogMappingScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {} void CreateViews() override; const char *tag() const override { return "RightAnalogMapping"; }