Enable game backgrounds on more screens

This commit is contained in:
Henrik Rydgård
2022-11-22 22:53:54 +01:00
parent 9c21951efe
commit 575560f679
16 changed files with 58 additions and 54 deletions
+2 -2
View File
@@ -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"; }
+6 -6
View File
@@ -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 &params) {
}
UI::EventReturn ControlMappingScreen::OnVisualizeMapping(UI::EventParams &params) {
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();
}
+9 -9
View File
@@ -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<void(KeyDef)> callback, std::shared_ptr<I18NCategory> i18n)
KeyMappingNewMouseKeyDialog(int btn, bool replace, std::function<void(KeyDef)> callback, std::shared_ptr<I18NCategory> 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"; }
+2 -3
View File
@@ -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) {
+1 -2
View File
@@ -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<CheatFileInfo> fileInfo_;
Path gamePath_;
std::string gameID_;
int fileCheckCounter_ = 0;
uint64_t fileCheckHash_;
+1 -1
View File
@@ -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;
}
+4 -1
View File
@@ -30,7 +30,7 @@
class DevMenuScreen : public PopupScreen {
public:
DevMenuScreen(std::shared_ptr<I18NCategory> i18n) : PopupScreen(i18n->T("Dev Tools")) {}
DevMenuScreen(const Path &gamePath, std::shared_ptr<I18NCategory> 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 {
+2 -2
View File
@@ -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 &params) {
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);
+6 -6
View File
@@ -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;
}
+5 -2
View File
@@ -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"; }
+1 -1
View File
@@ -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()));
+1 -1
View File
@@ -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 {
+1 -3
View File
@@ -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;
}
+2 -2
View File
@@ -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;
+11 -11
View File
@@ -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;
}});
+4 -2
View File
@@ -31,8 +31,9 @@ struct TouchButtonToggle {
std::function<UI::EventReturn(UI::EventParams&)> 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"; }