From 7f04a23e23ac00d1076f9b37ba7b0cd52744f1b7 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 27 Dec 2014 20:13:31 +0100 Subject: [PATCH] Add FileMonitor support for VolumeDirectory --- Source/Core/DiscIO/FileMonitor.cpp | 2 +- Source/Core/DiscIO/VolumeDirectory.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) 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 diff --git a/Source/Core/DiscIO/VolumeDirectory.cpp b/Source/Core/DiscIO/VolumeDirectory.cpp index f2163773f4..d5cae2def3 100644 --- a/Source/Core/DiscIO/VolumeDirectory.cpp +++ b/Source/Core/DiscIO/VolumeDirectory.cpp @@ -16,6 +16,7 @@ #include "Common/FileUtil.h" #include "Common/MathUtil.h" #include "DiscIO/FileBlob.h" +#include "DiscIO/FileMonitor.h" #include "DiscIO/Volume.h" #include "DiscIO/VolumeDirectory.h" @@ -111,13 +112,16 @@ bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const { _dbg_assert_(DVDINTERFACE, fileIter->first <= _Offset); u64 fileOffset = _Offset - fileIter->first; + const std::string fileName = fileIter->second; - std::unique_ptr reader(PlainFileReader::Create(fileIter->second)); + std::unique_ptr reader(PlainFileReader::Create(fileName)); if (reader == nullptr) return false; u64 fileSize = reader->GetDataSize(); + FileMon::CheckFile(fileName, fileSize); + if (fileOffset < fileSize) { u64 fileBytes = fileSize - fileOffset;