Move DVDRead from DVDInterface to Boot

It was previously an important part of DVDInterface,
but since its usage there was replaced with DVDThread,
the only remaining uses of it are in Boot and Boot_BS2Emu.
This commit is contained in:
JosJuice 2015-04-22 17:06:13 +02:00
parent 555eb1162f
commit e3b9e89f5a
5 changed files with 16 additions and 16 deletions

View File

@ -32,6 +32,11 @@
#include "DiscIO/NANDContentLoader.h" #include "DiscIO/NANDContentLoader.h"
#include "DiscIO/VolumeCreator.h" #include "DiscIO/VolumeCreator.h"
bool CBoot::DVDRead(u64 dvd_offset, u32 output_address, u32 length, bool decrypt)
{
return DVDInterface::GetVolume().Read(dvd_offset, length, Memory::GetPointer(output_address), decrypt);
}
void CBoot::Load_FST(bool _bIsWii) void CBoot::Load_FST(bool _bIsWii)
{ {
if (!DVDInterface::VolumeIsValid()) if (!DVDInterface::VolumeIsValid())
@ -40,7 +45,7 @@ void CBoot::Load_FST(bool _bIsWii)
const DiscIO::IVolume& volume = DVDInterface::GetVolume(); const DiscIO::IVolume& volume = DVDInterface::GetVolume();
// copy first 20 bytes of disc to start of Mem 1 // copy first 20 bytes of disc to start of Mem 1
DVDInterface::DVDRead(/*offset*/0, /*address*/0, /*length*/0x20, false); DVDRead(/*offset*/0, /*address*/0, /*length*/0x20, false);
// copy of game id // copy of game id
Memory::Write_U32(Memory::Read_U32(0x0000), 0x3180); Memory::Write_U32(Memory::Read_U32(0x0000), 0x3180);
@ -57,7 +62,7 @@ void CBoot::Load_FST(bool _bIsWii)
Memory::Write_U32(arenaHigh, 0x00000034); Memory::Write_U32(arenaHigh, 0x00000034);
// load FST // load FST
DVDInterface::DVDRead(fstOffset, arenaHigh, fstSize, _bIsWii); DVDRead(fstOffset, arenaHigh, fstSize, _bIsWii);
Memory::Write_U32(arenaHigh, 0x00000038); Memory::Write_U32(arenaHigh, 0x00000038);
Memory::Write_U32(maxFstSize, 0x0000003c); Memory::Write_U32(maxFstSize, 0x0000003c);
} }

View File

@ -41,6 +41,7 @@ public:
std::string* title_id = nullptr); std::string* title_id = nullptr);
private: private:
static bool DVDRead(u64 dvd_offset, u32 output_address, u32 length, bool decrypt);
static void RunFunction(u32 _iAddr); static void RunFunction(u32 _iAddr);
static void UpdateDebugger_MapLoaded(); static void UpdateDebugger_MapLoaded();

View File

