diff options
| author | Zopolis4 <creatorsmithmdt@gmail.com> | 2021-08-23 20:41:22 +1000 |
|---|---|---|
| committer | Zopolis4 <creatorsmithmdt@gmail.com> | 2025-04-21 22:05:25 +1000 |
| commit | 2baa09d5b417e08e5092dedb85bc055c0fddd8be (patch) | |
| tree | 0c83c0ed833d89549ef41ffeca3bd729a652592f /Source/Core | |
| parent | 8d94d25203b5b03d1fd9d6408b2aca3d71df1a14 (diff) | |
Implement endian swapping and lazy decryption of Triforce DI commands
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/Boot/Boot_BS2Emu.cpp | 7 | ||||
| -rw-r--r-- | Source/Core/Core/HW/DVD/DVDInterface.cpp | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/Source/Core/Core/Boot/Boot_BS2Emu.cpp b/Source/Core/Core/Boot/Boot_BS2Emu.cpp index baf2079677..884a11bd87 100644 --- a/Source/Core/Core/Boot/Boot_BS2Emu.cpp +++ b/Source/Core/Core/Boot/Boot_BS2Emu.cpp @@ -227,6 +227,13 @@ bool CBoot::RunApploader(Core::System& system, const Core::CPUThreadGuard& guard ppc_state.pc = ppc_state.gpr[3]; branch_watch.SetRecordingActive(guard, resume_branch_watch); + // Blank out session key (https://debugmo.de/2008/05/part-2-dumping-the-media-board/) + if (volume.GetVolumeType() == DiscIO::Platform::Triforce) + { + auto& memory = system.GetMemory(); + + memory.Memset(0, 0, 12); + } return true; } diff --git a/Source/Core/Core/HW/DVD/DVDInterface.cpp b/Source/Core/Core/HW/DVD/DVDInterface.cpp index babb500902..f6e7954b02 100644 --- a/Source/Core/Core/HW/DVD/DVDInterface.cpp +++ b/Source/Core/Core/HW/DVD/DVDInterface.cpp @@ -753,6 +753,15 @@ void DVDInterface::ExecuteCommand(ReplyType reply_type) DIInterruptType interrupt_type = DIInterruptType::TCINT; bool command_handled_by_thread = false; + // Swaps endian of Triforce DI commands, and zeroes out random bytes to prevent unknown read + // subcommand errors + auto& dvd_thread = m_system.GetDVDThread(); + if (dvd_thread.GetDiscType() == DiscIO::Platform::Triforce) + { + // TODO(C++23): Use std::byteswap and a bitwise AND for increased clarity + m_DICMDBUF[0] <<= 24; + } + // DVDLowRequestError needs access to the error code set by the previous command if (static_cast<DICommand>(m_DICMDBUF[0] >> 24) != DICommand::RequestError) SetDriveError(DriveError::None); |
