Added an IOS check as games which use IOS older than IOS30 do not need to be HLE'd. Added some stubs for Reset to Menu and SSBB's load from disc partition. Fixed loading Fate of Atlantis from the Indiana Jones and the Staff of Kings game.

This commit is contained in:
skidau 2011-11-01 23:00:12 +11:00
parent 651cedaac4
commit 88e273fac1
4 changed files with 103 additions and 20 deletions

View File

@ -267,7 +267,6 @@ bool CBoot::BootUp()
db.Apply(&g_symbolDB);
}
HLE::PatchFunctions();
g_symbolDB.Clear();
}
/* Try to load the symbol map if there is one, and then scan it for

View File

@ -28,6 +28,7 @@
#include "HLE_OS.h"
#include "HLE_Misc.h"
#include "IPC_HLE/WII_IPC_HLE_Device_es.h"
#include "ConfigManager.h"
namespace HLE
{
@ -137,13 +138,16 @@ void PatchFunctions()
}
}
for (size_t i = 1; i < sizeof(OSBreakPoints) / sizeof(SPatch); i++)
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging)
{
Symbol *symbol = g_symbolDB.GetSymbolFromName(OSPatches[i].m_szPatchName);
if (symbol > 0)
for (size_t i = 1; i < sizeof(OSBreakPoints) / sizeof(SPatch); i++)
{
PowerPC::breakpoints.Add(symbol->address, false);
INFO_LOG(OSHLE, "Adding BP to %s %08x", OSBreakPoints[i].m_szPatchName, symbol->address);
Symbol *symbol = g_symbolDB.GetSymbolFromName(OSPatches[i].m_szPatchName);
if (symbol > 0)
{
PowerPC::breakpoints.Add(symbol->address, false);
INFO_LOG(OSHLE, "Adding BP to %s %08x", OSBreakPoints[i].m_szPatchName, symbol->address);
}
}
}
@ -171,4 +175,19 @@ u32 GetOrigInstruction(u32 addr)
return (iter != orig_instruction.end()) ? iter->second : 0;
}
u32 UnPatch(std::string patchName)
{
Symbol *symbol = g_symbolDB.GetSymbolFromName(patchName.c_str());
if (symbol > 0)
{
for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4)
{
Memory::WriteUnchecked_U32(orig_instruction[addr], addr);
PowerPC::ppcState.iCache.Invalidate(addr);
}
return symbol->address;
}
return 0;
}
} // end of namespace HLE

View File

@ -24,6 +24,7 @@ namespace HLE
{
void PatchFunctions();
void Patch(u32 pc, const char *func_name);
u32 UnPatch(std::string patchName);
void Execute(u32 _CurrentPC, u32 _Instruction);
u32 GetOrigInstruction(u32 em_address);

View File

@ -28,10 +28,17 @@
#include "Filesystem.h"
#include "../Boot/Boot_DOL.h"
#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
#include "HLE.h"
namespace HLE_Misc
{
std::string dol;
std::string args;
u32 argsPtr;
u32 bootType;
u16 IOSv;
// Helper to quickly read the floating point value at a memory location.
inline float F(u32 addr)
{
@ -288,26 +295,19 @@ void HBReload()
Host_Message(WM_USER_STOP);
}
void OSBootDol()
void BootDOLFromDisc()
{
std::string dol;
std::string args;
u32 r28 = GPR(28);
Memory::GetString(dol, r28);
u32 argsPtr = Memory::Read_U32(GPR(5));
Memory::GetString(args, argsPtr);
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());
if (dol.substr(1, 1).compare("//"))
dol = dol.substr(1);
u32 fileSize = (u32) pFileSystem->GetFileSize(dol.c_str());
u8* dolFile = new u8[fileSize];
if (dolFile)
if (fileSize > 0)
{
pFileSystem->ReadFile(dol.substr(1).c_str(), dolFile, fileSize);
pFileSystem->ReadFile(dol.c_str(), dolFile, fileSize);
CDolLoader dolLoader(dolFile, fileSize);
dolLoader.Load();
PowerPC::ppcState.iCache.Reset();
@ -346,4 +346,68 @@ void OSBootDol()
}
}
u32 GetDolFileSize()
{
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(SConfig::GetInstance().m_LastFilename.c_str());
DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(pVolume);
std::string dolFile;
if (dol.substr(1, 1).compare("//"))
dolFile = dol.substr(1);
return (u32)pFileSystem->GetFileSize(dolFile.c_str());
}
void OSBootDol()
{
IOSv = Memory::Read_U16(0x00003140);
if (IOSv >= 30)
{
bootType = GPR(4);
if ((GPR(4) >> 28) == 0x8)
{
// Reset from menu
PanicAlert("Reset from menu");
}
else if ((GPR(4) >> 28) == 0xA)
{
// Boot from disc partition
PanicAlert("Boot Partition: %08x", GPR(26));
}
else if ((GPR(4) >> 28) == 0xC)
{
// Boot DOL from disc
u32 ptr = GPR(28);
Memory::GetString(dol, ptr);
if (GetDolFileSize() == 0)
{
ptr = GPR(30);
Memory::GetString(dol, ptr);
if (GetDolFileSize() == 0)
{
// Cannot locate the dol file, exit.
HLE::UnPatch("__OSBootDol");
NPC = PC;
return;
}
}
argsPtr = Memory::Read_U32(GPR(5));
Memory::GetString(args, argsPtr);
BootDOLFromDisc();
return;
}
else
{
PanicAlert("Unknown boot type: %08x", GPR(4));
}
}
HLE::UnPatch("__OSBootDol");
NPC = PC;
}
}