From e147b9eb91829453eb226992e3af936aaad3e691 Mon Sep 17 00:00:00 2001 From: nakeee Date: Fri, 4 Sep 2009 11:34:21 +0000 Subject: [PATCH] Fixed up the filemon a bit, added isEnable function to the logmanager and moved the FileMonitor from debug to discio to prevert cross dependencies git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4197 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/LogManager.h | 6 +++++- Source/Core/Common/Src/StringUtil.cpp | 6 ------ Source/Core/Common/Src/StringUtil.h | 2 -- Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp | 2 +- Source/Core/DebuggerWX/DebuggerWX.vcproj | 8 -------- Source/Core/DebuggerWX/Src/SConscript | 3 +-- Source/Core/DiscIO/DiscIO.vcproj | 9 +++++++++ Source/Core/{DebuggerWX => DiscIO}/Src/FileMonitor.cpp | 6 ++---- Source/Core/{DebuggerWX => DiscIO}/Src/FileMonitor.h | 0 Source/Core/DiscIO/Src/SConscript | 1 + Source/Core/DiscIO/Src/VolumeGC.cpp | 2 +- 11 files changed, 20 insertions(+), 25 deletions(-) rename Source/Core/{DebuggerWX => DiscIO}/Src/FileMonitor.cpp (91%) rename Source/Core/{DebuggerWX => DiscIO}/Src/FileMonitor.h (100%) diff --git a/Source/Core/Common/Src/LogManager.h b/Source/Core/Common/Src/LogManager.h index c1823a5f52..232bf6901f 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, @@ -153,6 +153,10 @@ public: m_Log[type]->setEnable(enable); } + bool isEnable(LogTypes::LOG_TYPE type) { + return m_Log[type]->isEnable(); + } + const char *getShortName(LogTypes::LOG_TYPE type) const { return m_Log[type]->getShortName(); } diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index b6b65a3e90..dbc6f30345 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -372,12 +372,6 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _ } #endif -std::string PathToFilename(std::string Path) -{ - std::string Name, Ending; - SplitPath(Path, 0, &Name, &Ending); - return Name + Ending; -} void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, const std::string& _Filename) { diff --git a/Source/Core/Common/Src/StringUtil.h b/Source/Core/Common/Src/StringUtil.h index d8edb2a9fa..65ffefcbd4 100644 --- a/Source/Core/Common/Src/StringUtil.h +++ b/Source/Core/Common/Src/StringUtil.h @@ -74,8 +74,6 @@ int ChooseStringFrom(const char* str, const char* * items); // "C:\Windows\winhelp.exe" to "C:\Windows\", "winhelp", "exe" bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, std::string* _pExtension); -// "C:\Windows\winhelp.exe" to "winhelp.exe" -std::string PathToFilename(std::string Path); void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, const std::string& _Filename); void NormalizeDirSep(std::string* str); 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 1e0e0ef9c5..c472842584 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 @@ -27,7 +27,7 @@ #include "VolumeCreator.h" #include "Filesystem.h" -#include "../../../Core/DebuggerWX/Src/FileMonitor.h" +#include "../../DiscIO/Src/FileMonitor.h" using namespace DVDInterface; diff --git a/Source/Core/DebuggerWX/DebuggerWX.vcproj b/Source/Core/DebuggerWX/DebuggerWX.vcproj index 8c228d4512..5e66b12a98 100644 --- a/Source/Core/DebuggerWX/DebuggerWX.vcproj +++ b/Source/Core/DebuggerWX/DebuggerWX.vcproj @@ -787,14 +787,6 @@ RelativePath=".\src\Debugger.h" > - - - - diff --git a/Source/Core/DebuggerWX/Src/SConscript b/Source/Core/DebuggerWX/Src/SConscript index 26f60a60df..28ecd04e9b 100644 --- a/Source/Core/DebuggerWX/Src/SConscript +++ b/Source/Core/DebuggerWX/Src/SConscript @@ -11,7 +11,6 @@ files = [ "BreakpointWindow.cpp", "CodeWindow.cpp", "CodeWindowFunctions.cpp", - "FileMonitor.cpp", "MemoryCheckDlg.cpp", "MemoryWindow.cpp", "RegisterWindow.cpp", @@ -30,7 +29,7 @@ wxenv.Append( ) libs = [ 'common', - 'debugger_ui_util' + 'debugger_ui_util' ] wxenv.StaticLibrary(env['local_libs'] + "debwx", files, LIBS = libs) diff --git a/Source/Core/DiscIO/DiscIO.vcproj b/Source/Core/DiscIO/DiscIO.vcproj index e1b526cf27..365e1aee90 100644 --- a/Source/Core/DiscIO/DiscIO.vcproj +++ b/Source/Core/DiscIO/DiscIO.vcproj @@ -648,6 +648,15 @@ RelativePath=".\Src\VolumeDirectory.cpp" > + + + + + diff --git a/Source/Core/DebuggerWX/Src/FileMonitor.cpp b/Source/Core/DiscIO/Src/FileMonitor.cpp similarity index 91% rename from Source/Core/DebuggerWX/Src/FileMonitor.cpp rename to Source/Core/DiscIO/Src/FileMonitor.cpp index 6998943501..3e0a159764 100644 --- a/Source/Core/DebuggerWX/Src/FileMonitor.cpp +++ b/Source/Core/DiscIO/Src/FileMonitor.cpp @@ -28,7 +28,6 @@ #include "IniFile.h" #include "LogManager.h" -#include "PowerPC/PowerPc.h" // Core #include "ConfigManager.h" #include "../../DiscIO/Src/FileSystemGCWii.h" #include "../../DiscIO/Src/VolumeCreator.h" @@ -97,7 +96,7 @@ void ReadGC(std::string FileName) void CheckFile(std::string File, int Size) { // Don't do anything if the log is unselected - if (!LogManager::GetInstance()->m_Log[LogTypes::FILEMON]->isEnable()) return; + if (!LogManager::GetInstance()->isEnable(LogTypes::FILEMON)) return; // Do nothing if we found the same file again if (CurrentFile == File) return; @@ -124,8 +123,7 @@ void CheckFile(std::string File, int Size) void FindFilename(u64 offset) { // Don't do anything if the log is unselected - if (!LogManager::GetInstance()->m_Log[LogTypes::FILEMON]->isEnable()) return; - if (PowerPC::GetState() != PowerPC::CPUState::CPU_RUNNING) return; + if (!LogManager::GetInstance()->isEnable(LogTypes::FILEMON)) return; if (!FileAccess) return; if (!pFileSystem || ISOFile != SConfig::GetInstance().m_LastFilename) diff --git a/Source/Core/DebuggerWX/Src/FileMonitor.h b/Source/Core/DiscIO/Src/FileMonitor.h similarity index 100% rename from Source/Core/DebuggerWX/Src/FileMonitor.h rename to Source/Core/DiscIO/Src/FileMonitor.h diff --git a/Source/Core/DiscIO/Src/SConscript b/Source/Core/DiscIO/Src/SConscript index 32d8eb4d3a..999e46dc43 100644 --- a/Source/Core/DiscIO/Src/SConscript +++ b/Source/Core/DiscIO/Src/SConscript @@ -20,6 +20,7 @@ files = [ 'VolumeGC.cpp', 'VolumeWad.cpp', 'VolumeWiiCrypted.cpp', + 'FileMonitor.cpp', 'NANDContentLoader.cpp', 'WiiWad.cpp', 'AES/aes_cbc.c', diff --git a/Source/Core/DiscIO/Src/VolumeGC.cpp b/Source/Core/DiscIO/Src/VolumeGC.cpp index 99d791b649..13c2ebbb07 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" +#include "FileMonitor.h" namespace DiscIO {