diff --git a/Core/Dialog/PSPOskDialog.cpp b/Core/Dialog/PSPOskDialog.cpp index 5535b2301c..7caf8d308a 100755 --- a/Core/Dialog/PSPOskDialog.cpp +++ b/Core/Dialog/PSPOskDialog.cpp @@ -27,19 +27,15 @@ #include "Common/ChunkFile.h" #include "GPU/GPUState.h" +#ifdef _WIN32 +#include "Core/Host.h" +#endif + #ifndef _WIN32 #include #include #endif -#ifdef _WIN32 -#include "../Windows/InputBox.h" -namespace MainWindow { - extern HWND hwndMain; - HINSTANCE GetHinstance(); -}; -#endif - const int numKeyCols[OSK_KEYBOARD_COUNT] = {12, 12, 13, 13, 12, 12, 12}; const int numKeyRows[OSK_KEYBOARD_COUNT] = {4, 4, 5, 5, 5, 4, 4}; @@ -783,10 +779,10 @@ int PSPOskDialog::NativeKeyboard() size_t maxInputLength = FieldMaxLength(); - if(!InputBox_GetString(0, MainWindow::hwndMain, windowTitle, defaultText, input, maxInputLength)) { + if(host->InputBoxGetString(windowTitle, defaultText, input, maxInputLength)) { strncat(input, "", strlen("")); } - // TODO: Insert your platform's native keyboard stuff here... + // TODO: Insert your platform's native keyboard stuff here... status = SCE_UTILITY_STATUS_FINISHED; } diff --git a/Core/Host.h b/Core/Host.h index 626f35a08d..836938213e 100644 --- a/Core/Host.h +++ b/Core/Host.h @@ -65,9 +65,15 @@ public: virtual void SetGPUStep(bool value, int flag = 0, int data = 0) {} virtual void NextGPUStep() {} +#ifdef _WIN32 + // Used instead of InputBox_GetString in PSPOskDialog.cpp to bypass the onscreen keyboard. + virtual bool InputBoxGetString(char *title, char *defaultValue, char *outValue, size_t outlength) { return false; } +#endif + // Used for headless. virtual void SendDebugOutput(const std::string &output) {} virtual void SendDebugScreenshot(const u8 *pixbuf, u32 w, u32 h) {} + }; extern Host *host; diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp index 9df56e80dd..94ee48f4f4 100644 --- a/Windows/WindowsHost.cpp +++ b/Windows/WindowsHost.cpp @@ -28,6 +28,7 @@ #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" @@ -39,7 +40,6 @@ #include "file/file_util.h" #include "main.h" - static PMixer *curMixer; int MyMix(short *buffer, int numSamples, int bits, int rate, int channels) @@ -255,3 +255,8 @@ void WindowsHost::UpdateConsolePosition() g_Config.iConsoleWindowY = rc.top; } } + +bool WindowsHost::InputBoxGetString(char *title, char *defaultValue, char *outValue, size_t outLength) +{ + return InputBox_GetString(MainWindow::GetHInstance(), MainWindow::GetHWND(), title, defaultValue, outValue, outLength); +} \ No newline at end of file diff --git a/Windows/WindowsHost.h b/Windows/WindowsHost.h index 5943875319..0f8b82608f 100644 --- a/Windows/WindowsHost.h +++ b/Windows/WindowsHost.h @@ -52,6 +52,8 @@ public: void SaveSymbolMap(); void SetWindowTitle(const char *message); + bool InputBoxGetString(char *title, char *defaultValue, char *outValue, size_t outlength); + std::shared_ptr keyboard; private: