mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Kill off some usages of c_str.
Also changes some function params, but this is ok. Some simplifications were also able to be made (ie. killing off strcmps with ==, etc).
This commit is contained in:
@ -33,7 +33,8 @@ void SectorReader::SetSectorSize(int blocksize)
|
||||
m_blocksize = blocksize;
|
||||
}
|
||||
|
||||
SectorReader::~SectorReader() {
|
||||
SectorReader::~SectorReader()
|
||||
{
|
||||
for (u8*& block : cache)
|
||||
{
|
||||
delete [] block;
|
||||
@ -100,6 +101,7 @@ bool SectorReader::Read(u64 offset, u64 size, u8* out_ptr)
|
||||
block++;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -112,12 +114,13 @@ bool SectorReader::ReadMultipleAlignedBlocks(u64 block_num, u64 num_blocks, u8 *
|
||||
return false;
|
||||
memcpy(out_ptr + i * m_blocksize, data, m_blocksize);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
IBlobReader* CreateBlobReader(const char* filename)
|
||||
IBlobReader* CreateBlobReader(const std::string& filename)
|
||||
{
|
||||
if (cdio_is_cdrom(std::string(filename)))
|
||||
if (cdio_is_cdrom(filename))
|
||||
return DriveReader::Create(filename);
|
||||
|
||||
if (!File::Exists(filename))
|
||||
|
@ -14,6 +14,7 @@
|
||||
// detect whether the file is a compressed blob, or just a big hunk of data, or a drive, and
|
||||
// automatically do the right thing.
|
||||
|
||||
#include <string>
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
namespace DiscIO
|
||||
@ -63,13 +64,13 @@ public:
|
||||
};
|
||||
|
||||
// Factory function - examines the path to choose the right type of IBlobReader, and returns one.
|
||||
IBlobReader* CreateBlobReader(const char *filename);
|
||||
IBlobReader* CreateBlobReader(const std::string& filename);
|
||||
|
||||
typedef void (*CompressCB)(const char *text, float percent, void* arg);
|
||||
|
||||
bool CompressFileToBlob(const char *infile, const char *outfile, u32 sub_type = 0, int sector_size = 16384,
|
||||
bool CompressFileToBlob(const std::string& infile, const std::string& outfile, u32 sub_type = 0, int sector_size = 16384,
|
||||
CompressCB callback = nullptr, void *arg = nullptr);
|
||||
bool DecompressBlobToFile(const char *infile, const char *outfile,
|
||||
bool DecompressBlobToFile(const std::string& infile, const std::string& outfile,
|
||||
CompressCB callback = nullptr, void *arg = nullptr);
|
||||
|
||||
} // namespace
|
||||
|
@ -29,7 +29,7 @@ CISOFileReader::CISOFileReader(std::FILE* file)
|
||||
m_ciso_map[idx] = (1 == header.map[idx]) ? count++ : UNUSED_BLOCK_ID;
|
||||
}
|
||||
|
||||
CISOFileReader* CISOFileReader::Create(const char* filename)
|
||||
CISOFileReader* CISOFileReader::Create(const std::string& filename)
|
||||
{
|
||||
if (IsCISOBlob(filename))
|
||||
{
|
||||
@ -37,7 +37,9 @@ CISOFileReader* CISOFileReader::Create(const char* filename)
|
||||
return new CISOFileReader(f.ReleaseHandle());
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
u64 CISOFileReader::GetDataSize() const
|
||||
@ -79,7 +81,7 @@ bool CISOFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsCISOBlob(const char* filename)
|
||||
bool IsCISOBlob(const std::string& filename)
|
||||
{
|
||||
File::IOFile f(filename, "rb");
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
@ -13,7 +14,7 @@
|
||||
namespace DiscIO
|
||||
{
|
||||
|
||||
bool IsCISOBlob(const char* filename);
|
||||
bool IsCISOBlob(const std::string& filename);
|
||||
|
||||
static const u32 CISO_HEADER_SIZE = 0x8000;
|
||||
static const u32 CISO_MAP_SIZE = CISO_HEADER_SIZE - sizeof(u32) - sizeof(char) * 4;
|
||||
@ -33,7 +34,7 @@ struct CISOHeader
|
||||
class CISOFileReader : public IBlobReader
|
||||
{
|
||||
public:
|
||||
static CISOFileReader* Create(const char* filename);
|
||||
static CISOFileReader* Create(const std::string& filename);
|
||||
|
||||
u64 GetDataSize() const override;
|
||||
u64 GetRawSize() const override;
|
||||
|
@ -25,7 +25,7 @@
|
||||
namespace DiscIO
|
||||
{
|
||||
|
||||
CompressedBlobReader::CompressedBlobReader(const char *filename) : file_name(filename)
|
||||
CompressedBlobReader::CompressedBlobReader(const std::string& filename) : file_name(filename)
|
||||
{
|
||||
m_file.Open(filename, "rb");
|
||||
file_size = File::GetSize(filename);
|
||||
@ -50,7 +50,7 @@ CompressedBlobReader::CompressedBlobReader(const char *filename) : file_name(fil
|
||||
memset(zlib_buffer, 0, zlib_buffer_size);
|
||||
}
|
||||
|
||||
CompressedBlobReader* CompressedBlobReader::Create(const char* filename)
|
||||
CompressedBlobReader* CompressedBlobReader::Create(const std::string& filename)
|
||||
{
|
||||
if (IsCompressedBlob(filename))
|
||||
return new CompressedBlobReader(filename);
|
||||
@ -107,7 +107,7 @@ void CompressedBlobReader::GetBlock(u64 block_num, u8 *out_ptr)
|
||||
PanicAlert("Hash of block %" PRIu64 " is %08x instead of %08x.\n"
|
||||
"Your ISO, %s, is corrupt.",
|
||||
block_num, block_hash, hashes[block_num],
|
||||
file_name.c_str());
|
||||
file_name.c_str());
|
||||
|
||||
if (uncompressed)
|
||||
{
|
||||
@ -140,14 +140,14 @@ void CompressedBlobReader::GetBlock(u64 block_num, u8 *out_ptr)
|
||||
}
|
||||
}
|
||||
|
||||
bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type,
|
||||
bool CompressFileToBlob(const std::string& infile, const std::string& outfile, u32 sub_type,
|
||||
int block_size, CompressCB callback, void* arg)
|
||||
{
|
||||
bool scrubbing = false;
|
||||
|
||||
if (IsCompressedBlob(infile))
|
||||
{
|
||||
PanicAlertT("%s is already compressed! Cannot compress it further.", infile);
|
||||
PanicAlertT("%s is already compressed! Cannot compress it further.", infile.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type,
|
||||
{
|
||||
if (!DiscScrubber::SetupScrub(infile, block_size))
|
||||
{
|
||||
PanicAlertT("%s failed to be scrubbed. Probably the image is corrupt.", infile);
|
||||
PanicAlertT("%s failed to be scrubbed. Probably the image is corrupt.", infile.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -278,7 +278,7 @@ cleanup:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DecompressBlobToFile(const char* infile, const char* outfile, CompressCB callback, void* arg)
|
||||
bool DecompressBlobToFile(const std::string& infile, const std::string& outfile, CompressCB callback, void* arg)
|
||||
{
|
||||
if (!IsCompressedBlob(infile))
|
||||
{
|
||||
@ -320,7 +320,7 @@ bool DecompressBlobToFile(const char* infile, const char* outfile, CompressCB ca
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsCompressedBlob(const char* filename)
|
||||
bool IsCompressedBlob(const std::string& filename)
|
||||
{
|
||||
File::IOFile f(filename, "rb");
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
namespace DiscIO
|
||||
{
|
||||
|
||||
bool IsCompressedBlob(const char* filename);
|
||||
bool IsCompressedBlob(const std::string& filename);
|
||||
|
||||
const u32 kBlobCookie = 0xB10BC001;
|
||||
|
||||
@ -46,23 +46,23 @@ struct CompressedBlobHeader // 32 bytes
|
||||
class CompressedBlobReader : public SectorReader
|
||||
{
|
||||
public:
|
||||
static CompressedBlobReader* Create(const char *filename);
|
||||
static CompressedBlobReader* Create(const std::string& filename);
|
||||
~CompressedBlobReader();
|
||||
const CompressedBlobHeader &GetHeader() const { return header; }
|
||||
u64 GetDataSize() const override { return header.data_size; }
|
||||
u64 GetRawSize() const override { return file_size; }
|
||||
u64 GetBlockCompressedSize(u64 block_num) const;
|
||||
void GetBlock(u64 block_num, u8 *out_ptr) override;
|
||||
void GetBlock(u64 block_num, u8* out_ptr) override;
|
||||
private:
|
||||
CompressedBlobReader(const char *filename);
|
||||
CompressedBlobReader(const std::string& filename);
|
||||
|
||||
CompressedBlobHeader header;
|
||||
u64 *block_pointers;
|
||||
u32 *hashes;
|
||||
u64* block_pointers;
|
||||
u32* hashes;
|
||||
int data_offset;
|
||||
File::IOFile m_file;
|
||||
u64 file_size;
|
||||
u8 *zlib_buffer;
|
||||
u8* zlib_buffer;
|
||||
int zlib_buffer_size;
|
||||
std::string file_name;
|
||||
};
|
||||
|
@ -81,10 +81,10 @@ bool ParsePartitionData(SPartition& _rPartition);
|
||||
u32 GetDOLSize(u64 _DOLOffset);
|
||||
|
||||
|
||||
bool SetupScrub(const char* filename, int block_size)
|
||||
bool SetupScrub(const std::string& filename, int block_size)
|
||||
{
|
||||
bool success = true;
|
||||
m_Filename = std::string(filename);
|
||||
m_Filename = filename;
|
||||
m_BlockSize = block_size;
|
||||
|
||||
if (CLUSTER_SIZE % m_BlockSize != 0)
|
||||
@ -102,7 +102,7 @@ bool SetupScrub(const char* filename, int block_size)
|
||||
|
||||
// Warn if not DVD5 or DVD9 size
|
||||
if (numClusters != 0x23048 && numClusters != 0x46090)
|
||||
WARN_LOG(DISCIO, "%s is not a standard sized Wii disc! (%x blocks)", filename, numClusters);
|
||||
WARN_LOG(DISCIO, "%s is not a standard sized Wii disc! (%x blocks)", filename.c_str(), numClusters);
|
||||
|
||||
// Table of free blocks
|
||||
m_FreeTable = new u8[numClusters];
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
namespace File { class IOFile; }
|
||||
@ -23,7 +24,7 @@ namespace DiscIO
|
||||
namespace DiscScrubber
|
||||
{
|
||||
|
||||
bool SetupScrub(const char* filename, int block_size);
|
||||
bool SetupScrub(const std::string& filename, int block_size);
|
||||
void GetNextBlock(File::IOFile& in, u8* buffer);
|
||||
void Cleanup();
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/FileUtil.h"
|
||||
@ -17,7 +18,7 @@
|
||||
namespace DiscIO
|
||||
{
|
||||
|
||||
DriveReader::DriveReader(const char *drive)
|
||||
DriveReader::DriveReader(const std::string& drive)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
SectorReader::SetSectorSize(2048);
|
||||
@ -56,8 +57,10 @@ DriveReader::DriveReader(const char *drive)
|
||||
#endif
|
||||
}
|
||||
else
|
||||
NOTICE_LOG(DISCIO, "Load from DVD backup failed or no disc in drive %s", drive);
|
||||
} // DriveReader::DriveReader
|
||||
{
|
||||
NOTICE_LOG(DISCIO, "Load from DVD backup failed or no disc in drive %s", drive.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
DriveReader::~DriveReader()
|
||||
{
|
||||
@ -79,18 +82,20 @@ DriveReader::~DriveReader()
|
||||
#endif
|
||||
}
|
||||
|
||||
DriveReader *DriveReader::Create(const char *drive)
|
||||
DriveReader* DriveReader::Create(const std::string& drive)
|
||||
{
|
||||
DriveReader *reader = new DriveReader(drive);
|
||||
DriveReader* reader = new DriveReader(drive);
|
||||
|
||||
if (!reader->IsOK())
|
||||
{
|
||||
delete reader;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return reader;
|
||||
}
|
||||
|
||||
void DriveReader::GetBlock(u64 block_num, u8 *out_ptr)
|
||||
void DriveReader::GetBlock(u64 block_num, u8* out_ptr)
|
||||
{
|
||||
u8* const lpSector = new u8[m_blocksize];
|
||||
#ifdef _WIN32
|
||||
@ -109,7 +114,7 @@ void DriveReader::GetBlock(u64 block_num, u8 *out_ptr)
|
||||
delete[] lpSector;
|
||||
}
|
||||
|
||||
bool DriveReader::ReadMultipleAlignedBlocks(u64 block_num, u64 num_blocks, u8 *out_ptr)
|
||||
bool DriveReader::ReadMultipleAlignedBlocks(u64 block_num, u64 num_blocks, u8* out_ptr)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
u32 NotUsed;
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "DiscIO/Blob.h"
|
||||
@ -19,7 +21,7 @@ namespace DiscIO
|
||||
class DriveReader : public SectorReader
|
||||
{
|
||||
private:
|
||||
DriveReader(const char *drive);
|
||||
DriveReader(const std::string& drive);
|
||||
void GetBlock(u64 block_num, u8 *out_ptr) override;
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -33,7 +35,7 @@ private:
|
||||
s64 size;
|
||||
|
||||
public:
|
||||
static DriveReader *Create(const char *drive);
|
||||
static DriveReader* Create(const std::string& drive);
|
||||
~DriveReader();
|
||||
u64 GetDataSize() const override { return size; }
|
||||
u64 GetRawSize() const override { return size; }
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <string>
|
||||
#include "DiscIO/FileBlob.h"
|
||||
|
||||
namespace DiscIO
|
||||
@ -13,7 +14,7 @@ PlainFileReader::PlainFileReader(std::FILE* file)
|
||||
m_size = m_file.GetSize();
|
||||
}
|
||||
|
||||
PlainFileReader* PlainFileReader::Create(const char* filename)
|
||||
PlainFileReader* PlainFileReader::Create(const std::string& filename)
|
||||
{
|
||||
File::IOFile f(filename, "rb");
|
||||
if (f)
|
||||
|
@ -5,6 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
@ -21,7 +22,7 @@ class PlainFileReader : public IBlobReader
|
||||
s64 m_size;
|
||||
|
||||
public:
|
||||
static PlainFileReader* Create(const char* filename);
|
||||
static PlainFileReader* Create(const std::string& filename);
|
||||
|
||||
u64 GetDataSize() const override { return m_size; }
|
||||
u64 GetRawSize() const override { return m_size; }
|
||||
|
@ -33,7 +33,7 @@ CFileSystemGCWii::~CFileSystemGCWii()
|
||||
m_FileInfoVector.clear();
|
||||
}
|
||||
|
||||
u64 CFileSystemGCWii::GetFileSize(const char* _rFullPath)
|
||||
u64 CFileSystemGCWii::GetFileSize(const std::string& _rFullPath)
|
||||
{
|
||||
if (!m_Initialized)
|
||||
InitFileSystem();
|
||||
@ -63,7 +63,7 @@ const char* CFileSystemGCWii::GetFileName(u64 _Address)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
u64 CFileSystemGCWii::ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize)
|
||||
u64 CFileSystemGCWii::ReadFile(const std::string& _rFullPath, u8* _pBuffer, size_t _MaxBufferSize)
|
||||
{
|
||||
if (!m_Initialized)
|
||||
InitFileSystem();
|
||||
@ -75,14 +75,14 @@ u64 CFileSystemGCWii::ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _Max
|
||||
if (pFileInfo->m_FileSize > _MaxBufferSize)
|
||||
return 0;
|
||||
|
||||
DEBUG_LOG(DISCIO, "Filename: %s. Offset: %" PRIx64 ". Size: %" PRIx64, _rFullPath,
|
||||
DEBUG_LOG(DISCIO, "Filename: %s. Offset: %" PRIx64 ". Size: %" PRIx64, _rFullPath.c_str(),
|
||||
pFileInfo->m_Offset, pFileInfo->m_FileSize);
|
||||
|
||||
m_rVolume->Read(pFileInfo->m_Offset, pFileInfo->m_FileSize, _pBuffer);
|
||||
return pFileInfo->m_FileSize;
|
||||
}
|
||||
|
||||
bool CFileSystemGCWii::ExportFile(const char* _rFullPath, const char* _rExportFilename)
|
||||
bool CFileSystemGCWii::ExportFile(const std::string& _rFullPath, const std::string& _rExportFilename)
|
||||
{
|
||||
if (!m_Initialized)
|
||||
InitFileSystem();
|
||||
@ -122,7 +122,7 @@ bool CFileSystemGCWii::ExportFile(const char* _rFullPath, const char* _rExportFi
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CFileSystemGCWii::ExportApploader(const char* _rExportFolder) const
|
||||
bool CFileSystemGCWii::ExportApploader(const std::string& _rExportFolder) const
|
||||
{
|
||||
u32 AppSize = Read32(0x2440 + 0x14);// apploader size
|
||||
AppSize += Read32(0x2440 + 0x18); // + trailer size
|
||||
@ -177,7 +177,7 @@ bool CFileSystemGCWii::GetBootDOL(u8* &buffer, u32 DolSize) const
|
||||
return m_rVolume->Read(DolOffset, DolSize, buffer);
|
||||
}
|
||||
|
||||
bool CFileSystemGCWii::ExportDOL(const char* _rExportFolder) const
|
||||
bool CFileSystemGCWii::ExportDOL(const std::string& _rExportFolder) const
|
||||
{
|
||||
u32 DolOffset = Read32(0x420) << m_OffsetShift;
|
||||
u32 DolSize = GetBootDOLSize();
|
||||
@ -232,14 +232,14 @@ size_t CFileSystemGCWii::GetFileList(std::vector<const SFileInfo *> &_rFilenames
|
||||
return m_FileInfoVector.size();
|
||||
}
|
||||
|
||||
const SFileInfo* CFileSystemGCWii::FindFileInfo(const char* _rFullPath)
|
||||
const SFileInfo* CFileSystemGCWii::FindFileInfo(const std::string& _rFullPath)
|
||||
{
|
||||
if (!m_Initialized)
|
||||
InitFileSystem();
|
||||
|
||||
for (auto& fileInfo : m_FileInfoVector)
|
||||
{
|
||||
if (!strcasecmp(fileInfo.m_FullPath, _rFullPath))
|
||||
if (!strcasecmp(fileInfo.m_FullPath, _rFullPath.c_str()))
|
||||
return &fileInfo;
|
||||
}
|
||||
|
||||
|
@ -22,13 +22,13 @@ public:
|
||||
CFileSystemGCWii(const IVolume* _rVolume);
|
||||
virtual ~CFileSystemGCWii();
|
||||
virtual bool IsValid() const override { return m_Valid; }
|
||||
virtual u64 GetFileSize(const char* _rFullPath) override;
|
||||
virtual u64 GetFileSize(const std::string& _rFullPath) override;
|
||||
virtual size_t GetFileList(std::vector<const SFileInfo *> &_rFilenames) override;
|
||||
virtual const char* GetFileName(u64 _Address) override;
|
||||
virtual u64 ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) override;
|
||||
virtual bool ExportFile(const char* _rFullPath, const char* _rExportFilename) override;
|
||||
virtual bool ExportApploader(const char* _rExportFolder) const override;
|
||||
virtual bool ExportDOL(const char* _rExportFolder) const override;
|
||||
virtual u64 ReadFile(const std::string& _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) override;
|
||||
virtual bool ExportFile(const std::string& _rFullPath, const std::string&_rExportFilename) override;
|
||||
virtual bool ExportApploader(const std::string& _rExportFolder) const override;
|
||||
virtual bool ExportDOL(const std::string& _rExportFolder) const override;
|
||||
virtual bool GetBootDOL(u8* &buffer, u32 DolSize) const override;
|
||||
virtual u32 GetBootDOLSize() const override;
|
||||
|
||||
@ -40,7 +40,7 @@ private:
|
||||
std::vector <SFileInfo> m_FileInfoVector;
|
||||
u32 Read32(u64 _Offset) const;
|
||||
std::string GetStringFromOffset(u64 _Offset) const;
|
||||
const SFileInfo* FindFileInfo(const char* _rFullPath);
|
||||
const SFileInfo* FindFileInfo(const std::string& _rFullPath);
|
||||
bool DetectFileSystem();
|
||||
void InitFileSystem();
|
||||
size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const char* _szDirectory, u64 _NameTableOffset);
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
@ -43,11 +44,11 @@ public:
|
||||
virtual ~IFileSystem();
|
||||
virtual bool IsValid() const = 0;
|
||||
virtual size_t GetFileList(std::vector<const SFileInfo *> &_rFilenames) = 0;
|
||||
virtual u64 GetFileSize(const char* _rFullPath) = 0;
|
||||
virtual u64 ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) = 0;
|
||||
virtual bool ExportFile(const char* _rFullPath, const char* _rExportFilename) = 0;
|
||||
virtual bool ExportApploader(const char* _rExportFolder) const = 0;
|
||||
virtual bool ExportDOL(const char* _rExportFolder) const = 0;
|
||||
virtual u64 GetFileSize(const std::string& _rFullPath) = 0;
|
||||
virtual u64 ReadFile(const std::string& _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) = 0;
|
||||
virtual bool ExportFile(const std::string& _rFullPath, const std::string& _rExportFilename) = 0;
|
||||
virtual bool ExportApploader(const std::string& _rExportFolder) const = 0;
|
||||
virtual bool ExportDOL(const std::string& _rExportFolder) const = 0;
|
||||
virtual const char* GetFileName(u64 _Address) = 0;
|
||||
virtual bool GetBootDOL(u8* &buffer, u32 DolSize) const = 0;
|
||||
virtual u32 GetBootDOLSize() const = 0;
|
||||
|
@ -74,7 +74,7 @@ EDiscType GetDiscType(IBlobReader& _rReader);
|
||||
|
||||
IVolume* CreateVolumeFromFilename(const std::string& _rFilename, u32 _PartitionGroup, u32 _VolumeNum)
|
||||
{
|
||||
IBlobReader* pReader = CreateBlobReader(_rFilename.c_str());
|
||||
IBlobReader* pReader = CreateBlobReader(_rFilename);
|
||||
if (pReader == nullptr)
|
||||
return nullptr;
|
||||
|
||||
|
@ -133,7 +133,7 @@ bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
|
||||
_dbg_assert_(DVDINTERFACE, fileIter->first <= _Offset);
|
||||
u64 fileOffset = _Offset - fileIter->first;
|
||||
|
||||
PlainFileReader* reader = PlainFileReader::Create(fileIter->second.c_str());
|
||||
PlainFileReader* reader = PlainFileReader::Create(fileIter->second);
|
||||
if (reader == nullptr)
|
||||
return false;
|
||||
|
||||
@ -326,12 +326,12 @@ bool CVolumeDirectory::SetApploader(const std::string& _rApploader)
|
||||
}
|
||||
}
|
||||
|
||||
void CVolumeDirectory::SetDOL(const std::string& _rDOL)
|
||||
void CVolumeDirectory::SetDOL(const std::string& rDOL)
|
||||
{
|
||||
if (!_rDOL.empty())
|
||||
if (!rDOL.empty())
|
||||
{
|
||||
std::string data;
|
||||
File::ReadFileToString(_rDOL.c_str(), data);
|
||||
File::ReadFileToString(rDOL, data);
|
||||
m_DOLSize = data.size();
|
||||
m_DOL = new u8[m_DOLSize];
|
||||
copy(data.begin(), data.end(), m_DOL);
|
||||
|
@ -23,10 +23,10 @@ static inline u64 align(u64 value, u64 bounds)
|
||||
return (value + (bounds - 1)) & (~(bounds - 1));
|
||||
}
|
||||
|
||||
WbfsFileReader::WbfsFileReader(const char* filename)
|
||||
WbfsFileReader::WbfsFileReader(const std::string& filename)
|
||||
: m_total_files(0), m_size(0), m_wlba_table(nullptr), m_good(true)
|
||||
{
|
||||
if (!filename || (strlen(filename) < 4) || !OpenFiles(filename) || !ReadHeader())
|
||||
if (filename.length() < 4 || !OpenFiles(filename) || !ReadHeader())
|
||||
{
|
||||
m_good = false;
|
||||
return;
|
||||
@ -48,7 +48,7 @@ WbfsFileReader::~WbfsFileReader()
|
||||
delete[] m_wlba_table;
|
||||
}
|
||||
|
||||
bool WbfsFileReader::OpenFiles(const char* filename)
|
||||
bool WbfsFileReader::OpenFiles(const std::string& filename)
|
||||
{
|
||||
m_total_files = 0;
|
||||
|
||||
@ -171,7 +171,7 @@ File::IOFile& WbfsFileReader::SeekToCluster(u64 offset, u64* available)
|
||||
return m_files[0]->file;
|
||||
}
|
||||
|
||||
WbfsFileReader* WbfsFileReader::Create(const char* filename)
|
||||
WbfsFileReader* WbfsFileReader::Create(const std::string& filename)
|
||||
{
|
||||
WbfsFileReader* reader = new WbfsFileReader(filename);
|
||||
|
||||
@ -186,7 +186,7 @@ WbfsFileReader* WbfsFileReader::Create(const char* filename)
|
||||
}
|
||||
}
|
||||
|
||||
bool IsWbfsBlob(const char* filename)
|
||||
bool IsWbfsBlob(const std::string& filename)
|
||||
{
|
||||
File::IOFile f(filename, "rb");
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
@ -15,10 +16,10 @@ namespace DiscIO
|
||||
|
||||
class WbfsFileReader : public IBlobReader
|
||||
{
|
||||
WbfsFileReader(const char* filename);
|
||||
WbfsFileReader(const std::string& filename);
|
||||
~WbfsFileReader();
|
||||
|
||||
bool OpenFiles(const char* filename);
|
||||
bool OpenFiles(const std::string& filename);
|
||||
bool ReadHeader();
|
||||
|
||||
File::IOFile& SeekToCluster(u64 offset, u64* available);
|
||||
@ -54,14 +55,14 @@ class WbfsFileReader : public IBlobReader
|
||||
bool m_good;
|
||||
|
||||
public:
|
||||
static WbfsFileReader* Create(const char* filename);
|
||||
static WbfsFileReader* Create(const std::string& filename);
|
||||
|
||||
u64 GetDataSize() const override { return m_size; }
|
||||
u64 GetRawSize() const override { return m_size; }
|
||||
bool Read(u64 offset, u64 nbytes, u8* out_ptr) override;
|
||||
};
|
||||
|
||||
bool IsWbfsBlob(const char* filename);
|
||||
bool IsWbfsBlob(const std::string& filename);
|
||||
|
||||
|
||||
} // namespace
|
||||
|
@ -34,7 +34,7 @@ private:
|
||||
|
||||
WiiWAD::WiiWAD(const std::string& _rName)
|
||||
{
|
||||
DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rName.c_str());
|
||||
DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rName);
|
||||
if (pReader == nullptr || File::IsDirectory(_rName))
|
||||
{
|
||||
m_Valid = false;
|
||||
@ -120,7 +120,7 @@ bool WiiWAD::ParseWAD(DiscIO::IBlobReader& _rReader)
|
||||
|
||||
bool WiiWAD::IsWiiWAD(const std::string& _rName)
|
||||
{
|
||||
DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rName.c_str());
|
||||
DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rName);
|
||||
if (pReader == nullptr)
|
||||
return false;
|
||||
|
||||
|
Reference in New Issue
Block a user