@ -59,7 +59,7 @@ bool CBoot::EmulatedBS2_GC(bool skipAppLoader)
// It's possible to boot DOL and ELF files without a disc inserted // It's possible to boot DOL and ELF files without a disc inserted
if (DVDInterface::VolumeIsValid()) if (DVDInterface::VolumeIsValid())
DVDInterface::DVDRead(/*offset*/0x00000000, /*address*/0x00000000, 0x20, false); // write disc info DVDRead(/*offset*/0x00000000, /*address*/0x00000000, 0x20, false); // write disc info
PowerPC::HostWrite_U32(0x0D15EA5E, 0x80000020); // Booted from bootrom. 0xE5207C22 = booted from jtag PowerPC::HostWrite_U32(0x0D15EA5E, 0x80000020); // Booted from bootrom. 0xE5207C22 = booted from jtag
PowerPC::HostWrite_U32(Memory::REALRAM_SIZE, 0x80000028); // Physical Memory Size (24MB on retail) PowerPC::HostWrite_U32(Memory::REALRAM_SIZE, 0x80000028); // Physical Memory Size (24MB on retail)
@ -98,7 +98,7 @@ bool CBoot::EmulatedBS2_GC(bool skipAppLoader)
INFO_LOG(BOOT, "GC BS2: Not running apploader!"); INFO_LOG(BOOT, "GC BS2: Not running apploader!");
return false; return false;
} }
DVDInterface::DVDRead(iAppLoaderOffset + 0x20, 0x01200000, iAppLoaderSize, false); DVDRead(iAppLoaderOffset + 0x20, 0x01200000, iAppLoaderSize, false);
// Setup pointers like real BS2 does // Setup pointers like real BS2 does
if (SConfig::GetInstance().bNTSC) if (SConfig::GetInstance().bNTSC)
@ -149,7 +149,7 @@ bool CBoot::EmulatedBS2_GC(bool skipAppLoader)
u32 iDVDOffset = PowerPC::Read_U32(0x8130000c); u32 iDVDOffset = PowerPC::Read_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, false); DVDRead(iDVDOffset, iRamAddress, iLength, false);
} while (PowerPC::ppcState.gpr[3] != 0x00); } while (PowerPC::ppcState.gpr[3] != 0x00);
@ -256,7 +256,7 @@ bool CBoot::SetupWiiMemory(DiscIO::IVolume::ECountry country)
// When booting a WAD or the system menu, there will probably not be a disc inserted // When booting a WAD or the system menu, there will probably not be a disc inserted
if (DVDInterface::VolumeIsValid()) if (DVDInterface::VolumeIsValid())
DVDInterface::DVDRead(0x00000000, 0x00000000, 0x20, false); // Game Code 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
@ -333,10 +333,10 @@ bool CBoot::EmulatedBS2_Wii()
if (DVDInterface::VolumeIsValid() && DVDInterface::GetVolume().GetVolumeType() == DiscIO::IVolume::WII_DISC) if (DVDInterface::VolumeIsValid() && DVDInterface::GetVolume().GetVolumeType() == DiscIO::IVolume::WII_DISC)
{ {
// This is some kind of consistency check that is compared to the 0x00 // This is some kind of consistency check that is compared to the 0x00
// values as the game boots. This location keep the 4 byte ID for as long // values as the game boots. This location keeps 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.
DVDInterface::DVDRead(0, 0x3180, 4, true); DVDRead(0, 0x3180, 4, true);
// Set up MSR and the BAT SPR registers. // Set up MSR and the BAT SPR registers.
UReg_MSR& m_MSR = ((UReg_MSR&)PowerPC::ppcState.msr); UReg_MSR& m_MSR = ((UReg_MSR&)PowerPC::ppcState.msr);
@ -376,7 +376,7 @@ bool CBoot::EmulatedBS2_Wii()
ERROR_LOG(BOOT, "Invalid apploader. Probably your image is corrupted."); ERROR_LOG(BOOT, "Invalid apploader. Probably your image is corrupted.");
return false; return false;
} }
DVDInterface::DVDRead(iAppLoaderOffset + 0x20, 0x01200000, iAppLoaderSize, true); DVDRead(iAppLoaderOffset + 0x20, 0x01200000, iAppLoaderSize, true);
//call iAppLoaderEntry //call iAppLoaderEntry
DEBUG_LOG(BOOT, "Call iAppLoaderEntry"); DEBUG_LOG(BOOT, "Call iAppLoaderEntry");
@ -414,7 +414,7 @@ bool CBoot::EmulatedBS2_Wii()
u32 iDVDOffset = PowerPC::Read_U32(0x8130000c) << 2; u32 iDVDOffset = PowerPC::Read_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, true); DVDRead(iDVDOffset, iRamAddress, iLength, true);
} while (PowerPC::ppcState.gpr[3] != 0x00); } while (PowerPC::ppcState.gpr[3] != 0x00);
// iAppLoaderClose // iAppLoaderClose

View File

@ -514,11 +514,6 @@ void SetLidOpen(bool _bOpen)
GenerateDIInterrupt(INT_CVRINT); GenerateDIInterrupt(INT_CVRINT);
} }
bool DVDRead(u64 _iDVDOffset, u32 _iRamAddress, u32 _iLength, bool decrypt)
{
return s_inserted_volume->Read(_iDVDOffset, _iLength, Memory::GetPointer(_iRamAddress), decrypt);
}
bool ChangePartition(u64 offset) bool ChangePartition(u64 offset)
{ {
DVDThread::WaitUntilIdle(); DVDThread::WaitUntilIdle();

View File

@ -105,7 +105,6 @@ 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 decrypt);
extern bool g_bStream; extern bool g_bStream;
bool ChangePartition(u64 offset); bool ChangePartition(u64 offset);
void ExecuteCommand(u32 command_0, u32 command_1, u32 command_2, u32 output_address, u32 output_length, void ExecuteCommand(u32 command_0, u32 command_1, u32 command_2, u32 output_address, u32 output_length,