From a69eb4301928bec4c55ae9ce0063211e74c545a2 Mon Sep 17 00:00:00 2001 From: John Peterson Date: Thu, 3 Sep 2009 20:00:09 +0000 Subject: [PATCH] GUI: Added file monitor log git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4185 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/Log.h | 1 + Source/Core/Common/Src/LogManager.cpp | 3 ++- Source/Core/Common/Src/LogManager.h | 2 +- Source/Core/Common/Src/StringUtil.cpp | 16 ++++++++++------ Source/Core/Common/Src/StringUtil.h | 4 ++-- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp | 6 ++++-- Source/Core/DebuggerWX/DebuggerWX.vcproj | 8 ++++++++ Source/Core/DebuggerWX/Src/CodeWindow.cpp | 3 +-- Source/Core/DebuggerWX/Src/SConscript | 1 + Source/Core/DiscIO/Src/VolumeGC.cpp | 4 +++- Source/Core/DolphinWX/Src/FrameAui.cpp | 4 ++-- Source/Core/DolphinWX/Src/LogWindow.cpp | 8 ++++++-- Source/Core/DolphinWX/Src/Main.cpp | 15 +++++++++------ 13 files changed, 50 insertions(+), 25 deletions(-) diff --git a/Source/Core/Common/Src/Log.h b/Source/Core/Common/Src/Log.h index a24f7e65f0..a00b993ed5 100644 --- a/Source/Core/Common/Src/Log.h +++ b/Source/Core/Common/Src/Log.h @@ -36,6 +36,7 @@ enum LOG_TYPE { COMMON, CONSOLE, DISCIO, + FILEMON, DSPHLE, DSPLLE, DSP_MAIL, diff --git a/Source/Core/Common/Src/LogManager.cpp b/Source/Core/Common/Src/LogManager.cpp index 30157cb4fe..609de30a30 100644 --- a/Source/Core/Common/Src/LogManager.cpp +++ b/Source/Core/Common/Src/LogManager.cpp @@ -34,6 +34,7 @@ LogManager::LogManager() : logMutex(1) { m_Log[LogTypes::BOOT] = new LogContainer("BOOT", "Boot"); m_Log[LogTypes::COMMON] = new LogContainer("COMMON", "Common"); m_Log[LogTypes::DISCIO] = new LogContainer("DIO", "Disc IO"); + m_Log[LogTypes::FILEMON] = new LogContainer("FileMon", "File Monitor"); m_Log[LogTypes::PAD] = new LogContainer("PAD", "Pad"); m_Log[LogTypes::PIXELENGINE] = new LogContainer("PE", "PixelEngine"); m_Log[LogTypes::COMMANDPROCESSOR] = new LogContainer("CP", "CommandProc"); @@ -148,7 +149,7 @@ void LogContainer::removeListener(LogListener *listener) { bool LogContainer::isListener(LogListener *listener) const { std::vector::const_iterator i; - for(i = listeners.begin(); i != listeners.end(); i++) { + for (i = listeners.begin(); i != listeners.end(); i++) { if ((*i) == listener) { return true; } diff --git a/Source/Core/Common/Src/LogManager.h b/Source/Core/Common/Src/LogManager.h index 68e6561ad0..c1823a5f52 100644 --- a/Source/Core/Common/Src/LogManager.h +++ b/Source/Core/Common/Src/LogManager.h @@ -133,13 +133,13 @@ private: class LogManager { private: - LogContainer* m_Log[LogTypes::NUMBER_OF_LOGS]; Common::CriticalSection logMutex; FileLogListener *m_fileLog; ConsoleListener *m_consoleLog; static LogManager *m_logManager; // Singleton. Ugh. public: + LogContainer* m_Log[LogTypes::NUMBER_OF_LOGS]; static u32 GetMaxLevel() { return MAX_LOGLEVEL; } void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index 57cfe503b7..b6b65a3e90 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -439,23 +439,27 @@ int ChooseStringFrom(const char* str, const char* * items) } -// Thousand separator. Turns 12345678 into 12,345,678. -std::string ThS(int Integer, bool Unsigned) +// Thousand separator. Turns 12345678 into 12,345,678 +std::string ThS(int Integer, bool Unsigned, int Spaces) { // Create storage space char cbuf[20]; // Determine treatment of signed or unsigned if(Unsigned) sprintf(cbuf, "%u", Integer); else sprintf(cbuf, "%i", Integer); - std::string sbuf = cbuf; - for (u32 i = 0; i < sbuf.length(); ++i) + std::string Sbuf = cbuf; + for (u32 i = 0; i < Sbuf.length(); ++i) { if((i & 3) == 3) { - sbuf.insert(sbuf.length() - i, ","); + Sbuf.insert(Sbuf.length() - i, ","); } } - return sbuf; + + // Spaces + std::string Spc = ""; + for (int i = 0; i < (Spaces - Sbuf.length()); i++) Spc += " "; + return Spc + Sbuf; } void NormalizeDirSep(std::string* str) diff --git a/Source/Core/Common/Src/StringUtil.h b/Source/Core/Common/Src/StringUtil.h index 811b49bdde..d8edb2a9fa 100644 --- a/Source/Core/Common/Src/StringUtil.h +++ b/Source/Core/Common/Src/StringUtil.h @@ -50,8 +50,8 @@ inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...) std::string StripSpaces(const std::string &s); std::string StripQuotes(const std::string &s); std::string StripNewline(const std::string &s); -std::string ThS(int a, bool b = true); // thousand separator - +// Thousand separator. Turns 12345678 into 12,345,678 +std::string ThS(int a, bool b = true, int Spaces = 0); std::string StringFromInt(int value); std::string StringFromBool(bool value); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp index a597f83e17..1e0e0ef9c5 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp @@ -23,12 +23,12 @@ #include "../HW/CPU.h" #include "../HW/Memmap.h" #include "../Core.h" - #include "../VolumeHandler.h" - #include "VolumeCreator.h" #include "Filesystem.h" +#include "../../../Core/DebuggerWX/Src/FileMonitor.h" + using namespace DVDInterface; @@ -217,6 +217,8 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 { PanicAlert("Cant read from DVD_Plugin - DVD-Interface: Fatal Error"); } + + FileMon::CheckFile(std::string(pFilename), m_pFileSystem->GetFileSize(pFilename)); } break; diff --git a/Source/Core/DebuggerWX/DebuggerWX.vcproj b/Source/Core/DebuggerWX/DebuggerWX.vcproj index 5e66b12a98..8c228d4512 100644 --- a/Source/Core/DebuggerWX/DebuggerWX.vcproj +++ b/Source/Core/DebuggerWX/DebuggerWX.vcproj @@ -787,6 +787,14 @@ RelativePath=".\src\Debugger.h" > + + + + diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp index 76b3eb7e97..1159d34a1d 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp @@ -464,7 +464,7 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam interpreter->Check(!_LocalCoreStartupParameter.bUseJIT); pCoreMenu->AppendSeparator(); - jitblocklinking = pCoreMenu->Append(IDM_JITBLOCKLINKING + 123, _T("&JIT Block Linking off"), + jitblocklinking = pCoreMenu->Append(IDM_JITBLOCKLINKING, _T("&JIT Block Linking off"), _T("Provide safer execution by not linking the JIT blocks."), wxITEM_CHECK); @@ -755,7 +755,6 @@ void CCodeWindow::UpdateButtonStates() GetMenuBar()->Enable(IDM_SEARCHINSTRUCTION, Initialized); GetMenuBar()->Enable(IDM_CLEARSYMBOLS, Initialized); // Symbols menu - GetMenuBar()->Enable(IDM_CLEANSYMBOLS, Initialized); // not used GetMenuBar()->Enable(IDM_SCANFUNCTIONS, Initialized); GetMenuBar()->Enable(IDM_LOADMAPFILE, Initialized); GetMenuBar()->Enable(IDM_SAVEMAPFILE, Initialized); diff --git a/Source/Core/DebuggerWX/Src/SConscript b/Source/Core/DebuggerWX/Src/SConscript index 0e8e164b3d..26f60a60df 100644 --- a/Source/Core/DebuggerWX/Src/SConscript +++ b/Source/Core/DebuggerWX/Src/SConscript @@ -11,6 +11,7 @@ files = [ "BreakpointWindow.cpp", "CodeWindow.cpp", "CodeWindowFunctions.cpp", + "FileMonitor.cpp", "MemoryCheckDlg.cpp", "MemoryWindow.cpp", "RegisterWindow.cpp", diff --git a/Source/Core/DiscIO/Src/VolumeGC.cpp b/Source/Core/DiscIO/Src/VolumeGC.cpp index 041244cdd1..99d791b649 100644 --- a/Source/Core/DiscIO/Src/VolumeGC.cpp +++ b/Source/Core/DiscIO/Src/VolumeGC.cpp @@ -19,7 +19,7 @@ #include "VolumeGC.h" #include "StringUtil.h" - +#include "../../../Core/DebuggerWX/Src/FileMonitor.h" namespace DiscIO { @@ -38,6 +38,8 @@ bool CVolumeGC::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const if (m_pReader == NULL) return false; + FileMon::FindFilename(_Offset); + return m_pReader->Read(_Offset, _Length, _pBuffer); } diff --git a/Source/Core/DolphinWX/Src/FrameAui.cpp b/Source/Core/DolphinWX/Src/FrameAui.cpp index afb1107aa8..f78393e8c3 100644 --- a/Source/Core/DolphinWX/Src/FrameAui.cpp +++ b/Source/Core/DolphinWX/Src/FrameAui.cpp @@ -281,8 +281,8 @@ int CFrame::GetNootebookAffiliation(wxString Name) } void CFrame::ClosePages() { - DoToggleWindow(IDM_LOGWINDOW, false); - DoToggleWindow(IDM_CONSOLEWINDOW, false); + //DoToggleWindow(IDM_LOGWINDOW, false); + //DoToggleWindow(IDM_CONSOLEWINDOW, false); DoToggleWindow(IDM_CODEWINDOW, false); DoToggleWindow(IDM_REGISTERWINDOW, false); DoToggleWindow(IDM_BREAKPOINTWINDOW, false); diff --git a/Source/Core/DolphinWX/Src/LogWindow.cpp b/Source/Core/DolphinWX/Src/LogWindow.cpp index 1cb9ff9044..1050cfeb46 100644 --- a/Source/Core/DolphinWX/Src/LogWindow.cpp +++ b/Source/Core/DolphinWX/Src/LogWindow.cpp @@ -437,10 +437,14 @@ void CLogWindow::OnLogTimer(wxTimerEvent& WXUNUSED(event)) if (!m_LogAccess) return; //m_Log->Freeze(); + int MsgSz = msgQueue.size(); UpdateLog(); // Better auto scroll - m_Log->ScrollLines(1); - m_Log->ShowPosition( m_Log->GetLastPosition() ); + if (MsgSz > 0) + { + m_Log->ScrollLines(1); + m_Log->ShowPosition( m_Log->GetLastPosition() ); + } //m_Log->Thaw(); } diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 815824ad11..73df46db8b 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -42,6 +42,9 @@ #include "BootManager.h" +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Main window +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ IMPLEMENT_APP(DolphinApp) #if defined(HAVE_WX) && HAVE_WX @@ -345,9 +348,13 @@ void DolphinApp::OnEndSession() { SConfig::GetInstance().SaveSettings(); } -/////////////////////////////////////// Main window created +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Talk to GUI +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ + // g_VideoInitialize.pSysMessage() goes here void Host_SysMessage(const char *fmt, ...) { @@ -363,10 +370,6 @@ void Host_SysMessage(const char *fmt, ...) PanicAlert("%s", msg); } - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Talk to GUI -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ #if defined HAVE_WX && HAVE_WX bool wxMsgAlert(const char* caption, const char* text, bool yes_no, int /*Style*/) { @@ -521,7 +524,7 @@ void Host_UpdateStatusBar(const char* _pText, int Field) event.StopPropagation(); wxPostEvent(main_frame, event); // Process the event before continue - wxYieldIfNeeded(); + wxGetApp().ProcessPendingEvents(); } void Host_SetWiiMoteConnectionState(int _State)