Merge pull request #1768 from JosJuice/filemonitor-regression
Re-add FileMonitor support for Wii discs
This commit is contained in:
commit
f71c4b5768
|
@ -27,7 +27,7 @@ namespace FileMon
|
||||||
|
|
||||||
static DiscIO::IVolume *OpenISO = nullptr;
|
static DiscIO::IVolume *OpenISO = nullptr;
|
||||||
static DiscIO::IFileSystem *pFileSystem = nullptr;
|
static DiscIO::IFileSystem *pFileSystem = nullptr;
|
||||||
static std::vector<const DiscIO::SFileInfo *> GCFiles;
|
static std::vector<const DiscIO::SFileInfo *> DiscFiles;
|
||||||
static std::string ISOFile = "", CurrentFile = "";
|
static std::string ISOFile = "", CurrentFile = "";
|
||||||
static bool FileAccess = true;
|
static bool FileAccess = true;
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ bool IsSoundFile(const std::string& filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Read the GC file system
|
// Read the file system
|
||||||
void ReadGC(const std::string& filename)
|
void ReadFileSystem(const std::string& filename)
|
||||||
{
|
{
|
||||||
// Should have an actual Shutdown procedure or something
|
// Should have an actual Shutdown procedure or something
|
||||||
if (OpenISO != nullptr)
|
if (OpenISO != nullptr)
|
||||||
|
@ -73,21 +73,22 @@ void ReadGC(const std::string& filename)
|
||||||
pFileSystem = nullptr;
|
pFileSystem = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GCFiles' pointers are no longer valid after pFileSystem is cleared
|
// DiscFiles' pointers are no longer valid after pFileSystem is cleared
|
||||||
GCFiles.clear();
|
DiscFiles.clear();
|
||||||
OpenISO = DiscIO::CreateVolumeFromFilename(filename);
|
OpenISO = DiscIO::CreateVolumeFromFilename(filename);
|
||||||
if (!OpenISO)
|
if (!OpenISO)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!DiscIO::IsVolumeWiiDisc(OpenISO) && !DiscIO::IsVolumeWadFile(OpenISO))
|
if (!DiscIO::IsVolumeWadFile(OpenISO))
|
||||||
{
|
{
|
||||||
pFileSystem = DiscIO::CreateFileSystem(OpenISO);
|
pFileSystem = DiscIO::CreateFileSystem(OpenISO);
|
||||||
|
|
||||||
if (!pFileSystem)
|
if (!pFileSystem)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pFileSystem->GetFileList(GCFiles);
|
pFileSystem->GetFileList(DiscFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAccess = true;
|
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)
|
void FindFilename(u64 offset)
|
||||||
{
|
{
|
||||||
// Don't do anything if a game is not running
|
// 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)
|
if (!pFileSystem || ISOFile != SConfig::GetInstance().m_LastFilename)
|
||||||
{
|
{
|
||||||
FileAccess = false;
|
FileAccess = false;
|
||||||
ReadGC(SConfig::GetInstance().m_LastFilename);
|
ReadFileSystem(SConfig::GetInstance().m_LastFilename);
|
||||||
ISOFile = SConfig::GetInstance().m_LastFilename;
|
ISOFile = SConfig::GetInstance().m_LastFilename;
|
||||||
INFO_LOG(FILEMON, "Opening '%s'", ISOFile.c_str());
|
INFO_LOG(FILEMON, "Opening '%s'", ISOFile.c_str());
|
||||||
return;
|
return;
|
||||||
|
@ -165,8 +166,8 @@ void Close()
|
||||||
pFileSystem = nullptr;
|
pFileSystem = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GCFiles' pointers are no longer valid after pFileSystem is cleared
|
// DiscFiles' pointers are no longer valid after pFileSystem is cleared
|
||||||
GCFiles.clear();
|
DiscFiles.clear();
|
||||||
|
|
||||||
ISOFile = "";
|
ISOFile = "";
|
||||||
CurrentFile = "";
|
CurrentFile = "";
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace FileMon
|
||||||
{
|
{
|
||||||
|
|
||||||
bool IsSoundFile(const std::string& filename);
|
bool IsSoundFile(const std::string& filename);
|
||||||
void ReadGC(const std::string& file);
|
void ReadFileSystem(const std::string& file);
|
||||||
void CheckFile(const std::string& file, u64 size);
|
void CheckFile(const std::string& file, u64 size);
|
||||||
void FindFilename(u64 offset);
|
void FindFilename(u64 offset);
|
||||||
void Close();
|
void Close();
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "Common/MsgHandler.h"
|
#include "Common/MsgHandler.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "DiscIO/Blob.h"
|
#include "DiscIO/Blob.h"
|
||||||
|
#include "DiscIO/FileMonitor.h"
|
||||||
#include "DiscIO/Volume.h"
|
#include "DiscIO/Volume.h"
|
||||||
#include "DiscIO/VolumeCreator.h"
|
#include "DiscIO/VolumeCreator.h"
|
||||||
#include "DiscIO/VolumeGC.h"
|
#include "DiscIO/VolumeGC.h"
|
||||||
|
@ -69,6 +70,8 @@ bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer) const
|
||||||
if (m_pReader == nullptr)
|
if (m_pReader == nullptr)
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
|
FileMon::FindFilename(_ReadOffset);
|
||||||
|
|
||||||
while (_Length > 0)
|
while (_Length > 0)
|
||||||
{
|
{
|
||||||
static unsigned char IV[16];
|
static unsigned char IV[16];
|
||||||
|
|
Loading…
Reference in New Issue