diff --git a/Core/Dialog/PSPOskDialog.cpp b/Core/Dialog/PSPOskDialog.cpp index 46fb8b0a9b..7e4f54e104 100755 --- a/Core/Dialog/PSPOskDialog.cpp +++ b/Core/Dialog/PSPOskDialog.cpp @@ -28,7 +28,7 @@ #include "GPU/GPUState.h" #ifdef _WIN32 -#include "Core/Host.h" +#include "base/NativeApp.h" #endif #ifndef _WIN32 @@ -803,7 +803,7 @@ int PSPOskDialog::NativeKeyboard() if(defaultText.empty()) defaultText.assign(L"VALUE"); - if(host->InputBoxGetWString(titleText.c_str(), defaultText, inputChars)) + if(System_InputBoxGetWString(titleText.c_str(), defaultText, inputChars)) { u32 maxLength = FieldMaxLength(); if (inputChars.length() > maxLength) @@ -851,8 +851,8 @@ int PSPOskDialog::Update(int animSpeed) // TODO: Add your platforms here when you have a NativeKeyboard func. #ifdef _WIN32 - // Fall back to the OSK/continue normally if we're in fullscreen. The dialog box - // doesn't work right if in fullscreen. + // Windows: Fall back to the OSK/continue normally if we're in fullscreen. + // The dialog box doesn't work right if in fullscreen. if(g_Config.bBypassOSKWithKeyboard && !g_Config.bFullScreen) return NativeKeyboard(); #endif diff --git a/Core/Host.h b/Core/Host.h index 94846c5aa8..44bc33e791 100644 --- a/Core/Host.h +++ b/Core/Host.h @@ -75,12 +75,6 @@ public: virtual bool CanCreateShortcut() {return false;} virtual bool CreateDesktopShortcut(std::string argumentPath, std::string title) {return false;} -#if defined(_WIN32) || (defined(USING_QT_UI) && !defined(USING_GLES2)) - // Implement this on your platform to grab text input from the user for whatever purpose. - virtual bool InputBoxGetString(char *title, const char *defaultValue, char *outValue, size_t outlength) { return false; } - virtual bool InputBoxGetWString(const wchar_t *title, const std::wstring &defaultvalue, std::wstring &outvalue) { return false; } -#endif - // Used for headless. virtual bool ShouldSkipUI() { return false; } virtual void SendDebugOutput(const std::string &output) {} diff --git a/Qt/QtHost.cpp b/Qt/QtHost.cpp index 56404d87ea..d9763d97ff 100644 --- a/Qt/QtHost.cpp +++ b/Qt/QtHost.cpp @@ -1,7 +1,6 @@ // This file is Qt Desktop's equivalent of NativeApp.cpp #include -#include #include #include #include @@ -243,31 +242,6 @@ void QtHost::NextGPUStep() m_hGPUStepEvent.notify_one(); } -bool QtHost::InputBoxGetString(char *title, const char *defaultValue, char *outValue, size_t outLength) -{ - bool ok; - QString text = QInputDialog::getText(mainWindow, title, title, QLineEdit::Normal, defaultValue, &ok); - if (ok && !text.isEmpty()) { - strcpy(outValue, text.toStdString().c_str()); - return true; - } else { - return false; - } -} - -bool QtHost::InputBoxGetWString(const wchar_t *title, const std::wstring &defaultValue, std::wstring &outValue) -{ - bool ok; - QString text = QInputDialog::getText(mainWindow, QString::fromStdWString(title), QString::fromStdWString(title), QLineEdit::Normal, QString::fromStdWString(defaultValue), &ok); - if (ok && !text.isEmpty()) { - outValue = text.toStdWString(); - return true; - } else { - return false; - } - -} - void NativeInit(int argc, const char *argv[], const char *savegame_directory, const char *external_directory, const char *installID) { isMessagePending = false; diff --git a/Qt/QtHost.h b/Qt/QtHost.h index 438566ccb1..002d4b4a27 100644 --- a/Qt/QtHost.h +++ b/Qt/QtHost.h @@ -18,7 +18,6 @@ // Globals static PMixer *g_mixer; static QString fileToStart; -static QtEmuGL* glWindow; class QtHost : public QObject, public Host { @@ -57,8 +56,6 @@ public: void SendGPUStart(); void SetGPUStep(bool value, int flag = 0, u32 data = 0); void NextGPUStep(); - bool InputBoxGetString(char *title, const char *defaultValue, char *outValue, size_t outlength); - bool InputBoxGetWString(const wchar_t *title, const std::wstring &defaultValue, std::wstring &outValue); signals: void BootDoneSignal(); diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 444327417f..69d7a9af61 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -17,7 +17,6 @@ extern bool g_TakeScreenshot; -class QtEmuGL; class MenuAction; class MenuTree; @@ -135,7 +134,6 @@ private: QTranslator translator; QString currentLanguage; - MainUI *emugl; CoreState nextState; InputState input_state; GlobalUIState lastUIState; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 6cd796883b..e2fde27817 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -121,7 +121,7 @@ void GameSettingsScreen::CreateViews() { postProcChoice_->OnClick.Handle(this, &GameSettingsScreen::OnPostProcShader); postProcChoice_->SetEnabled(g_Config.iRenderingMode != 0); -#ifdef _WIN32 +#if defined(_WIN32) || defined(USING_QT_UI) graphicsSettings->Add(new CheckBox(&g_Config.bFullScreen, gs->T("FullScreen")))->OnClick.Handle(this, &GameSettingsScreen::OnFullscreenChange); #endif graphicsSettings->Add(new CheckBox(&g_Config.bStretchToDisplay, gs->T("Stretch to Display"))); @@ -293,9 +293,11 @@ void GameSettingsScreen::CreateViews() { systemSettings->Add(new ItemHeader(s->T("PSP Settings"))); // TODO: Come up with a way to display a keyboard for mobile users, // so until then, this is Windows/Desktop only. -#if defined(_WIN32) || (defined(USING_QT_UI) && !defined(USING_GLES2)) +#if defined(_WIN32) || defined(USING_QT_UI) systemSettings->Add(new Choice(s->T("Change Nickname")))->OnClick.Handle(this, &GameSettingsScreen::OnChangeNickname); - // Screenshot functionality is not yet available on non-Windows +#endif +#if defined(_WIN32) || (defined(USING_QT_UI) && !defined(USING_GLES2)) + // Screenshot functionality is not yet available on non-Windows/non-Qt systemSettings->Add(new CheckBox(&g_Config.bScreenshotsAsPNG, s->T("Screenshots as PNG"))); #endif systemSettings->Add(new CheckBox(&g_Config.bDayLightSavings, s->T("Day Light Saving"))); @@ -432,13 +434,13 @@ void GlobalSettingsScreen::CreateViews() { }*/ UI::EventReturn GameSettingsScreen::OnChangeNickname(UI::EventParams &e) { -#if defined(_WIN32) || (defined(USING_QT_UI) && !defined(USING_GLES2)) +#if defined(_WIN32) || defined(USING_QT_UI) const size_t name_len = 256; char name[name_len]; memset(name, 0, sizeof(name)); - if (host->InputBoxGetString("Enter a new PSP nickname", g_Config.sNickName.c_str(), name, name_len)) { + if (System_InputBoxGetString("Enter a new PSP nickname", g_Config.sNickName.c_str(), name, name_len)) { g_Config.sNickName = name; } #endif diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp index 4dd493e34b..70171e0e7f 100644 --- a/Windows/WindowsHost.cpp +++ b/Windows/WindowsHost.cpp @@ -46,7 +46,6 @@ #include "Windows/Debugger/DebuggerShared.h" #include "Windows/Debugger/Debugger_Disasm.h" #include "Windows/Debugger/Debugger_MemoryDlg.h" -#include "Windows/InputBox.h" #include "Windows/DinputDevice.h" #include "Windows/XinputDevice.h" @@ -277,27 +276,6 @@ void WindowsHost::UpdateConsolePosition() } } -bool WindowsHost::InputBoxGetString(char *title, const char *defaultValue, char *outValue, size_t outLength) -{ - std::string out; - if (InputBox_GetString(MainWindow::GetHInstance(), MainWindow::GetHWND(), ConvertUTF8ToWString(title).c_str(), defaultValue, out)) { - strcpy(outValue, out.c_str()); - return true; - } else { - return false; - } -} - -bool WindowsHost::InputBoxGetWString(const wchar_t *title, const std::wstring &defaultvalue, std::wstring &outvalue) -{ - if (InputBox_GetWString(MainWindow::GetHInstance(), MainWindow::GetHWND(), title, defaultvalue, outvalue)) { - return true; - } else { - return false; - } -} - - // http://msdn.microsoft.com/en-us/library/aa969393.aspx HRESULT CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszArguments, LPCWSTR lpszPathLink, LPCWSTR lpszDesc) { HRESULT hres; diff --git a/Windows/WindowsHost.h b/Windows/WindowsHost.h index 2368886817..7bfdae872b 100644 --- a/Windows/WindowsHost.h +++ b/Windows/WindowsHost.h @@ -67,8 +67,6 @@ public: virtual void GoFullscreen(bool); - bool InputBoxGetString(char *title, const char *defaultValue, char *outValue, size_t outlength); - bool InputBoxGetWString(const wchar_t *title, const std::wstring &defaultvalue, std::wstring &outvalue); std::shared_ptr keyboard; private: diff --git a/Windows/main.cpp b/Windows/main.cpp index acea719031..a47c64e1e8 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -46,6 +46,7 @@ #include "Windows/Debugger/CtrlDisAsmView.h" #include "Windows/Debugger/CtrlMemView.h" #include "Windows/Debugger/CtrlRegisterList.h" +#include "Windows/InputBox.h" #include "Windows/WindowsHost.h" #include "Windows/main.h" @@ -179,6 +180,27 @@ void EnableCrashingOnCrashes() } } +bool System_InputBoxGetString(char *title, const char *defaultValue, char *outValue, size_t outLength) +{ + std::string out; + if (InputBox_GetString(MainWindow::GetHInstance(), MainWindow::GetHWND(), ConvertUTF8ToWString(title).c_str(), defaultValue, out)) { + strcpy(outValue, out.c_str()); + return true; + } else { + return false; + } +} + +bool System_InputBoxGetWString(const wchar_t *title, const std::wstring &defaultvalue, std::wstring &outvalue) +{ + if (InputBox_GetWString(MainWindow::GetHInstance(), MainWindow::GetHWND(), title, defaultvalue, outvalue)) { + return true; + } else { + return false; + } +} + + int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow) { EnableCrashingOnCrashes(); diff --git a/native b/native index 69806cdd3b..9e5df6028a 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 69806cdd3befb9ad3a61430a260c90940dff99ff +Subproject commit 9e5df6028ad08d796a4656a30fa532058aa9466d