Merge pull request #1776 from JosJuice/cleanrip-wii-discs
Fix CleanRip reading Wii discs
This commit is contained in:
commit
3738d27b24
|
@ -39,7 +39,7 @@ void CBoot::Load_FST(bool _bIsWii)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// copy first 20 bytes of disc to start of Mem 1
|
// copy first 20 bytes of disc to start of Mem 1
|
||||||
VolumeHandler::ReadToPtr(Memory::GetPointer(0x80000000), 0, 0x20);
|
VolumeHandler::ReadToPtr(Memory::GetPointer(0x80000000), 0, 0x20, false);
|
||||||
|
|
||||||
// copy of game id
|
// copy of game id
|
||||||
Memory::Write_U32(Memory::Read_U32(0x80000000), 0x80003180);
|
Memory::Write_U32(Memory::Read_U32(0x80000000), 0x80003180);
|
||||||
|
@ -48,15 +48,15 @@ void CBoot::Load_FST(bool _bIsWii)
|
||||||
if (_bIsWii)
|
if (_bIsWii)
|
||||||
shift = 2;
|
shift = 2;
|
||||||
|
|
||||||
u32 fstOffset = VolumeHandler::Read32(0x0424) << shift;
|
u32 fstOffset = VolumeHandler::Read32(0x0424, _bIsWii) << shift;
|
||||||
u32 fstSize = VolumeHandler::Read32(0x0428) << shift;
|
u32 fstSize = VolumeHandler::Read32(0x0428, _bIsWii) << shift;
|
||||||
u32 maxFstSize = VolumeHandler::Read32(0x042c) << shift;
|
u32 maxFstSize = VolumeHandler::Read32(0x042c, _bIsWii) << shift;
|
||||||
|
|
||||||
u32 arenaHigh = ROUND_DOWN(0x817FFFFF - maxFstSize, 0x20);
|
u32 arenaHigh = ROUND_DOWN(0x817FFFFF - maxFstSize, 0x20);
|
||||||
Memory::Write_U32(arenaHigh, 0x00000034);
|
Memory::Write_U32(arenaHigh, 0x00000034);
|
||||||
|
|
||||||
// load FST
|
// load FST
|
||||||
VolumeHandler::ReadToPtr(Memory::GetPointer(arenaHigh), fstOffset, fstSize);
|
VolumeHandler::ReadToPtr(Memory::GetPointer(arenaHigh), fstOffset, fstSize, _bIsWii);
|
||||||
Memory::Write_U32(arenaHigh, 0x00000038);
|
Memory::Write_U32(arenaHigh, 0x00000038);
|
||||||
Memory::Write_U32(maxFstSize, 0x0000003c);
|
Memory::Write_U32(maxFstSize, 0x0000003c);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ bool CBoot::EmulatedBS2_GC()
|
||||||
// Write necessary values
|
// Write necessary values
|
||||||
// Here we write values to memory that the apploader does not take care of. Game info goes
|
// Here we write values to memory that the apploader does not take care of. Game info goes
|
||||||
// to 0x80000000 according to YAGCD 4.2.
|
// to 0x80000000 according to YAGCD 4.2.
|
||||||
DVDInterface::DVDRead(0x00000000, 0x80000000, 0x20); // write disc info
|
DVDInterface::DVDRead(0x00000000, 0x80000000, 0x20, false); // write disc info
|
||||||
|
|
||||||
Memory::Write_U32(0x0D15EA5E, 0x80000020); // Booted from bootrom. 0xE5207C22 = booted from jtag
|
Memory::Write_U32(0x0D15EA5E, 0x80000020); // Booted from bootrom. 0xE5207C22 = booted from jtag
|
||||||
Memory::Write_U32(Memory::REALRAM_SIZE, 0x80000028); // Physical Memory Size (24MB on retail)
|
Memory::Write_U32(Memory::REALRAM_SIZE, 0x80000028); // Physical Memory Size (24MB on retail)
|
||||||
|
@ -84,14 +84,14 @@ bool CBoot::EmulatedBS2_GC()
|
||||||
// Load Apploader to Memory - The apploader is hardcoded to begin at 0x2440 on the disc,
|
// Load Apploader to Memory - The apploader is hardcoded to begin at 0x2440 on the disc,
|
||||||
// but the size can differ between discs. Compare with YAGCD chap 13.
|
// but the size can differ between discs. Compare with YAGCD chap 13.
|
||||||
u32 iAppLoaderOffset = 0x2440;
|
u32 iAppLoaderOffset = 0x2440;
|
||||||
u32 iAppLoaderEntry = VolumeHandler::Read32(iAppLoaderOffset + 0x10);
|
u32 iAppLoaderEntry = VolumeHandler::Read32(iAppLoaderOffset + 0x10, false);
|
||||||
u32 iAppLoaderSize = VolumeHandler::Read32(iAppLoaderOffset + 0x14) + VolumeHandler::Read32(iAppLoaderOffset + 0x18);
|
u32 iAppLoaderSize = VolumeHandler::Read32(iAppLoaderOffset + 0x14, false) + VolumeHandler::Read32(iAppLoaderOffset + 0x18, false);
|
||||||
if ((iAppLoaderEntry == (u32)-1) || (iAppLoaderSize == (u32)-1))
|
if ((iAppLoaderEntry == (u32)-1) || (iAppLoaderSize == (u32)-1))
|
||||||
{
|
{
|
||||||
INFO_LOG(BOOT, "GC BS2: Not running apploader!");
|
INFO_LOG(BOOT, "GC BS2: Not running apploader!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
VolumeHandler::ReadToPtr(Memory::GetPointer(0x81200000), iAppLoaderOffset + 0x20, iAppLoaderSize);
|
VolumeHandler::ReadToPtr(Memory::GetPointer(0x81200000), iAppLoaderOffset + 0x20, iAppLoaderSize, false);
|
||||||
|
|
||||||
// Setup pointers like real BS2 does
|
// Setup pointers like real BS2 does
|
||||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC)
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC)
|
||||||
|
@ -142,7 +142,7 @@ bool CBoot::EmulatedBS2_GC()
|
||||||
u32 iDVDOffset = Memory::ReadUnchecked_U32(0x8130000c);
|
u32 iDVDOffset = Memory::ReadUnchecked_U32(0x8130000c);
|
||||||
|
|
||||||
INFO_LOG(MASTER_LOG, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset, iRamAddress, iLength);
|
INFO_LOG(MASTER_LOG, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset, iRamAddress, iLength);
|
||||||
DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength);
|
DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength, false);
|
||||||
|
|
||||||
} while (PowerPC::ppcState.gpr[3] != 0x00);
|
} while (PowerPC::ppcState.gpr[3] != 0x00);
|
||||||
|
|
||||||
|
@ -241,50 +241,50 @@ bool CBoot::SetupWiiMemory(IVolume::ECountry country)
|
||||||
0x80000060 Copyright code
|
0x80000060 Copyright code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DVDInterface::DVDRead(0x00000000, 0x00000000, 0x20); // Game Code
|
DVDInterface::DVDRead(0x00000000, 0x00000000, 0x20, false); // Game Code
|
||||||
Memory::Write_U32(0x0D15EA5E, 0x00000020); // Another magic word
|
Memory::Write_U32(0x0D15EA5E, 0x00000020); // Another magic word
|
||||||
Memory::Write_U32(0x00000001, 0x00000024); // Unknown
|
Memory::Write_U32(0x00000001, 0x00000024); // Unknown
|
||||||
Memory::Write_U32(Memory::REALRAM_SIZE, 0x00000028); // MEM1 size 24MB
|
Memory::Write_U32(Memory::REALRAM_SIZE, 0x00000028); // MEM1 size 24MB
|
||||||
Memory::Write_U32(0x00000023, 0x0000002c); // Production Board Model
|
Memory::Write_U32(0x00000023, 0x0000002c); // Production Board Model
|
||||||
Memory::Write_U32(0x00000000, 0x00000030); // Init
|
Memory::Write_U32(0x00000000, 0x00000030); // Init
|
||||||
Memory::Write_U32(0x817FEC60, 0x00000034); // Init
|
Memory::Write_U32(0x817FEC60, 0x00000034); // Init
|
||||||
// 38, 3C should get start, size of FST through apploader
|
// 38, 3C should get start, size of FST through apploader
|
||||||
Memory::Write_U32(0x38a00040, 0x00000060); // Exception init
|
Memory::Write_U32(0x38a00040, 0x00000060); // Exception init
|
||||||
Memory::Write_U32(0x8008f7b8, 0x000000e4); // Thread Init
|
Memory::Write_U32(0x8008f7b8, 0x000000e4); // Thread Init
|
||||||
Memory::Write_U32(Memory::REALRAM_SIZE, 0x000000f0); // "Simulated memory size" (debug mode?)
|
Memory::Write_U32(Memory::REALRAM_SIZE, 0x000000f0); // "Simulated memory size" (debug mode?)
|
||||||
Memory::Write_U32(0x8179b500, 0x000000f4); // __start
|
Memory::Write_U32(0x8179b500, 0x000000f4); // __start
|
||||||
Memory::Write_U32(0x0e7be2c0, 0x000000f8); // Bus speed
|
Memory::Write_U32(0x0e7be2c0, 0x000000f8); // Bus speed
|
||||||
Memory::Write_U32(0x2B73A840, 0x000000fc); // CPU speed
|
Memory::Write_U32(0x2B73A840, 0x000000fc); // CPU speed
|
||||||
Memory::Write_U16(0x0000, 0x000030e6); // Console type
|
Memory::Write_U16(0x0000, 0x000030e6); // Console type
|
||||||
Memory::Write_U32(0x00000000, 0x000030c0); // EXI
|
Memory::Write_U32(0x00000000, 0x000030c0); // EXI
|
||||||
Memory::Write_U32(0x00000000, 0x000030c4); // EXI
|
Memory::Write_U32(0x00000000, 0x000030c4); // EXI
|
||||||
Memory::Write_U32(0x00000000, 0x000030dc); // Time
|
Memory::Write_U32(0x00000000, 0x000030dc); // Time
|
||||||
Memory::Write_U32(0x00000000, 0x000030d8); // Time
|
Memory::Write_U32(0x00000000, 0x000030d8); // Time
|
||||||
Memory::Write_U16(0x8201, 0x000030e6); // Dev console / debug capable
|
Memory::Write_U16(0x8201, 0x000030e6); // Dev console / debug capable
|
||||||
Memory::Write_U32(0x00000000, 0x000030f0); // Apploader
|
Memory::Write_U32(0x00000000, 0x000030f0); // Apploader
|
||||||
Memory::Write_U32(0x01800000, 0x00003100); // BAT
|
Memory::Write_U32(0x01800000, 0x00003100); // BAT
|
||||||
Memory::Write_U32(0x01800000, 0x00003104); // BAT
|
Memory::Write_U32(0x01800000, 0x00003104); // BAT
|
||||||
Memory::Write_U32(0x00000000, 0x0000310c); // Init
|
Memory::Write_U32(0x00000000, 0x0000310c); // Init
|
||||||
Memory::Write_U32(0x8179d500, 0x00003110); // Init
|
Memory::Write_U32(0x8179d500, 0x00003110); // Init
|
||||||
Memory::Write_U32(0x04000000, 0x00003118); // Unknown
|
Memory::Write_U32(0x04000000, 0x00003118); // Unknown
|
||||||
Memory::Write_U32(0x04000000, 0x0000311c); // BAT
|
Memory::Write_U32(0x04000000, 0x0000311c); // BAT
|
||||||
Memory::Write_U32(0x93400000, 0x00003120); // BAT
|
Memory::Write_U32(0x93400000, 0x00003120); // BAT
|
||||||
Memory::Write_U32(0x90000800, 0x00003124); // Init - MEM2 low
|
Memory::Write_U32(0x90000800, 0x00003124); // Init - MEM2 low
|
||||||
Memory::Write_U32(0x93ae0000, 0x00003128); // Init - MEM2 high
|
Memory::Write_U32(0x93ae0000, 0x00003128); // Init - MEM2 high
|
||||||
Memory::Write_U32(0x93ae0000, 0x00003130); // IOS MEM2 low
|
Memory::Write_U32(0x93ae0000, 0x00003130); // IOS MEM2 low
|
||||||
Memory::Write_U32(0x93b00000, 0x00003134); // IOS MEM2 high
|
Memory::Write_U32(0x93b00000, 0x00003134); // IOS MEM2 high
|
||||||
Memory::Write_U32(0x00000012, 0x00003138); // Console type
|
Memory::Write_U32(0x00000012, 0x00003138); // Console type
|
||||||
// 40 is copied from 88 after running apploader
|
// 40 is copied from 88 after running apploader
|
||||||
Memory::Write_U32(0x00090204, 0x00003140); // IOS revision (IOS9, v2.4)
|
Memory::Write_U32(0x00090204, 0x00003140); // IOS revision (IOS9, v2.4)
|
||||||
Memory::Write_U32(0x00062507, 0x00003144); // IOS date in USA format (June 25, 2007)
|
Memory::Write_U32(0x00062507, 0x00003144); // IOS date in USA format (June 25, 2007)
|
||||||
Memory::Write_U16(0x0113, 0x0000315e); // Apploader
|
Memory::Write_U16(0x0113, 0x0000315e); // Apploader
|
||||||
Memory::Write_U32(0x0000FF16, 0x00003158); // DDR ram vendor code
|
Memory::Write_U32(0x0000FF16, 0x00003158); // DDR ram vendor code
|
||||||
Memory::Write_U32(0x00000000, 0x00003160); // Init semaphore (sysmenu waits for this to clear)
|
Memory::Write_U32(0x00000000, 0x00003160); // Init semaphore (sysmenu waits for this to clear)
|
||||||
Memory::Write_U32(0x00090204, 0x00003188); // Expected IOS revision
|
Memory::Write_U32(0x00090204, 0x00003188); // Expected IOS revision
|
||||||
|
|
||||||
Memory::Write_U8(0x80, 0x0000315c); // OSInit
|
Memory::Write_U8(0x80, 0x0000315c); // OSInit
|
||||||
Memory::Write_U16(0x0000, 0x000030e0); // PADInit
|
Memory::Write_U16(0x0000, 0x000030e0); // PADInit
|
||||||
Memory::Write_U32(0x80000000, 0x00003184); // GameID Address
|
Memory::Write_U32(0x80000000, 0x00003184); // GameID Address
|
||||||
|
|
||||||
// Fake the VI Init of the IPL
|
// Fake the VI Init of the IPL
|
||||||
Memory::Write_U32(SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC ? 0 : 1, 0x000000CC);
|
Memory::Write_U32(SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC ? 0 : 1, 0x000000CC);
|
||||||
|
@ -316,7 +316,7 @@ bool CBoot::EmulatedBS2_Wii()
|
||||||
// values as the game boots. This location keep the 4 byte ID for as long
|
// values as the game boots. This location keep the 4 byte ID for as long
|
||||||
// as the game is running. The 6 byte ID at 0x00 is overwritten sometime
|
// as the game is running. The 6 byte ID at 0x00 is overwritten sometime
|
||||||
// after this check during booting.
|
// after this check during booting.
|
||||||
VolumeHandler::ReadToPtr(Memory::GetPointer(0x3180), 0, 4);
|
VolumeHandler::ReadToPtr(Memory::GetPointer(0x3180), 0, 4, true);
|
||||||
|
|
||||||
// Execute the apploader
|
// Execute the apploader
|
||||||
bool apploaderRan = false;
|
bool apploaderRan = false;
|
||||||
|
@ -349,14 +349,14 @@ bool CBoot::EmulatedBS2_Wii()
|
||||||
u32 iAppLoaderOffset = 0x2440; // 0x1c40;
|
u32 iAppLoaderOffset = 0x2440; // 0x1c40;
|
||||||
|
|
||||||
// Load Apploader to Memory
|
// Load Apploader to Memory
|
||||||
u32 iAppLoaderEntry = VolumeHandler::Read32(iAppLoaderOffset + 0x10);
|
u32 iAppLoaderEntry = VolumeHandler::Read32(iAppLoaderOffset + 0x10, true);
|
||||||
u32 iAppLoaderSize = VolumeHandler::Read32(iAppLoaderOffset + 0x14);
|
u32 iAppLoaderSize = VolumeHandler::Read32(iAppLoaderOffset + 0x14, true);
|
||||||
if ((iAppLoaderEntry == (u32)-1) || (iAppLoaderSize == (u32)-1))
|
if ((iAppLoaderEntry == (u32)-1) || (iAppLoaderSize == (u32)-1))
|
||||||
{
|
{
|
||||||
ERROR_LOG(BOOT, "Invalid apploader. Probably your image is corrupted.");
|
ERROR_LOG(BOOT, "Invalid apploader. Probably your image is corrupted.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
VolumeHandler::ReadToPtr(Memory::GetPointer(0x81200000), iAppLoaderOffset + 0x20, iAppLoaderSize);
|
VolumeHandler::ReadToPtr(Memory::GetPointer(0x81200000), iAppLoaderOffset + 0x20, iAppLoaderSize, true);
|
||||||
|
|
||||||
//call iAppLoaderEntry
|
//call iAppLoaderEntry
|
||||||
DEBUG_LOG(BOOT, "Call iAppLoaderEntry");
|
DEBUG_LOG(BOOT, "Call iAppLoaderEntry");
|
||||||
|
@ -394,7 +394,7 @@ bool CBoot::EmulatedBS2_Wii()
|
||||||
u32 iDVDOffset = Memory::ReadUnchecked_U32(0x8130000c) << 2;
|
u32 iDVDOffset = Memory::ReadUnchecked_U32(0x8130000c) << 2;
|
||||||
|
|
||||||
INFO_LOG(BOOT, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset, iRamAddress, iLength);
|
INFO_LOG(BOOT, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset, iRamAddress, iLength);
|
||||||
DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength);
|
DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength, true);
|
||||||
} while (PowerPC::ppcState.gpr[3] != 0x00);
|
} while (PowerPC::ppcState.gpr[3] != 0x00);
|
||||||
|
|
||||||
// iAppLoaderClose
|
// iAppLoaderClose
|
||||||
|
|
|
@ -258,7 +258,7 @@ void GenerateDIInterrupt(DIInterruptType _DVDInterrupt);
|
||||||
|
|
||||||
void WriteImmediate(u32 value, u32 output_address, bool write_to_DIIMMBUF);
|
void WriteImmediate(u32 value, u32 output_address, bool write_to_DIIMMBUF);
|
||||||
DVDCommandResult ExecuteReadCommand(u64 DVD_offset, u32 output_address,
|
DVDCommandResult ExecuteReadCommand(u64 DVD_offset, u32 output_address,
|
||||||
u32 DVD_length, u32 output_length, bool raw = false);
|
u32 DVD_length, u32 output_length, bool decrypt);
|
||||||
|
|
||||||
u64 SimulateDiscReadTime(u64 offset, u32 length);
|
u64 SimulateDiscReadTime(u64 offset, u32 length);
|
||||||
s64 CalculateRawDiscReadTime(u64 offset, s64 length);
|
s64 CalculateRawDiscReadTime(u64 offset, s64 length);
|
||||||
|
@ -328,7 +328,7 @@ static u32 ProcessDTKSamples(short *tempPCM, u32 num_samples)
|
||||||
|
|
||||||
u8 tempADPCM[NGCADPCM::ONE_BLOCK_SIZE];
|
u8 tempADPCM[NGCADPCM::ONE_BLOCK_SIZE];
|
||||||
// TODO: What if we can't read from AudioPos?
|
// TODO: What if we can't read from AudioPos?
|
||||||
VolumeHandler::ReadToPtr(tempADPCM, AudioPos, sizeof(tempADPCM));
|
VolumeHandler::ReadToPtr(tempADPCM, AudioPos, sizeof(tempADPCM), false);
|
||||||
AudioPos += sizeof(tempADPCM);
|
AudioPos += sizeof(tempADPCM);
|
||||||
NGCADPCM::DecodeBlock(tempPCM + samples_processed * 2, tempADPCM);
|
NGCADPCM::DecodeBlock(tempPCM + samples_processed * 2, tempADPCM);
|
||||||
samples_processed += NGCADPCM::SAMPLES_PER_BLOCK;
|
samples_processed += NGCADPCM::SAMPLES_PER_BLOCK;
|
||||||
|
@ -467,12 +467,9 @@ void SetLidOpen(bool _bOpen)
|
||||||
GenerateDIInterrupt(INT_CVRINT);
|
GenerateDIInterrupt(INT_CVRINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DVDRead(u64 _iDVDOffset, u32 _iRamAddress, u32 _iLength, bool raw)
|
bool DVDRead(u64 _iDVDOffset, u32 _iRamAddress, u32 _iLength, bool decrypt)
|
||||||
{
|
{
|
||||||
if (raw)
|
return VolumeHandler::ReadToPtr(Memory::GetPointer(_iRamAddress), _iDVDOffset, _iLength, decrypt);
|
||||||
return VolumeHandler::RAWReadToPtr(Memory::GetPointer(_iRamAddress), _iDVDOffset, _iLength);
|
|
||||||
else
|
|
||||||
return VolumeHandler::ReadToPtr(Memory::GetPointer(_iRamAddress), _iDVDOffset, _iLength);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
|
@ -615,7 +612,7 @@ void WriteImmediate(u32 value, u32 output_address, bool write_to_DIIMMBUF)
|
||||||
}
|
}
|
||||||
|
|
||||||
DVDCommandResult ExecuteReadCommand(u64 DVD_offset, u32 output_address,
|
DVDCommandResult ExecuteReadCommand(u64 DVD_offset, u32 output_address,
|
||||||
u32 DVD_length, u32 output_length, bool raw)
|
u32 DVD_length, u32 output_length, bool decrypt)
|
||||||
{
|
{
|
||||||
if (DVD_length > output_length)
|
if (DVD_length > output_length)
|
||||||
{
|
{
|
||||||
|
@ -633,7 +630,7 @@ DVDCommandResult ExecuteReadCommand(u64 DVD_offset, u32 output_address,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DVDRead(DVD_offset, output_address, DVD_length, raw))
|
if (!DVDRead(DVD_offset, output_address, DVD_length, decrypt))
|
||||||
PanicAlertT("Can't read from DVD_Plugin - DVD-Interface: Fatal Error");
|
PanicAlertT("Can't read from DVD_Plugin - DVD-Interface: Fatal Error");
|
||||||
|
|
||||||
result.interrupt_type = INT_TCINT;
|
result.interrupt_type = INT_TCINT;
|
||||||
|
@ -690,13 +687,13 @@ DVDCommandResult ExecuteCommand(u32 command_0, u32 command_1, u32 command_2,
|
||||||
// Only seems to be used from WII_IPC, not through direct access
|
// Only seems to be used from WII_IPC, not through direct access
|
||||||
case DVDLowReadDiskID:
|
case DVDLowReadDiskID:
|
||||||
INFO_LOG(DVDINTERFACE, "DVDLowReadDiskID");
|
INFO_LOG(DVDINTERFACE, "DVDLowReadDiskID");
|
||||||
result = ExecuteReadCommand(0, output_address, 0x20, output_length, true);
|
result = ExecuteReadCommand(0, output_address, 0x20, output_length, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Only seems to be used from WII_IPC, not through direct access
|
// Only used from WII_IPC. This is the only read command that decrypts data
|
||||||
case DVDLowRead:
|
case DVDLowRead:
|
||||||
INFO_LOG(DVDINTERFACE, "DVDLowRead: DVDAddr: 0x%09" PRIx64 ", Size: 0x%x", (u64)command_2 << 2, command_1);
|
INFO_LOG(DVDINTERFACE, "DVDLowRead: DVDAddr: 0x%09" PRIx64 ", Size: 0x%x", (u64)command_2 << 2, command_1);
|
||||||
result = ExecuteReadCommand((u64)command_2 << 2, output_address, command_1, output_length);
|
result = ExecuteReadCommand((u64)command_2 << 2, output_address, command_1, output_length, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Probably only used by Wii
|
// Probably only used by Wii
|
||||||
|
@ -780,7 +777,7 @@ DVDCommandResult ExecuteCommand(u32 command_0, u32 command_1, u32 command_2,
|
||||||
(command_2 > 0x7ed40000 && command_2 < 0x7ed40008) ||
|
(command_2 > 0x7ed40000 && command_2 < 0x7ed40008) ||
|
||||||
(((command_2 + command_1) > 0x7ed40000) && (command_2 + command_1) < 0x7ed40008)))
|
(((command_2 + command_1) > 0x7ed40000) && (command_2 + command_1) < 0x7ed40008)))
|
||||||
{
|
{
|
||||||
result = ExecuteReadCommand((u64)command_2 << 2, output_address, command_1, output_length, true);
|
result = ExecuteReadCommand((u64)command_2 << 2, output_address, command_1, output_length, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -876,13 +873,13 @@ DVDCommandResult ExecuteCommand(u32 command_0, u32 command_1, u32 command_2,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ExecuteReadCommand(iDVDOffset, output_address, command_2, output_length);
|
result = ExecuteReadCommand(iDVDOffset, output_address, command_2, output_length, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x40: // Read DiscID
|
case 0x40: // Read DiscID
|
||||||
INFO_LOG(DVDINTERFACE, "Read DiscID %08x", Memory::Read_U32(output_address));
|
INFO_LOG(DVDINTERFACE, "Read DiscID %08x", Memory::Read_U32(output_address));
|
||||||
result = ExecuteReadCommand(0, output_address, 0x20, output_length);
|
result = ExecuteReadCommand(0, output_address, 0x20, output_length, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -103,7 +103,7 @@ bool IsDiscInside();
|
||||||
void ChangeDisc(const std::string& fileName);
|
void ChangeDisc(const std::string& fileName);
|
||||||
|
|
||||||
// DVD Access Functions
|
// DVD Access Functions
|
||||||
bool DVDRead(u64 _iDVDOffset, u32 _iRamAddress, u32 _iLength, bool raw = false);
|
bool DVDRead(u64 _iDVDOffset, u32 _iRamAddress, u32 _iLength, bool decrypt);
|
||||||
extern bool g_bStream;
|
extern bool g_bStream;
|
||||||
DVDCommandResult ExecuteCommand(u32 command_0, u32 command_1, u32 command_2,
|
DVDCommandResult ExecuteCommand(u32 command_0, u32 command_1, u32 command_2,
|
||||||
u32 output_address, u32 output_length, bool write_to_DIIMMBUF);
|
u32 output_address, u32 output_length, bool write_to_DIIMMBUF);
|
||||||
|
|
|
@ -53,29 +53,21 @@ void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii, const std::
|
||||||
g_pVolume = DiscIO::CreateVolumeFromDirectory(_rFullPath, _bIsWii, _rApploader, _rDOL);
|
g_pVolume = DiscIO::CreateVolumeFromDirectory(_rFullPath, _bIsWii, _rApploader, _rDOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 Read32(u64 _Offset)
|
u32 Read32(u64 _Offset, bool decrypt)
|
||||||
{
|
{
|
||||||
if (g_pVolume != nullptr)
|
if (g_pVolume != nullptr)
|
||||||
{
|
{
|
||||||
u32 Temp;
|
u32 Temp;
|
||||||
g_pVolume->Read(_Offset, 4, (u8*)&Temp);
|
g_pVolume->Read(_Offset, 4, (u8*)&Temp, decrypt);
|
||||||
return Common::swap32(Temp);
|
return Common::swap32(Temp);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength)
|
bool ReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength, bool decrypt)
|
||||||
{
|
{
|
||||||
if (g_pVolume != nullptr && ptr)
|
if (g_pVolume != nullptr && ptr)
|
||||||
return g_pVolume->Read(_dwOffset, _dwLength, ptr);
|
return g_pVolume->Read(_dwOffset, _dwLength, ptr, decrypt);
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RAWReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength)
|
|
||||||
{
|
|
||||||
if (g_pVolume != nullptr && ptr)
|
|
||||||
return g_pVolume->RAWRead(_dwOffset, _dwLength, ptr);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,10 @@ namespace VolumeHandler
|
||||||
bool SetVolumeName(const std::string& _rFullPath);
|
bool SetVolumeName(const std::string& _rFullPath);
|
||||||
void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii, const std::string& _rApploader = "", const std::string& _rDOL = "");
|
void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii, const std::string& _rApploader = "", const std::string& _rDOL = "");
|
||||||
|
|
||||||
u32 Read32(u64 _Offset);
|
// decrypt parameter must be false if not reading a Wii disc
|
||||||
bool ReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength);
|
u32 Read32(u64 _Offset, bool decrypt);
|
||||||
bool RAWReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength);
|
// decrypt parameter must be false if not reading a Wii disc
|
||||||
|
bool ReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength, bool decrypt);
|
||||||
|
|
||||||
bool IsValid();
|
bool IsValid();
|
||||||
bool IsWii();
|
bool IsWii();
|
||||||
|
|
|
@ -73,10 +73,8 @@ static SPartitionGroup PartitionGroup[4];
|
||||||
|
|
||||||
void MarkAsUsed(u64 _Offset, u64 _Size);
|
void MarkAsUsed(u64 _Offset, u64 _Size);
|
||||||
void MarkAsUsedE(u64 _PartitionDataOffset, u64 _Offset, u64 _Size);
|
void MarkAsUsedE(u64 _PartitionDataOffset, u64 _Offset, u64 _Size);
|
||||||
void ReadFromDisc(u64 _Offset, u64 _Length, u32& _Buffer);
|
void ReadFromVolume(u64 _Offset, u64 _Length, u32& _Buffer, bool _Decrypt);
|
||||||
void ReadFromDisc(u64 _Offset, u64 _Length, u64& _Buffer);
|
void ReadFromVolume(u64 _Offset, u64 _Length, u64& _Buffer, bool _Decrypt);
|
||||||
void ReadFromVolume(u64 _Offset, u64 _Length, u32& _Buffer);
|
|
||||||
void ReadFromVolume(u64 _Offset, u64 _Length, u64& _Buffer);
|
|
||||||
bool ParseDisc();
|
bool ParseDisc();
|
||||||
bool ParsePartitionData(SPartition& _rPartition);
|
bool ParsePartitionData(SPartition& _rPartition);
|
||||||
u32 GetDOLSize(u64 _DOLOffset);
|
u32 GetDOLSize(u64 _DOLOffset);
|
||||||
|
@ -190,27 +188,15 @@ void MarkAsUsedE(u64 _PartitionDataOffset, u64 _Offset, u64 _Size)
|
||||||
MarkAsUsed(Offset, Size);
|
MarkAsUsed(Offset, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper functions for RAW reading the BE discs
|
|
||||||
void ReadFromDisc(u64 _Offset, u64 _Length, u32& _Buffer)
|
|
||||||
{
|
|
||||||
m_Disc->RAWRead(_Offset, _Length, (u8*)&_Buffer);
|
|
||||||
_Buffer = Common::swap32(_Buffer);
|
|
||||||
}
|
|
||||||
void ReadFromDisc(u64 _Offset, u64 _Length, u64& _Buffer)
|
|
||||||
{
|
|
||||||
m_Disc->RAWRead(_Offset, _Length, (u8*)&_Buffer);
|
|
||||||
_Buffer = Common::swap32((u32)_Buffer);
|
|
||||||
_Buffer <<= 2;
|
|
||||||
}
|
|
||||||
// Helper functions for reading the BE volume
|
// Helper functions for reading the BE volume
|
||||||
void ReadFromVolume(u64 _Offset, u64 _Length, u32& _Buffer)
|
void ReadFromVolume(u64 _Offset, u64 _Length, u32& _Buffer, bool _Decrypt)
|
||||||
{
|
{
|
||||||
m_Disc->Read(_Offset, _Length, (u8*)&_Buffer);
|
m_Disc->Read(_Offset, _Length, (u8*)&_Buffer, _Decrypt);
|
||||||
_Buffer = Common::swap32(_Buffer);
|
_Buffer = Common::swap32(_Buffer);
|
||||||
}
|
}
|
||||||
void ReadFromVolume(u64 _Offset, u64 _Length, u64& _Buffer)
|
void ReadFromVolume(u64 _Offset, u64 _Length, u64& _Buffer, bool _Decrypt)
|
||||||
{
|
{
|
||||||
m_Disc->Read(_Offset, _Length, (u8*)&_Buffer);
|
m_Disc->Read(_Offset, _Length, (u8*)&_Buffer, _Decrypt);
|
||||||
_Buffer = Common::swap32((u32)_Buffer);
|
_Buffer = Common::swap32((u32)_Buffer);
|
||||||
_Buffer <<= 2;
|
_Buffer <<= 2;
|
||||||
}
|
}
|
||||||
|
@ -222,8 +208,8 @@ bool ParseDisc()
|
||||||
|
|
||||||
for (int x = 0; x < 4; x++)
|
for (int x = 0; x < 4; x++)
|
||||||
{
|
{
|
||||||
ReadFromDisc(0x40000 + (x * 8) + 0, 4, PartitionGroup[x].numPartitions);
|
ReadFromVolume(0x40000 + (x * 8) + 0, 4, PartitionGroup[x].numPartitions, false);
|
||||||
ReadFromDisc(0x40000 + (x * 8) + 4, 4, PartitionGroup[x].PartitionsOffset);
|
ReadFromVolume(0x40000 + (x * 8) + 4, 4, PartitionGroup[x].PartitionsOffset, false);
|
||||||
|
|
||||||
// Read all partitions
|
// Read all partitions
|
||||||
for (u32 i = 0; i < PartitionGroup[x].numPartitions; i++)
|
for (u32 i = 0; i < PartitionGroup[x].numPartitions; i++)
|
||||||
|
@ -233,16 +219,16 @@ bool ParseDisc()
|
||||||
Partition.GroupNumber = x;
|
Partition.GroupNumber = x;
|
||||||
Partition.Number = i;
|
Partition.Number = i;
|
||||||
|
|
||||||
ReadFromDisc(PartitionGroup[x].PartitionsOffset + (i * 8) + 0, 4, Partition.Offset);
|
ReadFromVolume(PartitionGroup[x].PartitionsOffset + (i * 8) + 0, 4, Partition.Offset, false);
|
||||||
ReadFromDisc(PartitionGroup[x].PartitionsOffset + (i * 8) + 4, 4, Partition.Type);
|
ReadFromVolume(PartitionGroup[x].PartitionsOffset + (i * 8) + 4, 4, Partition.Type, false);
|
||||||
|
|
||||||
ReadFromDisc(Partition.Offset + 0x2a4, 4, Partition.Header.TMDSize);
|
ReadFromVolume(Partition.Offset + 0x2a4, 4, Partition.Header.TMDSize, false);
|
||||||
ReadFromDisc(Partition.Offset + 0x2a8, 4, Partition.Header.TMDOffset);
|
ReadFromVolume(Partition.Offset + 0x2a8, 4, Partition.Header.TMDOffset, false);
|
||||||
ReadFromDisc(Partition.Offset + 0x2ac, 4, Partition.Header.CertChainSize);
|
ReadFromVolume(Partition.Offset + 0x2ac, 4, Partition.Header.CertChainSize, false);
|
||||||
ReadFromDisc(Partition.Offset + 0x2b0, 4, Partition.Header.CertChainOffset);
|
ReadFromVolume(Partition.Offset + 0x2b0, 4, Partition.Header.CertChainOffset, false);
|
||||||
ReadFromDisc(Partition.Offset + 0x2b4, 4, Partition.Header.H3Offset);
|
ReadFromVolume(Partition.Offset + 0x2b4, 4, Partition.Header.H3Offset, false);
|
||||||
ReadFromDisc(Partition.Offset + 0x2b8, 4, Partition.Header.DataOffset);
|
ReadFromVolume(Partition.Offset + 0x2b8, 4, Partition.Header.DataOffset, false);
|
||||||
ReadFromDisc(Partition.Offset + 0x2bc, 4, Partition.Header.DataSize);
|
ReadFromVolume(Partition.Offset + 0x2bc, 4, Partition.Header.DataSize, false);
|
||||||
|
|
||||||
PartitionGroup[x].PartitionsVec.push_back(Partition);
|
PartitionGroup[x].PartitionsVec.push_back(Partition);
|
||||||
}
|
}
|
||||||
|
@ -293,8 +279,8 @@ bool ParsePartitionData(SPartition& _rPartition)
|
||||||
|
|
||||||
// Mark things as used which are not in the filesystem
|
// Mark things as used which are not in the filesystem
|
||||||
// Header, Header Information, Apploader
|
// Header, Header Information, Apploader
|
||||||
ReadFromVolume(0x2440 + 0x14, 4, _rPartition.Header.ApploaderSize);
|
ReadFromVolume(0x2440 + 0x14, 4, _rPartition.Header.ApploaderSize, true);
|
||||||
ReadFromVolume(0x2440 + 0x18, 4, _rPartition.Header.ApploaderTrailerSize);
|
ReadFromVolume(0x2440 + 0x18, 4, _rPartition.Header.ApploaderTrailerSize, true);
|
||||||
MarkAsUsedE(_rPartition.Offset
|
MarkAsUsedE(_rPartition.Offset
|
||||||
+ _rPartition.Header.DataOffset
|
+ _rPartition.Header.DataOffset
|
||||||
, 0
|
, 0
|
||||||
|
@ -303,7 +289,7 @@ bool ParsePartitionData(SPartition& _rPartition)
|
||||||
+ _rPartition.Header.ApploaderTrailerSize);
|
+ _rPartition.Header.ApploaderTrailerSize);
|
||||||
|
|
||||||
// DOL
|
// DOL
|
||||||
ReadFromVolume(0x420, 4, _rPartition.Header.DOLOffset);
|
ReadFromVolume(0x420, 4, _rPartition.Header.DOLOffset, true);
|
||||||
_rPartition.Header.DOLSize = GetDOLSize(_rPartition.Header.DOLOffset);
|
_rPartition.Header.DOLSize = GetDOLSize(_rPartition.Header.DOLOffset);
|
||||||
MarkAsUsedE(_rPartition.Offset
|
MarkAsUsedE(_rPartition.Offset
|
||||||
+ _rPartition.Header.DataOffset
|
+ _rPartition.Header.DataOffset
|
||||||
|
@ -311,8 +297,8 @@ bool ParsePartitionData(SPartition& _rPartition)
|
||||||
, _rPartition.Header.DOLSize);
|
, _rPartition.Header.DOLSize);
|
||||||
|
|
||||||
// FST
|
// FST
|
||||||
ReadFromVolume(0x424, 4, _rPartition.Header.FSTOffset);
|
ReadFromVolume(0x424, 4, _rPartition.Header.FSTOffset, true);
|
||||||
ReadFromVolume(0x428, 4, _rPartition.Header.FSTSize);
|
ReadFromVolume(0x428, 4, _rPartition.Header.FSTSize, true);
|
||||||
MarkAsUsedE(_rPartition.Offset
|
MarkAsUsedE(_rPartition.Offset
|
||||||
+ _rPartition.Header.DataOffset
|
+ _rPartition.Header.DataOffset
|
||||||
, _rPartition.Header.FSTOffset
|
, _rPartition.Header.FSTOffset
|
||||||
|
@ -348,8 +334,8 @@ u32 GetDOLSize(u64 _DOLOffset)
|
||||||
// Iterate through the 7 code segments
|
// Iterate through the 7 code segments
|
||||||
for (u8 i = 0; i < 7; i++)
|
for (u8 i = 0; i < 7; i++)
|
||||||
{
|
{
|
||||||
ReadFromVolume(_DOLOffset + 0x00 + i * 4, 4, offset);
|
ReadFromVolume(_DOLOffset + 0x00 + i * 4, 4, offset, true);
|
||||||
ReadFromVolume(_DOLOffset + 0x90 + i * 4, 4, size);
|
ReadFromVolume(_DOLOffset + 0x90 + i * 4, 4, size, true);
|
||||||
if (offset + size > max)
|
if (offset + size > max)
|
||||||
max = offset + size;
|
max = offset + size;
|
||||||
}
|
}
|
||||||
|
@ -357,8 +343,8 @@ u32 GetDOLSize(u64 _DOLOffset)
|
||||||
// Iterate through the 11 data segments
|
// Iterate through the 11 data segments
|
||||||
for (u8 i = 0; i < 11; i++)
|
for (u8 i = 0; i < 11; i++)
|
||||||
{
|
{
|
||||||
ReadFromVolume(_DOLOffset + 0x1c + i * 4, 4, offset);
|
ReadFromVolume(_DOLOffset + 0x1c + i * 4, 4, offset, true);
|
||||||
ReadFromVolume(_DOLOffset + 0xac + i * 4, 4, size);
|
ReadFromVolume(_DOLOffset + 0xac + i * 4, 4, size, true);
|
||||||
if (offset + size > max)
|
if (offset + size > max)
|
||||||
max = offset + size;
|
max = offset + size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ CFileSystemGCWii::CFileSystemGCWii(const IVolume *_rVolume)
|
||||||
: IFileSystem(_rVolume)
|
: IFileSystem(_rVolume)
|
||||||
, m_Initialized(false)
|
, m_Initialized(false)
|
||||||
, m_Valid(false)
|
, m_Valid(false)
|
||||||
, m_OffsetShift(0)
|
, m_Wii(false)
|
||||||
{
|
{
|
||||||
m_Valid = DetectFileSystem();
|
m_Valid = DetectFileSystem();
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ u64 CFileSystemGCWii::ReadFile(const std::string& _rFullPath, u8* _pBuffer, size
|
||||||
DEBUG_LOG(DISCIO, "Filename: %s. Offset: %" PRIx64 ". Size: %" PRIx64, _rFullPath.c_str(),
|
DEBUG_LOG(DISCIO, "Filename: %s. Offset: %" PRIx64 ". Size: %" PRIx64, _rFullPath.c_str(),
|
||||||
pFileInfo->m_Offset, pFileInfo->m_FileSize);
|
pFileInfo->m_Offset, pFileInfo->m_FileSize);
|
||||||
|
|
||||||
m_rVolume->Read(pFileInfo->m_Offset, pFileInfo->m_FileSize, _pBuffer);
|
m_rVolume->Read(pFileInfo->m_Offset, pFileInfo->m_FileSize, _pBuffer, m_Wii);
|
||||||
return pFileInfo->m_FileSize;
|
return pFileInfo->m_FileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ bool CFileSystemGCWii::ExportFile(const std::string& _rFullPath, const std::stri
|
||||||
|
|
||||||
std::vector<u8> buffer(readSize);
|
std::vector<u8> buffer(readSize);
|
||||||
|
|
||||||
result = m_rVolume->Read(fileOffset, readSize, &buffer[0]);
|
result = m_rVolume->Read(fileOffset, readSize, &buffer[0], m_Wii);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
break;
|
break;
|
||||||
|
@ -130,7 +130,7 @@ bool CFileSystemGCWii::ExportApploader(const std::string& _rExportFolder) const
|
||||||
DEBUG_LOG(DISCIO,"AppSize -> %x", AppSize);
|
DEBUG_LOG(DISCIO,"AppSize -> %x", AppSize);
|
||||||
|
|
||||||
std::vector<u8> buffer(AppSize);
|
std::vector<u8> buffer(AppSize);
|
||||||
if (m_rVolume->Read(0x2440, AppSize, &buffer[0]))
|
if (m_rVolume->Read(0x2440, AppSize, &buffer[0], m_Wii))
|
||||||
{
|
{
|
||||||
std::string exportName(_rExportFolder + "/apploader.img");
|
std::string exportName(_rExportFolder + "/apploader.img");
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ bool CFileSystemGCWii::ExportApploader(const std::string& _rExportFolder) const
|
||||||
|
|
||||||
u32 CFileSystemGCWii::GetBootDOLSize() const
|
u32 CFileSystemGCWii::GetBootDOLSize() const
|
||||||
{
|
{
|
||||||
u32 DolOffset = Read32(0x420) << m_OffsetShift;
|
u32 DolOffset = Read32(0x420) << GetOffsetShift();
|
||||||
u32 DolSize = 0, offset = 0, size = 0;
|
u32 DolSize = 0, offset = 0, size = 0;
|
||||||
|
|
||||||
// Iterate through the 7 code segments
|
// Iterate through the 7 code segments
|
||||||
|
@ -172,17 +172,17 @@ u32 CFileSystemGCWii::GetBootDOLSize() const
|
||||||
|
|
||||||
bool CFileSystemGCWii::GetBootDOL(u8* &buffer, u32 DolSize) const
|
bool CFileSystemGCWii::GetBootDOL(u8* &buffer, u32 DolSize) const
|
||||||
{
|
{
|
||||||
u32 DolOffset = Read32(0x420) << m_OffsetShift;
|
u32 DolOffset = Read32(0x420) << GetOffsetShift();
|
||||||
return m_rVolume->Read(DolOffset, DolSize, buffer);
|
return m_rVolume->Read(DolOffset, DolSize, buffer, m_Wii);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFileSystemGCWii::ExportDOL(const std::string& _rExportFolder) const
|
bool CFileSystemGCWii::ExportDOL(const std::string& _rExportFolder) const
|
||||||
{
|
{
|
||||||
u32 DolOffset = Read32(0x420) << m_OffsetShift;
|
u32 DolOffset = Read32(0x420) << GetOffsetShift();
|
||||||
u32 DolSize = GetBootDOLSize();
|
u32 DolSize = GetBootDOLSize();
|
||||||
|
|
||||||
std::vector<u8> buffer(DolSize);
|
std::vector<u8> buffer(DolSize);
|
||||||
if (m_rVolume->Read(DolOffset, DolSize, &buffer[0]))
|
if (m_rVolume->Read(DolOffset, DolSize, &buffer[0], m_Wii))
|
||||||
{
|
{
|
||||||
std::string exportName(_rExportFolder + "/boot.dol");
|
std::string exportName(_rExportFolder + "/boot.dol");
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ bool CFileSystemGCWii::ExportDOL(const std::string& _rExportFolder) const
|
||||||
u32 CFileSystemGCWii::Read32(u64 _Offset) const
|
u32 CFileSystemGCWii::Read32(u64 _Offset) const
|
||||||
{
|
{
|
||||||
u32 Temp = 0;
|
u32 Temp = 0;
|
||||||
m_rVolume->Read(_Offset, 4, (u8*)&Temp);
|
m_rVolume->Read(_Offset, 4, (u8*)&Temp, m_Wii);
|
||||||
return Common::swap32(Temp);
|
return Common::swap32(Temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ std::string CFileSystemGCWii::GetStringFromOffset(u64 _Offset) const
|
||||||
{
|
{
|
||||||
std::string data;
|
std::string data;
|
||||||
data.resize(255);
|
data.resize(255);
|
||||||
m_rVolume->Read(_Offset, data.size(), (u8*)&data[0]);
|
m_rVolume->Read(_Offset, data.size(), (u8*)&data[0], m_Wii);
|
||||||
data.erase(std::find(data.begin(), data.end(), 0x00), data.end());
|
data.erase(std::find(data.begin(), data.end(), 0x00), data.end());
|
||||||
|
|
||||||
// TODO: Should we really always use SHIFT-JIS?
|
// TODO: Should we really always use SHIFT-JIS?
|
||||||
|
@ -248,12 +248,12 @@ bool CFileSystemGCWii::DetectFileSystem()
|
||||||
{
|
{
|
||||||
if (Read32(0x18) == 0x5D1C9EA3)
|
if (Read32(0x18) == 0x5D1C9EA3)
|
||||||
{
|
{
|
||||||
m_OffsetShift = 2; // Wii file system
|
m_Wii = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (Read32(0x1c) == 0xC2339F3D)
|
else if (Read32(0x1c) == 0xC2339F3D)
|
||||||
{
|
{
|
||||||
m_OffsetShift = 0; // GC file system
|
m_Wii = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ void CFileSystemGCWii::InitFileSystem()
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
|
|
||||||
// read the whole FST
|
// read the whole FST
|
||||||
u64 FSTOffset = (u64)Read32(0x424) << m_OffsetShift;
|
u64 FSTOffset = (u64)Read32(0x424) << GetOffsetShift();
|
||||||
// u32 FSTSize = Read32(0x428);
|
// u32 FSTSize = Read32(0x428);
|
||||||
// u32 FSTMaxSize = Read32(0x42C);
|
// u32 FSTMaxSize = Read32(0x42C);
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ void CFileSystemGCWii::InitFileSystem()
|
||||||
// read all fileinfos
|
// read all fileinfos
|
||||||
SFileInfo Root;
|
SFileInfo Root;
|
||||||
Root.m_NameOffset = Read32(FSTOffset + 0x0);
|
Root.m_NameOffset = Read32(FSTOffset + 0x0);
|
||||||
Root.m_Offset = (u64)Read32(FSTOffset + 0x4) << m_OffsetShift;
|
Root.m_Offset = (u64)Read32(FSTOffset + 0x4) << GetOffsetShift();
|
||||||
Root.m_FileSize = Read32(FSTOffset + 0x8);
|
Root.m_FileSize = Read32(FSTOffset + 0x8);
|
||||||
|
|
||||||
if (Root.IsDirectory())
|
if (Root.IsDirectory())
|
||||||
|
@ -288,7 +288,7 @@ void CFileSystemGCWii::InitFileSystem()
|
||||||
SFileInfo sfi;
|
SFileInfo sfi;
|
||||||
u64 Offset = FSTOffset + (i * 0xC);
|
u64 Offset = FSTOffset + (i * 0xC);
|
||||||
sfi.m_NameOffset = Read32(Offset + 0x0);
|
sfi.m_NameOffset = Read32(Offset + 0x0);
|
||||||
sfi.m_Offset = (u64)Read32(Offset + 0x4) << m_OffsetShift;
|
sfi.m_Offset = (u64)Read32(Offset + 0x4) << GetOffsetShift();
|
||||||
sfi.m_FileSize = Read32(Offset + 0x8);
|
sfi.m_FileSize = Read32(Offset + 0x8);
|
||||||
|
|
||||||
m_FileInfoVector.push_back(sfi);
|
m_FileInfoVector.push_back(sfi);
|
||||||
|
@ -325,4 +325,9 @@ size_t CFileSystemGCWii::BuildFilenames(const size_t _FirstIndex, const size_t _
|
||||||
return CurrentIndex;
|
return CurrentIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 CFileSystemGCWii::GetOffsetShift() const
|
||||||
|
{
|
||||||
|
return m_Wii ? 2 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
private:
|
private:
|
||||||
bool m_Initialized;
|
bool m_Initialized;
|
||||||
bool m_Valid;
|
bool m_Valid;
|
||||||
u32 m_OffsetShift; // WII offsets are all shifted
|
bool m_Wii;
|
||||||
|
|
||||||
std::vector <SFileInfo> m_FileInfoVector;
|
std::vector <SFileInfo> m_FileInfoVector;
|
||||||
u32 Read32(u64 _Offset) const;
|
u32 Read32(u64 _Offset) const;
|
||||||
|
@ -44,6 +44,7 @@ private:
|
||||||
bool DetectFileSystem();
|
bool DetectFileSystem();
|
||||||
void InitFileSystem();
|
void InitFileSystem();
|
||||||
size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const std::string& _szDirectory, u64 _NameTableOffset);
|
size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const std::string& _szDirectory, u64 _NameTableOffset);
|
||||||
|
u32 GetOffsetShift() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -18,8 +18,9 @@ public:
|
||||||
IVolume() {}
|
IVolume() {}
|
||||||
virtual ~IVolume() {}
|
virtual ~IVolume() {}
|
||||||
|
|
||||||
virtual bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const = 0;
|
// decrypt parameter must be false if not reading a Wii disc
|
||||||
virtual bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const = 0;
|
virtual bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const = 0;
|
||||||
|
|
||||||
virtual bool GetTitleID(u8*) const { return false; }
|
virtual bool GetTitleID(u8*) const { return false; }
|
||||||
virtual std::unique_ptr<u8[]> GetTMD(u32 *_sz) const
|
virtual std::unique_ptr<u8[]> GetTMD(u32 *_sz) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -123,7 +123,7 @@ IVolume* CreateVolumeFromDirectory(const std::string& _rDirectory, bool _bIsWii,
|
||||||
bool IsVolumeWiiDisc(const IVolume *_rVolume)
|
bool IsVolumeWiiDisc(const IVolume *_rVolume)
|
||||||
{
|
{
|
||||||
u32 MagicWord = 0;
|
u32 MagicWord = 0;
|
||||||
_rVolume->Read(0x18, 4, (u8*)&MagicWord);
|
_rVolume->Read(0x18, 4, (u8*)&MagicWord, false);
|
||||||
|
|
||||||
return (Common::swap32(MagicWord) == 0x5D1C9EA3);
|
return (Common::swap32(MagicWord) == 0x5D1C9EA3);
|
||||||
//GameCube 0xc2339f3d
|
//GameCube 0xc2339f3d
|
||||||
|
@ -132,7 +132,7 @@ bool IsVolumeWiiDisc(const IVolume *_rVolume)
|
||||||
bool IsVolumeWadFile(const IVolume *_rVolume)
|
bool IsVolumeWadFile(const IVolume *_rVolume)
|
||||||
{
|
{
|
||||||
u32 MagicWord = 0;
|
u32 MagicWord = 0;
|
||||||
_rVolume->Read(0x02, 4, (u8*)&MagicWord);
|
_rVolume->Read(0x02, 4, (u8*)&MagicWord, false);
|
||||||
|
|
||||||
return (Common::swap32(MagicWord) == 0x00204973 || Common::swap32(MagicWord) == 0x00206962);
|
return (Common::swap32(MagicWord) == 0x00204973 || Common::swap32(MagicWord) == 0x00206962);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Common/MathUtil.h"
|
#include "Common/MathUtil.h"
|
||||||
|
#include "Core/VolumeHandler.h"
|
||||||
#include "DiscIO/FileBlob.h"
|
#include "DiscIO/FileBlob.h"
|
||||||
#include "DiscIO/Volume.h"
|
#include "DiscIO/Volume.h"
|
||||||
#include "DiscIO/VolumeDirectory.h"
|
#include "DiscIO/VolumeDirectory.h"
|
||||||
|
@ -63,13 +64,23 @@ bool CVolumeDirectory::IsValidDirectory(const std::string& _rDirectory)
|
||||||
return File::IsDirectory(directoryName);
|
return File::IsDirectory(directoryName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVolumeDirectory::RAWRead( u64 _Offset, u64 _Length, u8* _pBuffer ) const
|
bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const
|
||||||
{
|
{
|
||||||
return false;
|
bool wii = VolumeHandler::IsWii();
|
||||||
}
|
|
||||||
|
if (!decrypt && (_Offset + _Length >= 0x400) && wii)
|
||||||
|
{
|
||||||
|
// Fully supporting this would require re-encrypting every file that's read.
|
||||||
|
// Only supporting the areas that IOS allows software to read could be more feasible.
|
||||||
|
// Currently, only the header (up to 0x400) is supported, though we're cheating a bit
|
||||||
|
// with it by reading the header inside the current partition instead. Supporting the
|
||||||
|
// header is enough for booting games, but not for running things like the Disc Channel.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (decrypt && !wii)
|
||||||
|
PanicAlertT("Tried to decrypt data from a non-Wii volume");
|
||||||
|
|
||||||
bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
|
|
||||||
{
|
|
||||||
// header
|
// header
|
||||||
if (_Offset < DISKHEADERINFO_ADDRESS)
|
if (_Offset < DISKHEADERINFO_ADDRESS)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,8 +32,7 @@ public:
|
||||||
|
|
||||||
static bool IsValidDirectory(const std::string& _rDirectory);
|
static bool IsValidDirectory(const std::string& _rDirectory);
|
||||||
|
|
||||||
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const override;
|
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const override;
|
||||||
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const override;
|
|
||||||
|
|
||||||
std::string GetUniqueID() const override;
|
std::string GetUniqueID() const override;
|
||||||
void SetUniqueID(const std::string& _ID);
|
void SetUniqueID(const std::string& _ID);
|
||||||
|
|
|
@ -24,8 +24,11 @@ CVolumeGC::~CVolumeGC()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVolumeGC::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
|
bool CVolumeGC::Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const
|
||||||
{
|
{
|
||||||
|
if (decrypt)
|
||||||
|
PanicAlertT("Tried to decrypt data from a non-Wii volume");
|
||||||
|
|
||||||
if (m_pReader == nullptr)
|
if (m_pReader == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -34,11 +37,6 @@ bool CVolumeGC::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
|
||||||
return m_pReader->Read(_Offset, _Length, _pBuffer);
|
return m_pReader->Read(_Offset, _Length, _pBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVolumeGC::RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const
|
|
||||||
{
|
|
||||||
return Read(_Offset, _Length, _pBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CVolumeGC::GetUniqueID() const
|
std::string CVolumeGC::GetUniqueID() const
|
||||||
{
|
{
|
||||||
static const std::string NO_UID("NO_UID");
|
static const std::string NO_UID("NO_UID");
|
||||||
|
|
|
@ -23,8 +23,7 @@ class CVolumeGC : public IVolume
|
||||||
public:
|
public:
|
||||||
CVolumeGC(IBlobReader* _pReader);
|
CVolumeGC(IBlobReader* _pReader);
|
||||||
~CVolumeGC();
|
~CVolumeGC();
|
||||||
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const override;
|
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt = false) const override;
|
||||||
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const override;
|
|
||||||
std::string GetUniqueID() const override;
|
std::string GetUniqueID() const override;
|
||||||
std::string GetRevisionSpecificUniqueID() const override;
|
std::string GetRevisionSpecificUniqueID() const override;
|
||||||
std::string GetMakerID() const override;
|
std::string GetMakerID() const override;
|
||||||
|
|
|
@ -44,8 +44,11 @@ CVolumeWAD::~CVolumeWAD()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVolumeWAD::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
|
bool CVolumeWAD::Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const
|
||||||
{
|
{
|
||||||
|
if (decrypt)
|
||||||
|
PanicAlertT("Tried to decrypt data from a non-Wii volume");
|
||||||
|
|
||||||
if (m_pReader == nullptr)
|
if (m_pReader == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,7 @@ class CVolumeWAD : public IVolume
|
||||||
public:
|
public:
|
||||||
CVolumeWAD(IBlobReader* _pReader);
|
CVolumeWAD(IBlobReader* _pReader);
|
||||||
~CVolumeWAD();
|
~CVolumeWAD();
|
||||||
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const override;
|
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt = false) const override;
|
||||||
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const override { return false; }
|
|
||||||
bool GetTitleID(u8* _pBuffer) const override;
|
bool GetTitleID(u8* _pBuffer) const override;
|
||||||
std::string GetUniqueID() const override;
|
std::string GetUniqueID() const override;
|
||||||
std::string GetMakerID() const override;
|
std::string GetMakerID() const override;
|
||||||
|
|
|
@ -54,21 +54,13 @@ CVolumeWiiCrypted::~CVolumeWiiCrypted()
|
||||||
m_pBuffer = nullptr;
|
m_pBuffer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVolumeWiiCrypted::RAWRead( u64 _Offset, u64 _Length, u8* _pBuffer ) const
|
bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer, bool decrypt) const
|
||||||
{
|
|
||||||
// HyperIris: hack for DVDLowUnencryptedRead
|
|
||||||
// Medal Of Honor Heroes 2 read this DVD offset for PartitionsInfo
|
|
||||||
// and, PartitionsInfo is not encrypted, let's read it directly.
|
|
||||||
if (!m_pReader->Read(_Offset, _Length, _pBuffer))
|
|
||||||
return(false);
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer) const
|
|
||||||
{
|
{
|
||||||
if (m_pReader == nullptr)
|
if (m_pReader == nullptr)
|
||||||
return(false);
|
return false;
|
||||||
|
|
||||||
|
if (!decrypt)
|
||||||
|
return m_pReader->Read(_ReadOffset, _Length, _pBuffer);
|
||||||
|
|
||||||
FileMon::FindFilename(_ReadOffset);
|
FileMon::FindFilename(_ReadOffset);
|
||||||
|
|
||||||
|
@ -110,7 +102,7 @@ bool CVolumeWiiCrypted::GetTitleID(u8* _pBuffer) const
|
||||||
{
|
{
|
||||||
// Tik is at m_VolumeOffset size 0x2A4
|
// Tik is at m_VolumeOffset size 0x2A4
|
||||||
// TitleID offset in tik is 0x1DC
|
// TitleID offset in tik is 0x1DC
|
||||||
return RAWRead(m_VolumeOffset + 0x1DC, 8, _pBuffer);
|
return Read(m_VolumeOffset + 0x1DC, 8, _pBuffer, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<u8[]> CVolumeWiiCrypted::GetTMD(u32 *size) const
|
std::unique_ptr<u8[]> CVolumeWiiCrypted::GetTMD(u32 *size) const
|
||||||
|
@ -119,8 +111,8 @@ std::unique_ptr<u8[]> CVolumeWiiCrypted::GetTMD(u32 *size) const
|
||||||
u32 tmd_size;
|
u32 tmd_size;
|
||||||
u32 tmd_address;
|
u32 tmd_address;
|
||||||
|
|
||||||
RAWRead(m_VolumeOffset + 0x2a4, sizeof(u32), (u8*)&tmd_size);
|
Read(m_VolumeOffset + 0x2a4, sizeof(u32), (u8*)&tmd_size, false);
|
||||||
RAWRead(m_VolumeOffset + 0x2a8, sizeof(u32), (u8*)&tmd_address);
|
Read(m_VolumeOffset + 0x2a8, sizeof(u32), (u8*)&tmd_address, false);
|
||||||
tmd_size = Common::swap32(tmd_size);
|
tmd_size = Common::swap32(tmd_size);
|
||||||
tmd_address = Common::swap32(tmd_address) << 2;
|
tmd_address = Common::swap32(tmd_address) << 2;
|
||||||
|
|
||||||
|
@ -135,7 +127,7 @@ std::unique_ptr<u8[]> CVolumeWiiCrypted::GetTMD(u32 *size) const
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<u8[]> buf{ new u8[tmd_size] };
|
std::unique_ptr<u8[]> buf{ new u8[tmd_size] };
|
||||||
RAWRead(m_VolumeOffset + tmd_address, tmd_size, buf.get());
|
Read(m_VolumeOffset + tmd_address, tmd_size, buf.get(), false);
|
||||||
*size = tmd_size;
|
*size = tmd_size;
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +139,7 @@ std::string CVolumeWiiCrypted::GetUniqueID() const
|
||||||
|
|
||||||
char ID[7];
|
char ID[7];
|
||||||
|
|
||||||
if (!Read(0, 6, (u8*)ID))
|
if (!Read(0, 6, (u8*)ID, false))
|
||||||
return std::string();
|
return std::string();
|
||||||
|
|
||||||
ID[6] = '\0';
|
ID[6] = '\0';
|
||||||
|
@ -174,7 +166,7 @@ std::string CVolumeWiiCrypted::GetMakerID() const
|
||||||
|
|
||||||
char makerID[3];
|
char makerID[3];
|
||||||
|
|
||||||
if (!Read(0x4, 0x2, (u8*)&makerID))
|
if (!Read(0x4, 0x2, (u8*)&makerID, false))
|
||||||
return std::string();
|
return std::string();
|
||||||
|
|
||||||
makerID[2] = '\0';
|
makerID[2] = '\0';
|
||||||
|
@ -201,7 +193,7 @@ std::vector<std::string> CVolumeWiiCrypted::GetNames() const
|
||||||
auto const string_decoder = CVolumeGC::GetStringDecoder(GetCountry());
|
auto const string_decoder = CVolumeGC::GetStringDecoder(GetCountry());
|
||||||
|
|
||||||
char name[0xFF] = {};
|
char name[0xFF] = {};
|
||||||
if (m_pReader != nullptr && Read(0x20, 0x60, (u8*)&name))
|
if (m_pReader != nullptr && Read(0x20, 0x60, (u8*)&name, true))
|
||||||
names.push_back(string_decoder(name));
|
names.push_back(string_decoder(name));
|
||||||
|
|
||||||
return names;
|
return names;
|
||||||
|
@ -214,7 +206,7 @@ u32 CVolumeWiiCrypted::GetFSTSize() const
|
||||||
|
|
||||||
u32 size;
|
u32 size;
|
||||||
|
|
||||||
if (!Read(0x428, 0x4, (u8*)&size))
|
if (!Read(0x428, 0x4, (u8*)&size, true))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
|
@ -227,7 +219,7 @@ std::string CVolumeWiiCrypted::GetApploaderDate() const
|
||||||
|
|
||||||
char date[16];
|
char date[16];
|
||||||
|
|
||||||
if (!Read(0x2440, 0x10, (u8*)&date))
|
if (!Read(0x2440, 0x10, (u8*)&date, true))
|
||||||
return std::string();
|
return std::string();
|
||||||
|
|
||||||
date[10] = '\0';
|
date[10] = '\0';
|
||||||
|
@ -255,7 +247,7 @@ bool CVolumeWiiCrypted::CheckIntegrity() const
|
||||||
{
|
{
|
||||||
// Get partition data size
|
// Get partition data size
|
||||||
u32 partSizeDiv4;
|
u32 partSizeDiv4;
|
||||||
RAWRead(m_VolumeOffset + 0x2BC, 4, (u8*)&partSizeDiv4);
|
Read(m_VolumeOffset + 0x2BC, 4, (u8*)&partSizeDiv4, false);
|
||||||
u64 partDataSize = (u64)Common::swap32(partSizeDiv4) * 4;
|
u64 partDataSize = (u64)Common::swap32(partSizeDiv4) * 4;
|
||||||
|
|
||||||
u32 nClusters = (u32)(partDataSize / 0x8000);
|
u32 nClusters = (u32)(partDataSize / 0x8000);
|
||||||
|
@ -292,7 +284,7 @@ bool CVolumeWiiCrypted::CheckIntegrity() const
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
u8 clusterData[0x7C00];
|
u8 clusterData[0x7C00];
|
||||||
if (!Read((u64)clusterID * 0x7C00, 0x7C00, clusterData))
|
if (!Read((u64)clusterID * 0x7C00, 0x7C00, clusterData, true))
|
||||||
{
|
{
|
||||||
NOTICE_LOG(DISCIO, "Integrity Check: fail at cluster %d: could not read data", clusterID);
|
NOTICE_LOG(DISCIO, "Integrity Check: fail at cluster %d: could not read data", clusterID);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -24,8 +24,7 @@ class CVolumeWiiCrypted : public IVolume
|
||||||
public:
|
public:
|
||||||
CVolumeWiiCrypted(IBlobReader* _pReader, u64 _VolumeOffset, const unsigned char* _pVolumeKey);
|
CVolumeWiiCrypted(IBlobReader* _pReader, u64 _VolumeOffset, const unsigned char* _pVolumeKey);
|
||||||
~CVolumeWiiCrypted();
|
~CVolumeWiiCrypted();
|
||||||
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const override;
|
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const override;
|
||||||
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const override;
|
|
||||||
bool GetTitleID(u8* _pBuffer) const override;
|
bool GetTitleID(u8* _pBuffer) const override;
|
||||||
virtual std::unique_ptr<u8[]> GetTMD(u32 *_sz) const override;
|
virtual std::unique_ptr<u8[]> GetTMD(u32 *_sz) const override;
|
||||||
std::string GetUniqueID() const override;
|
std::string GetUniqueID() const override;
|
||||||
|
|
Loading…
Reference in New Issue