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.
This commit is contained in:
parent
0de073edea
commit
fbdf9ba153
Binary file not shown.
|
@ -257,6 +257,19 @@ bool CBoot::BootUp()
|
|||
EmulatedBS2(_StartupPara.bWii);
|
||||
}
|
||||
|
||||
// Scan for common HLE functions
|
||||
if (!_StartupPara.bEnableDebugging)
|
||||
{
|
||||
PPCAnalyst::FindFunctions(0x80000000, 0x81800000, &g_symbolDB);
|
||||
SignatureDB db;
|
||||
if (db.Load((File::GetSysDirectory() + TOTALDB).c_str()))
|
||||
{
|
||||
db.Apply(&g_symbolDB);
|
||||
}
|
||||
HLE::PatchFunctions();
|
||||
g_symbolDB.Clear();
|
||||
}
|
||||
|
||||
/* Try to load the symbol map if there is one, and then scan it for
|
||||
and eventually replace code */
|
||||
if (LoadMapFromFilename(_StartupPara.m_strFilename, gameID))
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "HLE_OS.h"
|
||||
#include "HLE_Misc.h"
|
||||
#include "IPC_HLE/WII_IPC_HLE_Device_es.h"
|
||||
|
||||
namespace HLE
|
||||
{
|
||||
|
@ -94,6 +95,7 @@ static const SPatch OSPatches[] =
|
|||
|
||||
// Name doesn't matter, installed in CBoot::BootUp()
|
||||
{ "HBReload", HLE_Misc::HBReload },
|
||||
{ "__OSBootDol", HLE_Misc::OSBootDol },
|
||||
};
|
||||
|
||||
static const SPatch OSBreakPoints[] =
|
||||
|
|
|
@ -22,6 +22,12 @@
|
|||
#include "../PowerPC/PowerPC.h"
|
||||
#include "../HW/Memmap.h"
|
||||
#include "../Host.h"
|
||||
#include "IPC_HLE/WII_IPC_HLE_Device_DI.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "VolumeCreator.h"
|
||||
#include "Filesystem.h"
|
||||
#include "../Boot/Boot_DOL.h"
|
||||
#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
|
||||
|
||||
namespace HLE_Misc
|
||||
{
|
||||
|
@ -282,4 +288,42 @@ void HBReload()
|
|||
Host_Message(WM_USER_STOP);
|
||||
}
|
||||
|
||||
|
||||
void OSBootDol()
|
||||
{
|
||||
std::string dol;
|
||||
|
||||
u32 r28 = GPR(28);
|
||||
Memory::GetString(dol, r28);
|
||||
|
||||
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(SConfig::GetInstance().m_LastFilename.c_str());
|
||||
DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(pVolume);
|
||||
|
||||
size_t fileSize = (size_t) pFileSystem->GetFileSize(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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ namespace HLE_Misc
|
|||
void FZ_sqrt_internal();
|
||||
void FZ_rsqrt_internal();
|
||||
void HBReload();
|
||||
void OSBootDol();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue