diff --git a/Windows/Debugger/DebuggerShared.h b/Windows/Debugger/DebuggerShared.h index 1500d46392..6490a52837 100644 --- a/Windows/Debugger/DebuggerShared.h +++ b/Windows/Debugger/DebuggerShared.h @@ -2,8 +2,6 @@ #include "Common/CommonWindows.h" #include "Core/Debugger/DebugInterface.h" -extern HMENU g_hPopupMenus; - enum { WM_DEB_GOTOWPARAM = WM_USER+2, WM_DEB_GOTOADDRESSEDIT, WM_DEB_MAPLOADED, @@ -16,4 +14,4 @@ enum { WM_DEB_GOTOWPARAM = WM_USER+2, bool executeExpressionWindow(HWND hwnd, DebugInterface* cpu, u32& dest); void displayExpressionError(HWND hwnd); -bool parseExpression(const char* exp, DebugInterface* cpu, u32& dest); \ No newline at end of file +bool parseExpression(const char* exp, DebugInterface* cpu, u32& dest); diff --git a/Windows/W32Util/ContextMenu.cpp b/Windows/W32Util/ContextMenu.cpp index 2647894b69..9e31320047 100644 --- a/Windows/W32Util/ContextMenu.cpp +++ b/Windows/W32Util/ContextMenu.cpp @@ -16,7 +16,13 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Windows/W32Util/ContextMenu.h" -#include "Windows/main.h" +#include "Windows/resource.h" + +static HMENU g_hPopupMenus; + +void ContextMenuInit(HINSTANCE inst) { + g_hPopupMenus = LoadMenu(inst, (LPCWSTR)IDR_POPUPMENUS); +} ContextPoint ContextPoint::FromCursor() { ContextPoint result; diff --git a/Windows/W32Util/ContextMenu.h b/Windows/W32Util/ContextMenu.h index f9af297223..7bddf6691a 100644 --- a/Windows/W32Util/ContextMenu.h +++ b/Windows/W32Util/ContextMenu.h @@ -41,5 +41,7 @@ struct ContextPoint { bool isClient_ = false; }; +void ContextMenuInit(HINSTANCE inst); + HMENU GetContextMenu(ContextMenuID); int TriggerContextMenu(ContextMenuID which, HWND wnd, const ContextPoint &pt); diff --git a/Windows/main.cpp b/Windows/main.cpp index ecfe18fa47..9395233e20 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -65,6 +65,7 @@ #if PPSSPP_API(ANY_GL) #include "Windows/GEDebugger/GEDebugger.h" #endif +#include "Windows/W32Util/ContextMenu.h" #include "Windows/W32Util/DialogManager.h" #include "Windows/W32Util/ShellUtil.h" @@ -101,7 +102,6 @@ static std::string gpuDriverVersion; static std::string restartArgs; -HMENU g_hPopupMenus; int g_activeWindow = 0; static std::thread inputBoxThread; @@ -665,10 +665,8 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin timeBeginPeriod(1); // TODO: Evaluate if this makes sense to keep. + ContextMenuInit(_hInstance); MainWindow::Init(_hInstance); - - g_hPopupMenus = LoadMenu(_hInstance, (LPCWSTR)IDR_POPUPMENUS); - MainWindow::Show(_hInstance); HWND hwndMain = MainWindow::GetHWND(); diff --git a/Windows/main.h b/Windows/main.h index 8f04b0ede4..890acc845c 100644 --- a/Windows/main.h +++ b/Windows/main.h @@ -31,7 +31,6 @@ extern CMemoryDlg *memoryWindow; extern CGEDebugger* geDebuggerWindow; #endif -extern HMENU g_hPopupMenus; extern int g_activeWindow; enum { WINDOW_MAINWINDOW, WINDOW_CPUDEBUGGER, WINDOW_GEDEBUGGER };