mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-19 10:46:28 +01:00
Boot: Make EmulatedBS2 require a volume
This commit is contained in:
parent
eb6f0a7258
commit
363547a5b2
@ -298,7 +298,7 @@ bool CBoot::BootUp(std::unique_ptr<BootParameters> boot)
|
|||||||
if (!volume)
|
if (!volume)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!EmulatedBS2(config.bWii, volume))
|
if (!EmulatedBS2(config.bWii, *volume))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Try to load the symbol map if there is one, and then scan it for
|
// Try to load the symbol map if there is one, and then scan it for
|
||||||
|
@ -102,9 +102,9 @@ 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::Volume& volume);
|
static bool RunApploader(bool is_wii, const DiscIO::Volume& volume);
|
||||||
static bool EmulatedBS2_GC(const DiscIO::Volume* volume);
|
static bool EmulatedBS2_GC(const DiscIO::Volume& volume);
|
||||||
static bool EmulatedBS2_Wii(const DiscIO::Volume* volume);
|
static bool EmulatedBS2_Wii(const DiscIO::Volume& volume);
|
||||||
static bool EmulatedBS2(bool is_wii, const DiscIO::Volume* 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 SetupGCMemory();
|
static void SetupGCMemory();
|
||||||
|
@ -188,7 +188,7 @@ void CBoot::SetupGCMemory()
|
|||||||
// 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::Volume* volume)
|
bool CBoot::EmulatedBS2_GC(const DiscIO::Volume& volume)
|
||||||
{
|
{
|
||||||
INFO_LOG(BOOT, "Faking GC BS2...");
|
INFO_LOG(BOOT, "Faking GC BS2...");
|
||||||
|
|
||||||
@ -197,10 +197,7 @@ bool CBoot::EmulatedBS2_GC(const DiscIO::Volume* volume)
|
|||||||
|
|
||||||
SetupGCMemory();
|
SetupGCMemory();
|
||||||
|
|
||||||
if (!volume)
|
DVDRead(volume, /*offset*/ 0x00000000, /*address*/ 0x00000000, 0x20, DiscIO::PARTITION_NONE);
|
||||||
return false;
|
|
||||||
|
|
||||||
DVDRead(*volume, /*offset*/ 0x00000000, /*address*/ 0x00000000, 0x20, DiscIO::PARTITION_NONE);
|
|
||||||
|
|
||||||
const bool ntsc = DiscIO::IsNTSC(SConfig::GetInstance().m_region);
|
const bool ntsc = DiscIO::IsNTSC(SConfig::GetInstance().m_region);
|
||||||
|
|
||||||
@ -213,7 +210,7 @@ bool CBoot::EmulatedBS2_GC(const DiscIO::Volume* volume)
|
|||||||
// Global pointer to Small Data Area Base (Luigi's Mansion's apploader uses it)
|
// Global pointer to Small Data Area Base (Luigi's Mansion's apploader uses it)
|
||||||
PowerPC::ppcState.gpr[13] = ntsc ? 0x81465320 : 0x814b4fc0;
|
PowerPC::ppcState.gpr[13] = ntsc ? 0x81465320 : 0x814b4fc0;
|
||||||
|
|
||||||
return RunApploader(/*is_wii*/ false, *volume);
|
return RunApploader(/*is_wii*/ false, volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CBoot::SetupWiiMemory(u64 ios_title_id)
|
bool CBoot::SetupWiiMemory(u64 ios_title_id)
|
||||||
@ -326,17 +323,14 @@ bool CBoot::SetupWiiMemory(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::Volume* 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.GetVolumeType() != DiscIO::Platform::WII_DISC)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (volume->GetVolumeType() != DiscIO::Platform::WII_DISC)
|
const DiscIO::Partition partition = volume.GetGamePartition();
|
||||||
return false;
|
const IOS::ES::TMDReader tmd = volume.GetTMD(partition);
|
||||||
|
|
||||||
const DiscIO::Partition partition = volume->GetGamePartition();
|
|
||||||
const IOS::ES::TMDReader tmd = volume->GetTMD(partition);
|
|
||||||
|
|
||||||
if (!tmd.IsValid())
|
if (!tmd.IsValid())
|
||||||
return false;
|
return false;
|
||||||
@ -344,13 +338,13 @@ bool CBoot::EmulatedBS2_Wii(const DiscIO::Volume* volume)
|
|||||||
if (!SetupWiiMemory(tmd.GetIOSId()))
|
if (!SetupWiiMemory(tmd.GetIOSId()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DVDRead(*volume, 0x00000000, 0x00000000, 0x20, DiscIO::PARTITION_NONE); // Game Code
|
DVDRead(volume, 0x00000000, 0x00000000, 0x20, DiscIO::PARTITION_NONE); // Game Code
|
||||||
|
|
||||||
// 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 keeps 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.
|
||||||
DVDRead(*volume, 0, 0x3180, 4, partition);
|
DVDRead(volume, 0, 0x3180, 4, partition);
|
||||||
|
|
||||||
SetupMSR();
|
SetupMSR();
|
||||||
SetupBAT(/*is_wii*/ true);
|
SetupBAT(/*is_wii*/ true);
|
||||||
@ -361,20 +355,19 @@ bool CBoot::EmulatedBS2_Wii(const DiscIO::Volume* volume)
|
|||||||
|
|
||||||
PowerPC::ppcState.gpr[1] = 0x816ffff0; // StackPointer
|
PowerPC::ppcState.gpr[1] = 0x816ffff0; // StackPointer
|
||||||
|
|
||||||
if (!RunApploader(/*is_wii*/ true, *volume))
|
if (!RunApploader(/*is_wii*/ true, volume))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Warning: This call will set incorrect running game metadata if our volume parameter
|
// Warning: This call will set incorrect running game metadata if our volume parameter
|
||||||
// doesn't point to the same disc as the one that's inserted in the emulated disc drive!
|
// doesn't point to the same disc as the one that's inserted in the emulated disc drive!
|
||||||
IOS::HLE::Device::ES::DIVerify(tmd, volume->GetTicket(partition));
|
IOS::HLE::Device::ES::DIVerify(tmd, volume.GetTicket(partition));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if apploader has run successfully.
|
// Returns true if apploader has run successfully. If is_wii is true, the disc
|
||||||
// If is_wii is true and volume is not nullptr, the disc that volume
|
// that volume refers 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::Volume& 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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user