Updated the Gecko code handler to the latest version from Gecko OS 1.9.3.1.

Added a check to ensure that the number of codes fits in memory (maximum 231 codes).
Store a copy of codehandler.bin in the Sys directory.
This commit is contained in:
skidau 2012-01-02 15:14:30 +11:00
parent 96600ef48d
commit f4d8e527b5
3 changed files with 16 additions and 10 deletions

BIN
Data/Sys/codehandler.bin Normal file

Binary file not shown.

View File

@ -126,7 +126,7 @@
#define WII_USA_SETTING "setting-usa.txt" #define WII_USA_SETTING "setting-usa.txt"
#define WII_JAP_SETTING "setting-jpn.txt" #define WII_JAP_SETTING "setting-jpn.txt"
#define GECKO_CODE_HANDLER "kenobiwii.bin" #define GECKO_CODE_HANDLER "codehandler.bin"
// Subdirs in Sys // Subdirs in Sys
#define GC_SYS_DIR "GC" #define GC_SYS_DIR "GC"

View File

@ -118,6 +118,7 @@ void SetActiveCodes(const std::vector<GeckoCode>& gcodes)
bool InstallCodeHandler() bool InstallCodeHandler()
{ {
u32 codelist_location = 0x800028B8; // Debugger on location (0x800022A8 = Debugger off, using codehandleronly.bin)
std::string data; std::string data;
std::string _rCodeHandlerFilename = File::GetSysDirectory() + GECKO_CODE_HANDLER; std::string _rCodeHandlerFilename = File::GetSysDirectory() + GECKO_CODE_HANDLER;
if (!File::ReadFileToString(false, _rCodeHandlerFilename.c_str(), data)) if (!File::ReadFileToString(false, _rCodeHandlerFilename.c_str(), data))
@ -127,14 +128,14 @@ bool InstallCodeHandler()
Memory::WriteBigEData((const u8*)data.data(), 0x80001800, data.length()); Memory::WriteBigEData((const u8*)data.data(), 0x80001800, data.length());
// Turn off Pause on start // Turn off Pause on start
Memory::Write_U32(0, 0x80001808); Memory::Write_U32(0, 0x80002774);
// Write the Game ID into the location expected by WiiRD // Write the Game ID into the location expected by WiiRD
Memory::WriteBigEData(Memory::GetPointer(0x80000000), 0x80001800, 6); Memory::WriteBigEData(Memory::GetPointer(0x80000000), 0x80001800, 6);
// Create GCT in memory // Create GCT in memory
Memory::Write_U32(0x00d0c0de, 0x800027d0); Memory::Write_U32(0x00d0c0de, codelist_location);
Memory::Write_U32(0x00d0c0de, 0x800027d4); Memory::Write_U32(0x00d0c0de, codelist_location + 4);
std::lock_guard<std::mutex> lk(active_codes_lock); std::lock_guard<std::mutex> lk(active_codes_lock);
@ -151,15 +152,20 @@ bool InstallCodeHandler()
for (; current_code < codes_end; ++current_code) for (; current_code < codes_end; ++current_code)
{ {
const GeckoCode::Code& code = *current_code; const GeckoCode::Code& code = *current_code;
Memory::Write_U32(code.address, 0x800027d8 + i);
Memory::Write_U32(code.data, 0x800027d8 + i + 4); // Make sure we have enough memory to hold the code list
if ((codelist_location + 24 + i) < 0x80003000)
{
Memory::Write_U32(code.address, codelist_location + 8 + i);
Memory::Write_U32(code.data, codelist_location + 12 + i);
i += 8; i += 8;
} }
} }
} }
}
Memory::Write_U32(0xff000000, 0x800027d8 + i); Memory::Write_U32(0xff000000, codelist_location + 8 + i);
Memory::Write_U32(0x00000000, 0x800027d8 + i + 4); Memory::Write_U32(0x00000000, codelist_location + 12 + i);
// Turn on codes // Turn on codes
Memory::Write_U8(1, 0x80001807); Memory::Write_U8(1, 0x80001807);
@ -214,7 +220,7 @@ bool RunGeckoCode(GeckoCode& gecko_code)
gecko_code.enabled = false; gecko_code.enabled = false;
PanicAlertT("GeckoCode failed to run (CT%i CST%i) (%s)" PanicAlertT("GeckoCode failed to run (CT%i CST%i) (%s)"
"\n(either a bad code or the code type is not yet supported. Try using the native code handler by placing the kenobiwii.bin file into the Sys directory and restarting Dolphin.)" "\n(either a bad code or the code type is not yet supported. Try using the native code handler by placing the codehandler.bin file into the Sys directory and restarting Dolphin.)"
, code.type, code.subtype, gecko_code.name.c_str()); , code.type, code.subtype, gecko_code.name.c_str());
return false; return false;
} }