UI: Reset touch controls after config load.

This is potentially earlier than full init, better to move the controls as
soon as possible.
This commit is contained in:
Unknown W. Brackets 2017-12-09 14:11:39 -08:00
parent cf6ccfca99
commit c097910439
6 changed files with 20 additions and 1 deletions

View File

@ -63,6 +63,7 @@ public:
virtual bool CreateDesktopShortcut(std::string argumentPath, std::string title) {return false;}
virtual void NotifyUserMessage(const std::string &message, float duration = 1.0f, u32 color = 0x00FFFFFF, const char *id = nullptr) {}
virtual void SendUIMessage(const std::string &message, const std::string &value) {}
// Used for headless.
virtual bool ShouldSkipUI() { return false; }

View File

@ -248,6 +248,7 @@ bool Load_PSP_ISO(FileLoader *fileLoader, std::string *error_string) {
//in case we didn't go through EmuScreen::boot
g_Config.loadGameConfig(id);
host->SendUIMessage("config_loaded", "");
INFO_LOG(LOADER,"Loading %s...", bootpath.c_str());
return __KernelLoadExec(bootpath.c_str(), 0, error_string);
}

View File

@ -144,7 +144,6 @@ void EmuScreen::bootGame(const std::string &filename) {
return;
}
bootComplete();
RecreateViews();
}
return;
}
@ -155,6 +154,8 @@ void EmuScreen::bootGame(const std::string &filename) {
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(nullptr, filename, 0);
if (info && !info->id.empty()) {
g_Config.loadGameConfig(info->id);
// Reset views in case controls are in a different place.
RecreateViews();
}
invalid_ = true;
@ -356,6 +357,9 @@ void EmuScreen::sendMessage(const char *message, const char *value) {
bootPending_ = true;
gamePath_ = value;
}
} else if (!strcmp(message, "config_loaded")) {
// In case we need to position touch controls differently.
RecreateViews();
} else if (!strcmp(message, "control mapping") && screenManager()->topScreen() == this) {
UpdateUIState(UISTATE_MENU);
releaseButtons();

View File

@ -53,6 +53,10 @@ public:
void NotifyUserMessage(const std::string &message, float duration = 1.0f, u32 color = 0x00FFFFFF, const char *id = nullptr) override {
osm.Show(message, duration, color, -1, true, id);
}
void SendUIMessage(const std::string &message, const std::string &value) override {
NativeMessageReceived(message.c_str(), value.c_str());
}
};
#if !defined(MOBILE_DEVICE) && defined(USING_QT_UI)
@ -134,6 +138,10 @@ public:
osm.Show(message, duration, color, -1, true, id);
}
void SendUIMessage(const std::string &message, const std::string &value) override {
NativeMessageReceived(message.c_str(), value.c_str());
}
bool GPUDebuggingActive()
{
auto dialogDisplayList = mainWindow->GetDialogDisplaylist();

View File

@ -371,3 +371,7 @@ void WindowsHost::ToggleDebugConsoleVisibility() {
void WindowsHost::NotifyUserMessage(const std::string &message, float duration, u32 color, const char *id) {
osm.Show(message, duration, color, -1, true, id);
}
void WindowsHost::SendUIMessage(const std::string &message, const std::string &value) {
NativeMessageReceived(message.c_str(), value.c_str());
}

View File

@ -65,6 +65,7 @@ public:
bool CreateDesktopShortcut(std::string argumentPath, std::string title) override;
void NotifyUserMessage(const std::string &message, float duration = 1.0f, u32 color = 0x00FFFFFF, const char *id = nullptr) override;
void SendUIMessage(const std::string &message, const std::string &value) override;
std::shared_ptr<KeyboardDevice> keyboard;