mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
DiscIO: Remove C/I/S prefixes from class names
These prefixes were inconsistent with the rest of Dolphin.
I'm also renaming VolumeWiiCrypted to VolumeWii because of 1113b13
.
This commit is contained in:
@ -22,23 +22,23 @@
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
CFileSystemGCWii::CFileSystemGCWii(const IVolume* _rVolume, const Partition& partition)
|
||||
: IFileSystem(_rVolume, partition), m_Initialized(false), m_Valid(false), m_offset_shift(0)
|
||||
FileSystemGCWii::FileSystemGCWii(const Volume* _rVolume, const Partition& partition)
|
||||
: FileSystem(_rVolume, partition), m_Initialized(false), m_Valid(false), m_offset_shift(0)
|
||||
{
|
||||
m_Valid = DetectFileSystem();
|
||||
}
|
||||
|
||||
CFileSystemGCWii::~CFileSystemGCWii()
|
||||
FileSystemGCWii::~FileSystemGCWii()
|
||||
{
|
||||
m_FileInfoVector.clear();
|
||||
}
|
||||
|
||||
u64 CFileSystemGCWii::GetFileSize(const std::string& _rFullPath)
|
||||
u64 FileSystemGCWii::GetFileSize(const std::string& _rFullPath)
|
||||
{
|
||||
if (!m_Initialized)
|
||||
InitFileSystem();
|
||||
|
||||
const SFileInfo* pFileInfo = FindFileInfo(_rFullPath);
|
||||
const FileInfo* pFileInfo = FindFileInfo(_rFullPath);
|
||||
|
||||
if (pFileInfo != nullptr && !pFileInfo->IsDirectory())
|
||||
return pFileInfo->m_FileSize;
|
||||
@ -46,7 +46,7 @@ u64 CFileSystemGCWii::GetFileSize(const std::string& _rFullPath)
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string CFileSystemGCWii::GetFileName(u64 _Address)
|
||||
std::string FileSystemGCWii::GetFileName(u64 _Address)
|
||||
{
|
||||
if (!m_Initialized)
|
||||
InitFileSystem();
|
||||
@ -62,13 +62,13 @@ std::string CFileSystemGCWii::GetFileName(u64 _Address)
|
||||
return "";
|
||||
}
|
||||
|
||||
u64 CFileSystemGCWii::ReadFile(const std::string& _rFullPath, u8* _pBuffer, u64 _MaxBufferSize,
|
||||
u64 _OffsetInFile)
|
||||
u64 FileSystemGCWii::ReadFile(const std::string& _rFullPath, u8* _pBuffer, u64 _MaxBufferSize,
|
||||
u64 _OffsetInFile)
|
||||
{
|
||||
if (!m_Initialized)
|
||||
InitFileSystem();
|
||||
|
||||
const SFileInfo* pFileInfo = FindFileInfo(_rFullPath);
|
||||
const FileInfo* pFileInfo = FindFileInfo(_rFullPath);
|
||||
if (pFileInfo == nullptr)
|
||||
return 0;
|
||||
|
||||
@ -77,22 +77,21 @@ u64 CFileSystemGCWii::ReadFile(const std::string& _rFullPath, u8* _pBuffer, u64
|
||||
|
||||
u64 read_length = std::min(_MaxBufferSize, pFileInfo->m_FileSize - _OffsetInFile);
|
||||
|
||||
DEBUG_LOG(DISCIO, "Reading %" PRIx64 " bytes at %" PRIx64 " from file %s. Offset: %" PRIx64
|
||||
" Size: %" PRIx64,
|
||||
read_length, _OffsetInFile, _rFullPath.c_str(), pFileInfo->m_Offset,
|
||||
pFileInfo->m_FileSize);
|
||||
DEBUG_LOG(
|
||||
DISCIO,
|
||||
"Reading %" PRIx64 " bytes at %" PRIx64 " from file %s. Offset: %" PRIx64 " Size: %" PRIx64,
|
||||
read_length, _OffsetInFile, _rFullPath.c_str(), pFileInfo->m_Offset, pFileInfo->m_FileSize);
|
||||
|
||||
m_rVolume->Read(pFileInfo->m_Offset + _OffsetInFile, read_length, _pBuffer, m_partition);
|
||||
return read_length;
|
||||
}
|
||||
|
||||
bool CFileSystemGCWii::ExportFile(const std::string& _rFullPath,
|
||||
const std::string& _rExportFilename)
|
||||
bool FileSystemGCWii::ExportFile(const std::string& _rFullPath, const std::string& _rExportFilename)
|
||||
{
|
||||
if (!m_Initialized)
|
||||
InitFileSystem();
|
||||
|
||||
const SFileInfo* pFileInfo = FindFileInfo(_rFullPath);
|
||||
const FileInfo* pFileInfo = FindFileInfo(_rFullPath);
|
||||
|
||||
if (!pFileInfo)
|
||||
return false;
|
||||
@ -127,7 +126,7 @@ bool CFileSystemGCWii::ExportFile(const std::string& _rFullPath,
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CFileSystemGCWii::ExportApploader(const std::string& _rExportFolder) const
|
||||
bool FileSystemGCWii::ExportApploader(const std::string& _rExportFolder) const
|
||||
{
|
||||
std::optional<u32> apploader_size = m_rVolume->ReadSwapped<u32>(0x2440 + 0x14, m_partition);
|
||||
const std::optional<u32> trailer_size = m_rVolume->ReadSwapped<u32>(0x2440 + 0x18, m_partition);
|
||||
@ -153,13 +152,13 @@ bool CFileSystemGCWii::ExportApploader(const std::string& _rExportFolder) const
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<u64> CFileSystemGCWii::GetBootDOLOffset() const
|
||||
std::optional<u64> FileSystemGCWii::GetBootDOLOffset() const
|
||||
{
|
||||
std::optional<u32> offset = m_rVolume->ReadSwapped<u32>(0x420, m_partition);
|
||||
return offset ? static_cast<u64>(*offset) << 2 : std::optional<u64>();
|
||||
}
|
||||
|
||||
std::optional<u32> CFileSystemGCWii::GetBootDOLSize(u64 dol_offset) const
|
||||
std::optional<u32> FileSystemGCWii::GetBootDOLSize(u64 dol_offset) const
|
||||
{
|
||||
u32 dol_size = 0;
|
||||
|
||||
@ -179,9 +178,9 @@ std::optional<u32> CFileSystemGCWii::GetBootDOLSize(u64 dol_offset) const
|
||||
for (u8 i = 0; i < 11; i++)
|
||||
{
|
||||
const std::optional<u32> offset =
|
||||
m_rVolume->ReadSwapped<u32>(dol_offset + 0x1c + i * 4, m_partition);
|
||||
m_rVolume->ReadSwapped<u32>(dol_offset + 0x1c + i * 4, m_partition);
|
||||
const std::optional<u32> size =
|
||||
m_rVolume->ReadSwapped<u32>(dol_offset + 0xac + i * 4, m_partition);
|
||||
m_rVolume->ReadSwapped<u32>(dol_offset + 0xac + i * 4, m_partition);
|
||||
if (!offset || !size)
|
||||
return {};
|
||||
dol_size = std::max(*offset + *size, dol_size);
|
||||
@ -190,7 +189,7 @@ std::optional<u32> CFileSystemGCWii::GetBootDOLSize(u64 dol_offset) const
|
||||
return dol_size;
|
||||
}
|
||||
|
||||
bool CFileSystemGCWii::ExportDOL(const std::string& _rExportFolder) const
|
||||
bool FileSystemGCWii::ExportDOL(const std::string& _rExportFolder) const
|
||||
{
|
||||
std::optional<u64> dol_offset = GetBootDOLOffset();
|
||||
if (!dol_offset)
|
||||
@ -215,7 +214,7 @@ bool CFileSystemGCWii::ExportDOL(const std::string& _rExportFolder) const
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string CFileSystemGCWii::GetStringFromOffset(u64 _Offset) const
|
||||
std::string FileSystemGCWii::GetStringFromOffset(u64 _Offset) const
|
||||
{
|
||||
std::string data(255, 0x00);
|
||||
m_rVolume->Read(_Offset, data.size(), (u8*)&data[0], m_partition);
|
||||
@ -226,7 +225,7 @@ std::string CFileSystemGCWii::GetStringFromOffset(u64 _Offset) const
|
||||
return SHIFTJISToUTF8(data);
|
||||
}
|
||||
|
||||
const std::vector<SFileInfo>& CFileSystemGCWii::GetFileList()
|
||||
const std::vector<FileInfo>& FileSystemGCWii::GetFileList()
|
||||
{
|
||||
if (!m_Initialized)
|
||||
InitFileSystem();
|
||||
@ -234,7 +233,7 @@ const std::vector<SFileInfo>& CFileSystemGCWii::GetFileList()
|
||||
return m_FileInfoVector;
|
||||
}
|
||||
|
||||
const SFileInfo* CFileSystemGCWii::FindFileInfo(const std::string& _rFullPath)
|
||||
const FileInfo* FileSystemGCWii::FindFileInfo(const std::string& _rFullPath)
|
||||
{
|
||||
if (!m_Initialized)
|
||||
InitFileSystem();
|
||||
@ -248,7 +247,7 @@ const SFileInfo* CFileSystemGCWii::FindFileInfo(const std::string& _rFullPath)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CFileSystemGCWii::DetectFileSystem()
|
||||
bool FileSystemGCWii::DetectFileSystem()
|
||||
{
|
||||
if (m_rVolume->ReadSwapped<u32>(0x18, m_partition) == u32(0x5D1C9EA3))
|
||||
{
|
||||
@ -264,7 +263,7 @@ bool CFileSystemGCWii::DetectFileSystem()
|
||||
return false;
|
||||
}
|
||||
|
||||
void CFileSystemGCWii::InitFileSystem()
|
||||
void FileSystemGCWii::InitFileSystem()
|
||||
{
|
||||
m_Initialized = true;
|
||||
|
||||
@ -280,8 +279,7 @@ void CFileSystemGCWii::InitFileSystem()
|
||||
const std::optional<u32> root_size = m_rVolume->ReadSwapped<u32>(FSTOffset + 0x8, m_partition);
|
||||
if (!root_name_offset || !root_offset || !root_size)
|
||||
return;
|
||||
SFileInfo root = {*root_name_offset, static_cast<u64>(*root_offset) << m_offset_shift,
|
||||
*root_size};
|
||||
FileInfo root = {*root_name_offset, static_cast<u64>(*root_offset) << m_offset_shift, *root_size};
|
||||
|
||||
if (!root.IsDirectory())
|
||||
return;
|
||||
@ -318,14 +316,14 @@ void CFileSystemGCWii::InitFileSystem()
|
||||
BuildFilenames(1, m_FileInfoVector.size(), "", NameTableOffset);
|
||||
}
|
||||
|
||||
size_t CFileSystemGCWii::BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex,
|
||||
const std::string& _szDirectory, u64 _NameTableOffset)
|
||||
size_t FileSystemGCWii::BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex,
|
||||
const std::string& _szDirectory, u64 _NameTableOffset)
|
||||
{
|
||||
size_t CurrentIndex = _FirstIndex;
|
||||
|
||||
while (CurrentIndex < _LastIndex)
|
||||
{
|
||||
SFileInfo& rFileInfo = m_FileInfoVector[CurrentIndex];
|
||||
FileInfo& rFileInfo = m_FileInfoVector[CurrentIndex];
|
||||
u64 const uOffset = _NameTableOffset + (rFileInfo.m_NameOffset & 0xFFFFFF);
|
||||
std::string const offset_str{GetStringFromOffset(uOffset)};
|
||||
bool const is_dir = rFileInfo.IsDirectory();
|
||||
|
Reference in New Issue
Block a user