mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 17:19:44 -06:00
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
This commit is contained in:
@ -787,14 +787,6 @@
|
||||
RelativePath=".\src\Debugger.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\FileMonitor.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\FileMonitor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\JitWindow.cpp"
|
||||
>
|
||||
|
@ -1,153 +0,0 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Include
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include "Common.h" // Common
|
||||
#include "IniFile.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
#include "PowerPC/PowerPc.h" // Core
|
||||
#include "ConfigManager.h"
|
||||
#include "../../DiscIO/Src/FileSystemGCWii.h"
|
||||
#include "../../DiscIO/Src/VolumeCreator.h"
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
namespace FileMon
|
||||
{
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Declarations and definitions
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
DiscIO::IVolume *OpenISO;
|
||||
DiscIO::IFileSystem *pFileSystem = NULL;
|
||||
std::vector<const DiscIO::SFileInfo *> GCFiles;
|
||||
std::string ISOFile, CurrentFile;
|
||||
bool FileAccess = true;
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Filtered files
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool ShowSound(std::string FileName)
|
||||
{
|
||||
std::string Ending;
|
||||
SplitPath(FileName, NULL, NULL, &Ending);
|
||||
std::transform(Ending.begin(),Ending.end(),Ending.begin(),::tolower);
|
||||
|
||||
if (
|
||||
(Ending == ".adp") // 1080 Avalanche, Crash Bandicoot, etc
|
||||
|| (Ending == ".afc") // Zelda WW
|
||||
|| (Ending == ".ast") // Zelda TP, Mario Kart
|
||||
|| (Ending == ".dsp") // Metroid Prime
|
||||
|| (Ending == ".hps") // SSB Melee
|
||||
|
||||
|| (Ending == ".brstm") // Wii Sports, Wario Land, etc
|
||||
|| (Ending == ".sad") // Disaster
|
||||
)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Read the GC file system
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void ReadGC(std::string FileName)
|
||||
{
|
||||
OpenISO = DiscIO::CreateVolumeFromFilename(FileName);
|
||||
if (!DiscIO::IsVolumeWiiDisc(OpenISO))
|
||||
{
|
||||
pFileSystem = DiscIO::CreateFileSystem(OpenISO);
|
||||
pFileSystem->GetFileList(GCFiles);
|
||||
}
|
||||
FileAccess = true;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Check if we should play this file
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
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;
|
||||
// Do nothing if we found the same file again
|
||||
if (CurrentFile == File) return;
|
||||
|
||||
if (Size > 0) Size = (Size / 1000);
|
||||
std::string Str = StringFromFormat("%s kB %s", ThS(Size, true, 7).c_str(), File.c_str());
|
||||
if (ShowSound(File))
|
||||
{
|
||||
NOTICE_LOG(FILEMON, Str.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
WARN_LOG(FILEMON, Str.c_str());
|
||||
}
|
||||
|
||||
// Update the current file
|
||||
CurrentFile = File;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Find the GC filename
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
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 (!FileAccess) return;
|
||||
|
||||
if (!pFileSystem || ISOFile != SConfig::GetInstance().m_LastFilename)
|
||||
{
|
||||
FileAccess = false;
|
||||
ReadGC(SConfig::GetInstance().m_LastFilename);
|
||||
ISOFile = SConfig::GetInstance().m_LastFilename;
|
||||
NOTICE_LOG(FILEMON, "Opening '%s'", ISOFile.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
// File
|
||||
if (!pFileSystem->GetFileName(offset)) return;
|
||||
std::string File = std::string(pFileSystem->GetFileName(offset));
|
||||
// There's something wrong with the paths
|
||||
if (File.length() == 512) return;
|
||||
|
||||
int Size = (int)pFileSystem->GetFileSize(File.c_str());
|
||||
|
||||
CheckFile(File, Size);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
} // FileMon
|
@ -1,32 +0,0 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
#include <iostream> // System: For std
|
||||
|
||||
#include "Common.h" // Common: For u64
|
||||
|
||||
|
||||
namespace FileMon
|
||||
{
|
||||
|
||||
void ShowSound(std::string File);
|
||||
void ReadGC(std::string File);
|
||||
void CheckFile(std::string File, int Size);
|
||||
void FindFilename(u64 Offset);
|
||||
|
||||
}
|
@ -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)
|
||||
|
Reference in New Issue
Block a user