From d7ff55d2cdcb6ad5760c8e119b9eec0a0bb1aae0 Mon Sep 17 00:00:00 2001 From: Zopolis4 Date: Thu, 18 Aug 2022 15:53:21 +1000 Subject: [PATCH] idfk actually finding the session key? --- Source/Core/Core/Boot/Boot.cpp | 14 ++++++++++++++ Source/Core/Core/Boot/Boot_BS2Emu.cpp | 2 ++ 2 files changed, 16 insertions(+) diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index e1500181cc9c..2ad8bcf6b44b 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -404,6 +404,7 @@ bool CBoot::Load_BS2(const std::string& boot_rom_filename) constexpr u32 MPAL_v1_1 = 0x667D0B64; // Brazil constexpr u32 PAL_v1_0 = 0x4F319F43; constexpr u32 PAL_v1_2 = 0xAD1B7F16; + constexpr u32 Triforce = 0xD1883221; // The Triforce's special IPL // Load the whole ROM dump std::string data; @@ -413,6 +414,7 @@ bool CBoot::Load_BS2(const std::string& boot_rom_filename) const u32 ipl_hash = Common::ComputeCRC32(data); bool known_ipl = false; bool pal_ipl = false; + bool triforce_ipl = false; switch (ipl_hash) { case NTSC_v1_0: @@ -426,6 +428,9 @@ bool CBoot::Load_BS2(const std::string& boot_rom_filename) pal_ipl = true; known_ipl = true; break; + case Triforce: + known_ipl = true; + triforce_ipl = true; default: PanicAlertFmtT("The IPL file is not a known good dump. (CRC32: {0:x})", ipl_hash); break; @@ -464,6 +469,15 @@ bool CBoot::Load_BS2(const std::string& boot_rom_filename) SetupBAT(/*is_wii*/ false); PC = 0x81200150; + + // is this the right place to do this? + // probably not! + // where is the session key set tho https://debugmo.de/2008/05/part-2-dumping-the-media-board/ + if (triforce_ipl) + { + u8 *skey = Memory::GetPointer(0); + INFO_LOG_FMT(BOOT, "Triforce: Session Key {:08x}", skey); + } return true; } diff --git a/Source/Core/Core/Boot/Boot_BS2Emu.cpp b/Source/Core/Core/Boot/Boot_BS2Emu.cpp index 48b01870d1bc..82d532c7612f 100644 --- a/Source/Core/Core/Boot/Boot_BS2Emu.cpp +++ b/Source/Core/Core/Boot/Boot_BS2Emu.cpp @@ -209,6 +209,8 @@ bool CBoot::RunApploader(bool is_wii, const DiscIO::VolumeDisc& volume, // Blank out session key (https://debugmo.de/2008/05/part-2-dumping-the-media-board/) if (volume.GetVolumeType() == DiscIO::Platform::Triforce) { + u8 *skey = Memory::GetPointer(0); + INFO_LOG_FMT(BOOT, "Triforce: Emulated Session Key {:08x}", skey); Memory::Memset(0, 0, 12); }