diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index bd641d41c6..8535446e7e 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -65,6 +65,7 @@ #include "GameInfoCache.h" #include "android/jni/TestRunner.h" + #ifdef USING_QT_UI #include #include @@ -73,6 +74,9 @@ #ifdef _WIN32 namespace MainWindow { + enum { + WM_USER_LOG_STATUS_CHANGED = WM_USER + 200 + }; extern HWND hwndMain; void BrowseAndBoot(std::string defaultPath, bool browseDirectory = false); } @@ -771,6 +775,10 @@ void DeveloperScreen::render() { const static std::string reportHostOfficial = "report.ppsspp.org"; UICheckBox(GEN_ID, x, y += stride, d->T("Enable Logging"), ALIGN_TOPLEFT, &g_Config.bEnableLogging); +#ifdef _WIN32 + // Update the main menu bar. + PostMessage(MainWindow::hwndMain, MainWindow::WM_USER_LOG_STATUS_CHANGED, 0, 0); +#endif if (UICheckBox(GEN_ID, x, y += stride, d->T("Report","Enable Compatibility Server Reports"), ALIGN_TOPLEFT, &reportingEnabled)) { g_Config.sReportHost = reportingEnabled ? reportHostOfficial : ""; diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index de8fda0c24..c189f83b15 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -88,8 +88,6 @@ namespace MainWindow LRESULT CALLBACK DisplayProc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM); - const UINT WM_USER_SAVESTATE_FINISH = WM_USER + 100; - HWND GetHWND() { return hwndMain; } @@ -1150,6 +1148,15 @@ namespace MainWindow SetCursor(LoadCursor(0, IDC_ARROW)); break; + case WM_USER_LOG_STATUS_CHANGED: + if(!g_Config.bEnableLogging) { + LogManager::GetInstance()->GetConsoleListener()->Show(false); + EnableMenuItem(menu, ID_DEBUG_LOG, MF_GRAYED); + } + else + EnableMenuItem(menu, ID_DEBUG_LOG, MF_ENABLED); + break; + case WM_MENUSELECT: // Unfortunately, accelerate keys (hotkeys) shares the same enabled/disabled states // with corresponding menu items. @@ -1181,7 +1188,6 @@ namespace MainWindow { HMENU menu = GetMenu(GetHWND()); #define CHECKITEM(item,value) CheckMenuItem(menu,item,MF_BYCOMMAND | ((value) ? MF_CHECKED : MF_UNCHECKED)); - CHECKITEM(ID_EMULATION_SPEEDLIMIT,g_Config.bSpeedLimit); // CHECK(ID_OPTIONS_ENABLEFRAMEBUFFER,g_Config.bEnableFrameBuffer); // CHECK(ID_OPTIONS_EMULATESYSCALL,g_bEmulateSyscall); @@ -1203,7 +1209,7 @@ namespace MainWindow CHECKITEM(ID_OPTIONS_TOPMOST, g_Config.bTopMost); CHECKITEM(ID_EMULATION_SOUND, g_Config.bEnableSound); CHECKITEM(ID_TEXTURESCALING_DEPOSTERIZE, g_Config.bTexDeposterize); - + static const int zoomitems[4] = { ID_OPTIONS_SCREEN1X, ID_OPTIONS_SCREEN2X, @@ -1305,9 +1311,7 @@ namespace MainWindow EnableMenuItem(menu,ID_TOGGLE_PAUSE, !menuEnable); EnableMenuItem(menu,ID_EMULATION_STOP, !menuEnable); EnableMenuItem(menu,ID_EMULATION_RESET, !menuEnable); - EnableMenuItem(menu, ID_DEBUG_LOG, g_Config.bEnableLogging ? MF_ENABLED : MF_GRAYED); - if(!g_Config.bEnableLogging && !LogManager::GetInstance()->GetConsoleListener()->Hidden()) - LogManager::GetInstance()->GetConsoleListener()->Show(false); + EnableMenuItem(menu,ID_DEBUG_LOG, !g_Config.bEnableLogging); } // Message handler for about box. diff --git a/Windows/WndMainWindow.h b/Windows/WndMainWindow.h index 99f3e97ec2..d061ffe951 100644 --- a/Windows/WndMainWindow.h +++ b/Windows/WndMainWindow.h @@ -7,6 +7,10 @@ namespace MainWindow { + enum { + WM_USER_SAVESTATE_FINISH = WM_USER + 100, + WM_USER_LOG_STATUS_CHANGED = WM_USER + 200, + }; void Init(HINSTANCE hInstance); BOOL Show(HINSTANCE hInstance, int nCmdShow); void Close();