Set 0x0000002C to NDEV 2.1 when running a debug-signed Wii disc
This fixes the The Last Story prototype that GerbilSoft was testing, because the apploader is a bit more lenient with the max size of DOL sections when it detects that you're using a devkit console.
This commit is contained in:
parent
5f29e891d3
commit
af5d9f693a
|
@ -43,6 +43,7 @@
|
|||
#include "Core/IOS/ES/ES.h"
|
||||
#include "Core/IOS/FS/FileSystem.h"
|
||||
#include "Core/IOS/IOS.h"
|
||||
#include "Core/IOS/IOSC.h"
|
||||
#include "Core/IOS/Uids.h"
|
||||
#include "Core/PatchEngine.h"
|
||||
#include "Core/PowerPC/PPCAnalyst.h"
|
||||
|
@ -370,7 +371,7 @@ bool CBoot::BootUp(std::unique_ptr<BootParameters> boot)
|
|||
|
||||
// Because there is no TMD to get the requested system (IOS) version from,
|
||||
// we default to IOS58, which is the version used by the Homebrew Channel.
|
||||
SetupWiiMemory();
|
||||
SetupWiiMemory(IOS::HLE::IOSC::ConsoleType::Retail);
|
||||
IOS::HLE::GetIOS()->BootIOS(Titles::IOS(58));
|
||||
}
|
||||
else
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/IOS/IOSC.h"
|
||||
#include "DiscIO/Blob.h"
|
||||
#include "DiscIO/Enums.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
|
@ -116,7 +117,7 @@ private:
|
|||
static bool Load_BS2(const std::string& boot_rom_filename);
|
||||
|
||||
static void SetupGCMemory();
|
||||
static bool SetupWiiMemory();
|
||||
static bool SetupWiiMemory(IOS::HLE::IOSC::ConsoleType console_type);
|
||||
};
|
||||
|
||||
class BootExecutableReader
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "Core/IOS/ES/Formats.h"
|
||||
#include "Core/IOS/FS/FileSystem.h"
|
||||
#include "Core/IOS/IOS.h"
|
||||
#include "Core/IOS/IOSC.h"
|
||||
#include "Core/IOS/Uids.h"
|
||||
#include "Core/PowerPC/MMU.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
|
@ -214,7 +215,7 @@ bool CBoot::EmulatedBS2_GC(const DiscIO::Volume& volume)
|
|||
return RunApploader(/*is_wii*/ false, volume);
|
||||
}
|
||||
|
||||
bool CBoot::SetupWiiMemory()
|
||||
bool CBoot::SetupWiiMemory(IOS::HLE::IOSC::ConsoleType console_type)
|
||||
{
|
||||
static const std::map<DiscIO::Region, const RegionSetting> region_settings = {
|
||||
{DiscIO::Region::NTSC_J, {"JPN", "NTSC", "JP", "LJ"}},
|
||||
|
@ -294,7 +295,8 @@ bool CBoot::SetupWiiMemory()
|
|||
Memory::Write_U32(0x0D15EA5E, 0x00000020); // Another magic word
|
||||
Memory::Write_U32(0x00000001, 0x00000024); // Unknown
|
||||
Memory::Write_U32(Memory::REALRAM_SIZE, 0x00000028); // MEM1 size 24MB
|
||||
Memory::Write_U32(0x00000023, 0x0000002c); // Production Board Model
|
||||
u32 board_model = console_type == IOS::HLE::IOSC::ConsoleType::RVT ? 0x10000021 : 0x00000023;
|
||||
Memory::Write_U32(board_model, 0x0000002c); // Board Model
|
||||
Memory::Write_U32(0x00000000, 0x00000030); // Init
|
||||
Memory::Write_U32(0x817FEC60, 0x00000034); // Init
|
||||
// 38, 3C should get start, size of FST through apploader
|
||||
|
@ -381,7 +383,8 @@ bool CBoot::EmulatedBS2_Wii(const DiscIO::Volume& volume)
|
|||
Memory::Write_U32(0, 0x3194);
|
||||
Memory::Write_U32(static_cast<u32>(data_partition.offset >> 2), 0x3198);
|
||||
|
||||
if (!SetupWiiMemory() || !IOS::HLE::GetIOS()->BootIOS(tmd.GetIOSId()))
|
||||
const auto console_type = volume.GetTicket(data_partition).GetConsoleType();
|
||||
if (!SetupWiiMemory(console_type) || !IOS::HLE::GetIOS()->BootIOS(tmd.GetIOSId()))
|
||||
return false;
|
||||
|
||||
DVDRead(volume, 0x00000000, 0x00000000, 0x20, DiscIO::PARTITION_NONE); // Game Code
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cinttypes>
|
||||
#include <memory>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
@ -12,6 +13,7 @@
|
|||
#include "Core/IOS/ES/ES.h"
|
||||
#include "Core/IOS/ES/Formats.h"
|
||||
#include "Core/IOS/IOS.h"
|
||||
#include "Core/IOS/IOSC.h"
|
||||
#include "Core/WiiUtils.h"
|
||||
#include "DiscIO/WiiWad.h"
|
||||
|
||||
|
@ -21,9 +23,15 @@ bool CBoot::BootNANDTitle(const u64 title_id)
|
|||
state->type = 0x04; // TYPE_NANDBOOT
|
||||
});
|
||||
|
||||
auto* ios = IOS::HLE::GetIOS();
|
||||
SetupWiiMemory();
|
||||
return ios->GetES()->LaunchTitle(title_id);
|
||||
auto es = IOS::HLE::GetIOS()->GetES();
|
||||
const IOS::ES::TicketReader ticket = es->FindSignedTicket(title_id);
|
||||
auto console_type = IOS::HLE::IOSC::ConsoleType::Retail;
|
||||
if (ticket.IsValid())
|
||||
console_type = ticket.GetConsoleType();
|
||||
else
|
||||
ERROR_LOG(BOOT, "No ticket was found for %016" PRIx64, title_id);
|
||||
SetupWiiMemory(console_type);
|
||||
return es->LaunchTitle(title_id);
|
||||
}
|
||||
|
||||
bool CBoot::Boot_WiiWAD(const DiscIO::WiiWAD& wad)
|
||||
|
|
|
@ -443,10 +443,13 @@ std::array<u8, 16> TicketReader::GetTitleKey(const HLE::IOSC& iosc) const
|
|||
|
||||
std::array<u8, 16> TicketReader::GetTitleKey() const
|
||||
{
|
||||
const bool is_rvt = (GetIssuer() == "Root-CA00000002-XS00000006");
|
||||
const HLE::IOSC::ConsoleType console_type =
|
||||
is_rvt ? HLE::IOSC::ConsoleType::RVT : HLE::IOSC::ConsoleType::Retail;
|
||||
return GetTitleKey(HLE::IOSC{console_type});
|
||||
return GetTitleKey(HLE::IOSC{GetConsoleType()});
|
||||
}
|
||||
|
||||
HLE::IOSC::ConsoleType TicketReader::GetConsoleType() const
|
||||
{
|
||||
const bool is_rvt = GetIssuer() == "Root-CA00000002-XS00000006";
|
||||
return is_rvt ? HLE::IOSC::ConsoleType::RVT : HLE::IOSC::ConsoleType::Retail;
|
||||
}
|
||||
|
||||
void TicketReader::DeleteTicket(u64 ticket_id_to_delete)
|
||||
|
|
|
@ -242,6 +242,9 @@ public:
|
|||
// and constructs a temporary IOSC instance.
|
||||
std::array<u8, 16> GetTitleKey() const;
|
||||
|
||||
// Infers the console type (retail or devkit) based on the certificate issuer.
|
||||
HLE::IOSC::ConsoleType GetConsoleType() const;
|
||||
|
||||
// Deletes a ticket with the given ticket ID from the internal buffer.
|
||||
void DeleteTicket(u64 ticket_id);
|
||||
|
||||
|
|
Loading…
Reference in New Issue