Implement endian swapping and lazy decryption of Triforce DI commands
This commit is contained in:
parent
252ee32444
commit
c55785a9d1
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue