From fbdf9ba153d6f409bd27ea1c160f9814a0e05393 Mon Sep 17 00:00:00 2001 From: skidau Date: Wed, 5 Oct 2011 00:22:51 +1100 Subject: [PATCH] Added preliminary support for ES_LAUNCH (Wii Multi-boot games) by using HLE to hijack the OSBootDol function. Metroid Prime Trilogy is working. Wii Sports+Wii Sports Resort is not working. Any games which can be played using the dol replacement trick should work here. Suspect that the DOL's are meant to receive an argument list which has not been catered for in this code. This probably also means that the Metroid Prime Trilogy games are locked in Veteran difficulty for the time-being. --- Data/Sys/totaldb.dsy | Bin 722980 -> 723252 bytes Source/Core/Core/Src/Boot/Boot.cpp | 13 ++++++++ Source/Core/Core/Src/HLE/HLE.cpp | 4 ++- Source/Core/Core/Src/HLE/HLE_Misc.cpp | 44 ++++++++++++++++++++++++++ Source/Core/Core/Src/HLE/HLE_Misc.h | 1 + 5 files changed, 61 insertions(+), 1 deletion(-) diff --git a/Data/Sys/totaldb.dsy b/Data/Sys/totaldb.dsy index 790a942eaefc071dfcad998bcc985dc239e2582f..a1c9683c9f57ca74ba2693c818d474dcb4761b2e 100644 GIT binary patch delta 93 zcmZ27L1)V(9mZpgjIE47#MH{j+{(z(%E;Qv$kxip-pa_)%E;Nu$hDP`TbV=Xjp3Gq hUlGetFileSize(dol.substr(1).c_str()); + u8* dolFile = new u8[fileSize]; + if (dolFile) + { + pFileSystem->ReadFile(dol.substr(1).c_str(), dolFile, fileSize); + CDolLoader dolLoader(dolFile, fileSize); + dolLoader.Load(); + PowerPC::ppcState.iCache.Reset(); + + static CWII_IPC_HLE_Device_usb_oh1_57e_305* s_Usb = GetUsbPointer(); + for (unsigned int i = 0; i < 4; i++) + { + if (s_Usb->m_WiiMotes[i].IsConnected()) + { + s_Usb->m_WiiMotes[i].Activate(false); + s_Usb->m_WiiMotes[i].Activate(true); + } + else + { + s_Usb->m_WiiMotes[i].Activate(false); + } + } + + NPC = dolLoader.GetEntryPoint() | 0x80000000; + } +} + } diff --git a/Source/Core/Core/Src/HLE/HLE_Misc.h b/Source/Core/Core/Src/HLE/HLE_Misc.h index 6c932258a7..f831e5b600 100644 --- a/Source/Core/Core/Src/HLE/HLE_Misc.h +++ b/Source/Core/Core/Src/HLE/HLE_Misc.h @@ -39,6 +39,7 @@ namespace HLE_Misc void FZ_sqrt_internal(); void FZ_rsqrt_internal(); void HBReload(); + void OSBootDol(); } #endif