mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-03 06:39:33 +00: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:
parent
1113b131f2
commit
b2af07a7b7
64 changed files with 394 additions and 398 deletions
|
@ -192,7 +192,7 @@ static inline u32 GetPixel(u32* buffer, unsigned int x, unsigned int y)
|
||||||
|
|
||||||
static bool LoadBanner(std::string filename, u32* Banner)
|
static bool LoadBanner(std::string filename, u32* Banner)
|
||||||
{
|
{
|
||||||
std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(filename));
|
std::unique_ptr<DiscIO::Volume> pVolume(DiscIO::CreateVolumeFromFilename(filename));
|
||||||
|
|
||||||
if (pVolume != nullptr)
|
if (pVolume != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -230,7 +230,7 @@ static bool LoadBanner(std::string filename, u32* Banner)
|
||||||
|
|
||||||
static int GetCountry(std::string filename)
|
static int GetCountry(std::string filename)
|
||||||
{
|
{
|
||||||
std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(filename));
|
std::unique_ptr<DiscIO::Volume> pVolume(DiscIO::CreateVolumeFromFilename(filename));
|
||||||
|
|
||||||
if (pVolume != nullptr)
|
if (pVolume != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -246,7 +246,7 @@ static int GetCountry(std::string filename)
|
||||||
|
|
||||||
static int GetPlatform(std::string filename)
|
static int GetPlatform(std::string filename)
|
||||||
{
|
{
|
||||||
std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(filename));
|
std::unique_ptr<DiscIO::Volume> pVolume(DiscIO::CreateVolumeFromFilename(filename));
|
||||||
|
|
||||||
if (pVolume != nullptr)
|
if (pVolume != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -272,7 +272,7 @@ static std::string GetTitle(std::string filename)
|
||||||
__android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Title for file: %s",
|
__android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Title for file: %s",
|
||||||
filename.c_str());
|
filename.c_str());
|
||||||
|
|
||||||
std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(filename));
|
std::unique_ptr<DiscIO::Volume> pVolume(DiscIO::CreateVolumeFromFilename(filename));
|
||||||
|
|
||||||
if (pVolume != nullptr)
|
if (pVolume != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -315,7 +315,7 @@ static std::string GetDescription(std::string filename)
|
||||||
__android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Description for file: %s",
|
__android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Description for file: %s",
|
||||||
filename.c_str());
|
filename.c_str());
|
||||||
|
|
||||||
std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(filename));
|
std::unique_ptr<DiscIO::Volume> volume(DiscIO::CreateVolumeFromFilename(filename));
|
||||||
|
|
||||||
if (volume != nullptr)
|
if (volume != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -350,7 +350,7 @@ static std::string GetGameId(std::string filename)
|
||||||
{
|
{
|
||||||
__android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting ID for file: %s", filename.c_str());
|
__android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting ID for file: %s", filename.c_str());
|
||||||
|
|
||||||
std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(filename));
|
std::unique_ptr<DiscIO::Volume> volume(DiscIO::CreateVolumeFromFilename(filename));
|
||||||
if (volume == nullptr)
|
if (volume == nullptr)
|
||||||
return std::string();
|
return std::string();
|
||||||
|
|
||||||
|
@ -364,7 +364,7 @@ static std::string GetCompany(std::string filename)
|
||||||
__android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Company for file: %s",
|
__android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Company for file: %s",
|
||||||
filename.c_str());
|
filename.c_str());
|
||||||
|
|
||||||
std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(filename));
|
std::unique_ptr<DiscIO::Volume> volume(DiscIO::CreateVolumeFromFilename(filename));
|
||||||
if (volume == nullptr)
|
if (volume == nullptr)
|
||||||
return std::string();
|
return std::string();
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ static u64 GetFileSize(std::string filename)
|
||||||
{
|
{
|
||||||
__android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting size of file: %s", filename.c_str());
|
__android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting size of file: %s", filename.c_str());
|
||||||
|
|
||||||
std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(filename));
|
std::unique_ptr<DiscIO::Volume> volume(DiscIO::CreateVolumeFromFilename(filename));
|
||||||
if (volume == nullptr)
|
if (volume == nullptr)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ std::string MD5Sum(const std::string& file_path, std::function<bool(int)> report
|
||||||
u64 read_offset = 0;
|
u64 read_offset = 0;
|
||||||
mbedtls_md5_context ctx;
|
mbedtls_md5_context ctx;
|
||||||
|
|
||||||
std::unique_ptr<DiscIO::IBlobReader> file(DiscIO::CreateBlobReader(file_path));
|
std::unique_ptr<DiscIO::BlobReader> file(DiscIO::CreateBlobReader(file_path));
|
||||||
u64 game_size = file->GetDataSize();
|
u64 game_size = file->GetDataSize();
|
||||||
|
|
||||||
mbedtls_md5_starts(&ctx);
|
mbedtls_md5_starts(&ctx);
|
||||||
|
|
|
@ -42,14 +42,14 @@
|
||||||
// Inserts a disc into the emulated disc drive and returns a pointer to it.
|
// Inserts a disc into the emulated disc drive and returns a pointer to it.
|
||||||
// The returned pointer must only be used while we are still booting,
|
// The returned pointer must only be used while we are still booting,
|
||||||
// because DVDThread can do whatever it wants to the disc after that.
|
// because DVDThread can do whatever it wants to the disc after that.
|
||||||
static const DiscIO::IVolume* SetDisc(std::unique_ptr<DiscIO::IVolume> volume)
|
static const DiscIO::Volume* SetDisc(std::unique_ptr<DiscIO::Volume> volume)
|
||||||
{
|
{
|
||||||
const DiscIO::IVolume* pointer = volume.get();
|
const DiscIO::Volume* pointer = volume.get();
|
||||||
DVDInterface::SetDisc(std::move(volume));
|
DVDInterface::SetDisc(std::move(volume));
|
||||||
return pointer;
|
return pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CBoot::DVDRead(const DiscIO::IVolume& volume, u64 dvd_offset, u32 output_address, u32 length,
|
bool CBoot::DVDRead(const DiscIO::Volume& volume, u64 dvd_offset, u32 output_address, u32 length,
|
||||||
const DiscIO::Partition& partition)
|
const DiscIO::Partition& partition)
|
||||||
{
|
{
|
||||||
std::vector<u8> buffer(length);
|
std::vector<u8> buffer(length);
|
||||||
|
@ -59,7 +59,7 @@ bool CBoot::DVDRead(const DiscIO::IVolume& volume, u64 dvd_offset, u32 output_ad
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBoot::Load_FST(bool is_wii, const DiscIO::IVolume* volume)
|
void CBoot::Load_FST(bool is_wii, const DiscIO::Volume* volume)
|
||||||
{
|
{
|
||||||
if (!volume)
|
if (!volume)
|
||||||
return;
|
return;
|
||||||
|
@ -113,8 +113,8 @@ bool CBoot::FindMapFile(std::string* existing_map_file, std::string* writable_ma
|
||||||
{
|
{
|
||||||
case SConfig::BOOT_WII_NAND:
|
case SConfig::BOOT_WII_NAND:
|
||||||
{
|
{
|
||||||
const DiscIO::CNANDContentLoader& Loader =
|
const DiscIO::NANDContentLoader& Loader =
|
||||||
DiscIO::CNANDContentManager::Access().GetNANDLoader(_StartupPara.m_strFilename);
|
DiscIO::NANDContentManager::Access().GetNANDLoader(_StartupPara.m_strFilename);
|
||||||
if (Loader.IsValid())
|
if (Loader.IsValid())
|
||||||
{
|
{
|
||||||
u64 TitleID = Loader.GetTMD().GetTitleId();
|
u64 TitleID = Loader.GetTMD().GetTitleId();
|
||||||
|
@ -290,7 +290,7 @@ bool CBoot::BootUp()
|
||||||
{
|
{
|
||||||
case SConfig::BOOT_ISO:
|
case SConfig::BOOT_ISO:
|
||||||
{
|
{
|
||||||
const DiscIO::IVolume* volume =
|
const DiscIO::Volume* volume =
|
||||||
SetDisc(DiscIO::CreateVolumeFromFilename(_StartupPara.m_strFilename));
|
SetDisc(DiscIO::CreateVolumeFromFilename(_StartupPara.m_strFilename));
|
||||||
|
|
||||||
if (!volume)
|
if (!volume)
|
||||||
|
@ -343,7 +343,7 @@ bool CBoot::BootUp()
|
||||||
PanicAlertT("Warning - starting DOL in wrong console mode!");
|
PanicAlertT("Warning - starting DOL in wrong console mode!");
|
||||||
}
|
}
|
||||||
|
|
||||||
const DiscIO::IVolume* volume = nullptr;
|
const DiscIO::Volume* volume = nullptr;
|
||||||
if (!_StartupPara.m_strDVDRoot.empty())
|
if (!_StartupPara.m_strDVDRoot.empty())
|
||||||
{
|
{
|
||||||
NOTICE_LOG(BOOT, "Setting DVDRoot %s", _StartupPara.m_strDVDRoot.c_str());
|
NOTICE_LOG(BOOT, "Setting DVDRoot %s", _StartupPara.m_strDVDRoot.c_str());
|
||||||
|
@ -385,7 +385,7 @@ bool CBoot::BootUp()
|
||||||
|
|
||||||
case SConfig::BOOT_ELF:
|
case SConfig::BOOT_ELF:
|
||||||
{
|
{
|
||||||
const DiscIO::IVolume* volume = nullptr;
|
const DiscIO::Volume* volume = nullptr;
|
||||||
|
|
||||||
// load image or create virtual drive from directory
|
// load image or create virtual drive from directory
|
||||||
if (!_StartupPara.m_strDVDRoot.empty())
|
if (!_StartupPara.m_strDVDRoot.empty())
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
class IVolume;
|
class Volume;
|
||||||
struct Partition;
|
struct Partition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public:
|
||||||
static bool LoadMapFromFilename();
|
static bool LoadMapFromFilename();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool DVDRead(const DiscIO::IVolume& volume, u64 dvd_offset, u32 output_address, u32 length,
|
static bool DVDRead(const DiscIO::Volume& volume, u64 dvd_offset, u32 output_address, u32 length,
|
||||||
const DiscIO::Partition& partition);
|
const DiscIO::Partition& partition);
|
||||||
static void RunFunction(u32 address);
|
static void RunFunction(u32 address);
|
||||||
|
|
||||||
|
@ -57,12 +57,12 @@ private:
|
||||||
|
|
||||||
static void SetupMSR();
|
static void SetupMSR();
|
||||||
static void SetupBAT(bool is_wii);
|
static void SetupBAT(bool is_wii);
|
||||||
static bool RunApploader(bool is_wii, const DiscIO::IVolume& volume);
|
static bool RunApploader(bool is_wii, const DiscIO::Volume& volume);
|
||||||
static bool EmulatedBS2_GC(const DiscIO::IVolume* volume, bool skip_app_loader = false);
|
static bool EmulatedBS2_GC(const DiscIO::Volume* volume, bool skip_app_loader = false);
|
||||||
static bool EmulatedBS2_Wii(const DiscIO::IVolume* volume);
|
static bool EmulatedBS2_Wii(const DiscIO::Volume* volume);
|
||||||
static bool EmulatedBS2(bool is_wii, const DiscIO::IVolume* volume);
|
static bool EmulatedBS2(bool is_wii, const DiscIO::Volume* volume);
|
||||||
static bool Load_BS2(const std::string& boot_rom_filename);
|
static bool Load_BS2(const std::string& boot_rom_filename);
|
||||||
static void Load_FST(bool is_wii, const DiscIO::IVolume* volume);
|
static void Load_FST(bool is_wii, const DiscIO::Volume* volume);
|
||||||
|
|
||||||
static bool SetupWiiMemory(const DiscIO::IVolume* volume, u64 ios_title_id);
|
static bool SetupWiiMemory(const DiscIO::Volume* volume, u64 ios_title_id);
|
||||||
};
|
};
|
||||||
|
|
|
@ -82,7 +82,7 @@ void CBoot::SetupBAT(bool is_wii)
|
||||||
PowerPC::IBATUpdated();
|
PowerPC::IBATUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CBoot::RunApploader(bool is_wii, const DiscIO::IVolume& volume)
|
bool CBoot::RunApploader(bool is_wii, const DiscIO::Volume& volume)
|
||||||
{
|
{
|
||||||
const DiscIO::Partition partition = volume.GetGamePartition();
|
const DiscIO::Partition partition = volume.GetGamePartition();
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ bool CBoot::RunApploader(bool is_wii, const DiscIO::IVolume& volume)
|
||||||
// GameCube Bootstrap 2 HLE:
|
// GameCube Bootstrap 2 HLE:
|
||||||
// copy the apploader to 0x81200000
|
// copy the apploader to 0x81200000
|
||||||
// execute the apploader, function by function, using the above utility.
|
// execute the apploader, function by function, using the above utility.
|
||||||
bool CBoot::EmulatedBS2_GC(const DiscIO::IVolume* volume, bool skip_app_loader)
|
bool CBoot::EmulatedBS2_GC(const DiscIO::Volume* volume, bool skip_app_loader)
|
||||||
{
|
{
|
||||||
INFO_LOG(BOOT, "Faking GC BS2...");
|
INFO_LOG(BOOT, "Faking GC BS2...");
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ bool CBoot::EmulatedBS2_GC(const DiscIO::IVolume* volume, bool skip_app_loader)
|
||||||
return RunApploader(/*is_wii*/ false, *volume);
|
return RunApploader(/*is_wii*/ false, *volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CBoot::SetupWiiMemory(const DiscIO::IVolume* volume, u64 ios_title_id)
|
bool CBoot::SetupWiiMemory(const DiscIO::Volume* volume, u64 ios_title_id)
|
||||||
{
|
{
|
||||||
static const std::map<DiscIO::Region, const RegionSetting> region_settings = {
|
static const std::map<DiscIO::Region, const RegionSetting> region_settings = {
|
||||||
{DiscIO::Region::NTSC_J, {"JPN", "NTSC", "JP", "LJ"}},
|
{DiscIO::Region::NTSC_J, {"JPN", "NTSC", "JP", "LJ"}},
|
||||||
|
@ -331,7 +331,7 @@ bool CBoot::SetupWiiMemory(const DiscIO::IVolume* volume, u64 ios_title_id)
|
||||||
// Wii Bootstrap 2 HLE:
|
// Wii Bootstrap 2 HLE:
|
||||||
// copy the apploader to 0x81200000
|
// copy the apploader to 0x81200000
|
||||||
// execute the apploader
|
// execute the apploader
|
||||||
bool CBoot::EmulatedBS2_Wii(const DiscIO::IVolume* volume)
|
bool CBoot::EmulatedBS2_Wii(const DiscIO::Volume* volume)
|
||||||
{
|
{
|
||||||
INFO_LOG(BOOT, "Faking Wii BS2...");
|
INFO_LOG(BOOT, "Faking Wii BS2...");
|
||||||
if (!volume)
|
if (!volume)
|
||||||
|
@ -374,7 +374,7 @@ bool CBoot::EmulatedBS2_Wii(const DiscIO::IVolume* volume)
|
||||||
// Returns true if apploader has run successfully.
|
// Returns true if apploader has run successfully.
|
||||||
// If is_wii is true and volume is not nullptr, the disc that volume
|
// If is_wii is true and volume is not nullptr, the disc that volume
|
||||||
// point to must currently be inserted into the emulated disc drive.
|
// point to must currently be inserted into the emulated disc drive.
|
||||||
bool CBoot::EmulatedBS2(bool is_wii, const DiscIO::IVolume* volume)
|
bool CBoot::EmulatedBS2(bool is_wii, const DiscIO::Volume* volume)
|
||||||
{
|
{
|
||||||
return is_wii ? EmulatedBS2_Wii(volume) : EmulatedBS2_GC(volume);
|
return is_wii ? EmulatedBS2_Wii(volume) : EmulatedBS2_GC(volume);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,8 +72,8 @@ bool CBoot::Boot_WiiWAD(const std::string& _pFilename)
|
||||||
state_file.WriteBytes(&state, sizeof(StateFlags));
|
state_file.WriteBytes(&state, sizeof(StateFlags));
|
||||||
}
|
}
|
||||||
|
|
||||||
const DiscIO::CNANDContentLoader& ContentLoader =
|
const DiscIO::NANDContentLoader& ContentLoader =
|
||||||
DiscIO::CNANDContentManager::Access().GetNANDLoader(_pFilename);
|
DiscIO::NANDContentManager::Access().GetNANDLoader(_pFilename);
|
||||||
if (!ContentLoader.IsValid())
|
if (!ContentLoader.IsValid())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -721,7 +721,7 @@ void SConfig::ResetRunningGameMetadata()
|
||||||
SetRunningGameMetadata("00000000", 0, 0, Core::TitleDatabase::TitleType::Other);
|
SetRunningGameMetadata("00000000", 0, 0, Core::TitleDatabase::TitleType::Other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SConfig::SetRunningGameMetadata(const DiscIO::IVolume& volume,
|
void SConfig::SetRunningGameMetadata(const DiscIO::Volume& volume,
|
||||||
const DiscIO::Partition& partition)
|
const DiscIO::Partition& partition)
|
||||||
{
|
{
|
||||||
SetRunningGameMetadata(volume.GetGameID(partition), volume.GetTitleID(partition).value_or(0),
|
SetRunningGameMetadata(volume.GetGameID(partition), volume.GetTitleID(partition).value_or(0),
|
||||||
|
@ -917,7 +917,7 @@ bool SConfig::AutoSetup(EBootBS2 _BootBS2)
|
||||||
bootDrive)
|
bootDrive)
|
||||||
{
|
{
|
||||||
m_BootType = BOOT_ISO;
|
m_BootType = BOOT_ISO;
|
||||||
std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(m_strFilename));
|
std::unique_ptr<DiscIO::Volume> pVolume(DiscIO::CreateVolumeFromFilename(m_strFilename));
|
||||||
if (pVolume == nullptr)
|
if (pVolume == nullptr)
|
||||||
{
|
{
|
||||||
if (bootDrive)
|
if (bootDrive)
|
||||||
|
@ -973,10 +973,10 @@ bool SConfig::AutoSetup(EBootBS2 _BootBS2)
|
||||||
bWii = ddfFile->GetIsWii();
|
bWii = ddfFile->GetIsWii();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (DiscIO::CNANDContentManager::Access().GetNANDLoader(m_strFilename).IsValid())
|
else if (DiscIO::NANDContentManager::Access().GetNANDLoader(m_strFilename).IsValid())
|
||||||
{
|
{
|
||||||
const DiscIO::CNANDContentLoader& content_loader =
|
const DiscIO::NANDContentLoader& content_loader =
|
||||||
DiscIO::CNANDContentManager::Access().GetNANDLoader(m_strFilename);
|
DiscIO::NANDContentManager::Access().GetNANDLoader(m_strFilename);
|
||||||
const IOS::ES::TMDReader& tmd = content_loader.GetTMD();
|
const IOS::ES::TMDReader& tmd = content_loader.GetTMD();
|
||||||
|
|
||||||
if (!IOS::ES::IsChannel(tmd.GetTitleId()))
|
if (!IOS::ES::IsChannel(tmd.GetTitleId()))
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace DiscIO
|
||||||
enum class Language;
|
enum class Language;
|
||||||
enum class Region;
|
enum class Region;
|
||||||
struct Partition;
|
struct Partition;
|
||||||
class IVolume;
|
class Volume;
|
||||||
}
|
}
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
|
@ -225,7 +225,7 @@ struct SConfig : NonCopyable
|
||||||
u64 GetTitleID() const { return m_title_id; }
|
u64 GetTitleID() const { return m_title_id; }
|
||||||
u16 GetRevision() const { return m_revision; }
|
u16 GetRevision() const { return m_revision; }
|
||||||
void ResetRunningGameMetadata();
|
void ResetRunningGameMetadata();
|
||||||
void SetRunningGameMetadata(const DiscIO::IVolume& volume, const DiscIO::Partition& partition);
|
void SetRunningGameMetadata(const DiscIO::Volume& volume, const DiscIO::Partition& partition);
|
||||||
void SetRunningGameMetadata(const IOS::ES::TMDReader& tmd);
|
void SetRunningGameMetadata(const IOS::ES::TMDReader& tmd);
|
||||||
|
|
||||||
void LoadDefaults();
|
void LoadDefaults();
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#include "DiscIO/Enums.h"
|
#include "DiscIO/Enums.h"
|
||||||
#include "DiscIO/Volume.h"
|
#include "DiscIO/Volume.h"
|
||||||
#include "DiscIO/VolumeWiiCrypted.h"
|
#include "DiscIO/VolumeWii.h"
|
||||||
|
|
||||||
// The minimum time it takes for the DVD drive to process a command (in
|
// The minimum time it takes for the DVD drive to process a command (in
|
||||||
// microseconds)
|
// microseconds)
|
||||||
|
@ -435,7 +435,7 @@ void Shutdown()
|
||||||
DVDThread::Stop();
|
DVDThread::Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDisc(std::unique_ptr<DiscIO::IVolume> disc)
|
void SetDisc(std::unique_ptr<DiscIO::Volume> disc)
|
||||||
{
|
{
|
||||||
if (disc)
|
if (disc)
|
||||||
s_current_partition = disc->GetGamePartition();
|
s_current_partition = disc->GetGamePartition();
|
||||||
|
@ -460,7 +460,7 @@ static void EjectDiscCallback(u64 userdata, s64 cyclesLate)
|
||||||
|
|
||||||
static void InsertDiscCallback(u64 userdata, s64 cyclesLate)
|
static void InsertDiscCallback(u64 userdata, s64 cyclesLate)
|
||||||
{
|
{
|
||||||
std::unique_ptr<DiscIO::IVolume> new_volume =
|
std::unique_ptr<DiscIO::Volume> new_volume =
|
||||||
DiscIO::CreateVolumeFromFilename(s_disc_path_to_insert);
|
DiscIO::CreateVolumeFromFilename(s_disc_path_to_insert);
|
||||||
|
|
||||||
if (new_volume)
|
if (new_volume)
|
||||||
|
@ -1147,7 +1147,7 @@ void ScheduleReads(u64 offset, u32 length, const DiscIO::Partition& partition, u
|
||||||
// The variable dvd_offset tracks the actual offset on the DVD
|
// The variable dvd_offset tracks the actual offset on the DVD
|
||||||
// that the disc drive starts reading at, which differs in two ways:
|
// that the disc drive starts reading at, which differs in two ways:
|
||||||
// It's rounded to a whole ECC block and never uses Wii partition addressing.
|
// It's rounded to a whole ECC block and never uses Wii partition addressing.
|
||||||
u64 dvd_offset = DiscIO::CVolumeWiiCrypted::PartitionOffsetToRawOffset(offset, partition);
|
u64 dvd_offset = DiscIO::VolumeWii::PartitionOffsetToRawOffset(offset, partition);
|
||||||
dvd_offset = Common::AlignDown(dvd_offset, DVD_ECC_BLOCK_SIZE);
|
dvd_offset = Common::AlignDown(dvd_offset, DVD_ECC_BLOCK_SIZE);
|
||||||
|
|
||||||
if (SConfig::GetInstance().bFastDiscSpeed)
|
if (SConfig::GetInstance().bFastDiscSpeed)
|
||||||
|
@ -1215,7 +1215,7 @@ void ScheduleReads(u64 offset, u32 length, const DiscIO::Partition& partition, u
|
||||||
|
|
||||||
const u32 bytes_per_chunk = partition == DiscIO::PARTITION_NONE ?
|
const u32 bytes_per_chunk = partition == DiscIO::PARTITION_NONE ?
|
||||||
DVD_ECC_BLOCK_SIZE :
|
DVD_ECC_BLOCK_SIZE :
|
||||||
DiscIO::CVolumeWiiCrypted::BLOCK_DATA_SIZE;
|
DiscIO::VolumeWii::BLOCK_DATA_SIZE;
|
||||||
|
|
||||||
while (length > 0)
|
while (length > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
class IVolume;
|
class Volume;
|
||||||
struct Partition;
|
struct Partition;
|
||||||
}
|
}
|
||||||
namespace MMIO
|
namespace MMIO
|
||||||
|
@ -110,12 +110,12 @@ void DoState(PointerWrap& p);
|
||||||
|
|
||||||
void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
|
void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
|
||||||
|
|
||||||
void SetDisc(std::unique_ptr<DiscIO::IVolume> disc);
|
void SetDisc(std::unique_ptr<DiscIO::Volume> disc);
|
||||||
bool IsDiscInside();
|
bool IsDiscInside();
|
||||||
void ChangeDiscAsHost(const std::string& new_path); // Can only be called by the host thread
|
void ChangeDiscAsHost(const std::string& new_path); // Can only be called by the host thread
|
||||||
void ChangeDiscAsCPU(const std::string& new_path); // Can only be called by the CPU thread
|
void ChangeDiscAsCPU(const std::string& new_path); // Can only be called by the CPU thread
|
||||||
|
|
||||||
// This function returns true and calls SConfig::SetRunningGameMetadata(IVolume&, Partition&)
|
// This function returns true and calls SConfig::SetRunningGameMetadata(Volume&, Partition&)
|
||||||
// if both of the following conditions are true:
|
// if both of the following conditions are true:
|
||||||
// - A disc is inserted
|
// - A disc is inserted
|
||||||
// - The title_id argument doesn't contain a value, or its value matches the disc's title ID
|
// - The title_id argument doesn't contain a value, or its value matches the disc's title ID
|
||||||
|
|
|
@ -86,7 +86,7 @@ static Common::FifoQueue<ReadRequest, false> s_request_queue;
|
||||||
static Common::FifoQueue<ReadResult, false> s_result_queue;
|
static Common::FifoQueue<ReadResult, false> s_result_queue;
|
||||||
static std::map<u64, ReadResult> s_result_map;
|
static std::map<u64, ReadResult> s_result_map;
|
||||||
|
|
||||||
static std::unique_ptr<DiscIO::IVolume> s_disc;
|
static std::unique_ptr<DiscIO::Volume> s_disc;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
@ -180,7 +180,7 @@ void DoState(PointerWrap& p)
|
||||||
// was made. Handling that properly may be more effort than it's worth.
|
// was made. Handling that properly may be more effort than it's worth.
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDisc(std::unique_ptr<DiscIO::IVolume> disc)
|
void SetDisc(std::unique_ptr<DiscIO::Volume> disc)
|
||||||
{
|
{
|
||||||
WaitUntilIdle();
|
WaitUntilIdle();
|
||||||
s_disc = std::move(disc);
|
s_disc = std::move(disc);
|
||||||
|
|
|
@ -22,7 +22,7 @@ enum class ReplyType : u32;
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
enum class Platform;
|
enum class Platform;
|
||||||
class IVolume;
|
class Volume;
|
||||||
}
|
}
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
|
@ -39,13 +39,13 @@ void Start();
|
||||||
void Stop();
|
void Stop();
|
||||||
void DoState(PointerWrap& p);
|
void DoState(PointerWrap& p);
|
||||||
|
|
||||||
void SetDisc(std::unique_ptr<DiscIO::IVolume> disc);
|
void SetDisc(std::unique_ptr<DiscIO::Volume> disc);
|
||||||
bool HasDisc();
|
bool HasDisc();
|
||||||
|
|
||||||
DiscIO::Platform GetDiscType();
|
DiscIO::Platform GetDiscType();
|
||||||
IOS::ES::TMDReader GetTMD(const DiscIO::Partition& partition);
|
IOS::ES::TMDReader GetTMD(const DiscIO::Partition& partition);
|
||||||
IOS::ES::TicketReader GetTicket(const DiscIO::Partition& partition);
|
IOS::ES::TicketReader GetTicket(const DiscIO::Partition& partition);
|
||||||
// This function returns true and calls SConfig::SetRunningGameMetadata(IVolume&, Partition&)
|
// This function returns true and calls SConfig::SetRunningGameMetadata(Volume&, Partition&)
|
||||||
// if both of the following conditions are true:
|
// if both of the following conditions are true:
|
||||||
// - A disc is inserted
|
// - A disc is inserted
|
||||||
// - The title_id argument doesn't contain a value, or its value matches the disc's title ID
|
// - The title_id argument doesn't contain a value, or its value matches the disc's title ID
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
|
|
||||||
namespace FileMonitor
|
namespace FileMonitor
|
||||||
{
|
{
|
||||||
static const DiscIO::IVolume* s_volume;
|
static const DiscIO::Volume* s_volume;
|
||||||
static bool s_new_volume = false;
|
static bool s_new_volume = false;
|
||||||
static std::unique_ptr<DiscIO::IFileSystem> s_filesystem;
|
static std::unique_ptr<DiscIO::FileSystem> s_filesystem;
|
||||||
static DiscIO::Partition s_partition;
|
static DiscIO::Partition s_partition;
|
||||||
static std::string s_previous_file;
|
static std::string s_previous_file;
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ static bool IsSoundFile(const std::string& filename)
|
||||||
return extensions.find(extension) != extensions.end();
|
return extensions.find(extension) != extensions.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFileSystem(const DiscIO::IVolume* volume)
|
void SetFileSystem(const DiscIO::Volume* volume)
|
||||||
{
|
{
|
||||||
// Instead of creating the file system object right away, we will let Log
|
// Instead of creating the file system object right away, we will let Log
|
||||||
// create it later once we know that it actually will get used
|
// create it later once we know that it actually will get used
|
||||||
|
|
|
@ -9,14 +9,14 @@
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
struct Partition;
|
struct Partition;
|
||||||
class IVolume;
|
class Volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace FileMonitor
|
namespace FileMonitor
|
||||||
{
|
{
|
||||||
// Can be called with nullptr to set the file system to nothing. When not called
|
// Can be called with nullptr to set the file system to nothing. When not called
|
||||||
// with nullptr, the volume must remain valid until the next SetFileSystem call.
|
// with nullptr, the volume must remain valid until the next SetFileSystem call.
|
||||||
void SetFileSystem(const DiscIO::IVolume* volume);
|
void SetFileSystem(const DiscIO::Volume* volume);
|
||||||
// Logs access to files in the file system set by SetFileSystem
|
// Logs access to files in the file system set by SetFileSystem
|
||||||
void Log(u64 offset, const DiscIO::Partition& partition);
|
void Log(u64 offset, const DiscIO::Partition& partition);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ void TitleContext::DoState(PointerWrap& p)
|
||||||
p.Do(active);
|
p.Do(active);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TitleContext::Update(const DiscIO::CNANDContentLoader& content_loader)
|
void TitleContext::Update(const DiscIO::NANDContentLoader& content_loader)
|
||||||
{
|
{
|
||||||
if (!content_loader.IsValid())
|
if (!content_loader.IsValid())
|
||||||
return;
|
return;
|
||||||
|
@ -121,7 +121,7 @@ void ES::LoadWAD(const std::string& _rContentFile)
|
||||||
s_content_file = _rContentFile;
|
s_content_file = _rContentFile;
|
||||||
// XXX: Ideally, this should be done during a launch, but because we support launching WADs
|
// XXX: Ideally, this should be done during a launch, but because we support launching WADs
|
||||||
// without installing them (which is a bit of a hack), we have to do this manually here.
|
// without installing them (which is a bit of a hack), we have to do this manually here.
|
||||||
const auto& content_loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(s_content_file);
|
const auto& content_loader = DiscIO::NANDContentManager::Access().GetNANDLoader(s_content_file);
|
||||||
s_title_context.Update(content_loader);
|
s_title_context.Update(content_loader);
|
||||||
INFO_LOG(IOS_ES, "LoadWAD: Title context changed: %016" PRIx64, s_title_context.tmd.GetTitleId());
|
INFO_LOG(IOS_ES, "LoadWAD: Title context changed: %016" PRIx64, s_title_context.tmd.GetTitleId());
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ bool ES::LaunchTitle(u64 title_id, bool skip_reload)
|
||||||
// ES_Launch should probably reset the whole state, which at least means closing all open files.
|
// ES_Launch should probably reset the whole state, which at least means closing all open files.
|
||||||
// leaving them open through ES_Launch may cause hangs and other funky behavior
|
// leaving them open through ES_Launch may cause hangs and other funky behavior
|
||||||
// (supposedly when trying to re-open those files).
|
// (supposedly when trying to re-open those files).
|
||||||
DiscIO::CNANDContentManager::Access().ClearCache();
|
DiscIO::NANDContentManager::Access().ClearCache();
|
||||||
|
|
||||||
if (IsTitleType(title_id, IOS::ES::TitleType::System) && title_id != TITLEID_SYSMENU)
|
if (IsTitleType(title_id, IOS::ES::TitleType::System) && title_id != TITLEID_SYSMENU)
|
||||||
return LaunchIOS(title_id);
|
return LaunchIOS(title_id);
|
||||||
|
@ -230,7 +230,7 @@ bool ES::LaunchIOS(u64 ios_title_id)
|
||||||
|
|
||||||
bool ES::LaunchPPCTitle(u64 title_id, bool skip_reload)
|
bool ES::LaunchPPCTitle(u64 title_id, bool skip_reload)
|
||||||
{
|
{
|
||||||
const DiscIO::CNANDContentLoader& content_loader = AccessContentDevice(title_id);
|
const DiscIO::NANDContentLoader& content_loader = AccessContentDevice(title_id);
|
||||||
if (!content_loader.IsValid())
|
if (!content_loader.IsValid())
|
||||||
{
|
{
|
||||||
if (title_id == 0x0000000100000002)
|
if (title_id == 0x0000000100000002)
|
||||||
|
@ -369,7 +369,7 @@ ReturnCode ES::Close(u32 fd)
|
||||||
INFO_LOG(IOS_ES, "ES: Close");
|
INFO_LOG(IOS_ES, "ES: Close");
|
||||||
m_is_active = false;
|
m_is_active = false;
|
||||||
// clear the NAND content cache to make sure nothing remains open.
|
// clear the NAND content cache to make sure nothing remains open.
|
||||||
DiscIO::CNANDContentManager::Access().ClearCache();
|
DiscIO::NANDContentManager::Access().ClearCache();
|
||||||
return IPC_SUCCESS;
|
return IPC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ IPCCommandResult ES::LaunchBC(const IOCtlVRequest& request)
|
||||||
return GetNoReply();
|
return GetNoReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
const DiscIO::CNANDContentLoader& ES::AccessContentDevice(u64 title_id)
|
const DiscIO::NANDContentLoader& ES::AccessContentDevice(u64 title_id)
|
||||||
{
|
{
|
||||||
// for WADs, the passed title id and the stored title id match; along with s_content_file
|
// for WADs, the passed title id and the stored title id match; along with s_content_file
|
||||||
// being set to the actual WAD file name. We cannot simply get a NAND Loader for the title id
|
// being set to the actual WAD file name. We cannot simply get a NAND Loader for the title id
|
||||||
|
@ -594,10 +594,10 @@ const DiscIO::CNANDContentLoader& ES::AccessContentDevice(u64 title_id)
|
||||||
if (s_title_context.active && s_title_context.tmd.GetTitleId() == title_id &&
|
if (s_title_context.active && s_title_context.tmd.GetTitleId() == title_id &&
|
||||||
!s_content_file.empty())
|
!s_content_file.empty())
|
||||||
{
|
{
|
||||||
return DiscIO::CNANDContentManager::Access().GetNANDLoader(s_content_file);
|
return DiscIO::NANDContentManager::Access().GetNANDLoader(s_content_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DiscIO::CNANDContentManager::Access().GetNANDLoader(title_id, Common::FROM_SESSION_ROOT);
|
return DiscIO::NANDContentManager::Access().GetNANDLoader(title_id, Common::FROM_SESSION_ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is technically an ioctlv in IOS's ES, but it is an internal API which cannot be
|
// This is technically an ioctlv in IOS's ES, but it is an internal API which cannot be
|
||||||
|
@ -636,7 +636,7 @@ s32 ES::DIVerify(const IOS::ES::TMDReader& tmd, const IOS::ES::TicketReader& tic
|
||||||
}
|
}
|
||||||
// DI_VERIFY writes to title.tmd, which is read and cached inside the NAND Content Manager.
|
// DI_VERIFY writes to title.tmd, which is read and cached inside the NAND Content Manager.
|
||||||
// clear the cache to avoid content access mismatches.
|
// clear the cache to avoid content access mismatches.
|
||||||
DiscIO::CNANDContentManager::Access().ClearCache();
|
DiscIO::NANDContentManager::Access().ClearCache();
|
||||||
|
|
||||||
if (!UpdateUIDAndGID(*GetIOS(), s_title_context.tmd))
|
if (!UpdateUIDAndGID(*GetIOS(), s_title_context.tmd))
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,7 @@ class PointerWrap;
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
class CNANDContentLoader;
|
class NANDContentLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
|
@ -31,7 +31,7 @@ struct TitleContext
|
||||||
{
|
{
|
||||||
void Clear();
|
void Clear();
|
||||||
void DoState(PointerWrap& p);
|
void DoState(PointerWrap& p);
|
||||||
void Update(const DiscIO::CNANDContentLoader& content_loader);
|
void Update(const DiscIO::NANDContentLoader& content_loader);
|
||||||
void Update(const IOS::ES::TMDReader& tmd_, const IOS::ES::TicketReader& ticket_);
|
void Update(const IOS::ES::TMDReader& tmd_, const IOS::ES::TicketReader& ticket_);
|
||||||
|
|
||||||
IOS::ES::TicketReader ticket;
|
IOS::ES::TicketReader ticket;
|
||||||
|
@ -284,7 +284,7 @@ private:
|
||||||
bool LaunchPPCTitle(u64 title_id, bool skip_reload);
|
bool LaunchPPCTitle(u64 title_id, bool skip_reload);
|
||||||
static TitleContext& GetTitleContext();
|
static TitleContext& GetTitleContext();
|
||||||
|
|
||||||
static const DiscIO::CNANDContentLoader& AccessContentDevice(u64 title_id);
|
static const DiscIO::NANDContentLoader& AccessContentDevice(u64 title_id);
|
||||||
|
|
||||||
u32 OpenTitleContent(u32 CFD, u64 TitleID, u16 Index);
|
u32 OpenTitleContent(u32 CFD, u64 TitleID, u16 Index);
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace Device
|
||||||
{
|
{
|
||||||
u32 ES::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index)
|
u32 ES::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index)
|
||||||
{
|
{
|
||||||
const DiscIO::CNANDContentLoader& Loader = AccessContentDevice(TitleID);
|
const DiscIO::NANDContentLoader& Loader = AccessContentDevice(TitleID);
|
||||||
|
|
||||||
if (!Loader.IsValid() || !Loader.GetTMD().IsValid() || !Loader.GetTicket().IsValid())
|
if (!Loader.IsValid() || !Loader.GetTMD().IsValid() || !Loader.GetTicket().IsValid())
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ u32 ES::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index)
|
||||||
return 0xffffffff;
|
return 0xffffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DiscIO::SNANDContent* pContent = Loader.GetContentByIndex(Index);
|
const DiscIO::NANDContent* pContent = Loader.GetContentByIndex(Index);
|
||||||
|
|
||||||
if (pContent == nullptr)
|
if (pContent == nullptr)
|
||||||
{
|
{
|
||||||
|
@ -106,11 +106,11 @@ IPCCommandResult ES::ReadContent(u32 uid, const IOCtlVRequest& request)
|
||||||
{
|
{
|
||||||
if (pDest)
|
if (pDest)
|
||||||
{
|
{
|
||||||
const DiscIO::CNANDContentLoader& ContentLoader = AccessContentDevice(rContent.m_title_id);
|
const DiscIO::NANDContentLoader& ContentLoader = AccessContentDevice(rContent.m_title_id);
|
||||||
// ContentLoader should never be invalid; rContent has been created by it.
|
// ContentLoader should never be invalid; rContent has been created by it.
|
||||||
if (ContentLoader.IsValid() && ContentLoader.GetTicket().IsValid())
|
if (ContentLoader.IsValid() && ContentLoader.GetTicket().IsValid())
|
||||||
{
|
{
|
||||||
const DiscIO::SNANDContent* pContent =
|
const DiscIO::NANDContent* pContent =
|
||||||
ContentLoader.GetContentByIndex(rContent.m_content.index);
|
ContentLoader.GetContentByIndex(rContent.m_content.index);
|
||||||
if (!pContent->m_Data->GetRange(rContent.m_position, Size, pDest))
|
if (!pContent->m_Data->GetRange(rContent.m_position, Size, pDest))
|
||||||
ERROR_LOG(IOS_ES, "ES: failed to read %u bytes from %u!", Size, rContent.m_position);
|
ERROR_LOG(IOS_ES, "ES: failed to read %u bytes from %u!", Size, rContent.m_position);
|
||||||
|
@ -146,11 +146,11 @@ IPCCommandResult ES::CloseContent(u32 uid, const IOCtlVRequest& request)
|
||||||
return GetDefaultReply(-1);
|
return GetDefaultReply(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const DiscIO::CNANDContentLoader& ContentLoader = AccessContentDevice(itr->second.m_title_id);
|
const DiscIO::NANDContentLoader& ContentLoader = AccessContentDevice(itr->second.m_title_id);
|
||||||
// ContentLoader should never be invalid; we shouldn't be here if ES_OPENCONTENT failed before.
|
// ContentLoader should never be invalid; we shouldn't be here if ES_OPENCONTENT failed before.
|
||||||
if (ContentLoader.IsValid())
|
if (ContentLoader.IsValid())
|
||||||
{
|
{
|
||||||
const DiscIO::SNANDContent* pContent =
|
const DiscIO::NANDContent* pContent =
|
||||||
ContentLoader.GetContentByIndex(itr->second.m_content.index);
|
ContentLoader.GetContentByIndex(itr->second.m_content.index);
|
||||||
pContent->m_Data->Close();
|
pContent->m_Data->Close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -375,8 +375,8 @@ ReturnCode ES::DeleteTitle(u64 title_id)
|
||||||
ERROR_LOG(IOS_ES, "DeleteTitle: Failed to delete title directory: %s", title_dir.c_str());
|
ERROR_LOG(IOS_ES, "DeleteTitle: Failed to delete title directory: %s", title_dir.c_str());
|
||||||
return FS_EACCESS;
|
return FS_EACCESS;
|
||||||
}
|
}
|
||||||
// XXX: ugly, but until we drop CNANDContentManager everywhere, this is going to be needed.
|
// XXX: ugly, but until we drop NANDContentManager everywhere, this is going to be needed.
|
||||||
DiscIO::CNANDContentManager::Access().ClearCache();
|
DiscIO::NANDContentManager::Access().ClearCache();
|
||||||
|
|
||||||
return IPC_SUCCESS;
|
return IPC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,7 +273,7 @@ u16 Kernel::GetGidForPPC() const
|
||||||
|
|
||||||
// This corresponds to syscall 0x41, which loads a binary from the NAND and bootstraps the PPC.
|
// This corresponds to syscall 0x41, which loads a binary from the NAND and bootstraps the PPC.
|
||||||
// Unlike 0x42, IOS will set up some constants in memory before booting the PPC.
|
// Unlike 0x42, IOS will set up some constants in memory before booting the PPC.
|
||||||
bool Kernel::BootstrapPPC(const DiscIO::CNANDContentLoader& content_loader)
|
bool Kernel::BootstrapPPC(const DiscIO::NANDContentLoader& content_loader)
|
||||||
{
|
{
|
||||||
if (!content_loader.IsValid())
|
if (!content_loader.IsValid())
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -21,7 +21,7 @@ class PointerWrap;
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
class CNANDContentLoader;
|
class NANDContentLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
|
@ -111,7 +111,7 @@ public:
|
||||||
void SetGidForPPC(u16 gid);
|
void SetGidForPPC(u16 gid);
|
||||||
u16 GetGidForPPC() const;
|
u16 GetGidForPPC() const;
|
||||||
|
|
||||||
bool BootstrapPPC(const DiscIO::CNANDContentLoader& content_loader);
|
bool BootstrapPPC(const DiscIO::NANDContentLoader& content_loader);
|
||||||
bool BootIOS(u64 ios_title_id);
|
bool BootIOS(u64 ios_title_id);
|
||||||
u32 GetVersion() const;
|
u32 GetVersion() const;
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ u32 ARMBinary::GetElfSize() const
|
||||||
static std::vector<u8> GetMIOSBinary()
|
static std::vector<u8> GetMIOSBinary()
|
||||||
{
|
{
|
||||||
const auto& loader =
|
const auto& loader =
|
||||||
DiscIO::CNANDContentManager::Access().GetNANDLoader(MIOS_TITLE_ID, Common::FROM_SESSION_ROOT);
|
DiscIO::NANDContentManager::Access().GetNANDLoader(MIOS_TITLE_ID, Common::FROM_SESSION_ROOT);
|
||||||
if (!loader.IsValid())
|
if (!loader.IsValid())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ u32 SectorReader::ReadChunk(u8* buffer, u64 chunk_num)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<IBlobReader> CreateBlobReader(const std::string& filename)
|
std::unique_ptr<BlobReader> CreateBlobReader(const std::string& filename)
|
||||||
{
|
{
|
||||||
if (cdio_is_cdrom(filename))
|
if (cdio_is_cdrom(filename))
|
||||||
return DriveReader::Create(filename);
|
return DriveReader::Create(filename);
|
||||||
|
|
|
@ -36,10 +36,10 @@ enum class BlobType
|
||||||
TGC
|
TGC
|
||||||
};
|
};
|
||||||
|
|
||||||
class IBlobReader
|
class BlobReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~IBlobReader() {}
|
virtual ~BlobReader() {}
|
||||||
virtual BlobType GetBlobType() const = 0;
|
virtual BlobType GetBlobType() const = 0;
|
||||||
virtual u64 GetRawSize() const = 0;
|
virtual u64 GetRawSize() const = 0;
|
||||||
virtual u64 GetDataSize() const = 0;
|
virtual u64 GetDataSize() const = 0;
|
||||||
|
@ -56,13 +56,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
IBlobReader() {}
|
BlobReader() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Provides caching and byte-operation-to-block-operations facilities.
|
// Provides caching and byte-operation-to-block-operations facilities.
|
||||||
// Used for compressed blob and direct drive reading.
|
// Used for compressed blob and direct drive reading.
|
||||||
// NOTE: GetDataSize() is expected to be evenly divisible by the sector size.
|
// NOTE: GetDataSize() is expected to be evenly divisible by the sector size.
|
||||||
class SectorReader : public IBlobReader
|
class SectorReader : public BlobReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~SectorReader() = 0;
|
virtual ~SectorReader() = 0;
|
||||||
|
@ -147,8 +147,8 @@ private:
|
||||||
std::array<Cache, CACHE_LINES> m_cache;
|
std::array<Cache, CACHE_LINES> m_cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Factory function - examines the path to choose the right type of IBlobReader, and returns one.
|
// Factory function - examines the path to choose the right type of BlobReader, and returns one.
|
||||||
std::unique_ptr<IBlobReader> CreateBlobReader(const std::string& filename);
|
std::unique_ptr<BlobReader> CreateBlobReader(const std::string& filename);
|
||||||
|
|
||||||
typedef bool (*CompressCB)(const std::string& text, float percent, void* arg);
|
typedef bool (*CompressCB)(const std::string& text, float percent, void* arg);
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ struct CISOHeader
|
||||||
u8 map[CISO_MAP_SIZE];
|
u8 map[CISO_MAP_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
class CISOFileReader : public IBlobReader
|
class CISOFileReader : public BlobReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::unique_ptr<CISOFileReader> Create(File::IOFile file);
|
static std::unique_ptr<CISOFileReader> Create(File::IOFile file);
|
||||||
|
|
|
@ -16,7 +16,7 @@ set(SRCS
|
||||||
VolumeDirectory.cpp
|
VolumeDirectory.cpp
|
||||||
VolumeGC.cpp
|
VolumeGC.cpp
|
||||||
VolumeWad.cpp
|
VolumeWad.cpp
|
||||||
VolumeWiiCrypted.cpp
|
VolumeWii.cpp
|
||||||
WiiWad.cpp
|
WiiWad.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
<ClCompile Include="VolumeDirectory.cpp" />
|
<ClCompile Include="VolumeDirectory.cpp" />
|
||||||
<ClCompile Include="VolumeGC.cpp" />
|
<ClCompile Include="VolumeGC.cpp" />
|
||||||
<ClCompile Include="VolumeWad.cpp" />
|
<ClCompile Include="VolumeWad.cpp" />
|
||||||
<ClCompile Include="VolumeWiiCrypted.cpp" />
|
<ClCompile Include="VolumeWii.cpp" />
|
||||||
<ClCompile Include="WbfsBlob.cpp" />
|
<ClCompile Include="WbfsBlob.cpp" />
|
||||||
<ClCompile Include="WiiWad.cpp" />
|
<ClCompile Include="WiiWad.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
<ClInclude Include="VolumeDirectory.h" />
|
<ClInclude Include="VolumeDirectory.h" />
|
||||||
<ClInclude Include="VolumeGC.h" />
|
<ClInclude Include="VolumeGC.h" />
|
||||||
<ClInclude Include="VolumeWad.h" />
|
<ClInclude Include="VolumeWad.h" />
|
||||||
<ClInclude Include="VolumeWiiCrypted.h" />
|
<ClInclude Include="VolumeWii.h" />
|
||||||
<ClInclude Include="WbfsBlob.h" />
|
<ClInclude Include="WbfsBlob.h" />
|
||||||
<ClInclude Include="WiiWad.h" />
|
<ClInclude Include="WiiWad.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -63,10 +63,10 @@
|
||||||
<ClCompile Include="VolumeWad.cpp">
|
<ClCompile Include="VolumeWad.cpp">
|
||||||
<Filter>Volume</Filter>
|
<Filter>Volume</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="VolumeWiiCrypted.cpp">
|
<ClCompile Include="Enums.cpp">
|
||||||
<Filter>Volume</Filter>
|
<Filter>Volume</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Enums.cpp">
|
<ClCompile Include="VolumeWii.cpp">
|
||||||
<Filter>Volume</Filter>
|
<Filter>Volume</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Volume.cpp">
|
<ClCompile Include="Volume.cpp">
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
<ClInclude Include="VolumeWad.h">
|
<ClInclude Include="VolumeWad.h">
|
||||||
<Filter>Volume</Filter>
|
<Filter>Volume</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="VolumeWiiCrypted.h">
|
<ClInclude Include="VolumeWii.h">
|
||||||
<Filter>Volume</Filter>
|
<Filter>Volume</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Enums.h">
|
<ClInclude Include="Enums.h">
|
||||||
|
|
|
@ -179,7 +179,7 @@ bool DiscScrubber::ParseDisc()
|
||||||
// Operations dealing with encrypted space are done here
|
// Operations dealing with encrypted space are done here
|
||||||
bool DiscScrubber::ParsePartitionData(const Partition& partition, PartitionHeader* header)
|
bool DiscScrubber::ParsePartitionData(const Partition& partition, PartitionHeader* header)
|
||||||
{
|
{
|
||||||
std::unique_ptr<IFileSystem> filesystem(CreateFileSystem(m_disc.get(), partition));
|
std::unique_ptr<FileSystem> filesystem(CreateFileSystem(m_disc.get(), partition));
|
||||||
if (!filesystem)
|
if (!filesystem)
|
||||||
{
|
{
|
||||||
ERROR_LOG(DISCIO, "Failed to read file system for the partition at 0x%" PRIx64,
|
ERROR_LOG(DISCIO, "Failed to read file system for the partition at 0x%" PRIx64,
|
||||||
|
@ -219,7 +219,7 @@ bool DiscScrubber::ParsePartitionData(const Partition& partition, PartitionHeade
|
||||||
MarkAsUsedE(partition_data_offset, header->fst_offset, header->fst_size);
|
MarkAsUsedE(partition_data_offset, header->fst_offset, header->fst_size);
|
||||||
|
|
||||||
// Go through the filesystem and mark entries as used
|
// Go through the filesystem and mark entries as used
|
||||||
for (const SFileInfo& file : filesystem->GetFileList())
|
for (const FileInfo& file : filesystem->GetFileList())
|
||||||
{
|
{
|
||||||
DEBUG_LOG(DISCIO, "%s", file.m_FullPath.empty() ? "/" : file.m_FullPath.c_str());
|
DEBUG_LOG(DISCIO, "%s", file.m_FullPath.empty() ? "/" : file.m_FullPath.c_str());
|
||||||
if ((file.m_NameOffset & 0x1000000) == 0)
|
if ((file.m_NameOffset & 0x1000000) == 0)
|
||||||
|
|
|
@ -25,7 +25,7 @@ class IOFile;
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
class IVolume;
|
class Volume;
|
||||||
struct Partition;
|
struct Partition;
|
||||||
|
|
||||||
class DiscScrubber final
|
class DiscScrubber final
|
||||||
|
@ -66,7 +66,7 @@ private:
|
||||||
bool ParsePartitionData(const Partition& partition, PartitionHeader* header);
|
bool ParsePartitionData(const Partition& partition, PartitionHeader* header);
|
||||||
|
|
||||||
std::string m_filename;
|
std::string m_filename;
|
||||||
std::unique_ptr<IVolume> m_disc;
|
std::unique_ptr<Volume> m_disc;
|
||||||
|
|
||||||
std::vector<u8> m_free_table;
|
std::vector<u8> m_free_table;
|
||||||
u64 m_file_size = 0;
|
u64 m_file_size = 0;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
class PlainFileReader : public IBlobReader
|
class PlainFileReader : public BlobReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::unique_ptr<PlainFileReader> Create(File::IOFile file);
|
static std::unique_ptr<PlainFileReader> Create(File::IOFile file);
|
||||||
|
|
|
@ -22,23 +22,23 @@
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
CFileSystemGCWii::CFileSystemGCWii(const IVolume* _rVolume, const Partition& partition)
|
FileSystemGCWii::FileSystemGCWii(const Volume* _rVolume, const Partition& partition)
|
||||||
: IFileSystem(_rVolume, partition), m_Initialized(false), m_Valid(false), m_offset_shift(0)
|
: FileSystem(_rVolume, partition), m_Initialized(false), m_Valid(false), m_offset_shift(0)
|
||||||
{
|
{
|
||||||
m_Valid = DetectFileSystem();
|
m_Valid = DetectFileSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
CFileSystemGCWii::~CFileSystemGCWii()
|
FileSystemGCWii::~FileSystemGCWii()
|
||||||
{
|
{
|
||||||
m_FileInfoVector.clear();
|
m_FileInfoVector.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 CFileSystemGCWii::GetFileSize(const std::string& _rFullPath)
|
u64 FileSystemGCWii::GetFileSize(const std::string& _rFullPath)
|
||||||
{
|
{
|
||||||
if (!m_Initialized)
|
if (!m_Initialized)
|
||||||
InitFileSystem();
|
InitFileSystem();
|
||||||
|
|
||||||
const SFileInfo* pFileInfo = FindFileInfo(_rFullPath);
|
const FileInfo* pFileInfo = FindFileInfo(_rFullPath);
|
||||||
|
|
||||||
if (pFileInfo != nullptr && !pFileInfo->IsDirectory())
|
if (pFileInfo != nullptr && !pFileInfo->IsDirectory())
|
||||||
return pFileInfo->m_FileSize;
|
return pFileInfo->m_FileSize;
|
||||||
|
@ -46,7 +46,7 @@ u64 CFileSystemGCWii::GetFileSize(const std::string& _rFullPath)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CFileSystemGCWii::GetFileName(u64 _Address)
|
std::string FileSystemGCWii::GetFileName(u64 _Address)
|
||||||
{
|
{
|
||||||
if (!m_Initialized)
|
if (!m_Initialized)
|
||||||
InitFileSystem();
|
InitFileSystem();
|
||||||
|
@ -62,13 +62,13 @@ std::string CFileSystemGCWii::GetFileName(u64 _Address)
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 CFileSystemGCWii::ReadFile(const std::string& _rFullPath, u8* _pBuffer, u64 _MaxBufferSize,
|
u64 FileSystemGCWii::ReadFile(const std::string& _rFullPath, u8* _pBuffer, u64 _MaxBufferSize,
|
||||||
u64 _OffsetInFile)
|
u64 _OffsetInFile)
|
||||||
{
|
{
|
||||||
if (!m_Initialized)
|
if (!m_Initialized)
|
||||||
InitFileSystem();
|
InitFileSystem();
|
||||||
|
|
||||||
const SFileInfo* pFileInfo = FindFileInfo(_rFullPath);
|
const FileInfo* pFileInfo = FindFileInfo(_rFullPath);
|
||||||
if (pFileInfo == nullptr)
|
if (pFileInfo == nullptr)
|
||||||
return 0;
|
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);
|
u64 read_length = std::min(_MaxBufferSize, pFileInfo->m_FileSize - _OffsetInFile);
|
||||||
|
|
||||||
DEBUG_LOG(DISCIO, "Reading %" PRIx64 " bytes at %" PRIx64 " from file %s. Offset: %" PRIx64
|
DEBUG_LOG(
|
||||||
" Size: %" PRIx64,
|
DISCIO,
|
||||||
read_length, _OffsetInFile, _rFullPath.c_str(), pFileInfo->m_Offset,
|
"Reading %" PRIx64 " bytes at %" PRIx64 " from file %s. Offset: %" PRIx64 " Size: %" PRIx64,
|
||||||
pFileInfo->m_FileSize);
|
read_length, _OffsetInFile, _rFullPath.c_str(), pFileInfo->m_Offset, pFileInfo->m_FileSize);
|
||||||
|
|
||||||
m_rVolume->Read(pFileInfo->m_Offset + _OffsetInFile, read_length, _pBuffer, m_partition);
|
m_rVolume->Read(pFileInfo->m_Offset + _OffsetInFile, read_length, _pBuffer, m_partition);
|
||||||
return read_length;
|
return read_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFileSystemGCWii::ExportFile(const std::string& _rFullPath,
|
bool FileSystemGCWii::ExportFile(const std::string& _rFullPath, const std::string& _rExportFilename)
|
||||||
const std::string& _rExportFilename)
|
|
||||||
{
|
{
|
||||||
if (!m_Initialized)
|
if (!m_Initialized)
|
||||||
InitFileSystem();
|
InitFileSystem();
|
||||||
|
|
||||||
const SFileInfo* pFileInfo = FindFileInfo(_rFullPath);
|
const FileInfo* pFileInfo = FindFileInfo(_rFullPath);
|
||||||
|
|
||||||
if (!pFileInfo)
|
if (!pFileInfo)
|
||||||
return false;
|
return false;
|
||||||
|
@ -127,7 +126,7 @@ bool CFileSystemGCWii::ExportFile(const std::string& _rFullPath,
|
||||||
return result;
|
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);
|
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);
|
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;
|
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);
|
std::optional<u32> offset = m_rVolume->ReadSwapped<u32>(0x420, m_partition);
|
||||||
return offset ? static_cast<u64>(*offset) << 2 : std::optional<u64>();
|
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;
|
u32 dol_size = 0;
|
||||||
|
|
||||||
|
@ -190,7 +189,7 @@ std::optional<u32> CFileSystemGCWii::GetBootDOLSize(u64 dol_offset) const
|
||||||
return dol_size;
|
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();
|
std::optional<u64> dol_offset = GetBootDOLOffset();
|
||||||
if (!dol_offset)
|
if (!dol_offset)
|
||||||
|
@ -215,7 +214,7 @@ bool CFileSystemGCWii::ExportDOL(const std::string& _rExportFolder) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CFileSystemGCWii::GetStringFromOffset(u64 _Offset) const
|
std::string FileSystemGCWii::GetStringFromOffset(u64 _Offset) const
|
||||||
{
|
{
|
||||||
std::string data(255, 0x00);
|
std::string data(255, 0x00);
|
||||||
m_rVolume->Read(_Offset, data.size(), (u8*)&data[0], m_partition);
|
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);
|
return SHIFTJISToUTF8(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<SFileInfo>& CFileSystemGCWii::GetFileList()
|
const std::vector<FileInfo>& FileSystemGCWii::GetFileList()
|
||||||
{
|
{
|
||||||
if (!m_Initialized)
|
if (!m_Initialized)
|
||||||
InitFileSystem();
|
InitFileSystem();
|
||||||
|
@ -234,7 +233,7 @@ const std::vector<SFileInfo>& CFileSystemGCWii::GetFileList()
|
||||||
return m_FileInfoVector;
|
return m_FileInfoVector;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SFileInfo* CFileSystemGCWii::FindFileInfo(const std::string& _rFullPath)
|
const FileInfo* FileSystemGCWii::FindFileInfo(const std::string& _rFullPath)
|
||||||
{
|
{
|
||||||
if (!m_Initialized)
|
if (!m_Initialized)
|
||||||
InitFileSystem();
|
InitFileSystem();
|
||||||
|
@ -248,7 +247,7 @@ const SFileInfo* CFileSystemGCWii::FindFileInfo(const std::string& _rFullPath)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFileSystemGCWii::DetectFileSystem()
|
bool FileSystemGCWii::DetectFileSystem()
|
||||||
{
|
{
|
||||||
if (m_rVolume->ReadSwapped<u32>(0x18, m_partition) == u32(0x5D1C9EA3))
|
if (m_rVolume->ReadSwapped<u32>(0x18, m_partition) == u32(0x5D1C9EA3))
|
||||||
{
|
{
|
||||||
|
@ -264,7 +263,7 @@ bool CFileSystemGCWii::DetectFileSystem()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFileSystemGCWii::InitFileSystem()
|
void FileSystemGCWii::InitFileSystem()
|
||||||
{
|
{
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
|
|
||||||
|
@ -280,8 +279,7 @@ void CFileSystemGCWii::InitFileSystem()
|
||||||
const std::optional<u32> root_size = m_rVolume->ReadSwapped<u32>(FSTOffset + 0x8, m_partition);
|
const std::optional<u32> root_size = m_rVolume->ReadSwapped<u32>(FSTOffset + 0x8, m_partition);
|
||||||
if (!root_name_offset || !root_offset || !root_size)
|
if (!root_name_offset || !root_offset || !root_size)
|
||||||
return;
|
return;
|
||||||
SFileInfo root = {*root_name_offset, static_cast<u64>(*root_offset) << m_offset_shift,
|
FileInfo root = {*root_name_offset, static_cast<u64>(*root_offset) << m_offset_shift, *root_size};
|
||||||
*root_size};
|
|
||||||
|
|
||||||
if (!root.IsDirectory())
|
if (!root.IsDirectory())
|
||||||
return;
|
return;
|
||||||
|
@ -318,14 +316,14 @@ void CFileSystemGCWii::InitFileSystem()
|
||||||
BuildFilenames(1, m_FileInfoVector.size(), "", NameTableOffset);
|
BuildFilenames(1, m_FileInfoVector.size(), "", NameTableOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CFileSystemGCWii::BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex,
|
size_t FileSystemGCWii::BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex,
|
||||||
const std::string& _szDirectory, u64 _NameTableOffset)
|
const std::string& _szDirectory, u64 _NameTableOffset)
|
||||||
{
|
{
|
||||||
size_t CurrentIndex = _FirstIndex;
|
size_t CurrentIndex = _FirstIndex;
|
||||||
|
|
||||||
while (CurrentIndex < _LastIndex)
|
while (CurrentIndex < _LastIndex)
|
||||||
{
|
{
|
||||||
SFileInfo& rFileInfo = m_FileInfoVector[CurrentIndex];
|
FileInfo& rFileInfo = m_FileInfoVector[CurrentIndex];
|
||||||
u64 const uOffset = _NameTableOffset + (rFileInfo.m_NameOffset & 0xFFFFFF);
|
u64 const uOffset = _NameTableOffset + (rFileInfo.m_NameOffset & 0xFFFFFF);
|
||||||
std::string const offset_str{GetStringFromOffset(uOffset)};
|
std::string const offset_str{GetStringFromOffset(uOffset)};
|
||||||
bool const is_dir = rFileInfo.IsDirectory();
|
bool const is_dir = rFileInfo.IsDirectory();
|
||||||
|
|
|
@ -14,18 +14,18 @@
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
class IVolume;
|
class Volume;
|
||||||
struct Partition;
|
struct Partition;
|
||||||
|
|
||||||
class CFileSystemGCWii : public IFileSystem
|
class FileSystemGCWii : public FileSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CFileSystemGCWii(const IVolume* _rVolume, const Partition& partition);
|
FileSystemGCWii(const Volume* _rVolume, const Partition& partition);
|
||||||
virtual ~CFileSystemGCWii();
|
virtual ~FileSystemGCWii();
|
||||||
|
|
||||||
bool IsValid() const override { return m_Valid; }
|
bool IsValid() const override { return m_Valid; }
|
||||||
u64 GetFileSize(const std::string& _rFullPath) override;
|
u64 GetFileSize(const std::string& _rFullPath) override;
|
||||||
const std::vector<SFileInfo>& GetFileList() override;
|
const std::vector<FileInfo>& GetFileList() override;
|
||||||
std::string GetFileName(u64 _Address) override;
|
std::string GetFileName(u64 _Address) override;
|
||||||
u64 ReadFile(const std::string& _rFullPath, u8* _pBuffer, u64 _MaxBufferSize,
|
u64 ReadFile(const std::string& _rFullPath, u8* _pBuffer, u64 _MaxBufferSize,
|
||||||
u64 _OffsetInFile) override;
|
u64 _OffsetInFile) override;
|
||||||
|
@ -39,10 +39,10 @@ private:
|
||||||
bool m_Initialized;
|
bool m_Initialized;
|
||||||
bool m_Valid;
|
bool m_Valid;
|
||||||
u32 m_offset_shift;
|
u32 m_offset_shift;
|
||||||
std::vector<SFileInfo> m_FileInfoVector;
|
std::vector<FileInfo> m_FileInfoVector;
|
||||||
|
|
||||||
std::string GetStringFromOffset(u64 _Offset) const;
|
std::string GetStringFromOffset(u64 _Offset) const;
|
||||||
const SFileInfo* FindFileInfo(const std::string& _rFullPath);
|
const FileInfo* FindFileInfo(const std::string& _rFullPath);
|
||||||
bool DetectFileSystem();
|
bool DetectFileSystem();
|
||||||
void InitFileSystem();
|
void InitFileSystem();
|
||||||
size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex,
|
size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex,
|
||||||
|
|
|
@ -9,21 +9,21 @@
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
IFileSystem::IFileSystem(const IVolume* _rVolume, const Partition& partition)
|
FileSystem::FileSystem(const Volume* _rVolume, const Partition& partition)
|
||||||
: m_rVolume(_rVolume), m_partition(partition)
|
: m_rVolume(_rVolume), m_partition(partition)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
IFileSystem::~IFileSystem()
|
FileSystem::~FileSystem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<IFileSystem> CreateFileSystem(const IVolume* volume, const Partition& partition)
|
std::unique_ptr<FileSystem> CreateFileSystem(const Volume* volume, const Partition& partition)
|
||||||
{
|
{
|
||||||
if (!volume)
|
if (!volume)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
std::unique_ptr<IFileSystem> filesystem = std::make_unique<CFileSystemGCWii>(volume, partition);
|
std::unique_ptr<FileSystem> filesystem = std::make_unique<FileSystemGCWii>(volume, partition);
|
||||||
|
|
||||||
if (!filesystem)
|
if (!filesystem)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
// file info of an FST entry
|
// file info of an FST entry
|
||||||
struct SFileInfo
|
struct FileInfo
|
||||||
{
|
{
|
||||||
u64 m_NameOffset = 0u;
|
u64 m_NameOffset = 0u;
|
||||||
u64 m_Offset = 0u;
|
u64 m_Offset = 0u;
|
||||||
|
@ -23,23 +23,23 @@ struct SFileInfo
|
||||||
std::string m_FullPath;
|
std::string m_FullPath;
|
||||||
|
|
||||||
bool IsDirectory() const { return (m_NameOffset & 0xFF000000) != 0; }
|
bool IsDirectory() const { return (m_NameOffset & 0xFF000000) != 0; }
|
||||||
SFileInfo(u64 name_offset, u64 offset, u64 filesize)
|
FileInfo(u64 name_offset, u64 offset, u64 filesize)
|
||||||
: m_NameOffset(name_offset), m_Offset(offset), m_FileSize(filesize)
|
: m_NameOffset(name_offset), m_Offset(offset), m_FileSize(filesize)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SFileInfo(SFileInfo const&) = default;
|
FileInfo(FileInfo const&) = default;
|
||||||
SFileInfo() = default;
|
FileInfo() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IFileSystem
|
class FileSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IFileSystem(const IVolume* _rVolume, const Partition& partition);
|
FileSystem(const Volume* _rVolume, const Partition& partition);
|
||||||
|
|
||||||
virtual ~IFileSystem();
|
virtual ~FileSystem();
|
||||||
virtual bool IsValid() const = 0;
|
virtual bool IsValid() const = 0;
|
||||||
virtual const std::vector<SFileInfo>& GetFileList() = 0;
|
virtual const std::vector<FileInfo>& GetFileList() = 0;
|
||||||
virtual u64 GetFileSize(const std::string& _rFullPath) = 0;
|
virtual u64 GetFileSize(const std::string& _rFullPath) = 0;
|
||||||
virtual u64 ReadFile(const std::string& _rFullPath, u8* _pBuffer, u64 _MaxBufferSize,
|
virtual u64 ReadFile(const std::string& _rFullPath, u8* _pBuffer, u64 _MaxBufferSize,
|
||||||
u64 _OffsetInFile = 0) = 0;
|
u64 _OffsetInFile = 0) = 0;
|
||||||
|
@ -52,10 +52,10 @@ public:
|
||||||
|
|
||||||
virtual const Partition GetPartition() const { return m_partition; }
|
virtual const Partition GetPartition() const { return m_partition; }
|
||||||
protected:
|
protected:
|
||||||
const IVolume* const m_rVolume;
|
const Volume* const m_rVolume;
|
||||||
const Partition m_partition;
|
const Partition m_partition;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<IFileSystem> CreateFileSystem(const IVolume* volume, const Partition& partition);
|
std::unique_ptr<FileSystem> CreateFileSystem(const Volume* volume, const Partition& partition);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -32,26 +32,26 @@
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
CNANDContentData::~CNANDContentData() = default;
|
NANDContentData::~NANDContentData() = default;
|
||||||
|
|
||||||
CNANDContentDataFile::CNANDContentDataFile(const std::string& filename) : m_filename{filename}
|
NANDContentDataFile::NANDContentDataFile(const std::string& filename) : m_filename{filename}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CNANDContentDataFile::~CNANDContentDataFile() = default;
|
NANDContentDataFile::~NANDContentDataFile() = default;
|
||||||
|
|
||||||
void CNANDContentDataFile::EnsureOpen()
|
void NANDContentDataFile::EnsureOpen()
|
||||||
{
|
{
|
||||||
if (!m_file)
|
if (!m_file)
|
||||||
m_file = std::make_unique<File::IOFile>(m_filename, "rb");
|
m_file = std::make_unique<File::IOFile>(m_filename, "rb");
|
||||||
else if (!m_file->IsOpen())
|
else if (!m_file->IsOpen())
|
||||||
m_file->Open(m_filename, "rb");
|
m_file->Open(m_filename, "rb");
|
||||||
}
|
}
|
||||||
void CNANDContentDataFile::Open()
|
void NANDContentDataFile::Open()
|
||||||
{
|
{
|
||||||
EnsureOpen();
|
EnsureOpen();
|
||||||
}
|
}
|
||||||
std::vector<u8> CNANDContentDataFile::Get()
|
std::vector<u8> NANDContentDataFile::Get()
|
||||||
{
|
{
|
||||||
EnsureOpen();
|
EnsureOpen();
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ std::vector<u8> CNANDContentDataFile::Get()
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CNANDContentDataFile::GetRange(u32 start, u32 size, u8* buffer)
|
bool NANDContentDataFile::GetRange(u32 start, u32 size, u8* buffer)
|
||||||
{
|
{
|
||||||
EnsureOpen();
|
EnsureOpen();
|
||||||
if (!m_file->IsGood())
|
if (!m_file->IsGood())
|
||||||
|
@ -79,13 +79,13 @@ bool CNANDContentDataFile::GetRange(u32 start, u32 size, u8* buffer)
|
||||||
|
|
||||||
return m_file->ReadBytes(buffer, static_cast<size_t>(size));
|
return m_file->ReadBytes(buffer, static_cast<size_t>(size));
|
||||||
}
|
}
|
||||||
void CNANDContentDataFile::Close()
|
void NANDContentDataFile::Close()
|
||||||
{
|
{
|
||||||
if (m_file && m_file->IsOpen())
|
if (m_file && m_file->IsOpen())
|
||||||
m_file->Close();
|
m_file->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CNANDContentDataBuffer::GetRange(u32 start, u32 size, u8* buffer)
|
bool NANDContentDataBuffer::GetRange(u32 start, u32 size, u8* buffer)
|
||||||
{
|
{
|
||||||
if (start + size > m_buffer.size())
|
if (start + size > m_buffer.size())
|
||||||
return false;
|
return false;
|
||||||
|
@ -94,22 +94,22 @@ bool CNANDContentDataBuffer::GetRange(u32 start, u32 size, u8* buffer)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CNANDContentLoader::CNANDContentLoader(const std::string& content_name, Common::FromWhichRoot from)
|
NANDContentLoader::NANDContentLoader(const std::string& content_name, Common::FromWhichRoot from)
|
||||||
: m_root(from)
|
: m_root(from)
|
||||||
{
|
{
|
||||||
m_Valid = Initialize(content_name);
|
m_Valid = Initialize(content_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
CNANDContentLoader::~CNANDContentLoader()
|
NANDContentLoader::~NANDContentLoader()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CNANDContentLoader::IsValid() const
|
bool NANDContentLoader::IsValid() const
|
||||||
{
|
{
|
||||||
return m_Valid;
|
return m_Valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SNANDContent* CNANDContentLoader::GetContentByID(u32 id) const
|
const NANDContent* NANDContentLoader::GetContentByID(u32 id) const
|
||||||
{
|
{
|
||||||
const auto iterator = std::find_if(m_Content.begin(), m_Content.end(), [id](const auto& content) {
|
const auto iterator = std::find_if(m_Content.begin(), m_Content.end(), [id](const auto& content) {
|
||||||
return content.m_metadata.id == id;
|
return content.m_metadata.id == id;
|
||||||
|
@ -117,7 +117,7 @@ const SNANDContent* CNANDContentLoader::GetContentByID(u32 id) const
|
||||||
return iterator != m_Content.end() ? &*iterator : nullptr;
|
return iterator != m_Content.end() ? &*iterator : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SNANDContent* CNANDContentLoader::GetContentByIndex(int index) const
|
const NANDContent* NANDContentLoader::GetContentByIndex(int index) const
|
||||||
{
|
{
|
||||||
for (auto& Content : m_Content)
|
for (auto& Content : m_Content)
|
||||||
{
|
{
|
||||||
|
@ -129,7 +129,7 @@ const SNANDContent* CNANDContentLoader::GetContentByIndex(int index) const
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CNANDContentLoader::Initialize(const std::string& name)
|
bool NANDContentLoader::Initialize(const std::string& name)
|
||||||
{
|
{
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
return false;
|
return false;
|
||||||
|
@ -173,7 +173,7 @@ bool CNANDContentLoader::Initialize(const std::string& name)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNANDContentLoader::InitializeContentEntries(const std::vector<u8>& data_app)
|
void NANDContentLoader::InitializeContentEntries(const std::vector<u8>& data_app)
|
||||||
{
|
{
|
||||||
if (!m_ticket.IsValid())
|
if (!m_ticket.IsValid())
|
||||||
{
|
{
|
||||||
|
@ -201,7 +201,7 @@ void CNANDContentLoader::InitializeContentEntries(const std::vector<u8>& data_ap
|
||||||
|
|
||||||
u32 rounded_size = Common::AlignUp(static_cast<u32>(content.size), 0x40);
|
u32 rounded_size = Common::AlignUp(static_cast<u32>(content.size), 0x40);
|
||||||
|
|
||||||
m_Content[i].m_Data = std::make_unique<CNANDContentDataBuffer>(Common::AES::Decrypt(
|
m_Content[i].m_Data = std::make_unique<NANDContentDataBuffer>(Common::AES::Decrypt(
|
||||||
title_key.data(), iv.data(), &data_app[data_app_offset], rounded_size));
|
title_key.data(), iv.data(), &data_app[data_app_offset], rounded_size));
|
||||||
data_app_offset += rounded_size;
|
data_app_offset += rounded_size;
|
||||||
}
|
}
|
||||||
|
@ -213,37 +213,36 @@ void CNANDContentLoader::InitializeContentEntries(const std::vector<u8>& data_ap
|
||||||
else
|
else
|
||||||
filename = StringFromFormat("%s/%08x.app", m_Path.c_str(), content.id);
|
filename = StringFromFormat("%s/%08x.app", m_Path.c_str(), content.id);
|
||||||
|
|
||||||
m_Content[i].m_Data = std::make_unique<CNANDContentDataFile>(filename);
|
m_Content[i].m_Data = std::make_unique<NANDContentDataFile>(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Content[i].m_metadata = std::move(content);
|
m_Content[i].m_metadata = std::move(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CNANDContentManager::~CNANDContentManager()
|
NANDContentManager::~NANDContentManager()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const CNANDContentLoader& CNANDContentManager::GetNANDLoader(const std::string& content_path,
|
const NANDContentLoader& NANDContentManager::GetNANDLoader(const std::string& content_path,
|
||||||
Common::FromWhichRoot from)
|
Common::FromWhichRoot from)
|
||||||
{
|
{
|
||||||
auto it = m_map.find(content_path);
|
auto it = m_map.find(content_path);
|
||||||
if (it != m_map.end())
|
if (it != m_map.end())
|
||||||
return *it->second;
|
return *it->second;
|
||||||
return *m_map
|
return *m_map
|
||||||
.emplace_hint(it, std::make_pair(content_path, std::make_unique<CNANDContentLoader>(
|
.emplace_hint(it, std::make_pair(content_path, std::make_unique<NANDContentLoader>(
|
||||||
content_path, from)))
|
content_path, from)))
|
||||||
->second;
|
->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CNANDContentLoader& CNANDContentManager::GetNANDLoader(u64 title_id,
|
const NANDContentLoader& NANDContentManager::GetNANDLoader(u64 title_id, Common::FromWhichRoot from)
|
||||||
Common::FromWhichRoot from)
|
|
||||||
{
|
{
|
||||||
std::string path = Common::GetTitleContentPath(title_id, from);
|
std::string path = Common::GetTitleContentPath(title_id, from);
|
||||||
return GetNANDLoader(path, from);
|
return GetNANDLoader(path, from);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNANDContentManager::ClearCache()
|
void NANDContentManager::ClearCache()
|
||||||
{
|
{
|
||||||
m_map.clear();
|
m_map.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,21 +26,21 @@ enum class Region;
|
||||||
// TODO: move some of these to Core/IOS/ES.
|
// TODO: move some of these to Core/IOS/ES.
|
||||||
IOS::ES::TicketReader FindSignedTicket(u64 title_id);
|
IOS::ES::TicketReader FindSignedTicket(u64 title_id);
|
||||||
|
|
||||||
class CNANDContentData
|
class NANDContentData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~CNANDContentData() = 0;
|
virtual ~NANDContentData() = 0;
|
||||||
virtual void Open() {}
|
virtual void Open() {}
|
||||||
virtual std::vector<u8> Get() = 0;
|
virtual std::vector<u8> Get() = 0;
|
||||||
virtual bool GetRange(u32 start, u32 size, u8* buffer) = 0;
|
virtual bool GetRange(u32 start, u32 size, u8* buffer) = 0;
|
||||||
virtual void Close() {}
|
virtual void Close() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CNANDContentDataFile final : public CNANDContentData
|
class NANDContentDataFile final : public NANDContentData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CNANDContentDataFile(const std::string& filename);
|
explicit NANDContentDataFile(const std::string& filename);
|
||||||
~CNANDContentDataFile();
|
~NANDContentDataFile();
|
||||||
|
|
||||||
void Open() override;
|
void Open() override;
|
||||||
std::vector<u8> Get() override;
|
std::vector<u8> Get() override;
|
||||||
|
@ -53,10 +53,11 @@ private:
|
||||||
const std::string m_filename;
|
const std::string m_filename;
|
||||||
std::unique_ptr<File::IOFile> m_file;
|
std::unique_ptr<File::IOFile> m_file;
|
||||||
};
|
};
|
||||||
class CNANDContentDataBuffer final : public CNANDContentData
|
|
||||||
|
class NANDContentDataBuffer final : public NANDContentData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CNANDContentDataBuffer(const std::vector<u8>& buffer) : m_buffer(buffer) {}
|
explicit NANDContentDataBuffer(const std::vector<u8>& buffer) : m_buffer(buffer) {}
|
||||||
std::vector<u8> Get() override { return m_buffer; }
|
std::vector<u8> Get() override { return m_buffer; }
|
||||||
bool GetRange(u32 start, u32 size, u8* buffer) override;
|
bool GetRange(u32 start, u32 size, u8* buffer) override;
|
||||||
|
|
||||||
|
@ -64,25 +65,25 @@ private:
|
||||||
const std::vector<u8> m_buffer;
|
const std::vector<u8> m_buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SNANDContent
|
struct NANDContent
|
||||||
{
|
{
|
||||||
IOS::ES::Content m_metadata;
|
IOS::ES::Content m_metadata;
|
||||||
std::unique_ptr<CNANDContentData> m_Data;
|
std::unique_ptr<NANDContentData> m_Data;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Instances of this class must be created by CNANDContentManager
|
// Instances of this class must be created by NANDContentManager
|
||||||
class CNANDContentLoader final
|
class NANDContentLoader final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CNANDContentLoader(const std::string& content_name, Common::FromWhichRoot from);
|
explicit NANDContentLoader(const std::string& content_name, Common::FromWhichRoot from);
|
||||||
~CNANDContentLoader();
|
~NANDContentLoader();
|
||||||
|
|
||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
const SNANDContent* GetContentByID(u32 id) const;
|
const NANDContent* GetContentByID(u32 id) const;
|
||||||
const SNANDContent* GetContentByIndex(int index) const;
|
const NANDContent* GetContentByIndex(int index) const;
|
||||||
const IOS::ES::TMDReader& GetTMD() const { return m_tmd; }
|
const IOS::ES::TMDReader& GetTMD() const { return m_tmd; }
|
||||||
const IOS::ES::TicketReader& GetTicket() const { return m_ticket; }
|
const IOS::ES::TicketReader& GetTicket() const { return m_ticket; }
|
||||||
const std::vector<SNANDContent>& GetContent() const { return m_Content; }
|
const std::vector<NANDContent>& GetContent() const { return m_Content; }
|
||||||
private:
|
private:
|
||||||
bool Initialize(const std::string& name);
|
bool Initialize(const std::string& name);
|
||||||
void InitializeContentEntries(const std::vector<u8>& data_app);
|
void InitializeContentEntries(const std::vector<u8>& data_app);
|
||||||
|
@ -94,33 +95,33 @@ private:
|
||||||
IOS::ES::TMDReader m_tmd;
|
IOS::ES::TMDReader m_tmd;
|
||||||
IOS::ES::TicketReader m_ticket;
|
IOS::ES::TicketReader m_ticket;
|
||||||
|
|
||||||
std::vector<SNANDContent> m_Content;
|
std::vector<NANDContent> m_Content;
|
||||||
};
|
};
|
||||||
|
|
||||||
// we open the NAND Content files too often... let's cache them
|
// we open the NAND Content files too often... let's cache them
|
||||||
class CNANDContentManager
|
class NANDContentManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static CNANDContentManager& Access()
|
static NANDContentManager& Access()
|
||||||
{
|
{
|
||||||
static CNANDContentManager instance;
|
static NANDContentManager instance;
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CNANDContentLoader&
|
const NANDContentLoader&
|
||||||
GetNANDLoader(const std::string& content_path,
|
GetNANDLoader(const std::string& content_path,
|
||||||
Common::FromWhichRoot from = Common::FROM_CONFIGURED_ROOT);
|
Common::FromWhichRoot from = Common::FROM_CONFIGURED_ROOT);
|
||||||
const CNANDContentLoader&
|
const NANDContentLoader&
|
||||||
GetNANDLoader(u64 title_id, Common::FromWhichRoot from = Common::FROM_CONFIGURED_ROOT);
|
GetNANDLoader(u64 title_id, Common::FromWhichRoot from = Common::FROM_CONFIGURED_ROOT);
|
||||||
void ClearCache();
|
void ClearCache();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CNANDContentManager() {}
|
NANDContentManager() {}
|
||||||
~CNANDContentManager();
|
~NANDContentManager();
|
||||||
|
|
||||||
CNANDContentManager(CNANDContentManager const&) = delete;
|
NANDContentManager(NANDContentManager const&) = delete;
|
||||||
void operator=(CNANDContentManager const&) = delete;
|
void operator=(NANDContentManager const&) = delete;
|
||||||
|
|
||||||
std::unordered_map<std::string, std::unique_ptr<CNANDContentLoader>> m_map;
|
std::unordered_map<std::string, std::unique_ptr<NANDContentLoader>> m_map;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ void NANDImporter::ImportNANDBin(const std::string& path_to_bin,
|
||||||
ExtractCertificates(nand_root);
|
ExtractCertificates(nand_root);
|
||||||
|
|
||||||
// We have to clear the cache so the new NAND takes effect
|
// We have to clear the cache so the new NAND takes effect
|
||||||
DiscIO::CNANDContentManager::Access().ClearCache();
|
DiscIO::NANDContentManager::Access().ClearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NANDImporter::ReadNANDBin(const std::string& path_to_bin)
|
bool NANDImporter::ReadNANDBin(const std::string& path_to_bin)
|
||||||
|
|
|
@ -37,7 +37,7 @@ struct TGCHeader
|
||||||
u32 unknown_important_2;
|
u32 unknown_important_2;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TGCFileReader final : public IBlobReader
|
class TGCFileReader final : public BlobReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::unique_ptr<TGCFileReader> Create(File::IOFile file);
|
static std::unique_ptr<TGCFileReader> Create(File::IOFile file);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "DiscIO/VolumeDirectory.h"
|
#include "DiscIO/VolumeDirectory.h"
|
||||||
#include "DiscIO/VolumeGC.h"
|
#include "DiscIO/VolumeGC.h"
|
||||||
#include "DiscIO/VolumeWad.h"
|
#include "DiscIO/VolumeWad.h"
|
||||||
#include "DiscIO/VolumeWiiCrypted.h"
|
#include "DiscIO/VolumeWii.h"
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
|
@ -33,10 +33,10 @@ static const unsigned int WII_BANNER_HEIGHT = 64;
|
||||||
static const unsigned int WII_BANNER_SIZE = WII_BANNER_WIDTH * WII_BANNER_HEIGHT * 2;
|
static const unsigned int WII_BANNER_SIZE = WII_BANNER_WIDTH * WII_BANNER_HEIGHT * 2;
|
||||||
static const unsigned int WII_BANNER_OFFSET = 0xA0;
|
static const unsigned int WII_BANNER_OFFSET = 0xA0;
|
||||||
|
|
||||||
const IOS::ES::TicketReader IVolume::INVALID_TICKET{};
|
const IOS::ES::TicketReader Volume::INVALID_TICKET{};
|
||||||
const IOS::ES::TMDReader IVolume::INVALID_TMD{};
|
const IOS::ES::TMDReader Volume::INVALID_TMD{};
|
||||||
|
|
||||||
std::vector<u32> IVolume::GetWiiBanner(int* width, int* height, u64 title_id)
|
std::vector<u32> Volume::GetWiiBanner(int* width, int* height, u64 title_id)
|
||||||
{
|
{
|
||||||
*width = 0;
|
*width = 0;
|
||||||
*height = 0;
|
*height = 0;
|
||||||
|
@ -66,7 +66,7 @@ std::vector<u32> IVolume::GetWiiBanner(int* width, int* height, u64 title_id)
|
||||||
return image_buffer;
|
return image_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<Language, std::string> IVolume::ReadWiiNames(const std::vector<u8>& data)
|
std::map<Language, std::string> Volume::ReadWiiNames(const std::vector<u8>& data)
|
||||||
{
|
{
|
||||||
std::map<Language, std::string> names;
|
std::map<Language, std::string> names;
|
||||||
for (size_t i = 0; i < NUMBER_OF_LANGUAGES; ++i)
|
for (size_t i = 0; i < NUMBER_OF_LANGUAGES; ++i)
|
||||||
|
@ -87,38 +87,38 @@ std::map<Language, std::string> IVolume::ReadWiiNames(const std::vector<u8>& dat
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<IVolume> CreateVolumeFromFilename(const std::string& filename)
|
std::unique_ptr<Volume> CreateVolumeFromFilename(const std::string& filename)
|
||||||
{
|
{
|
||||||
std::unique_ptr<IBlobReader> reader(CreateBlobReader(filename));
|
std::unique_ptr<BlobReader> reader(CreateBlobReader(filename));
|
||||||
if (reader == nullptr)
|
if (reader == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// Check for Wii
|
// Check for Wii
|
||||||
const std::optional<u32> wii_magic = reader->ReadSwapped<u32>(0x18);
|
const std::optional<u32> wii_magic = reader->ReadSwapped<u32>(0x18);
|
||||||
if (wii_magic == u32(0x5D1C9EA3))
|
if (wii_magic == u32(0x5D1C9EA3))
|
||||||
return std::make_unique<CVolumeWiiCrypted>(std::move(reader));
|
return std::make_unique<VolumeWii>(std::move(reader));
|
||||||
|
|
||||||
// Check for WAD
|
// Check for WAD
|
||||||
// 0x206962 for boot2 wads
|
// 0x206962 for boot2 wads
|
||||||
const std::optional<u32> wad_magic = reader->ReadSwapped<u32>(0x02);
|
const std::optional<u32> wad_magic = reader->ReadSwapped<u32>(0x02);
|
||||||
if (wad_magic == u32(0x00204973) || wad_magic == u32(0x00206962))
|
if (wad_magic == u32(0x00204973) || wad_magic == u32(0x00206962))
|
||||||
return std::make_unique<CVolumeWAD>(std::move(reader));
|
return std::make_unique<VolumeWAD>(std::move(reader));
|
||||||
|
|
||||||
// Check for GC
|
// Check for GC
|
||||||
const std::optional<u32> gc_magic = reader->ReadSwapped<u32>(0x1C);
|
const std::optional<u32> gc_magic = reader->ReadSwapped<u32>(0x1C);
|
||||||
if (gc_magic == u32(0xC2339F3D))
|
if (gc_magic == u32(0xC2339F3D))
|
||||||
return std::make_unique<CVolumeGC>(std::move(reader));
|
return std::make_unique<VolumeGC>(std::move(reader));
|
||||||
|
|
||||||
// No known magic words found
|
// No known magic words found
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<IVolume> CreateVolumeFromDirectory(const std::string& directory, bool is_wii,
|
std::unique_ptr<Volume> CreateVolumeFromDirectory(const std::string& directory, bool is_wii,
|
||||||
const std::string& apploader,
|
const std::string& apploader,
|
||||||
const std::string& dol)
|
const std::string& dol)
|
||||||
{
|
{
|
||||||
if (CVolumeDirectory::IsValidDirectory(directory))
|
if (VolumeDirectory::IsValidDirectory(directory))
|
||||||
return std::make_unique<CVolumeDirectory>(directory, is_wii, apploader, dol);
|
return std::make_unique<VolumeDirectory>(directory, is_wii, apploader, dol);
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,11 +37,11 @@ struct Partition final
|
||||||
|
|
||||||
const Partition PARTITION_NONE(std::numeric_limits<u64>::max() - 1);
|
const Partition PARTITION_NONE(std::numeric_limits<u64>::max() - 1);
|
||||||
|
|
||||||
class IVolume
|
class Volume
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IVolume() {}
|
Volume() {}
|
||||||
virtual ~IVolume() {}
|
virtual ~Volume() {}
|
||||||
virtual bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, const Partition& partition) const = 0;
|
virtual bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, const Partition& partition) const = 0;
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::optional<T> ReadSwapped(u64 offset, const Partition& partition) const
|
std::optional<T> ReadSwapped(u64 offset, const Partition& partition) const
|
||||||
|
@ -117,8 +117,8 @@ protected:
|
||||||
static const IOS::ES::TMDReader INVALID_TMD;
|
static const IOS::ES::TMDReader INVALID_TMD;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<IVolume> CreateVolumeFromFilename(const std::string& filename);
|
std::unique_ptr<Volume> CreateVolumeFromFilename(const std::string& filename);
|
||||||
std::unique_ptr<IVolume> CreateVolumeFromDirectory(const std::string& directory, bool is_wii,
|
std::unique_ptr<Volume> CreateVolumeFromDirectory(const std::string& directory, bool is_wii,
|
||||||
const std::string& apploader = "",
|
const std::string& apploader = "",
|
||||||
const std::string& dol = "");
|
const std::string& dol = "");
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,10 @@ static u32 ComputeNameSize(const File::FSTEntry& parent_entry);
|
||||||
static std::string ASCIIToUppercase(std::string str);
|
static std::string ASCIIToUppercase(std::string str);
|
||||||
static void ConvertUTF8NamesToSHIFTJIS(File::FSTEntry& parent_entry);
|
static void ConvertUTF8NamesToSHIFTJIS(File::FSTEntry& parent_entry);
|
||||||
|
|
||||||
const size_t CVolumeDirectory::MAX_NAME_LENGTH;
|
const size_t VolumeDirectory::MAX_NAME_LENGTH;
|
||||||
const size_t CVolumeDirectory::MAX_ID_LENGTH;
|
const size_t VolumeDirectory::MAX_ID_LENGTH;
|
||||||
|
|
||||||
CVolumeDirectory::CVolumeDirectory(const std::string& directory, bool is_wii,
|
VolumeDirectory::VolumeDirectory(const std::string& directory, bool is_wii,
|
||||||
const std::string& apploader, const std::string& dol)
|
const std::string& apploader, const std::string& dol)
|
||||||
: m_data_start_address(-1), m_disk_header(DISKHEADERINFO_ADDRESS),
|
: m_data_start_address(-1), m_disk_header(DISKHEADERINFO_ADDRESS),
|
||||||
m_disk_header_info(std::make_unique<SDiskHeaderInfo>()), m_fst_address(0), m_dol_address(0)
|
m_disk_header_info(std::make_unique<SDiskHeaderInfo>()), m_fst_address(0), m_dol_address(0)
|
||||||
|
@ -56,16 +56,16 @@ CVolumeDirectory::CVolumeDirectory(const std::string& directory, bool is_wii,
|
||||||
BuildFST();
|
BuildFST();
|
||||||
}
|
}
|
||||||
|
|
||||||
CVolumeDirectory::~CVolumeDirectory()
|
VolumeDirectory::~VolumeDirectory()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVolumeDirectory::IsValidDirectory(const std::string& directory)
|
bool VolumeDirectory::IsValidDirectory(const std::string& directory)
|
||||||
{
|
{
|
||||||
return File::IsDirectory(ExtractDirectoryName(directory));
|
return File::IsDirectory(ExtractDirectoryName(directory));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVolumeDirectory::Read(u64 offset, u64 length, u8* buffer, const Partition& partition) const
|
bool VolumeDirectory::Read(u64 offset, u64 length, u8* buffer, const Partition& partition) const
|
||||||
{
|
{
|
||||||
bool decrypt = partition != PARTITION_NONE;
|
bool decrypt = partition != PARTITION_NONE;
|
||||||
|
|
||||||
|
@ -160,27 +160,27 @@ bool CVolumeDirectory::Read(u64 offset, u64 length, u8* buffer, const Partition&
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Partition> CVolumeDirectory::GetPartitions() const
|
std::vector<Partition> VolumeDirectory::GetPartitions() const
|
||||||
{
|
{
|
||||||
return m_is_wii ? std::vector<Partition>{GetGamePartition()} : std::vector<Partition>();
|
return m_is_wii ? std::vector<Partition>{GetGamePartition()} : std::vector<Partition>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Partition CVolumeDirectory::GetGamePartition() const
|
Partition VolumeDirectory::GetGamePartition() const
|
||||||
{
|
{
|
||||||
return m_is_wii ? Partition(0x50000) : PARTITION_NONE;
|
return m_is_wii ? Partition(0x50000) : PARTITION_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CVolumeDirectory::GetGameID(const Partition& partition) const
|
std::string VolumeDirectory::GetGameID(const Partition& partition) const
|
||||||
{
|
{
|
||||||
return std::string(m_disk_header.begin(), m_disk_header.begin() + MAX_ID_LENGTH);
|
return std::string(m_disk_header.begin(), m_disk_header.begin() + MAX_ID_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVolumeDirectory::SetGameID(const std::string& id)
|
void VolumeDirectory::SetGameID(const std::string& id)
|
||||||
{
|
{
|
||||||
memcpy(m_disk_header.data(), id.c_str(), std::min(id.length(), MAX_ID_LENGTH));
|
memcpy(m_disk_header.data(), id.c_str(), std::min(id.length(), MAX_ID_LENGTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
Region CVolumeDirectory::GetRegion() const
|
Region VolumeDirectory::GetRegion() const
|
||||||
{
|
{
|
||||||
if (m_is_wii)
|
if (m_is_wii)
|
||||||
return RegionSwitchWii(m_disk_header[3]);
|
return RegionSwitchWii(m_disk_header[3]);
|
||||||
|
@ -188,18 +188,18 @@ Region CVolumeDirectory::GetRegion() const
|
||||||
return RegionSwitchGC(m_disk_header[3]);
|
return RegionSwitchGC(m_disk_header[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Country CVolumeDirectory::GetCountry(const Partition& partition) const
|
Country VolumeDirectory::GetCountry(const Partition& partition) const
|
||||||
{
|
{
|
||||||
return CountrySwitch(m_disk_header[3]);
|
return CountrySwitch(m_disk_header[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CVolumeDirectory::GetMakerID(const Partition& partition) const
|
std::string VolumeDirectory::GetMakerID(const Partition& partition) const
|
||||||
{
|
{
|
||||||
// Not implemented
|
// Not implemented
|
||||||
return "00";
|
return "00";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CVolumeDirectory::GetInternalName(const Partition& partition) const
|
std::string VolumeDirectory::GetInternalName(const Partition& partition) const
|
||||||
{
|
{
|
||||||
char name[0x60];
|
char name[0x60];
|
||||||
if (Read(0x20, 0x60, (u8*)name, partition))
|
if (Read(0x20, 0x60, (u8*)name, partition))
|
||||||
|
@ -208,7 +208,7 @@ std::string CVolumeDirectory::GetInternalName(const Partition& partition) const
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<Language, std::string> CVolumeDirectory::GetLongNames() const
|
std::map<Language, std::string> VolumeDirectory::GetLongNames() const
|
||||||
{
|
{
|
||||||
std::string name = GetInternalName();
|
std::string name = GetInternalName();
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
|
@ -216,7 +216,7 @@ std::map<Language, std::string> CVolumeDirectory::GetLongNames() const
|
||||||
return {{Language::LANGUAGE_UNKNOWN, name}};
|
return {{Language::LANGUAGE_UNKNOWN, name}};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u32> CVolumeDirectory::GetBanner(int* width, int* height) const
|
std::vector<u32> VolumeDirectory::GetBanner(int* width, int* height) const
|
||||||
{
|
{
|
||||||
// Not implemented
|
// Not implemented
|
||||||
*width = 0;
|
*width = 0;
|
||||||
|
@ -224,25 +224,25 @@ std::vector<u32> CVolumeDirectory::GetBanner(int* width, int* height) const
|
||||||
return std::vector<u32>();
|
return std::vector<u32>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVolumeDirectory::SetName(const std::string& name)
|
void VolumeDirectory::SetName(const std::string& name)
|
||||||
{
|
{
|
||||||
size_t length = std::min(name.length(), MAX_NAME_LENGTH);
|
size_t length = std::min(name.length(), MAX_NAME_LENGTH);
|
||||||
memcpy(&m_disk_header[0x20], name.c_str(), length);
|
memcpy(&m_disk_header[0x20], name.c_str(), length);
|
||||||
m_disk_header[length + 0x20] = 0;
|
m_disk_header[length + 0x20] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CVolumeDirectory::GetApploaderDate(const Partition& partition) const
|
std::string VolumeDirectory::GetApploaderDate(const Partition& partition) const
|
||||||
{
|
{
|
||||||
// Not implemented
|
// Not implemented
|
||||||
return "VOID";
|
return "VOID";
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform CVolumeDirectory::GetVolumeType() const
|
Platform VolumeDirectory::GetVolumeType() const
|
||||||
{
|
{
|
||||||
return m_is_wii ? Platform::WII_DISC : Platform::GAMECUBE_DISC;
|
return m_is_wii ? Platform::WII_DISC : Platform::GAMECUBE_DISC;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlobType CVolumeDirectory::GetBlobType() const
|
BlobType VolumeDirectory::GetBlobType() const
|
||||||
{
|
{
|
||||||
// VolumeDirectory isn't actually a blob, but it sort of acts
|
// VolumeDirectory isn't actually a blob, but it sort of acts
|
||||||
// like one, so it makes sense that it has its own blob type.
|
// like one, so it makes sense that it has its own blob type.
|
||||||
|
@ -250,19 +250,19 @@ BlobType CVolumeDirectory::GetBlobType() const
|
||||||
return BlobType::DIRECTORY;
|
return BlobType::DIRECTORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 CVolumeDirectory::GetSize() const
|
u64 VolumeDirectory::GetSize() const
|
||||||
{
|
{
|
||||||
// Not implemented
|
// Not implemented
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 CVolumeDirectory::GetRawSize() const
|
u64 VolumeDirectory::GetRawSize() const
|
||||||
{
|
{
|
||||||
// Not implemented
|
// Not implemented
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CVolumeDirectory::ExtractDirectoryName(const std::string& directory)
|
std::string VolumeDirectory::ExtractDirectoryName(const std::string& directory)
|
||||||
{
|
{
|
||||||
std::string result = directory;
|
std::string result = directory;
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ std::string CVolumeDirectory::ExtractDirectoryName(const std::string& directory)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVolumeDirectory::SetDiskTypeWii()
|
void VolumeDirectory::SetDiskTypeWii()
|
||||||
{
|
{
|
||||||
Write32(0x5d1c9ea3, 0x18, &m_disk_header);
|
Write32(0x5d1c9ea3, 0x18, &m_disk_header);
|
||||||
memset(&m_disk_header[0x1c], 0, 4);
|
memset(&m_disk_header[0x1c], 0, 4);
|
||||||
|
@ -296,7 +296,7 @@ void CVolumeDirectory::SetDiskTypeWii()
|
||||||
m_address_shift = 2;
|
m_address_shift = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVolumeDirectory::SetDiskTypeGC()
|
void VolumeDirectory::SetDiskTypeGC()
|
||||||
{
|
{
|
||||||
memset(&m_disk_header[0x18], 0, 4);
|
memset(&m_disk_header[0x18], 0, 4);
|
||||||
Write32(0xc2339f3d, 0x1c, &m_disk_header);
|
Write32(0xc2339f3d, 0x1c, &m_disk_header);
|
||||||
|
@ -305,7 +305,7 @@ void CVolumeDirectory::SetDiskTypeGC()
|
||||||
m_address_shift = 0;
|
m_address_shift = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVolumeDirectory::SetApploader(const std::string& apploader)
|
bool VolumeDirectory::SetApploader(const std::string& apploader)
|
||||||
{
|
{
|
||||||
if (!apploader.empty())
|
if (!apploader.empty())
|
||||||
{
|
{
|
||||||
|
@ -338,7 +338,7 @@ bool CVolumeDirectory::SetApploader(const std::string& apploader)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVolumeDirectory::SetDOL(const std::string& dol)
|
void VolumeDirectory::SetDOL(const std::string& dol)
|
||||||
{
|
{
|
||||||
if (!dol.empty())
|
if (!dol.empty())
|
||||||
{
|
{
|
||||||
|
@ -354,7 +354,7 @@ void CVolumeDirectory::SetDOL(const std::string& dol)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVolumeDirectory::BuildFST()
|
void VolumeDirectory::BuildFST()
|
||||||
{
|
{
|
||||||
m_fst_data.clear();
|
m_fst_data.clear();
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ void CVolumeDirectory::BuildFST()
|
||||||
Write32((u32)(m_fst_data.size() >> m_address_shift), 0x042c, &m_disk_header);
|
Write32((u32)(m_fst_data.size() >> m_address_shift), 0x042c, &m_disk_header);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVolumeDirectory::WriteToBuffer(u64 source_start_address, u64 source_length, const u8* source,
|
void VolumeDirectory::WriteToBuffer(u64 source_start_address, u64 source_length, const u8* source,
|
||||||
u64* address, u64* length, u8** buffer) const
|
u64* address, u64* length, u8** buffer) const
|
||||||
{
|
{
|
||||||
if (*length == 0)
|
if (*length == 0)
|
||||||
|
@ -416,7 +416,7 @@ void CVolumeDirectory::WriteToBuffer(u64 source_start_address, u64 source_length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVolumeDirectory::PadToAddress(u64 start_address, u64* address, u64* length, u8** buffer) const
|
void VolumeDirectory::PadToAddress(u64 start_address, u64* address, u64* length, u8** buffer) const
|
||||||
{
|
{
|
||||||
if (start_address > *address && *length > 0)
|
if (start_address > *address && *length > 0)
|
||||||
{
|
{
|
||||||
|
@ -428,7 +428,7 @@ void CVolumeDirectory::PadToAddress(u64 start_address, u64* address, u64* length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVolumeDirectory::Write32(u32 data, u32 offset, std::vector<u8>* const buffer)
|
void VolumeDirectory::Write32(u32 data, u32 offset, std::vector<u8>* const buffer)
|
||||||
{
|
{
|
||||||
(*buffer)[offset++] = (data >> 24);
|
(*buffer)[offset++] = (data >> 24);
|
||||||
(*buffer)[offset++] = (data >> 16) & 0xff;
|
(*buffer)[offset++] = (data >> 16) & 0xff;
|
||||||
|
@ -436,7 +436,7 @@ void CVolumeDirectory::Write32(u32 data, u32 offset, std::vector<u8>* const buff
|
||||||
(*buffer)[offset] = (data)&0xff;
|
(*buffer)[offset] = (data)&0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVolumeDirectory::WriteEntryData(u32* entry_offset, u8 type, u32 name_offset, u64 data_offset,
|
void VolumeDirectory::WriteEntryData(u32* entry_offset, u8 type, u32 name_offset, u64 data_offset,
|
||||||
u64 length, u32 address_shift)
|
u64 length, u32 address_shift)
|
||||||
{
|
{
|
||||||
m_fst_data[(*entry_offset)++] = type;
|
m_fst_data[(*entry_offset)++] = type;
|
||||||
|
@ -452,14 +452,14 @@ void CVolumeDirectory::WriteEntryData(u32* entry_offset, u8 type, u32 name_offse
|
||||||
*entry_offset += 4;
|
*entry_offset += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVolumeDirectory::WriteEntryName(u32* name_offset, const std::string& name)
|
void VolumeDirectory::WriteEntryName(u32* name_offset, const std::string& name)
|
||||||
{
|
{
|
||||||
strncpy((char*)&m_fst_data[*name_offset + m_fst_name_offset], name.c_str(), name.length() + 1);
|
strncpy((char*)&m_fst_data[*name_offset + m_fst_name_offset], name.c_str(), name.length() + 1);
|
||||||
|
|
||||||
*name_offset += (u32)(name.length() + 1);
|
*name_offset += (u32)(name.length() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVolumeDirectory::WriteDirectory(const File::FSTEntry& parent_entry, u32* fst_offset,
|
void VolumeDirectory::WriteDirectory(const File::FSTEntry& parent_entry, u32* fst_offset,
|
||||||
u32* name_offset, u64* data_offset, u32 parent_entry_index)
|
u32* name_offset, u64* data_offset, u32 parent_entry_index)
|
||||||
{
|
{
|
||||||
std::vector<File::FSTEntry> sorted_entries = parent_entry.children;
|
std::vector<File::FSTEntry> sorted_entries = parent_entry.children;
|
||||||
|
|
|
@ -30,13 +30,13 @@ enum class Language;
|
||||||
enum class Region;
|
enum class Region;
|
||||||
enum class Platform;
|
enum class Platform;
|
||||||
|
|
||||||
class CVolumeDirectory : public IVolume
|
class VolumeDirectory : public Volume
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CVolumeDirectory(const std::string& directory, bool is_wii, const std::string& apploader = "",
|
VolumeDirectory(const std::string& directory, bool is_wii, const std::string& apploader = "",
|
||||||
const std::string& dol = "");
|
const std::string& dol = "");
|
||||||
|
|
||||||
~CVolumeDirectory();
|
~VolumeDirectory();
|
||||||
|
|
||||||
static bool IsValidDirectory(const std::string& directory);
|
static bool IsValidDirectory(const std::string& directory);
|
||||||
|
|
||||||
|
|
|
@ -24,16 +24,16 @@
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
CVolumeGC::CVolumeGC(std::unique_ptr<IBlobReader> reader) : m_pReader(std::move(reader))
|
VolumeGC::VolumeGC(std::unique_ptr<BlobReader> reader) : m_pReader(std::move(reader))
|
||||||
{
|
{
|
||||||
_assert_(m_pReader);
|
_assert_(m_pReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
CVolumeGC::~CVolumeGC()
|
VolumeGC::~VolumeGC()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVolumeGC::Read(u64 _Offset, u64 _Length, u8* _pBuffer, const Partition& partition) const
|
bool VolumeGC::Read(u64 _Offset, u64 _Length, u8* _pBuffer, const Partition& partition) const
|
||||||
{
|
{
|
||||||
if (partition != PARTITION_NONE)
|
if (partition != PARTITION_NONE)
|
||||||
return false;
|
return false;
|
||||||
|
@ -41,7 +41,7 @@ bool CVolumeGC::Read(u64 _Offset, u64 _Length, u8* _pBuffer, const Partition& pa
|
||||||
return m_pReader->Read(_Offset, _Length, _pBuffer);
|
return m_pReader->Read(_Offset, _Length, _pBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CVolumeGC::GetGameID(const Partition& partition) const
|
std::string VolumeGC::GetGameID(const Partition& partition) const
|
||||||
{
|
{
|
||||||
static const std::string NO_UID("NO_UID");
|
static const std::string NO_UID("NO_UID");
|
||||||
|
|
||||||
|
@ -56,19 +56,19 @@ std::string CVolumeGC::GetGameID(const Partition& partition) const
|
||||||
return DecodeString(ID);
|
return DecodeString(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
Region CVolumeGC::GetRegion() const
|
Region VolumeGC::GetRegion() const
|
||||||
{
|
{
|
||||||
const std::optional<u8> country_code = ReadSwapped<u8>(3, PARTITION_NONE);
|
const std::optional<u8> country_code = ReadSwapped<u8>(3, PARTITION_NONE);
|
||||||
return country_code ? RegionSwitchGC(*country_code) : Region::UNKNOWN_REGION;
|
return country_code ? RegionSwitchGC(*country_code) : Region::UNKNOWN_REGION;
|
||||||
}
|
}
|
||||||
|
|
||||||
Country CVolumeGC::GetCountry(const Partition& partition) const
|
Country VolumeGC::GetCountry(const Partition& partition) const
|
||||||
{
|
{
|
||||||
const std::optional<u8> country_code = ReadSwapped<u8>(3, partition);
|
const std::optional<u8> country_code = ReadSwapped<u8>(3, partition);
|
||||||
return country_code ? CountrySwitch(*country_code) : Country::COUNTRY_UNKNOWN;
|
return country_code ? CountrySwitch(*country_code) : Country::COUNTRY_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CVolumeGC::GetMakerID(const Partition& partition) const
|
std::string VolumeGC::GetMakerID(const Partition& partition) const
|
||||||
{
|
{
|
||||||
char makerID[2];
|
char makerID[2];
|
||||||
if (!Read(0x4, 0x2, (u8*)&makerID, partition))
|
if (!Read(0x4, 0x2, (u8*)&makerID, partition))
|
||||||
|
@ -77,13 +77,13 @@ std::string CVolumeGC::GetMakerID(const Partition& partition) const
|
||||||
return DecodeString(makerID);
|
return DecodeString(makerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<u16> CVolumeGC::GetRevision(const Partition& partition) const
|
std::optional<u16> VolumeGC::GetRevision(const Partition& partition) const
|
||||||
{
|
{
|
||||||
std::optional<u8> revision = ReadSwapped<u8>(7, partition);
|
std::optional<u8> revision = ReadSwapped<u8>(7, partition);
|
||||||
return revision ? *revision : std::optional<u16>();
|
return revision ? *revision : std::optional<u16>();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CVolumeGC::GetInternalName(const Partition& partition) const
|
std::string VolumeGC::GetInternalName(const Partition& partition) const
|
||||||
{
|
{
|
||||||
char name[0x60];
|
char name[0x60];
|
||||||
if (Read(0x20, 0x60, (u8*)name, partition))
|
if (Read(0x20, 0x60, (u8*)name, partition))
|
||||||
|
@ -92,37 +92,37 @@ std::string CVolumeGC::GetInternalName(const Partition& partition) const
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<Language, std::string> CVolumeGC::GetShortNames() const
|
std::map<Language, std::string> VolumeGC::GetShortNames() const
|
||||||
{
|
{
|
||||||
LoadBannerFile();
|
LoadBannerFile();
|
||||||
return m_short_names;
|
return m_short_names;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<Language, std::string> CVolumeGC::GetLongNames() const
|
std::map<Language, std::string> VolumeGC::GetLongNames() const
|
||||||
{
|
{
|
||||||
LoadBannerFile();
|
LoadBannerFile();
|
||||||
return m_long_names;
|
return m_long_names;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<Language, std::string> CVolumeGC::GetShortMakers() const
|
std::map<Language, std::string> VolumeGC::GetShortMakers() const
|
||||||
{
|
{
|
||||||
LoadBannerFile();
|
LoadBannerFile();
|
||||||
return m_short_makers;
|
return m_short_makers;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<Language, std::string> CVolumeGC::GetLongMakers() const
|
std::map<Language, std::string> VolumeGC::GetLongMakers() const
|
||||||
{
|
{
|
||||||
LoadBannerFile();
|
LoadBannerFile();
|
||||||
return m_long_makers;
|
return m_long_makers;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<Language, std::string> CVolumeGC::GetDescriptions() const
|
std::map<Language, std::string> VolumeGC::GetDescriptions() const
|
||||||
{
|
{
|
||||||
LoadBannerFile();
|
LoadBannerFile();
|
||||||
return m_descriptions;
|
return m_descriptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u32> CVolumeGC::GetBanner(int* width, int* height) const
|
std::vector<u32> VolumeGC::GetBanner(int* width, int* height) const
|
||||||
{
|
{
|
||||||
LoadBannerFile();
|
LoadBannerFile();
|
||||||
*width = m_image_width;
|
*width = m_image_width;
|
||||||
|
@ -130,7 +130,7 @@ std::vector<u32> CVolumeGC::GetBanner(int* width, int* height) const
|
||||||
return m_image_buffer;
|
return m_image_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CVolumeGC::GetApploaderDate(const Partition& partition) const
|
std::string VolumeGC::GetApploaderDate(const Partition& partition) const
|
||||||
{
|
{
|
||||||
char date[16];
|
char date[16];
|
||||||
if (!Read(0x2440, 0x10, (u8*)&date, partition))
|
if (!Read(0x2440, 0x10, (u8*)&date, partition))
|
||||||
|
@ -139,32 +139,32 @@ std::string CVolumeGC::GetApploaderDate(const Partition& partition) const
|
||||||
return DecodeString(date);
|
return DecodeString(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlobType CVolumeGC::GetBlobType() const
|
BlobType VolumeGC::GetBlobType() const
|
||||||
{
|
{
|
||||||
return m_pReader->GetBlobType();
|
return m_pReader->GetBlobType();
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 CVolumeGC::GetSize() const
|
u64 VolumeGC::GetSize() const
|
||||||
{
|
{
|
||||||
return m_pReader->GetDataSize();
|
return m_pReader->GetDataSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 CVolumeGC::GetRawSize() const
|
u64 VolumeGC::GetRawSize() const
|
||||||
{
|
{
|
||||||
return m_pReader->GetRawSize();
|
return m_pReader->GetRawSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<u8> CVolumeGC::GetDiscNumber(const Partition& partition) const
|
std::optional<u8> VolumeGC::GetDiscNumber(const Partition& partition) const
|
||||||
{
|
{
|
||||||
return ReadSwapped<u8>(6, partition);
|
return ReadSwapped<u8>(6, partition);
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform CVolumeGC::GetVolumeType() const
|
Platform VolumeGC::GetVolumeType() const
|
||||||
{
|
{
|
||||||
return Platform::GAMECUBE_DISC;
|
return Platform::GAMECUBE_DISC;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVolumeGC::LoadBannerFile() const
|
void VolumeGC::LoadBannerFile() const
|
||||||
{
|
{
|
||||||
// If opening.bnr has been loaded already, return immediately
|
// If opening.bnr has been loaded already, return immediately
|
||||||
if (m_banner_loaded)
|
if (m_banner_loaded)
|
||||||
|
@ -173,7 +173,7 @@ void CVolumeGC::LoadBannerFile() const
|
||||||
m_banner_loaded = true;
|
m_banner_loaded = true;
|
||||||
|
|
||||||
GCBanner banner_file;
|
GCBanner banner_file;
|
||||||
std::unique_ptr<IFileSystem> file_system(CreateFileSystem(this, PARTITION_NONE));
|
std::unique_ptr<FileSystem> file_system(CreateFileSystem(this, PARTITION_NONE));
|
||||||
if (!file_system)
|
if (!file_system)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ void CVolumeGC::LoadBannerFile() const
|
||||||
ExtractBannerInformation(banner_file, is_bnr1);
|
ExtractBannerInformation(banner_file, is_bnr1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVolumeGC::ExtractBannerInformation(const GCBanner& banner_file, bool is_bnr1) const
|
void VolumeGC::ExtractBannerInformation(const GCBanner& banner_file, bool is_bnr1) const
|
||||||
{
|
{
|
||||||
u32 number_of_languages = 0;
|
u32 number_of_languages = 0;
|
||||||
Language start_language = Language::LANGUAGE_UNKNOWN;
|
Language start_language = Language::LANGUAGE_UNKNOWN;
|
||||||
|
|
|
@ -17,18 +17,18 @@
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
class IBlobReader;
|
class BlobReader;
|
||||||
enum class BlobType;
|
enum class BlobType;
|
||||||
enum class Country;
|
enum class Country;
|
||||||
enum class Language;
|
enum class Language;
|
||||||
enum class Region;
|
enum class Region;
|
||||||
enum class Platform;
|
enum class Platform;
|
||||||
|
|
||||||
class CVolumeGC : public IVolume
|
class VolumeGC : public Volume
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CVolumeGC(std::unique_ptr<IBlobReader> reader);
|
VolumeGC(std::unique_ptr<BlobReader> reader);
|
||||||
~CVolumeGC();
|
~VolumeGC();
|
||||||
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer,
|
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer,
|
||||||
const Partition& partition = PARTITION_NONE) const override;
|
const Partition& partition = PARTITION_NONE) const override;
|
||||||
std::string GetGameID(const Partition& partition = PARTITION_NONE) const override;
|
std::string GetGameID(const Partition& partition = PARTITION_NONE) const override;
|
||||||
|
@ -93,7 +93,7 @@ private:
|
||||||
mutable int m_image_height = 0;
|
mutable int m_image_height = 0;
|
||||||
mutable int m_image_width = 0;
|
mutable int m_image_width = 0;
|
||||||
|
|
||||||
std::unique_ptr<IBlobReader> m_pReader;
|
std::unique_ptr<BlobReader> m_pReader;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
CVolumeWAD::CVolumeWAD(std::unique_ptr<IBlobReader> reader) : m_reader(std::move(reader))
|
VolumeWAD::VolumeWAD(std::unique_ptr<BlobReader> reader) : m_reader(std::move(reader))
|
||||||
{
|
{
|
||||||
_assert_(m_reader);
|
_assert_(m_reader);
|
||||||
|
|
||||||
|
@ -53,11 +53,11 @@ CVolumeWAD::CVolumeWAD(std::unique_ptr<IBlobReader> reader) : m_reader(std::move
|
||||||
m_tmd.SetBytes(std::move(tmd_buffer));
|
m_tmd.SetBytes(std::move(tmd_buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
CVolumeWAD::~CVolumeWAD()
|
VolumeWAD::~VolumeWAD()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVolumeWAD::Read(u64 offset, u64 length, u8* buffer, const Partition& partition) const
|
bool VolumeWAD::Read(u64 offset, u64 length, u8* buffer, const Partition& partition) const
|
||||||
{
|
{
|
||||||
if (partition != PARTITION_NONE)
|
if (partition != PARTITION_NONE)
|
||||||
return false;
|
return false;
|
||||||
|
@ -65,14 +65,14 @@ bool CVolumeWAD::Read(u64 offset, u64 length, u8* buffer, const Partition& parti
|
||||||
return m_reader->Read(offset, length, buffer);
|
return m_reader->Read(offset, length, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
Region CVolumeWAD::GetRegion() const
|
Region VolumeWAD::GetRegion() const
|
||||||
{
|
{
|
||||||
if (!m_tmd.IsValid())
|
if (!m_tmd.IsValid())
|
||||||
return Region::UNKNOWN_REGION;
|
return Region::UNKNOWN_REGION;
|
||||||
return m_tmd.GetRegion();
|
return m_tmd.GetRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
Country CVolumeWAD::GetCountry(const Partition& partition) const
|
Country VolumeWAD::GetCountry(const Partition& partition) const
|
||||||
{
|
{
|
||||||
if (!m_tmd.IsValid())
|
if (!m_tmd.IsValid())
|
||||||
return Country::COUNTRY_UNKNOWN;
|
return Country::COUNTRY_UNKNOWN;
|
||||||
|
@ -84,17 +84,17 @@ Country CVolumeWAD::GetCountry(const Partition& partition) const
|
||||||
return CountrySwitch(country_code);
|
return CountrySwitch(country_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
const IOS::ES::TMDReader& CVolumeWAD::GetTMD(const Partition& partition) const
|
const IOS::ES::TMDReader& VolumeWAD::GetTMD(const Partition& partition) const
|
||||||
{
|
{
|
||||||
return m_tmd;
|
return m_tmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CVolumeWAD::GetGameID(const Partition& partition) const
|
std::string VolumeWAD::GetGameID(const Partition& partition) const
|
||||||
{
|
{
|
||||||
return m_tmd.GetGameID();
|
return m_tmd.GetGameID();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CVolumeWAD::GetMakerID(const Partition& partition) const
|
std::string VolumeWAD::GetMakerID(const Partition& partition) const
|
||||||
{
|
{
|
||||||
char temp[2];
|
char temp[2];
|
||||||
if (!Read(0x198 + m_tmd_offset, 2, (u8*)temp, partition))
|
if (!Read(0x198 + m_tmd_offset, 2, (u8*)temp, partition))
|
||||||
|
@ -108,12 +108,12 @@ std::string CVolumeWAD::GetMakerID(const Partition& partition) const
|
||||||
return DecodeString(temp);
|
return DecodeString(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<u64> CVolumeWAD::GetTitleID(const Partition& partition) const
|
std::optional<u64> VolumeWAD::GetTitleID(const Partition& partition) const
|
||||||
{
|
{
|
||||||
return ReadSwapped<u64>(m_offset + 0x01DC, partition);
|
return ReadSwapped<u64>(m_offset + 0x01DC, partition);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<u16> CVolumeWAD::GetRevision(const Partition& partition) const
|
std::optional<u16> VolumeWAD::GetRevision(const Partition& partition) const
|
||||||
{
|
{
|
||||||
if (!m_tmd.IsValid())
|
if (!m_tmd.IsValid())
|
||||||
return {};
|
return {};
|
||||||
|
@ -121,12 +121,12 @@ std::optional<u16> CVolumeWAD::GetRevision(const Partition& partition) const
|
||||||
return m_tmd.GetTitleVersion();
|
return m_tmd.GetTitleVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform CVolumeWAD::GetVolumeType() const
|
Platform VolumeWAD::GetVolumeType() const
|
||||||
{
|
{
|
||||||
return Platform::WII_WAD;
|
return Platform::WII_WAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<Language, std::string> CVolumeWAD::GetLongNames() const
|
std::map<Language, std::string> VolumeWAD::GetLongNames() const
|
||||||
{
|
{
|
||||||
if (!m_tmd.IsValid() || !IOS::ES::IsChannel(m_tmd.GetTitleId()))
|
if (!m_tmd.IsValid() || !IOS::ES::IsChannel(m_tmd.GetTitleId()))
|
||||||
return {};
|
return {};
|
||||||
|
@ -137,7 +137,7 @@ std::map<Language, std::string> CVolumeWAD::GetLongNames() const
|
||||||
return ReadWiiNames(name_data);
|
return ReadWiiNames(name_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u32> CVolumeWAD::GetBanner(int* width, int* height) const
|
std::vector<u32> VolumeWAD::GetBanner(int* width, int* height) const
|
||||||
{
|
{
|
||||||
*width = 0;
|
*width = 0;
|
||||||
*height = 0;
|
*height = 0;
|
||||||
|
@ -149,17 +149,17 @@ std::vector<u32> CVolumeWAD::GetBanner(int* width, int* height) const
|
||||||
return GetWiiBanner(width, height, *title_id);
|
return GetWiiBanner(width, height, *title_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlobType CVolumeWAD::GetBlobType() const
|
BlobType VolumeWAD::GetBlobType() const
|
||||||
{
|
{
|
||||||
return m_reader->GetBlobType();
|
return m_reader->GetBlobType();
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 CVolumeWAD::GetSize() const
|
u64 VolumeWAD::GetSize() const
|
||||||
{
|
{
|
||||||
return m_reader->GetDataSize();
|
return m_reader->GetDataSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 CVolumeWAD::GetRawSize() const
|
u64 VolumeWAD::GetRawSize() const
|
||||||
{
|
{
|
||||||
return m_reader->GetRawSize();
|
return m_reader->GetRawSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,23 +15,23 @@
|
||||||
#include "DiscIO/Volume.h"
|
#include "DiscIO/Volume.h"
|
||||||
|
|
||||||
// --- this volume type is used for Wad files ---
|
// --- this volume type is used for Wad files ---
|
||||||
// Some of this code might look redundant with the CNANDContentLoader class, however,
|
// Some of this code might look redundant with the NANDContentLoader class, however,
|
||||||
// We do not do any decryption here, we do raw read, so things are -Faster-
|
// We do not do any decryption here, we do raw read, so things are -Faster-
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
class IBlobReader;
|
class BlobReader;
|
||||||
enum class BlobType;
|
enum class BlobType;
|
||||||
enum class Country;
|
enum class Country;
|
||||||
enum class Language;
|
enum class Language;
|
||||||
enum class Region;
|
enum class Region;
|
||||||
enum class Platform;
|
enum class Platform;
|
||||||
|
|
||||||
class CVolumeWAD : public IVolume
|
class VolumeWAD : public Volume
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CVolumeWAD(std::unique_ptr<IBlobReader> reader);
|
VolumeWAD(std::unique_ptr<BlobReader> reader);
|
||||||
~CVolumeWAD();
|
~VolumeWAD();
|
||||||
bool Read(u64 offset, u64 length, u8* buffer,
|
bool Read(u64 offset, u64 length, u8* buffer,
|
||||||
const Partition& partition = PARTITION_NONE) const override;
|
const Partition& partition = PARTITION_NONE) const override;
|
||||||
std::optional<u64> GetTitleID(const Partition& partition = PARTITION_NONE) const override;
|
std::optional<u64> GetTitleID(const Partition& partition = PARTITION_NONE) const override;
|
||||||
|
@ -58,7 +58,7 @@ public:
|
||||||
u64 GetRawSize() const override;
|
u64 GetRawSize() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<IBlobReader> m_reader;
|
std::unique_ptr<BlobReader> m_reader;
|
||||||
IOS::ES::TMDReader m_tmd;
|
IOS::ES::TMDReader m_tmd;
|
||||||
u32 m_offset = 0;
|
u32 m_offset = 0;
|
||||||
u32 m_tmd_offset = 0;
|
u32 m_tmd_offset = 0;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "DiscIO/VolumeWiiCrypted.h"
|
#include "DiscIO/VolumeWii.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
@ -31,7 +31,7 @@ namespace DiscIO
|
||||||
{
|
{
|
||||||
constexpr u64 PARTITION_DATA_OFFSET = 0x20000;
|
constexpr u64 PARTITION_DATA_OFFSET = 0x20000;
|
||||||
|
|
||||||
CVolumeWiiCrypted::CVolumeWiiCrypted(std::unique_ptr<IBlobReader> reader)
|
VolumeWii::VolumeWii(std::unique_ptr<BlobReader> reader)
|
||||||
: m_pReader(std::move(reader)), m_game_partition(PARTITION_NONE), m_last_decrypted_block(-1)
|
: m_pReader(std::move(reader)), m_game_partition(PARTITION_NONE), m_last_decrypted_block(-1)
|
||||||
{
|
{
|
||||||
_assert_(m_pReader);
|
_assert_(m_pReader);
|
||||||
|
@ -50,7 +50,8 @@ CVolumeWiiCrypted::CVolumeWiiCrypted(std::unique_ptr<IBlobReader> reader)
|
||||||
if (!number_of_partitions)
|
if (!number_of_partitions)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::optional<u32> read_buffer = m_pReader->ReadSwapped<u32>(0x40000 + (partition_group * 8) + 4);
|
std::optional<u32> read_buffer =
|
||||||
|
m_pReader->ReadSwapped<u32>(0x40000 + (partition_group * 8) + 4);
|
||||||
if (!read_buffer)
|
if (!read_buffer)
|
||||||
continue;
|
continue;
|
||||||
const u64 partition_table_offset = static_cast<u64>(*read_buffer) << 2;
|
const u64 partition_table_offset = static_cast<u64>(*read_buffer) << 2;
|
||||||
|
@ -115,12 +116,11 @@ CVolumeWiiCrypted::CVolumeWiiCrypted(std::unique_ptr<IBlobReader> reader)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CVolumeWiiCrypted::~CVolumeWiiCrypted()
|
VolumeWii::~VolumeWii()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer,
|
bool VolumeWii::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer, const Partition& partition) const
|
||||||
const Partition& partition) const
|
|
||||||
{
|
{
|
||||||
if (partition == PARTITION_NONE)
|
if (partition == PARTITION_NONE)
|
||||||
return m_pReader->Read(_ReadOffset, _Length, _pBuffer);
|
return m_pReader->Read(_ReadOffset, _Length, _pBuffer);
|
||||||
|
@ -173,7 +173,7 @@ bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Partition> CVolumeWiiCrypted::GetPartitions() const
|
std::vector<Partition> VolumeWii::GetPartitions() const
|
||||||
{
|
{
|
||||||
std::vector<Partition> partitions;
|
std::vector<Partition> partitions;
|
||||||
for (const auto& pair : m_partition_keys)
|
for (const auto& pair : m_partition_keys)
|
||||||
|
@ -181,12 +181,12 @@ std::vector<Partition> CVolumeWiiCrypted::GetPartitions() const
|
||||||
return partitions;
|
return partitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
Partition CVolumeWiiCrypted::GetGamePartition() const
|
Partition VolumeWii::GetGamePartition() const
|
||||||
{
|
{
|
||||||
return m_game_partition;
|
return m_game_partition;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<u64> CVolumeWiiCrypted::GetTitleID(const Partition& partition) const
|
std::optional<u64> VolumeWii::GetTitleID(const Partition& partition) const
|
||||||
{
|
{
|
||||||
const IOS::ES::TicketReader& ticket = GetTicket(partition);
|
const IOS::ES::TicketReader& ticket = GetTicket(partition);
|
||||||
if (!ticket.IsValid())
|
if (!ticket.IsValid())
|
||||||
|
@ -194,19 +194,19 @@ std::optional<u64> CVolumeWiiCrypted::GetTitleID(const Partition& partition) con
|
||||||
return ticket.GetTitleId();
|
return ticket.GetTitleId();
|
||||||
}
|
}
|
||||||
|
|
||||||
const IOS::ES::TicketReader& CVolumeWiiCrypted::GetTicket(const Partition& partition) const
|
const IOS::ES::TicketReader& VolumeWii::GetTicket(const Partition& partition) const
|
||||||
{
|
{
|
||||||
auto it = m_partition_tickets.find(partition);
|
auto it = m_partition_tickets.find(partition);
|
||||||
return it != m_partition_tickets.end() ? it->second : INVALID_TICKET;
|
return it != m_partition_tickets.end() ? it->second : INVALID_TICKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
const IOS::ES::TMDReader& CVolumeWiiCrypted::GetTMD(const Partition& partition) const
|
const IOS::ES::TMDReader& VolumeWii::GetTMD(const Partition& partition) const
|
||||||
{
|
{
|
||||||
auto it = m_partition_tmds.find(partition);
|
auto it = m_partition_tmds.find(partition);
|
||||||
return it != m_partition_tmds.end() ? it->second : INVALID_TMD;
|
return it != m_partition_tmds.end() ? it->second : INVALID_TMD;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 CVolumeWiiCrypted::PartitionOffsetToRawOffset(u64 offset, const Partition& partition)
|
u64 VolumeWii::PartitionOffsetToRawOffset(u64 offset, const Partition& partition)
|
||||||
{
|
{
|
||||||
if (partition == PARTITION_NONE)
|
if (partition == PARTITION_NONE)
|
||||||
return offset;
|
return offset;
|
||||||
|
@ -215,7 +215,7 @@ u64 CVolumeWiiCrypted::PartitionOffsetToRawOffset(u64 offset, const Partition& p
|
||||||
(offset % BLOCK_DATA_SIZE);
|
(offset % BLOCK_DATA_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CVolumeWiiCrypted::GetGameID(const Partition& partition) const
|
std::string VolumeWii::GetGameID(const Partition& partition) const
|
||||||
{
|
{
|
||||||
char ID[6];
|
char ID[6];
|
||||||
|
|
||||||
|
@ -225,13 +225,13 @@ std::string CVolumeWiiCrypted::GetGameID(const Partition& partition) const
|
||||||
return DecodeString(ID);
|
return DecodeString(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
Region CVolumeWiiCrypted::GetRegion() const
|
Region VolumeWii::GetRegion() const
|
||||||
{
|
{
|
||||||
const std::optional<u32> region_code = m_pReader->ReadSwapped<u32>(0x4E000);
|
const std::optional<u32> region_code = m_pReader->ReadSwapped<u32>(0x4E000);
|
||||||
return region_code ? static_cast<Region>(*region_code) : Region::UNKNOWN_REGION;
|
return region_code ? static_cast<Region>(*region_code) : Region::UNKNOWN_REGION;
|
||||||
}
|
}
|
||||||
|
|
||||||
Country CVolumeWiiCrypted::GetCountry(const Partition& partition) const
|
Country VolumeWii::GetCountry(const Partition& partition) const
|
||||||
{
|
{
|
||||||
// The 0 that we use as a default value is mapped to COUNTRY_UNKNOWN and UNKNOWN_REGION
|
// The 0 that we use as a default value is mapped to COUNTRY_UNKNOWN and UNKNOWN_REGION
|
||||||
u8 country_byte = ReadSwapped<u8>(3, partition).value_or(0);
|
u8 country_byte = ReadSwapped<u8>(3, partition).value_or(0);
|
||||||
|
@ -243,7 +243,7 @@ Country CVolumeWiiCrypted::GetCountry(const Partition& partition) const
|
||||||
return CountrySwitch(country_byte);
|
return CountrySwitch(country_byte);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CVolumeWiiCrypted::GetMakerID(const Partition& partition) const
|
std::string VolumeWii::GetMakerID(const Partition& partition) const
|
||||||
{
|
{
|
||||||
char makerID[2];
|
char makerID[2];
|
||||||
|
|
||||||
|
@ -253,13 +253,13 @@ std::string CVolumeWiiCrypted::GetMakerID(const Partition& partition) const
|
||||||
return DecodeString(makerID);
|
return DecodeString(makerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<u16> CVolumeWiiCrypted::GetRevision(const Partition& partition) const
|
std::optional<u16> VolumeWii::GetRevision(const Partition& partition) const
|
||||||
{
|
{
|
||||||
std::optional<u8> revision = ReadSwapped<u8>(7, partition);
|
std::optional<u8> revision = ReadSwapped<u8>(7, partition);
|
||||||
return revision ? *revision : std::optional<u16>();
|
return revision ? *revision : std::optional<u16>();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CVolumeWiiCrypted::GetInternalName(const Partition& partition) const
|
std::string VolumeWii::GetInternalName(const Partition& partition) const
|
||||||
{
|
{
|
||||||
char name_buffer[0x60];
|
char name_buffer[0x60];
|
||||||
if (Read(0x20, 0x60, (u8*)&name_buffer, partition))
|
if (Read(0x20, 0x60, (u8*)&name_buffer, partition))
|
||||||
|
@ -268,9 +268,9 @@ std::string CVolumeWiiCrypted::GetInternalName(const Partition& partition) const
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<Language, std::string> CVolumeWiiCrypted::GetLongNames() const
|
std::map<Language, std::string> VolumeWii::GetLongNames() const
|
||||||
{
|
{
|
||||||
std::unique_ptr<IFileSystem> file_system(CreateFileSystem(this, GetGamePartition()));
|
std::unique_ptr<FileSystem> file_system(CreateFileSystem(this, GetGamePartition()));
|
||||||
if (!file_system)
|
if (!file_system)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ std::map<Language, std::string> CVolumeWiiCrypted::GetLongNames() const
|
||||||
return ReadWiiNames(opening_bnr);
|
return ReadWiiNames(opening_bnr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u32> CVolumeWiiCrypted::GetBanner(int* width, int* height) const
|
std::vector<u32> VolumeWii::GetBanner(int* width, int* height) const
|
||||||
{
|
{
|
||||||
*width = 0;
|
*width = 0;
|
||||||
*height = 0;
|
*height = 0;
|
||||||
|
@ -292,7 +292,7 @@ std::vector<u32> CVolumeWiiCrypted::GetBanner(int* width, int* height) const
|
||||||
return GetWiiBanner(width, height, *title_id);
|
return GetWiiBanner(width, height, *title_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CVolumeWiiCrypted::GetApploaderDate(const Partition& partition) const
|
std::string VolumeWii::GetApploaderDate(const Partition& partition) const
|
||||||
{
|
{
|
||||||
char date[16];
|
char date[16];
|
||||||
|
|
||||||
|
@ -302,32 +302,32 @@ std::string CVolumeWiiCrypted::GetApploaderDate(const Partition& partition) cons
|
||||||
return DecodeString(date);
|
return DecodeString(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform CVolumeWiiCrypted::GetVolumeType() const
|
Platform VolumeWii::GetVolumeType() const
|
||||||
{
|
{
|
||||||
return Platform::WII_DISC;
|
return Platform::WII_DISC;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<u8> CVolumeWiiCrypted::GetDiscNumber(const Partition& partition) const
|
std::optional<u8> VolumeWii::GetDiscNumber(const Partition& partition) const
|
||||||
{
|
{
|
||||||
return ReadSwapped<u8>(6, partition);
|
return ReadSwapped<u8>(6, partition);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlobType CVolumeWiiCrypted::GetBlobType() const
|
BlobType VolumeWii::GetBlobType() const
|
||||||
{
|
{
|
||||||
return m_pReader->GetBlobType();
|
return m_pReader->GetBlobType();
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 CVolumeWiiCrypted::GetSize() const
|
u64 VolumeWii::GetSize() const
|
||||||
{
|
{
|
||||||
return m_pReader->GetDataSize();
|
return m_pReader->GetDataSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 CVolumeWiiCrypted::GetRawSize() const
|
u64 VolumeWii::GetRawSize() const
|
||||||
{
|
{
|
||||||
return m_pReader->GetRawSize();
|
return m_pReader->GetRawSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVolumeWiiCrypted::CheckIntegrity(const Partition& partition) const
|
bool VolumeWii::CheckIntegrity(const Partition& partition) const
|
||||||
{
|
{
|
||||||
// Get the decryption key for the partition
|
// Get the decryption key for the partition
|
||||||
auto it = m_partition_keys.find(partition);
|
auto it = m_partition_keys.find(partition);
|
|
@ -19,18 +19,18 @@
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
class IBlobReader;
|
class BlobReader;
|
||||||
enum class BlobType;
|
enum class BlobType;
|
||||||
enum class Country;
|
enum class Country;
|
||||||
enum class Language;
|
enum class Language;
|
||||||
enum class Region;
|
enum class Region;
|
||||||
enum class Platform;
|
enum class Platform;
|
||||||
|
|
||||||
class CVolumeWiiCrypted : public IVolume
|
class VolumeWii : public Volume
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CVolumeWiiCrypted(std::unique_ptr<IBlobReader> reader);
|
VolumeWii(std::unique_ptr<BlobReader> reader);
|
||||||
~CVolumeWiiCrypted();
|
~VolumeWii();
|
||||||
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, const Partition& partition) const override;
|
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, const Partition& partition) const override;
|
||||||
std::vector<Partition> GetPartitions() const override;
|
std::vector<Partition> GetPartitions() const override;
|
||||||
Partition GetGamePartition() const override;
|
Partition GetGamePartition() const override;
|
||||||
|
@ -63,7 +63,7 @@ public:
|
||||||
static constexpr unsigned int BLOCK_TOTAL_SIZE = BLOCK_HEADER_SIZE + BLOCK_DATA_SIZE;
|
static constexpr unsigned int BLOCK_TOTAL_SIZE = BLOCK_HEADER_SIZE + BLOCK_DATA_SIZE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<IBlobReader> m_pReader;
|
std::unique_ptr<BlobReader> m_pReader;
|
||||||
std::map<Partition, std::unique_ptr<mbedtls_aes_context>> m_partition_keys;
|
std::map<Partition, std::unique_ptr<mbedtls_aes_context>> m_partition_keys;
|
||||||
std::map<Partition, IOS::ES::TicketReader> m_partition_tickets;
|
std::map<Partition, IOS::ES::TicketReader> m_partition_tickets;
|
||||||
std::map<Partition, IOS::ES::TMDReader> m_partition_tmds;
|
std::map<Partition, IOS::ES::TMDReader> m_partition_tmds;
|
|
@ -16,7 +16,7 @@ namespace DiscIO
|
||||||
{
|
{
|
||||||
static constexpr u32 WBFS_MAGIC = 0x53464257; // "WBFS" (byteswapped to little endian)
|
static constexpr u32 WBFS_MAGIC = 0x53464257; // "WBFS" (byteswapped to little endian)
|
||||||
|
|
||||||
class WbfsFileReader : public IBlobReader
|
class WbfsFileReader : public BlobReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~WbfsFileReader();
|
~WbfsFileReader();
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace DiscIO
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
std::vector<u8> CreateWADEntry(IBlobReader& reader, u32 size, u64 offset)
|
std::vector<u8> CreateWADEntry(BlobReader& reader, u32 size, u64 offset)
|
||||||
{
|
{
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return {};
|
return {};
|
||||||
|
@ -35,7 +35,7 @@ std::vector<u8> CreateWADEntry(IBlobReader& reader, u32 size, u64 offset)
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsWiiWAD(IBlobReader& reader)
|
bool IsWiiWAD(BlobReader& reader)
|
||||||
{
|
{
|
||||||
const std::optional<u32> header_size = reader.ReadSwapped<u32>(0x0);
|
const std::optional<u32> header_size = reader.ReadSwapped<u32>(0x0);
|
||||||
const std::optional<u32> header_type = reader.ReadSwapped<u32>(0x4);
|
const std::optional<u32> header_type = reader.ReadSwapped<u32>(0x4);
|
||||||
|
|
|
@ -13,8 +13,7 @@
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
class IBlobReader;
|
class BlobReader;
|
||||||
class CBlobBigEndianReader;
|
|
||||||
|
|
||||||
class WiiWAD
|
class WiiWAD
|
||||||
{
|
{
|
||||||
|
@ -35,7 +34,7 @@ private:
|
||||||
|
|
||||||
bool m_valid;
|
bool m_valid;
|
||||||
|
|
||||||
std::unique_ptr<IBlobReader> m_reader;
|
std::unique_ptr<BlobReader> m_reader;
|
||||||
|
|
||||||
u64 m_data_app_offset = 0;
|
u64 m_data_app_offset = 0;
|
||||||
std::vector<u8> m_certificate_chain;
|
std::vector<u8> m_certificate_chain;
|
||||||
|
|
|
@ -168,7 +168,7 @@ void InfoWidget::ComputeChecksum()
|
||||||
{
|
{
|
||||||
QCryptographicHash hash(QCryptographicHash::Md5);
|
QCryptographicHash hash(QCryptographicHash::Md5);
|
||||||
hash.reset();
|
hash.reset();
|
||||||
std::unique_ptr<DiscIO::IBlobReader> file(
|
std::unique_ptr<DiscIO::BlobReader> file(
|
||||||
DiscIO::CreateBlobReader(m_game.GetFilePath().toStdString()));
|
DiscIO::CreateBlobReader(m_game.GetFilePath().toStdString()));
|
||||||
std::vector<u8> file_data(8 * 1080 * 1080); // read 1MB at a time
|
std::vector<u8> file_data(8 * 1080 * 1080); // read 1MB at a time
|
||||||
u64 game_size = file->GetDataSize();
|
u64 game_size = file->GetDataSize();
|
||||||
|
|
|
@ -84,7 +84,7 @@ QString GameFile::GetCacheFileName() const
|
||||||
return folder + m_file_name + hash;
|
return folder + m_file_name + hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameFile::ReadBanner(const DiscIO::IVolume& volume)
|
void GameFile::ReadBanner(const DiscIO::Volume& volume)
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
std::vector<u32> buffer = volume.GetBanner(&width, &height);
|
std::vector<u32> buffer = volume.GetBanner(&width, &height);
|
||||||
|
@ -154,7 +154,7 @@ bool GameFile::TryLoadCache()
|
||||||
|
|
||||||
bool GameFile::TryLoadVolume()
|
bool GameFile::TryLoadVolume()
|
||||||
{
|
{
|
||||||
QSharedPointer<DiscIO::IVolume> volume(
|
QSharedPointer<DiscIO::Volume> volume(
|
||||||
DiscIO::CreateVolumeFromFilename(m_path.toStdString()).release());
|
DiscIO::CreateVolumeFromFilename(m_path.toStdString()).release());
|
||||||
if (volume == nullptr)
|
if (volume == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -18,7 +18,7 @@ enum class Country;
|
||||||
enum class Language;
|
enum class Language;
|
||||||
enum class Region;
|
enum class Region;
|
||||||
enum class Platform;
|
enum class Platform;
|
||||||
class IVolume;
|
class Volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO cache
|
// TODO cache
|
||||||
|
@ -76,7 +76,7 @@ private:
|
||||||
QString GetBannerString(const QMap<DiscIO::Language, QString>& m) const;
|
QString GetBannerString(const QMap<DiscIO::Language, QString>& m) const;
|
||||||
|
|
||||||
QString GetCacheFileName() const;
|
QString GetCacheFileName() const;
|
||||||
void ReadBanner(const DiscIO::IVolume& volume);
|
void ReadBanner(const DiscIO::Volume& volume);
|
||||||
bool LoadFileInfo(const QString& path);
|
bool LoadFileInfo(const QString& path);
|
||||||
void LoadState();
|
void LoadState();
|
||||||
bool IsElfOrDol();
|
bool IsElfOrDol();
|
||||||
|
|
|
@ -224,7 +224,7 @@ void PathConfigPane::OnNANDRootChanged(wxCommandEvent& event)
|
||||||
File::SetUserPath(D_WIIROOT_IDX, nand_path);
|
File::SetUserPath(D_WIIROOT_IDX, nand_path);
|
||||||
m_nand_root_dirpicker->SetPath(StrToWxStr(nand_path));
|
m_nand_root_dirpicker->SetPath(StrToWxStr(nand_path));
|
||||||
|
|
||||||
DiscIO::CNANDContentManager::Access().ClearCache();
|
DiscIO::NANDContentManager::Access().ClearCache();
|
||||||
|
|
||||||
wxCommandEvent update_event{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM, GetId()};
|
wxCommandEvent update_event{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM, GetId()};
|
||||||
update_event.SetEventObject(this);
|
update_event.SetEventObject(this);
|
||||||
|
|
|
@ -1497,7 +1497,7 @@ void CFrame::UpdateGUI()
|
||||||
GetMenuBar()
|
GetMenuBar()
|
||||||
->FindItem(IDM_LOAD_GC_IPL_EUR)
|
->FindItem(IDM_LOAD_GC_IPL_EUR)
|
||||||
->Enable(!Initialized && File::Exists(SConfig::GetInstance().GetBootROMPath(EUR_DIR)));
|
->Enable(!Initialized && File::Exists(SConfig::GetInstance().GetBootROMPath(EUR_DIR)));
|
||||||
if (DiscIO::CNANDContentManager::Access()
|
if (DiscIO::NANDContentManager::Access()
|
||||||
.GetNANDLoader(TITLEID_SYSMENU, Common::FROM_CONFIGURED_ROOT)
|
.GetNANDLoader(TITLEID_SYSMENU, Common::FROM_CONFIGURED_ROOT)
|
||||||
.IsValid())
|
.IsValid())
|
||||||
GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized);
|
GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized);
|
||||||
|
|
|
@ -79,7 +79,7 @@ GameListItem::GameListItem(const std::string& _rFileName, const Core::TitleDatab
|
||||||
if (m_pImage.empty())
|
if (m_pImage.empty())
|
||||||
{
|
{
|
||||||
std::vector<u32> buffer =
|
std::vector<u32> buffer =
|
||||||
DiscIO::IVolume::GetWiiBanner(&m_ImageWidth, &m_ImageHeight, m_title_id);
|
DiscIO::Volume::GetWiiBanner(&m_ImageWidth, &m_ImageHeight, m_title_id);
|
||||||
ReadVolumeBanner(buffer, m_ImageWidth, m_ImageHeight);
|
ReadVolumeBanner(buffer, m_ImageWidth, m_ImageHeight);
|
||||||
if (!m_pImage.empty())
|
if (!m_pImage.empty())
|
||||||
SaveToCache();
|
SaveToCache();
|
||||||
|
@ -87,7 +87,7 @@ GameListItem::GameListItem(const std::string& _rFileName, const Core::TitleDatab
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(_rFileName));
|
std::unique_ptr<DiscIO::Volume> volume(DiscIO::CreateVolumeFromFilename(_rFileName));
|
||||||
|
|
||||||
if (volume != nullptr)
|
if (volume != nullptr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,18 +32,17 @@ namespace
|
||||||
class WiiPartition final : public wxTreeItemData
|
class WiiPartition final : public wxTreeItemData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WiiPartition(std::unique_ptr<DiscIO::IFileSystem> filesystem_)
|
WiiPartition(std::unique_ptr<DiscIO::FileSystem> filesystem_) : filesystem{std::move(filesystem_)}
|
||||||
: filesystem{std::move(filesystem_)}
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<DiscIO::IFileSystem> filesystem;
|
std::unique_ptr<DiscIO::FileSystem> filesystem;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IntegrityCheckThread final : public wxThread
|
class IntegrityCheckThread final : public wxThread
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit IntegrityCheckThread(const DiscIO::IVolume* volume, DiscIO::Partition partition)
|
explicit IntegrityCheckThread(const DiscIO::Volume* volume, DiscIO::Partition partition)
|
||||||
: wxThread{wxTHREAD_JOINABLE}, m_volume{volume}, m_partition{partition}
|
: wxThread{wxTHREAD_JOINABLE}, m_volume{volume}, m_partition{partition}
|
||||||
{
|
{
|
||||||
Create();
|
Create();
|
||||||
|
@ -55,7 +54,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const DiscIO::IVolume* const m_volume;
|
const DiscIO::Volume* const m_volume;
|
||||||
const DiscIO::Partition m_partition;
|
const DiscIO::Partition m_partition;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -85,14 +84,14 @@ wxImageList* LoadIconBitmaps(const wxWindow* context)
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CreateDirectoryTree(wxTreeCtrl* tree_ctrl, wxTreeItemId parent,
|
size_t CreateDirectoryTree(wxTreeCtrl* tree_ctrl, wxTreeItemId parent,
|
||||||
const std::vector<DiscIO::SFileInfo>& file_infos,
|
const std::vector<DiscIO::FileInfo>& file_infos,
|
||||||
const size_t first_index, const size_t last_index)
|
const size_t first_index, const size_t last_index)
|
||||||
{
|
{
|
||||||
size_t current_index = first_index;
|
size_t current_index = first_index;
|
||||||
|
|
||||||
while (current_index < last_index)
|
while (current_index < last_index)
|
||||||
{
|
{
|
||||||
const DiscIO::SFileInfo& file_info = file_infos[current_index];
|
const DiscIO::FileInfo& file_info = file_infos[current_index];
|
||||||
std::string file_path = file_info.m_FullPath;
|
std::string file_path = file_info.m_FullPath;
|
||||||
|
|
||||||
// Trim the trailing '/' if it exists.
|
// Trim the trailing '/' if it exists.
|
||||||
|
@ -127,7 +126,7 @@ size_t CreateDirectoryTree(wxTreeCtrl* tree_ctrl, wxTreeItemId parent,
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CreateDirectoryTree(wxTreeCtrl* tree_ctrl, wxTreeItemId parent,
|
size_t CreateDirectoryTree(wxTreeCtrl* tree_ctrl, wxTreeItemId parent,
|
||||||
const std::vector<DiscIO::SFileInfo>& file_infos)
|
const std::vector<DiscIO::FileInfo>& file_infos)
|
||||||
{
|
{
|
||||||
if (file_infos.empty())
|
if (file_infos.empty())
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -155,7 +154,7 @@ WiiPartition* FindWiiPartition(wxTreeCtrl* tree_ctrl, const wxString& label)
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
FilesystemPanel::FilesystemPanel(wxWindow* parent, wxWindowID id,
|
FilesystemPanel::FilesystemPanel(wxWindow* parent, wxWindowID id,
|
||||||
const std::unique_ptr<DiscIO::IVolume>& opened_iso)
|
const std::unique_ptr<DiscIO::Volume>& opened_iso)
|
||||||
: wxPanel{parent, id}, m_opened_iso{opened_iso}
|
: wxPanel{parent, id}, m_opened_iso{opened_iso}
|
||||||
{
|
{
|
||||||
CreateGUI();
|
CreateGUI();
|
||||||
|
@ -204,7 +203,7 @@ bool FilesystemPanel::PopulateFileSystemTree()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < partitions.size(); ++i)
|
for (size_t i = 0; i < partitions.size(); ++i)
|
||||||
{
|
{
|
||||||
std::unique_ptr<DiscIO::IFileSystem> file_system(
|
std::unique_ptr<DiscIO::FileSystem> file_system(
|
||||||
DiscIO::CreateFileSystem(m_opened_iso.get(), partitions[i]));
|
DiscIO::CreateFileSystem(m_opened_iso.get(), partitions[i]));
|
||||||
if (file_system)
|
if (file_system)
|
||||||
{
|
{
|
||||||
|
@ -310,7 +309,7 @@ void FilesystemPanel::OnExtractDirectories(wxCommandEvent& event)
|
||||||
|
|
||||||
void FilesystemPanel::OnExtractHeaderData(wxCommandEvent& event)
|
void FilesystemPanel::OnExtractHeaderData(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
DiscIO::IFileSystem* file_system = nullptr;
|
DiscIO::FileSystem* file_system = nullptr;
|
||||||
const wxString path = wxDirSelector(_("Choose the folder to extract to"));
|
const wxString path = wxDirSelector(_("Choose the folder to extract to"));
|
||||||
|
|
||||||
if (path.empty())
|
if (path.empty())
|
||||||
|
@ -451,9 +450,9 @@ void FilesystemPanel::ExtractSingleDirectory(const wxString& output_folder)
|
||||||
|
|
||||||
void FilesystemPanel::ExtractDirectories(const std::string& full_path,
|
void FilesystemPanel::ExtractDirectories(const std::string& full_path,
|
||||||
const std::string& output_folder,
|
const std::string& output_folder,
|
||||||
DiscIO::IFileSystem* filesystem)
|
DiscIO::FileSystem* filesystem)
|
||||||
{
|
{
|
||||||
const std::vector<DiscIO::SFileInfo>& fst = filesystem->GetFileList();
|
const std::vector<DiscIO::FileInfo>& fst = filesystem->GetFileList();
|
||||||
|
|
||||||
u32 index = 0;
|
u32 index = 0;
|
||||||
u32 size = 0;
|
u32 size = 0;
|
||||||
|
|
|
@ -14,15 +14,15 @@ class wxTreeEvent;
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
class IFileSystem;
|
class FileSystem;
|
||||||
class IVolume;
|
class Volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
class FilesystemPanel final : public wxPanel
|
class FilesystemPanel final : public wxPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit FilesystemPanel(wxWindow* parent, wxWindowID id,
|
explicit FilesystemPanel(wxWindow* parent, wxWindowID id,
|
||||||
const std::unique_ptr<DiscIO::IVolume>& opened_iso);
|
const std::unique_ptr<DiscIO::Volume>& opened_iso);
|
||||||
~FilesystemPanel();
|
~FilesystemPanel();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -51,15 +51,15 @@ private:
|
||||||
void ExtractSingleFile(const wxString& output_file_path) const;
|
void ExtractSingleFile(const wxString& output_file_path) const;
|
||||||
void ExtractSingleDirectory(const wxString& output_folder);
|
void ExtractSingleDirectory(const wxString& output_folder);
|
||||||
void ExtractDirectories(const std::string& full_path, const std::string& output_folder,
|
void ExtractDirectories(const std::string& full_path, const std::string& output_folder,
|
||||||
DiscIO::IFileSystem* filesystem);
|
DiscIO::FileSystem* filesystem);
|
||||||
|
|
||||||
wxString BuildFilePathFromSelection() const;
|
wxString BuildFilePathFromSelection() const;
|
||||||
wxString BuildDirectoryPathFromSelection() const;
|
wxString BuildDirectoryPathFromSelection() const;
|
||||||
|
|
||||||
wxTreeCtrl* m_tree_ctrl;
|
wxTreeCtrl* m_tree_ctrl;
|
||||||
|
|
||||||
const std::unique_ptr<DiscIO::IVolume>& m_opened_iso;
|
const std::unique_ptr<DiscIO::Volume>& m_opened_iso;
|
||||||
|
|
||||||
std::unique_ptr<DiscIO::IFileSystem> m_filesystem;
|
std::unique_ptr<DiscIO::FileSystem> m_filesystem;
|
||||||
bool m_has_partitions;
|
bool m_has_partitions;
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,7 +30,7 @@ class wxTextCtrl;
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
class IVolume;
|
class Volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Gecko
|
namespace Gecko
|
||||||
|
@ -60,7 +60,7 @@ public:
|
||||||
private:
|
private:
|
||||||
DECLARE_EVENT_TABLE();
|
DECLARE_EVENT_TABLE();
|
||||||
|
|
||||||
std::unique_ptr<DiscIO::IVolume> m_open_iso;
|
std::unique_ptr<DiscIO::Volume> m_open_iso;
|
||||||
|
|
||||||
std::vector<PatchEngine::Patch> onFrame;
|
std::vector<PatchEngine::Patch> onFrame;
|
||||||
PHackData m_PHack_Data;
|
PHackData m_PHack_Data;
|
||||||
|
|
|
@ -142,7 +142,7 @@ int FindPreferredLanguageIndex(DiscIO::Language preferred_language,
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
InfoPanel::InfoPanel(wxWindow* parent, wxWindowID id, const GameListItem& item,
|
InfoPanel::InfoPanel(wxWindow* parent, wxWindowID id, const GameListItem& item,
|
||||||
const std::unique_ptr<DiscIO::IVolume>& opened_iso)
|
const std::unique_ptr<DiscIO::Volume>& opened_iso)
|
||||||
: wxPanel{parent, id}, m_game_list_item{item}, m_opened_iso{opened_iso}
|
: wxPanel{parent, id}, m_game_list_item{item}, m_opened_iso{opened_iso}
|
||||||
{
|
{
|
||||||
CreateGUI();
|
CreateGUI();
|
||||||
|
|
|
@ -16,7 +16,7 @@ class wxTextCtrl;
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
class IVolume;
|
class Volume;
|
||||||
enum class Language;
|
enum class Language;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class InfoPanel final : public wxPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InfoPanel(wxWindow* parent, wxWindowID id, const GameListItem& item,
|
InfoPanel(wxWindow* parent, wxWindowID id, const GameListItem& item,
|
||||||
const std::unique_ptr<DiscIO::IVolume>& opened_iso);
|
const std::unique_ptr<DiscIO::Volume>& opened_iso);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum
|
enum
|
||||||
|
@ -53,7 +53,7 @@ private:
|
||||||
void EmitTitleChangeEvent(const wxString& new_title);
|
void EmitTitleChangeEvent(const wxString& new_title);
|
||||||
|
|
||||||
const GameListItem& m_game_list_item;
|
const GameListItem& m_game_list_item;
|
||||||
const std::unique_ptr<DiscIO::IVolume>& m_opened_iso;
|
const std::unique_ptr<DiscIO::Volume>& m_opened_iso;
|
||||||
|
|
||||||
wxTextCtrl* m_internal_name;
|
wxTextCtrl* m_internal_name;
|
||||||
wxTextCtrl* m_game_id;
|
wxTextCtrl* m_game_id;
|
||||||
|
|
|
@ -581,7 +581,7 @@ void MainMenuBar::RefreshWiiSystemMenuLabel() const
|
||||||
{
|
{
|
||||||
auto* const item = FindItem(IDM_LOAD_WII_MENU);
|
auto* const item = FindItem(IDM_LOAD_WII_MENU);
|
||||||
|
|
||||||
const auto& sys_menu_loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(
|
const auto& sys_menu_loader = DiscIO::NANDContentManager::Access().GetNANDLoader(
|
||||||
TITLEID_SYSMENU, Common::FROM_CONFIGURED_ROOT);
|
TITLEID_SYSMENU, Common::FROM_CONFIGURED_ROOT);
|
||||||
|
|
||||||
if (sys_menu_loader.IsValid())
|
if (sys_menu_loader.IsValid())
|
||||||
|
|
|
@ -58,7 +58,7 @@ bool InstallWAD(const std::string& wad_path)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DiscIO::CNANDContentManager::Access().ClearCache();
|
DiscIO::NANDContentManager::Access().ClearCache();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue