Allow Windows UI options to work in most places.

This makes it so you can change language from the pause screen, etc.
This commit is contained in:
Unknown W. Brackets committed 2016-09-28 22:37:36 -07:00
1 parent 5ae511a1ae
commit e989e5f44c
3 files changed
+38 -8

No files matched your search

+35 -8
View File
@@ -31,10 +31,13 @@
#include "util/random/rng.h"
#include "file/vfs.h"
#include "UI/ui_atlas.h"
#include "UI/MiscScreens.h"
#include "UI/ControlMappingScreen.h"
#include "UI/DisplayLayoutScreen.h"
#include "UI/EmuScreen.h"
#include "UI/MainScreen.h"
#include "UI/GameInfoCache.h"
#include "UI/GameSettingsScreen.h"
#include "UI/MainScreen.h"
#include "UI/MiscScreens.h"
#include "Core/Config.h"
#include "Core/Host.h"
#include "Core/System.h"
@@ -136,6 +139,16 @@ void HandleCommonMessages(const char *message, const char *value, ScreenManager
if (PSP_IsInited()) {
currentMIPS->UpdateCore((CPUCore)g_Config.iCpuCore);
}
} else if (!strcmp(message, "control mapping")) {
manager->push(new ControlMappingScreen());
} else if (!strcmp(message, "display layout editor")) {
manager->push(new DisplayLayoutScreen());
} else if (!strcmp(message, "window minimized")) {
if (!strcmp(value, "true")) {
gstate_c.skipDrawReason |= SKIPDRAW_WINDOW_MINIMIZED;
} else {
gstate_c.skipDrawReason &= ~SKIPDRAW_WINDOW_MINIMIZED;
}
}
}
@@ -153,10 +166,26 @@ void UIScreenWithGameBackground::DrawBackground(UIContext &dc) {
}
}
void UIScreenWithGameBackground::sendMessage(const char *message, const char *value) {
if (!strcmp(message, "settings")) {
screenManager()->push(new GameSettingsScreen(gamePath_));
} else {
UIScreenWithBackground::sendMessage(message, value);
}
}
void UIDialogScreenWithGameBackground::DrawBackground(UIContext &dc) {
DrawGameBackground(dc, gamePath_);
}
void UIDialogScreenWithGameBackground::sendMessage(const char *message, const char *value) {
if (!strcmp(message, "settings")) {
screenManager()->push(new GameSettingsScreen(gamePath_));
} else {
UIDialogScreenWithBackground::sendMessage(message, value);
}
}
void UIScreenWithBackground::sendMessage(const char *message, const char *value) {
HandleCommonMessages(message, value, screenManager());
I18NCategory *dev = GetI18NCategory("Developer");
@@ -164,6 +193,8 @@ void UIScreenWithBackground::sendMessage(const char *message, const char *value)
auto langScreen = new NewLanguageScreen(dev->T("Language"));
langScreen->OnChoice.Handle(this, &UIScreenWithBackground::OnLanguageChange);
screenManager()->push(langScreen);
} else if (!strcmp(message, "settings")) {
screenManager()->push(new GameSettingsScreen("", ""));
}
}
@@ -203,12 +234,8 @@ void UIDialogScreenWithBackground::sendMessage(const char *message, const char *
auto langScreen = new NewLanguageScreen(dev->T("Language"));
langScreen->OnChoice.Handle(this, &UIDialogScreenWithBackground::OnLanguageChange);
screenManager()->push(langScreen);
} else if (!strcmp(message, "window minimized")) {
if (!strcmp(value, "true")) {
gstate_c.skipDrawReason |= SKIPDRAW_WINDOW_MINIMIZED;
} else {
gstate_c.skipDrawReason &= ~SKIPDRAW_WINDOW_MINIMIZED;
}
} else if (!strcmp(message, "settings")) {
screenManager()->push(new GameSettingsScreen("", ""));
}
}
+2
View File
@@ -45,6 +45,7 @@ public:
UIScreenWithGameBackground(const std::string &gamePath)
: UIScreenWithBackground(), gamePath_(gamePath) {}
virtual void DrawBackground(UIContext &dc);
virtual void sendMessage(const char *message, const char *value) override;
protected:
std::string gamePath_;
};
@@ -65,6 +66,7 @@ public:
UIDialogScreenWithGameBackground(const std::string &gamePath)
: UIDialogScreenWithBackground(), gamePath_(gamePath) {}
virtual void DrawBackground(UIContext &dc) override;
virtual void sendMessage(const char *message, const char *value) override;
protected:
std::string gamePath_;
};
+1
View File
@@ -452,6 +452,7 @@ UI::EventReturn GamePauseScreen::OnDeleteConfig(UI::EventParams &e)
void GamePauseScreen::sendMessage(const char *message, const char *value) {
UIDialogScreenWithGameBackground::sendMessage(message, value);
// Since the language message isn't allowed to be in native, we have to have add this
// to every screen which directly inherits from UIScreen(which are few right now, luckily).
if (!strcmp(message, "language")) {