From 34692ab826abc8f8faa61bdb2280b742424528f1 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 7 Dec 2013 15:14:29 -0500 Subject: Remove unnecessary Src/ folders --- Source/Core/DiscIO/FileMonitor.cpp | 164 +++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 Source/Core/DiscIO/FileMonitor.cpp (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp new file mode 100644 index 0000000000..ae2f9c0f99 --- /dev/null +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -0,0 +1,164 @@ +// Copyright 2013 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include +#include +#include +#include + + +#include "Common.h" +#include "IniFile.h" +#include "LogManager.h" + +#include "../Core/Core.h" +#include "../Core/ConfigManager.h" +#include "FileSystemGCWii.h" +#include "VolumeCreator.h" + +namespace FileMon +{ + +DiscIO::IVolume *OpenISO = NULL; +DiscIO::IFileSystem *pFileSystem = NULL; +std::vector GCFiles; +std::string ISOFile = "", CurrentFile = ""; +bool FileAccess = true; + +// Filtered files +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 +void ReadGC(std::string FileName) +{ + // Should have an actual Shutdown procedure or something + if(OpenISO != NULL) + { + delete OpenISO; + OpenISO = NULL; + } + if(pFileSystem != NULL) + { + delete pFileSystem; + pFileSystem = NULL; + } + + // GCFiles' pointers are no longer valid after pFileSystem is cleared + GCFiles.clear(); + OpenISO = DiscIO::CreateVolumeFromFilename(FileName); + if (!OpenISO) return; + if (!DiscIO::IsVolumeWiiDisc(OpenISO) && !DiscIO::IsVolumeWadFile(OpenISO)) + { + pFileSystem = DiscIO::CreateFileSystem(OpenISO); + if(!pFileSystem) return; + pFileSystem->GetFileList(GCFiles); + } + FileAccess = true; +} + +// Check if we should play this file +void CheckFile(std::string File, u64 Size) +{ + // Don't do anything if the log is unselected + if (!LogManager::GetInstance()->IsEnabled(LogTypes::FILEMON)) + 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", ThousandSeparate(Size, 7).c_str(), File.c_str()); + if (ShowSound(File)) + { + INFO_LOG(FILEMON, "%s", Str.c_str()); + } + else + { + WARN_LOG(FILEMON, "%s", Str.c_str()); + } + + // Update the current file + CurrentFile = File; +} + + +// Find the GC filename +void FindFilename(u64 offset) +{ + // Don't do anything if a game is not running + if (Core::GetState() != Core::CORE_RUN) + return; + + // Or if the log is unselected + if (!LogManager::GetInstance()->IsEnabled(LogTypes::FILEMON)) + return; + + // Or if we don't have file access + if (!FileAccess) + return; + + if (!pFileSystem || ISOFile != SConfig::GetInstance().m_LastFilename) + { + FileAccess = false; + ReadGC(SConfig::GetInstance().m_LastFilename); + ISOFile = SConfig::GetInstance().m_LastFilename; + INFO_LOG(FILEMON, "Opening '%s'", ISOFile.c_str()); + return; + } + + const char *fname = pFileSystem->GetFileName(offset); + + // There's something wrong with the paths + if (!fname || (strlen(fname) == 512)) + return; + + CheckFile(fname, pFileSystem->GetFileSize(fname)); +} + +void Close() +{ + if(OpenISO != NULL) + { + delete OpenISO; + OpenISO = NULL; + } + + if(pFileSystem != NULL) + { + delete pFileSystem; + pFileSystem = NULL; + } + + // GCFiles' pointers are no longer valid after pFileSystem is cleared + GCFiles.clear(); + + ISOFile = ""; + CurrentFile = ""; + FileAccess = true; +} + + +} // FileMon -- cgit v1.2.3 From 2afe2152712981e21d6bda6f029292ed2b1cf91e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 17 Feb 2014 05:18:15 -0500 Subject: Convert all includes to relative paths. --- Source/Core/DiscIO/FileMonitor.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index ae2f9c0f99..bae2f49964 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -2,20 +2,20 @@ // Licensed under GPLv2 // Refer to the license.txt file included. +#include #include -#include #include -#include +#include +#include "Common/Common.h" +#include "Common/IniFile.h" +#include "Common/LogManager.h" -#include "Common.h" -#include "IniFile.h" -#include "LogManager.h" +#include "Core/ConfigManager.h" +#include "Core/Core.h" -#include "../Core/Core.h" -#include "../Core/ConfigManager.h" -#include "FileSystemGCWii.h" -#include "VolumeCreator.h" +#include "DiscIO/FileSystemGCWii.h" +#include "DiscIO/VolumeCreator.h" namespace FileMon { -- cgit v1.2.3 From c698c07755fb95990f7b74ac525a65b2c725bfbf Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Fri, 21 Feb 2014 01:47:53 +0100 Subject: Make DiscIO/ mostly IWYU clean (and fix errors in rest of the project detected by this change). --- Source/Core/DiscIO/FileMonitor.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index bae2f49964..94d0189668 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -3,18 +3,21 @@ // Refer to the license.txt file included. #include -#include +#include +#include #include #include #include "Common/Common.h" -#include "Common/IniFile.h" #include "Common/LogManager.h" +#include "Common/StringUtil.h" #include "Core/ConfigManager.h" #include "Core/Core.h" +#include "Core/Boot/Boot.h" -#include "DiscIO/FileSystemGCWii.h" +#include "DiscIO/Filesystem.h" +#include "DiscIO/Volume.h" #include "DiscIO/VolumeCreator.h" namespace FileMon -- cgit v1.2.3 From f39c757edf93673f8e1792d16481a61d901a0af6 Mon Sep 17 00:00:00 2001 From: lioncash Date: Tue, 4 Mar 2014 08:39:25 -0500 Subject: Simplify ShowSound() in FileMonitor.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now if more sound types are found, they just need to simply be added to the unordered set. - Also changed ShowSound() to IsSoundFile() - Fixed IsSoundFile’s definition in FileMonitor.h. This whole time it has been defined as a void method, when in reality it was a bool function. - Changed the FileMonitor’s string parameters to be constant references. --- Source/Core/DiscIO/FileMonitor.cpp | 74 ++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 35 deletions(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index 94d0189668..63f4dddf56 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include "Common/Common.h" @@ -30,38 +31,36 @@ std::string ISOFile = "", CurrentFile = ""; bool FileAccess = true; // Filtered files -bool ShowSound(std::string FileName) +bool IsSoundFile(const 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; + std::string extension; + SplitPath(filename, NULL, NULL, &extension); + std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); + + std::unordered_set extensions = { + ".adp", // 1080 Avalanche, Crash Bandicoot, etc + ".afc", // Zelda WW + ".ast", // Zelda TP, Mario Kart + ".dsp", // Metroid Prime + ".hps", // SSB Melee + ".brstm", // Wii Sports, Wario Land, etc. + ".sad" // Disaster + }; + + return extensions.find(extension) != extensions.end(); } // Read the GC file system -void ReadGC(std::string FileName) +void ReadGC(const std::string& filename) { // Should have an actual Shutdown procedure or something - if(OpenISO != NULL) + if (OpenISO != NULL) { delete OpenISO; OpenISO = NULL; } - if(pFileSystem != NULL) + if (pFileSystem != NULL) { delete pFileSystem; pFileSystem = NULL; @@ -69,42 +68,47 @@ void ReadGC(std::string FileName) // GCFiles' pointers are no longer valid after pFileSystem is cleared GCFiles.clear(); - OpenISO = DiscIO::CreateVolumeFromFilename(FileName); - if (!OpenISO) return; + OpenISO = DiscIO::CreateVolumeFromFilename(filename); + if (!OpenISO) + return; + if (!DiscIO::IsVolumeWiiDisc(OpenISO) && !DiscIO::IsVolumeWadFile(OpenISO)) { pFileSystem = DiscIO::CreateFileSystem(OpenISO); - if(!pFileSystem) return; + + if (!pFileSystem) + return; + pFileSystem->GetFileList(GCFiles); } FileAccess = true; } // Check if we should play this file -void CheckFile(std::string File, u64 Size) +void CheckFile(const std::string& file, u64 size) { // Don't do anything if the log is unselected if (!LogManager::GetInstance()->IsEnabled(LogTypes::FILEMON)) return; // Do nothing if we found the same file again - if (CurrentFile == File) + if (CurrentFile == file) return; - if (Size > 0) - Size = (Size / 1000); + if (size > 0) + size = (size / 1000); - std::string Str = StringFromFormat("%s kB %s", ThousandSeparate(Size, 7).c_str(), File.c_str()); - if (ShowSound(File)) + std::string str = StringFromFormat("%s kB %s", ThousandSeparate(size, 7).c_str(), file.c_str()); + if (IsSoundFile(file)) { - INFO_LOG(FILEMON, "%s", Str.c_str()); + INFO_LOG(FILEMON, "%s", str.c_str()); } else { - WARN_LOG(FILEMON, "%s", Str.c_str()); + WARN_LOG(FILEMON, "%s", str.c_str()); } // Update the current file - CurrentFile = File; + CurrentFile = file; } @@ -143,13 +147,13 @@ void FindFilename(u64 offset) void Close() { - if(OpenISO != NULL) + if (OpenISO != NULL) { delete OpenISO; OpenISO = NULL; } - if(pFileSystem != NULL) + if (pFileSystem != NULL) { delete pFileSystem; pFileSystem = NULL; -- cgit v1.2.3 From 2c8b9735ae52471a36a33c5bf37c4487eb96367a Mon Sep 17 00:00:00 2001 From: lioncash Date: Tue, 4 Mar 2014 08:57:07 -0500 Subject: Add two other formats to the list of extensions in IsSoundFile .adx is used in various games, so this should definitely be here. --- Source/Core/DiscIO/FileMonitor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index 63f4dddf56..cc0a345838 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -38,12 +38,14 @@ bool IsSoundFile(const std::string& filename) std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); std::unordered_set extensions = { - ".adp", // 1080 Avalanche, Crash Bandicoot, etc + ".adp", // 1080 Avalanche, Crash Bandicoot, etc. + ".adx", // Sonic Adventure 2 Battle, etc. ".afc", // Zelda WW ".ast", // Zelda TP, Mario Kart + ".brstm", // Wii Sports, Wario Land, etc. ".dsp", // Metroid Prime ".hps", // SSB Melee - ".brstm", // Wii Sports, Wario Land, etc. + ".ogg", // Tony Hawk's Underground 2 ".sad" // Disaster }; -- cgit v1.2.3 From b027c4d64eb011c051750b94fef0ad8ef6c49572 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 9 Mar 2014 12:46:01 -0400 Subject: Add more sound file extensions to FileMonitor's IsSoundFile. --- Source/Core/DiscIO/FileMonitor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index cc0a345838..e22276cc30 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -46,7 +46,11 @@ bool IsSoundFile(const std::string& filename) ".dsp", // Metroid Prime ".hps", // SSB Melee ".ogg", // Tony Hawk's Underground 2 - ".sad" // Disaster + ".sad", // Disaster + ".snd", // Tales of Symphonia + ".song", // Tales of Symphonia + ".ssm", // Custom Robo, Kirby Air Ride, etc. + ".str", // Harry Potter & the Sorcerer's Stone }; return extensions.find(extension) != extensions.end(); -- cgit v1.2.3 From d802d392811be44d34ae9cd23f616db93e54c50f Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sun, 9 Mar 2014 21:14:26 +0100 Subject: clang-modernize -use-nullptr and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine --- Source/Core/DiscIO/FileMonitor.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index cc0a345838..e04bc2211e 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -24,8 +24,8 @@ namespace FileMon { -DiscIO::IVolume *OpenISO = NULL; -DiscIO::IFileSystem *pFileSystem = NULL; +DiscIO::IVolume *OpenISO = nullptr; +DiscIO::IFileSystem *pFileSystem = nullptr; std::vector GCFiles; std::string ISOFile = "", CurrentFile = ""; bool FileAccess = true; @@ -34,7 +34,7 @@ bool FileAccess = true; bool IsSoundFile(const std::string& filename) { std::string extension; - SplitPath(filename, NULL, NULL, &extension); + SplitPath(filename, nullptr, nullptr, &extension); std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); std::unordered_set extensions = { @@ -57,15 +57,15 @@ bool IsSoundFile(const std::string& filename) void ReadGC(const std::string& filename) { // Should have an actual Shutdown procedure or something - if (OpenISO != NULL) + if (OpenISO != nullptr) { delete OpenISO; - OpenISO = NULL; + OpenISO = nullptr; } - if (pFileSystem != NULL) + if (pFileSystem != nullptr) { delete pFileSystem; - pFileSystem = NULL; + pFileSystem = nullptr; } // GCFiles' pointers are no longer valid after pFileSystem is cleared @@ -149,16 +149,16 @@ void FindFilename(u64 offset) void Close() { - if (OpenISO != NULL) + if (OpenISO != nullptr) { delete OpenISO; - OpenISO = NULL; + OpenISO = nullptr; } - if (pFileSystem != NULL) + if (pFileSystem != nullptr) { delete pFileSystem; - pFileSystem = NULL; + pFileSystem = nullptr; } // GCFiles' pointers are no longer valid after pFileSystem is cleared -- cgit v1.2.3 From bd1ce18f9092f2929929513729e8abee8f60e4a5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 14 Mar 2014 23:38:14 -0400 Subject: Simplify file tree building for the filesystem view. Technically this also simplifies on disc filename building in general. --- Source/Core/DiscIO/FileMonitor.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index 34790ff408..d99bd14cd8 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -142,13 +142,9 @@ void FindFilename(u64 offset) return; } - const char *fname = pFileSystem->GetFileName(offset); + const std::string filename = pFileSystem->GetFileName(offset); - // There's something wrong with the paths - if (!fname || (strlen(fname) == 512)) - return; - - CheckFile(fname, pFileSystem->GetFileSize(fname)); + CheckFile(filename, pFileSystem->GetFileSize(filename)); } void Close() -- cgit v1.2.3 From 5310d6d2ea0233f745aa6fc9884930f7d30d4fee Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 23 Mar 2014 22:29:30 -0500 Subject: Fix a crash that got recently introduced. When CFileSystemGCWii::GetFileName can't find a valid filename it would return nullptr. nullptr as a std::string throws an assert within the std lib. So return an empty string and check if it is empty or not --- Source/Core/DiscIO/FileMonitor.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index d99bd14cd8..4743e7c1af 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -143,6 +143,9 @@ void FindFilename(u64 offset) } const std::string filename = pFileSystem->GetFileName(offset); + + if (filename.empty()) + return; CheckFile(filename, pFileSystem->GetFileSize(filename)); } -- cgit v1.2.3 From 664c8d30a055f4762a2a60be77c1c8eaec1a5d85 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sat, 29 Mar 2014 11:05:44 +0100 Subject: Remove all trailing whitespaces from our codebase. --- Source/Core/DiscIO/FileMonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index 4743e7c1af..cdbb885f13 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -143,7 +143,7 @@ void FindFilename(u64 offset) } const std::string filename = pFileSystem->GetFileName(offset); - + if (filename.empty()) return; -- cgit v1.2.3 From ca5340ebde1c4204f7299daa815f50a05aa0c8dc Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 5 Jun 2014 19:29:54 -0400 Subject: Centralize the logging code into its own folder in Common. --- Source/Core/DiscIO/FileMonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index cdbb885f13..04ea595a41 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -10,8 +10,8 @@ #include #include "Common/Common.h" -#include "Common/LogManager.h" #include "Common/StringUtil.h" +#include "Common/Logging/LogManager.h" #include "Core/ConfigManager.h" #include "Core/Core.h" -- cgit v1.2.3 From 22e1aa5bb4a159d6d66a321f978917614aa36331 Mon Sep 17 00:00:00 2001 From: degasus Date: Tue, 8 Jul 2014 14:29:26 +0200 Subject: mark all local functions as static --- Source/Core/DiscIO/FileMonitor.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index 04ea595a41..dba7c9ff74 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -17,6 +17,7 @@ #include "Core/Core.h" #include "Core/Boot/Boot.h" +#include "DiscIO/FileMonitor.h" #include "DiscIO/Filesystem.h" #include "DiscIO/Volume.h" #include "DiscIO/VolumeCreator.h" -- cgit v1.2.3 From 6d3f249dcc746cc7845ef88ddb8ce3bcc9221aca Mon Sep 17 00:00:00 2001 From: degasus Date: Tue, 8 Jul 2014 15:58:25 +0200 Subject: mark all local variables as static --- Source/Core/DiscIO/FileMonitor.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index dba7c9ff74..ce8799b227 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -25,11 +25,11 @@ namespace FileMon { -DiscIO::IVolume *OpenISO = nullptr; -DiscIO::IFileSystem *pFileSystem = nullptr; -std::vector GCFiles; -std::string ISOFile = "", CurrentFile = ""; -bool FileAccess = true; +static DiscIO::IVolume *OpenISO = nullptr; +static DiscIO::IFileSystem *pFileSystem = nullptr; +static std::vector GCFiles; +static std::string ISOFile = "", CurrentFile = ""; +static bool FileAccess = true; // Filtered files bool IsSoundFile(const std::string& filename) -- cgit v1.2.3 From f18fec81fe5144cbf72233bab255abb45b55e71c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 25 Aug 2014 19:56:03 -0400 Subject: DiscIO: Make the unordered set in IsSoundFile static Doesn't need to be instantiated every time the function is called. --- Source/Core/DiscIO/FileMonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index ce8799b227..723a02eb2c 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -38,7 +38,7 @@ bool IsSoundFile(const std::string& filename) SplitPath(filename, nullptr, nullptr, &extension); std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); - std::unordered_set extensions = { + static std::unordered_set extensions = { ".adp", // 1080 Avalanche, Crash Bandicoot, etc. ".adx", // Sonic Adventure 2 Battle, etc. ".afc", // Zelda WW -- cgit v1.2.3 From fbc64984ca7de7db10b1a8a4f49002f260c93569 Mon Sep 17 00:00:00 2001 From: Rohit Nirmal Date: Sun, 7 Sep 2014 20:06:58 -0500 Subject: Include CommonTypes.h instead of Common.h. --- Source/Core/DiscIO/FileMonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index 723a02eb2c..770716d2ca 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -9,7 +9,7 @@ #include #include -#include "Common/Common.h" +#include "Common/CommonTypes.h" #include "Common/StringUtil.h" #include "Common/Logging/LogManager.h" -- cgit v1.2.3 From 8624461315c5baaf23b3d13a0365de69a95266e6 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Thu, 25 Dec 2014 11:01:18 +0100 Subject: Re-add FileMonitor support for Wii discs This in done in the same way as GC discs, unlike the previous implementation. --- Source/Core/DiscIO/FileMonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index 770716d2ca..6cb8c410ef 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -79,7 +79,7 @@ void ReadGC(const std::string& filename) if (!OpenISO) return; - if (!DiscIO::IsVolumeWiiDisc(OpenISO) && !DiscIO::IsVolumeWadFile(OpenISO)) + if (!DiscIO::IsVolumeWadFile(OpenISO)) { pFileSystem = DiscIO::CreateFileSystem(OpenISO); -- cgit v1.2.3 From 1618d315237a88b7ebce4866cacf590c6fccbf07 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Thu, 25 Dec 2014 11:12:04 +0100 Subject: FileMonitor: Get rid of "GC" from names and comments --- Source/Core/DiscIO/FileMonitor.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index 6cb8c410ef..16c110716e 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -27,7 +27,7 @@ namespace FileMon static DiscIO::IVolume *OpenISO = nullptr; static DiscIO::IFileSystem *pFileSystem = nullptr; -static std::vector GCFiles; +static std::vector DiscFiles; static std::string ISOFile = "", CurrentFile = ""; static bool FileAccess = true; @@ -58,8 +58,8 @@ bool IsSoundFile(const std::string& filename) } -// Read the GC file system -void ReadGC(const std::string& filename) +// Read the file system +void ReadFileSystem(const std::string& filename) { // Should have an actual Shutdown procedure or something if (OpenISO != nullptr) @@ -73,8 +73,8 @@ void ReadGC(const std::string& filename) pFileSystem = nullptr; } - // GCFiles' pointers are no longer valid after pFileSystem is cleared - GCFiles.clear(); + // DiscFiles' pointers are no longer valid after pFileSystem is cleared + DiscFiles.clear(); OpenISO = DiscIO::CreateVolumeFromFilename(filename); if (!OpenISO) return; @@ -86,8 +86,9 @@ void ReadGC(const std::string& filename) if (!pFileSystem) return; - pFileSystem->GetFileList(GCFiles); + pFileSystem->GetFileList(DiscFiles); } + FileAccess = true; } @@ -119,7 +120,7 @@ void CheckFile(const std::string& file, u64 size) } -// Find the GC filename +// Find the filename void FindFilename(u64 offset) { // Don't do anything if a game is not running @@ -137,7 +138,7 @@ void FindFilename(u64 offset) if (!pFileSystem || ISOFile != SConfig::GetInstance().m_LastFilename) { FileAccess = false; - ReadGC(SConfig::GetInstance().m_LastFilename); + ReadFileSystem(SConfig::GetInstance().m_LastFilename); ISOFile = SConfig::GetInstance().m_LastFilename; INFO_LOG(FILEMON, "Opening '%s'", ISOFile.c_str()); return; @@ -165,8 +166,8 @@ void Close() pFileSystem = nullptr; } - // GCFiles' pointers are no longer valid after pFileSystem is cleared - GCFiles.clear(); + // DiscFiles' pointers are no longer valid after pFileSystem is cleared + DiscFiles.clear(); ISOFile = ""; CurrentFile = ""; -- cgit v1.2.3 From 7f04a23e23ac00d1076f9b37ba7b0cd52744f1b7 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 27 Dec 2014 20:13:31 +0100 Subject: Add FileMonitor support for VolumeDirectory --- Source/Core/DiscIO/FileMonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index 16c110716e..0cb561728a 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -92,7 +92,7 @@ void ReadFileSystem(const std::string& filename) FileAccess = true; } -// Check if we should play this file +// Logs a file if it passes a few checks void CheckFile(const std::string& file, u64 size) { // Don't do anything if the log is unselected -- cgit v1.2.3 From ace060748b572063b33acee13c19000783a6cdde Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 17 Jan 2015 13:21:02 +0100 Subject: Don't read from disk when checking volume type Should be faster than relying on the OS to cache the magic words. Also gets rid of the odd recursive call in VolumeDirectory. --- Source/Core/DiscIO/FileMonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index 16c110716e..830cbfac41 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -79,7 +79,7 @@ void ReadFileSystem(const std::string& filename) if (!OpenISO) return; - if (!DiscIO::IsVolumeWadFile(OpenISO)) + if (!OpenISO->IsWadFile()) { pFileSystem = DiscIO::CreateFileSystem(OpenISO); -- cgit v1.2.3 From 96c4b332f667054630349b70095ebaaa358e4065 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 3 Mar 2015 11:33:16 +0100 Subject: FileMonitor: Check log level in addition to FileMonitor checkbox This is good for performance when FileMontior is selected but the log level only is set to notice or warning. The ability to do this wasn't available until recently: 1ed41672f50c9cfe7aa4ab5aa3b73f7e41029124 --- Source/Core/DiscIO/FileMonitor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index e93855c4ee..48ab314c5f 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -96,7 +96,7 @@ void ReadFileSystem(const std::string& filename) void CheckFile(const std::string& file, u64 size) { // Don't do anything if the log is unselected - if (!LogManager::GetInstance()->IsEnabled(LogTypes::FILEMON)) + if (!LogManager::GetInstance()->IsEnabled(LogTypes::FILEMON, LogTypes::LWARNING)) return; // Do nothing if we found the same file again if (CurrentFile == file) @@ -128,7 +128,7 @@ void FindFilename(u64 offset) return; // Or if the log is unselected - if (!LogManager::GetInstance()->IsEnabled(LogTypes::FILEMON)) + if (!LogManager::GetInstance()->IsEnabled(LogTypes::FILEMON, LogTypes::LWARNING)) return; // Or if we don't have file access -- cgit v1.2.3 From d43a920924b11a825d474f75cba3996b676bb731 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 28 Apr 2015 12:48:05 +0200 Subject: Filesystem: Return file list reference instead of modifying argument --- Source/Core/DiscIO/FileMonitor.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index 48ab314c5f..09f1e3d33d 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -27,7 +27,6 @@ namespace FileMon static DiscIO::IVolume *OpenISO = nullptr; static DiscIO::IFileSystem *pFileSystem = nullptr; -static std::vector DiscFiles; static std::string ISOFile = "", CurrentFile = ""; static bool FileAccess = true; @@ -73,8 +72,6 @@ void ReadFileSystem(const std::string& filename) pFileSystem = nullptr; } - // DiscFiles' pointers are no longer valid after pFileSystem is cleared - DiscFiles.clear(); OpenISO = DiscIO::CreateVolumeFromFilename(filename); if (!OpenISO) return; @@ -85,8 +82,6 @@ void ReadFileSystem(const std::string& filename) if (!pFileSystem) return; - - pFileSystem->GetFileList(DiscFiles); } FileAccess = true; @@ -166,9 +161,6 @@ void Close() pFileSystem = nullptr; } - // DiscFiles' pointers are no longer valid after pFileSystem is cleared - DiscFiles.clear(); - ISOFile = ""; CurrentFile = ""; FileAccess = true; -- cgit v1.2.3 From cefcb0ace9d363b3679b4e93bcc9ec05f1e5f4f8 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Mon, 18 May 2015 01:08:10 +0200 Subject: Update license headers to GPLv2+ --- Source/Core/DiscIO/FileMonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index 48ab314c5f..82279f3527 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -1,5 +1,5 @@ // Copyright 2013 Dolphin Emulator Project -// Licensed under GPLv2 +// Licensed under GPLv2+ // Refer to the license.txt file included. #include -- cgit v1.2.3 From 30ebb2459eb97ba544547183854775df8460b475 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sun, 24 May 2015 06:55:12 +0200 Subject: Set copyright year to when a file was created --- Source/Core/DiscIO/FileMonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index 82279f3527..61bbace2da 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -1,4 +1,4 @@ -// Copyright 2013 Dolphin Emulator Project +// Copyright 2009 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. -- cgit v1.2.3 From 0ed31181411a9aa98dc194c6179681e670f186cb Mon Sep 17 00:00:00 2001 From: JosJuice Date: Thu, 4 Jun 2015 16:26:36 +0200 Subject: Volume: Return volume type as an enum ISOFile and GameFile were using IsWiiDisc() and IsWadFile() to set an enum value. The volume might as well return an enum directly. I increased the Qt CACHE_REVISION because m_platform now is saved as u32 instead of int, but increasing the wx CACHE_REVISION is not necessary. --- Source/Core/DiscIO/FileMonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/FileMonitor.cpp') diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index 7a3c28fd8a..0583d17a44 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -76,7 +76,7 @@ void ReadFileSystem(const std::string& filename) if (!OpenISO) return; - if (!OpenISO->IsWadFile()) + if (OpenISO->GetVolumeType() != DiscIO::IVolume::WII_WAD) { pFileSystem = DiscIO::CreateFileSystem(OpenISO); -- cgit v1.2.3