From e3b9e89f5a6a1163cf966c424fec7f9e0f7d9174 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 22 Apr 2015 17:06:13 +0200 Subject: [PATCH] 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. --- Source/Core/Core/Boot/Boot.cpp | 9 +++++++-- Source/Core/Core/Boot/Boot.h | 1 + Source/Core/Core/Boot/Boot_BS2Emu.cpp | 16 ++++++++-------- Source/Core/Core/HW/DVDInterface.cpp | 5 ----- Source/Core/Core/HW/DVDInterface.h | 1 - 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index 30fce0bc68..d4aa35b653 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -32,6 +32,11 @@ #include "DiscIO/NANDContentLoader.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) { if (!DVDInterface::VolumeIsValid()) @@ -40,7 +45,7 @@ void CBoot::Load_FST(bool _bIsWii) const DiscIO::IVolume& volume = DVDInterface::GetVolume(); // 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 Memory::Write_U32(Memory::Read_U32(0x0000), 0x3180); @@ -57,7 +62,7 @@ void CBoot::Load_FST(bool _bIsWii) Memory::Write_U32(arenaHigh, 0x00000034); // load FST - DVDInterface::DVDRead(fstOffset, arenaHigh, fstSize, _bIsWii); + DVDRead(fstOffset, arenaHigh, fstSize, _bIsWii); Memory::Write_U32(arenaHigh, 0x00000038); Memory::Write_U32(maxFstSize, 0x0000003c); } diff --git a/Source/Core/Core/Boot/Boot.h b/Source/Core/Core/Boot/Boot.h index fbf221b7a6..41815c00f4 100644 --- a/Source/Core/Core/Boot/Boot.h +++ b/Source/Core/Core/Boot/Boot.h @@ -41,6 +41,7 @@ public: std::string* title_id = nullptr); private: + static bool DVDRead(u64 dvd_offset, u32 output_address, u32 length, bool decrypt); static void RunFunction(u32 _iAddr); static void UpdateDebugger_MapLoaded(); diff --git a/Source/Core/Core/Boot/Boot_BS2Emu.cpp b/Source/Core/Core/Boot/Boot_BS2Emu.cpp index 6ee859c73a..c8f6f0d270 100644 --- a/Source/Core/Core/Boot/Boot_BS2Emu.cpp +++ b/Source/Core/Core/Boot/Boot_BS2Emu.cpp @@ -59,7 +59,7 @@ bool CBoot::EmulatedBS2_GC(bool skipAppLoader) // It's possible to boot DOL and ELF files without a disc inserted 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(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!"); return false; } - DVDInterface::DVDRead(iAppLoaderOffset + 0x20, 0x01200000, iAppLoaderSize, false); + DVDRead(iAppLoaderOffset + 0x20, 0x01200000, iAppLoaderSize, false); // Setup pointers like real BS2 does if (SConfig::GetInstance().bNTSC) @@ -149,7 +149,7 @@ bool CBoot::EmulatedBS2_GC(bool skipAppLoader) u32 iDVDOffset = PowerPC::Read_U32(0x8130000c); 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); @@ -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 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(0x00000001, 0x00000024); // Unknown @@ -333,10 +333,10 @@ bool CBoot::EmulatedBS2_Wii() if (DVDInterface::VolumeIsValid() && DVDInterface::GetVolume().GetVolumeType() == DiscIO::IVolume::WII_DISC) { // 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 // after this check during booting. - DVDInterface::DVDRead(0, 0x3180, 4, true); + DVDRead(0, 0x3180, 4, true); // Set up MSR and the BAT SPR registers. 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."); return false; } - DVDInterface::DVDRead(iAppLoaderOffset + 0x20, 0x01200000, iAppLoaderSize, true); + DVDRead(iAppLoaderOffset + 0x20, 0x01200000, iAppLoaderSize, true); //call iAppLoaderEntry DEBUG_LOG(BOOT, "Call iAppLoaderEntry"); @@ -414,7 +414,7 @@ bool CBoot::EmulatedBS2_Wii() u32 iDVDOffset = PowerPC::Read_U32(0x8130000c) << 2; 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); // iAppLoaderClose diff --git a/Source/Core/Core/HW/DVDInterface.cpp b/Source/Core/Core/HW/DVDInterface.cpp index 12c34b818b..1dfa08124b 100644 --- a/Source/Core/Core/HW/DVDInterface.cpp +++ b/Source/Core/Core/HW/DVDInterface.cpp @@ -514,11 +514,6 @@ void SetLidOpen(bool _bOpen) 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) { DVDThread::WaitUntilIdle(); diff --git a/Source/Core/Core/HW/DVDInterface.h b/Source/Core/Core/HW/DVDInterface.h index 583f3074f5..c931e128ff 100644 --- a/Source/Core/Core/HW/DVDInterface.h +++ b/Source/Core/Core/HW/DVDInterface.h @@ -105,7 +105,6 @@ bool IsDiscInside(); void ChangeDisc(const std::string& fileName); // DVD Access Functions -bool DVDRead(u64 _iDVDOffset, u32 _iRamAddress, u32 _iLength, bool decrypt); extern bool g_bStream; bool ChangePartition(u64 offset); void ExecuteCommand(u32 command_0, u32 command_1, u32 command_2, u32 output_address, u32 output_length,