Add Fix002 gameini parameter (no ui yet). Hack to fix games that display "002 error" without having to manually patch the games. (yeah this is ugly).

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2952 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2009-04-10 21:09:49 +00:00
parent 4fa154bb56
commit 4b8741d524
5 changed files with 36 additions and 2 deletions

View File

@ -42,6 +42,30 @@ void CBoot::RunFunction(u32 _iAddr)
PowerPC::SingleStep();
}
// THIS IS UGLY. this should be figured out properly instead of patching the games.
bool Remove_002_Protection(u32 addr, int Size)
{
u32 SearchPattern[3] = { 0x2C000000, 0x40820214, 0x3C608000 };
u32 PatchData[3] = { 0x2C000000, 0x48000214, 0x3C608000 };
while (Size >= 12)
{
if (Memory::ReadUnchecked_U32(addr + 0) == SearchPattern[0] &&
Memory::ReadUnchecked_U32(addr + 4) == SearchPattern[1] &&
Memory::ReadUnchecked_U32(addr + 8) == SearchPattern[2])
{
Memory::WriteUnchecked_U32(PatchData[0], addr);
Memory::WriteUnchecked_U32(PatchData[1], addr + 4);
Memory::WriteUnchecked_U32(PatchData[2], addr + 8);
return true;
}
addr += 4;
Size -= 4;
}
return false;
}
// __________________________________________________________________________________________________
//
// GameCube BIOS HLE:
@ -265,7 +289,6 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
{
Memory::Write_U32(0x00000000, 0x80000000 + i);
}
return true;
}
@ -373,6 +396,14 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
PowerPC::ppcState.DebugCount = 0;
if (Core::GetStartupParameter().bFix002)
{
// UGLY UGLY UGLY
// TODO: Understand what this does and fix it properly..
// This "fixes" games that display "Error 002" instead of running.
Remove_002_Protection(0x80004000, 0x5000000);
}
return true;
}

View File

@ -44,6 +44,7 @@ void SCoreStartupParameter::LoadDefaults()
bDSPThread = true;
bLockThreads = true;
bWii = false;
bFix002 = false;
SelectedLanguage = 0;
iTLBHack = 0;
delete gameIni;

View File

@ -71,6 +71,7 @@ struct SCoreStartupParameter
bool bRunCompareClient;
int iTLBHack;
bool bFix002;
int SelectedLanguage;

View File

@ -14,6 +14,7 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _EXICHANNEL_H
#define _EXICHANNEL_H
@ -93,7 +94,6 @@ private:
IEXIDevice* m_pDevices[NUM_DEVICES];
public:
// channelId for debugging
u32 m_ChannelId;

View File

@ -135,6 +135,7 @@ bool BootCore(const std::string& _rFilename)
ini->Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle);
ini->Get("Core", "OptimizeQuantizers", &StartUp.bOptimizeQuantizers, StartUp.bOptimizeQuantizers);
ini->Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack);
ini->Get("Core", "Fix002", &StartUp.bFix002, false);
// ------------------------------------------------
// Wii settings