Merge pull request #4164 from thedax/fixDebugLogCheckbox

Win32: Make NewUI debug log checkbox instant, and on debug builds, always enable logging on program start.
This commit is contained in:
Henrik Rydgård committed 2013-10-13 11:41:14 -07:00
commit e16ccf933e
8 files changed
+28 -39

No files matched your search

+1
View File
@@ -48,6 +48,7 @@ public:
virtual void GoFullscreen(bool) {}
virtual void ShutdownSound() = 0;
virtual void PollControllers(InputState &input_state) {}
virtual void ToggleDebugConsoleVisibility() {}
//this is sent from EMU thread! Make sure that Host handles it properly!
virtual void BootDone() {}
+2 -13
View File
@@ -42,9 +42,6 @@
#ifdef _WIN32
namespace MainWindow {
enum {
WM_USER_LOG_STATUS_CHANGED = WM_USER + 101,
};
extern HWND hwndMain;
}
#endif
@@ -479,8 +476,6 @@ void DeveloperToolsScreen::CreateViews() {
using namespace UI;
root_ = new ScrollView(ORIENT_VERTICAL);
enableLogging_ = g_Config.bEnableLogging;
I18NCategory *d = GetI18NCategory("Dialog");
I18NCategory *de = GetI18NCategory("Developer");
I18NCategory *gs = GetI18NCategory("Graphics");
@@ -498,7 +493,7 @@ void DeveloperToolsScreen::CreateViews() {
if (!File::Exists(g_Config.memCardDirectory + "pspautotests/tests/"))
cpuTests->SetEnabled(false);
list->Add(new CheckBox(&enableLogging_, de->T("Enable Logging")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLoggingChanged);
list->Add(new CheckBox(&g_Config.bEnableLogging, de->T("Enable Logging")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLoggingChanged);
list->Add(new Choice(de->T("Logging Channels")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLogConfig);
list->Add(new ItemHeader(de->T("Language")));
list->Add(new Choice(de->T("Load language ini")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLoadLanguageIni);
@@ -515,10 +510,6 @@ void DeveloperToolsScreen::sendMessage(const char *message, const char *value){
UI::EventReturn DeveloperToolsScreen::OnBack(UI::EventParams &e) {
screenManager()->finishDialog(this, DR_OK);
g_Config.bEnableLogging = enableLogging_;
#ifdef _WIN32
PostMessage(MainWindow::hwndMain, MainWindow::WM_USER_LOG_STATUS_CHANGED, 0, 0);
#endif
g_Config.Save();
return UI::EVENT_DONE;
@@ -542,9 +533,7 @@ UI::EventReturn GameSettingsScreen::OnRestoreDefaultSettings(UI::EventParams &e)
}
UI::EventReturn DeveloperToolsScreen::OnLoggingChanged(UI::EventParams &e) {
#ifdef _WIN32
PostMessage(MainWindow::hwndMain, MainWindow::WM_USER_LOG_STATUS_CHANGED, 0, 0);
#endif
host->ToggleDebugConsoleVisibility();
return UI::EVENT_DONE;
}
-3
View File
@@ -102,7 +102,4 @@ private:
UI::EventReturn OnLoadLanguageIni(UI::EventParams &e);
UI::EventReturn OnSaveLanguageIni(UI::EventParams &e);
UI::EventReturn OnLogConfig(UI::EventParams &e);
// Temporary variable.
bool enableLogging_;
};
+4 -2
View File
@@ -169,8 +169,6 @@ void WindowsHost::SetDebugMode(bool mode)
}
}
extern BOOL g_bFullScreen;
void WindowsHost::PollControllers(InputState &input_state)
{
bool doPad = true;
@@ -376,3 +374,7 @@ void WindowsHost::GoFullscreen(bool viewFullscreen) {
else
MainWindow::_ViewNormal(MainWindow::GetHWND());
}
void WindowsHost::ToggleDebugConsoleVisibility() {
MainWindow::ToggleDebugConsoleVisibility();
}
+1
View File
@@ -62,6 +62,7 @@ public:
virtual void GPUNotifyDraw();
virtual void GPUNotifyTextureAttachment(u32 addr);
virtual bool GPUAllowTextureCache(u32 addr);
virtual void ToggleDebugConsoleVisibility();
virtual bool CanCreateShortcut() {return false;} // Turn on when fixed
virtual bool CreateDesktopShortcut(std::string argumentPath, std::string title);
+11 -10
View File
@@ -1588,16 +1588,6 @@ 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 {
LogManager::GetInstance()->GetConsoleListener()->Show(true);
EnableMenuItem(menu, ID_DEBUG_LOG, MF_ENABLED);
}
break;
case WM_USER_UPDATE_UI:
TranslateMenus();
Update();
@@ -1863,4 +1853,15 @@ namespace MainWindow
HINSTANCE GetHInstance() {
return hInst;
}
void ToggleDebugConsoleVisibility() {
if (!g_Config.bEnableLogging) {
LogManager::GetInstance()->GetConsoleListener()->Show(false);
EnableMenuItem(menu, ID_DEBUG_LOG, MF_GRAYED);
}
else {
LogManager::GetInstance()->GetConsoleListener()->Show(true);
EnableMenuItem(menu, ID_DEBUG_LOG, MF_ENABLED);
}
}
}
+4 -4
View File
@@ -9,10 +9,9 @@ namespace MainWindow
{
enum {
WM_USER_SAVESTATE_FINISH = WM_USER + 100,
WM_USER_LOG_STATUS_CHANGED = WM_USER + 101,
WM_USER_UPDATE_UI = WM_USER + 102,
WM_USER_UPDATE_SCREEN = WM_USER + 103,
WM_USER_WINDOW_TITLE_CHANGED = WM_USER + 104,
WM_USER_UPDATE_UI = WM_USER + 101,
WM_USER_UPDATE_SCREEN = WM_USER + 102,
WM_USER_WINDOW_TITLE_CHANGED = WM_USER + 103,
};
enum {
@@ -65,6 +64,7 @@ namespace MainWindow
void SaveStateActionFinished(bool result, void *userdata);
void _ViewFullScreen(HWND hWnd);
void _ViewNormal(HWND hWnd);
void ToggleDebugConsoleVisibility();
void TranslateMenus();
void setTexScalingMultiplier(int level);
}
+5 -7
View File
@@ -170,11 +170,6 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
}
SetCurrentDirectory(modulePath);
// GetCurrentDirectory(MAX_PATH, modulePath); // for checking in the debugger
#ifndef _DEBUG
bool hideLog = true;
#else
bool hideLog = false;
#endif
VFSRegister("", new DirectoryAssetReader("assets/"));
VFSRegister("", new DirectoryAssetReader(""));
@@ -237,7 +232,7 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
switch (__argv[i][1])
{
case 'l':
hideLog = false;
g_Config.bEnableLogging = true;
break;
case 's':
g_Config.bAutoRun = false;
@@ -252,9 +247,12 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
g_Config.bFullScreen = false;
}
}
#ifdef _DEBUG
g_Config.bEnableLogging = true;
#endif
LogManager::Init();
LogManager::GetInstance()->GetConsoleListener()->Open(hideLog, 150, 120, "PPSSPP Debug Console");
LogManager::GetInstance()->GetConsoleListener()->Open(!g_Config.bEnableLogging, 150, 120, "PPSSPP Debug Console");
//Windows, API init stuff