mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-23 19:59:16 +01:00
-added fwrite patch, just set debugger to OSReport (thx skidau for the suggestion)
-added another neek check, may helps with older neek revisions -replaced the "Disabled" hooktype by "AUTO", meaning it will automatically set the hooktype VBI for you if you want to use cheats but forgot to select a hooktype -added debugger pause back, it will be automatically enabled if you just use debugger but no cheats (thx skidau for the small fix needed)
This commit is contained in:
parent
3834f144d0
commit
09db10a805
@ -115,10 +115,12 @@ void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipa
|
|||||||
Anti_002_fix(dst, len);
|
Anti_002_fix(dst, len);
|
||||||
if((CurrentIOS.Type == IOS_TYPE_WANIN && CurrentIOS.Revision < 13) || CurrentIOS.Type == IOS_TYPE_HERMES)
|
if((CurrentIOS.Type == IOS_TYPE_WANIN && CurrentIOS.Revision < 13) || CurrentIOS.Type == IOS_TYPE_HERMES)
|
||||||
patch_NoDiscinDrive(dst, len);
|
patch_NoDiscinDrive(dst, len);
|
||||||
|
patchVideoModes(dst, len, vidMode, vmode, patchVidModes);
|
||||||
|
|
||||||
|
if(debuggerselect == 2)
|
||||||
|
Patch_fwrite(dst, len);
|
||||||
if(hooktype != 0 && hookpatched == false)
|
if(hooktype != 0 && hookpatched == false)
|
||||||
hookpatched = dogamehooks(dst, len, false);
|
hookpatched = dogamehooks(dst, len, false);
|
||||||
patchVideoModes(dst, len, vidMode, vmode, patchVidModes);
|
|
||||||
if(patchVidModes > 0)
|
if(patchVidModes > 0)
|
||||||
PatchVideoSneek(dst, len);
|
PatchVideoSneek(dst, len);
|
||||||
if(vipatch)
|
if(vipatch)
|
||||||
|
@ -144,8 +144,6 @@ void load_handler()
|
|||||||
{
|
{
|
||||||
gprintf("Ocarina: Debugger selected.\n");
|
gprintf("Ocarina: Debugger selected.\n");
|
||||||
memcpy((void*)0x80001800, codehandler, codehandler_size);
|
memcpy((void*)0x80001800, codehandler, codehandler_size);
|
||||||
//if (pausedstartoption == 0x01)
|
|
||||||
// *(u32*)0x80002798 = 1;
|
|
||||||
if(code_size > 0 && code_buf)
|
if(code_size > 0 && code_buf)
|
||||||
{
|
{
|
||||||
gprintf("Ocarina: Codes found.\n");
|
gprintf("Ocarina: Codes found.\n");
|
||||||
@ -155,7 +153,10 @@ void load_handler()
|
|||||||
memcpy((void*)0x80001F5E, ((u8*) &codelist) + 2, 2);
|
memcpy((void*)0x80001F5E, ((u8*) &codelist) + 2, 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
gprintf("Ocarina: No Codes found.\n");
|
gprintf("Ocarina: No Codes found.\n");
|
||||||
|
*(u32*)0x80002774 = 1; //pause for debugger
|
||||||
|
}
|
||||||
DCFlushRange((void*)0x80001800, codehandler_size);
|
DCFlushRange((void*)0x80001800, codehandler_size);
|
||||||
ICInvalidateRange((void*)0x80001800, codehandler_size);
|
ICInvalidateRange((void*)0x80001800, codehandler_size);
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,31 @@ const u32 langpatch[3] = {0x7C600775, 0x40820010, 0x38000000};
|
|||||||
static const u32 oldpatch002[3] = {0x2C000000, 0x40820214, 0x3C608000};
|
static const u32 oldpatch002[3] = {0x2C000000, 0x40820214, 0x3C608000};
|
||||||
static const u32 newpatch002[3] = {0x2C000000, 0x48000214, 0x3C608000};
|
static const u32 newpatch002[3] = {0x2C000000, 0x48000214, 0x3C608000};
|
||||||
|
|
||||||
|
unsigned char sig_fwrite[32] =
|
||||||
|
{
|
||||||
|
0x94, 0x21, 0xFF, 0xD0,
|
||||||
|
0x7C, 0x08, 0x02, 0xA6,
|
||||||
|
0x90, 0x01, 0x00, 0x34,
|
||||||
|
0xBF, 0x21, 0x00, 0x14,
|
||||||
|
0x7C, 0x9B, 0x23, 0x78,
|
||||||
|
0x7C, 0xDC, 0x33, 0x78,
|
||||||
|
0x7C, 0x7A, 0x1B, 0x78,
|
||||||
|
0x7C, 0xB9, 0x2B, 0x78,
|
||||||
|
} ;
|
||||||
|
|
||||||
|
unsigned char patch_fwrite[144] =
|
||||||
|
{
|
||||||
|
0x7C, 0x85, 0x21, 0xD7, 0x40, 0x81, 0x00, 0x84, 0x3C, 0xE0, 0xCD, 0x00, 0x3D, 0x40, 0xCD, 0x00,
|
||||||
|
0x3D, 0x60, 0xCD, 0x00, 0x60, 0xE7, 0x68, 0x14, 0x61, 0x4A, 0x68, 0x24, 0x61, 0x6B, 0x68, 0x20,
|
||||||
|
0x38, 0xC0, 0x00, 0x00, 0x7C, 0x06, 0x18, 0xAE, 0x54, 0x00, 0xA0, 0x16, 0x64, 0x08, 0xB0, 0x00,
|
||||||
|
0x38, 0x00, 0x00, 0xD0, 0x90, 0x07, 0x00, 0x00, 0x7C, 0x00, 0x06, 0xAC, 0x91, 0x0A, 0x00, 0x00,
|
||||||
|
0x7C, 0x00, 0x06, 0xAC, 0x38, 0x00, 0x00, 0x19, 0x90, 0x0B, 0x00, 0x00, 0x7C, 0x00, 0x06, 0xAC,
|
||||||
|
0x80, 0x0B, 0x00, 0x00, 0x7C, 0x00, 0x04, 0xAC, 0x70, 0x09, 0x00, 0x01, 0x40, 0x82, 0xFF, 0xF4,
|
||||||
|
0x80, 0x0A, 0x00, 0x00, 0x7C, 0x00, 0x04, 0xAC, 0x39, 0x20, 0x00, 0x00, 0x91, 0x27, 0x00, 0x00,
|
||||||
|
0x7C, 0x00, 0x06, 0xAC, 0x74, 0x09, 0x04, 0x00, 0x41, 0x82, 0xFF, 0xB8, 0x38, 0xC6, 0x00, 0x01,
|
||||||
|
0x7F, 0x86, 0x20, 0x00, 0x40, 0x9E, 0xFF, 0xA0, 0x7C, 0xA3, 0x2B, 0x78, 0x4E, 0x80, 0x00, 0x20,
|
||||||
|
};
|
||||||
|
|
||||||
bool dogamehooks(void *addr, u32 len, bool channel)
|
bool dogamehooks(void *addr, u32 len, bool channel)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -427,6 +452,19 @@ void PatchAspectRatio(void *addr, u32 len, u8 aspect)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Patch_fwrite(void *Address, int Size)
|
||||||
|
{
|
||||||
|
u8 *addr_start = (u8*)Address;
|
||||||
|
u8 *addr_end = (u8*)(Address + Size) - sizeof(patch_fwrite);
|
||||||
|
|
||||||
|
while(addr_start < addr_end)
|
||||||
|
{
|
||||||
|
if(memcmp(addr_start, sig_fwrite, sizeof(sig_fwrite)) == 0)
|
||||||
|
memcpy(addr_start, patch_fwrite, sizeof(patch_fwrite));
|
||||||
|
addr_start += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PatchCountryStrings(void *Address, int Size)
|
void PatchCountryStrings(void *Address, int Size)
|
||||||
{
|
{
|
||||||
u8 SearchPattern[4] = {0x00, 0x00, 0x00, 0x00};
|
u8 SearchPattern[4] = {0x00, 0x00, 0x00, 0x00};
|
||||||
|
@ -37,6 +37,7 @@ void PatchVideoSneek(void *addr, u32 len);
|
|||||||
void PatchCountryStrings(void *Address, int Size);
|
void PatchCountryStrings(void *Address, int Size);
|
||||||
void PatchAspectRatio(void *addr, u32 len, u8 aspect);
|
void PatchAspectRatio(void *addr, u32 len, u8 aspect);
|
||||||
bool PatchReturnTo(void *Address, int Size, u32 id);
|
bool PatchReturnTo(void *Address, int Size, u32 id);
|
||||||
|
void Patch_fwrite(void *Address, int Size);
|
||||||
s32 BlockIOSReload(void);
|
s32 BlockIOSReload(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -46,6 +46,12 @@ bool neek2o(void)
|
|||||||
neek = IOS_Ioctlv(ESHandle, 0xA2, 0, 0, NULL) == 0x666c6f77;
|
neek = IOS_Ioctlv(ESHandle, 0xA2, 0, 0, NULL) == 0x666c6f77;
|
||||||
IOS_Close(ESHandle);
|
IOS_Close(ESHandle);
|
||||||
if(!neek)
|
if(!neek)
|
||||||
|
{
|
||||||
|
s32 FSHandle = IOS_Open("/dev/fs", 0);
|
||||||
|
neek = IOS_Ioctlv(FSHandle, 0x21, 0, 0, NULL) == 0;
|
||||||
|
IOS_Close(FSHandle);
|
||||||
|
}
|
||||||
|
if(!neek)
|
||||||
{
|
{
|
||||||
u32 num = 0;
|
u32 num = 0;
|
||||||
neek = (ISFS_ReadDir("/sneek", NULL, &num) == 0);
|
neek = (ISFS_ReadDir("/sneek", NULL, &num) == 0);
|
||||||
|
@ -1107,6 +1107,7 @@ private:
|
|||||||
static const SOption _NoDVD[3];
|
static const SOption _NoDVD[3];
|
||||||
static const SOption _GCLoader[3];
|
static const SOption _GCLoader[3];
|
||||||
static const SOption _vidModePatch[4];
|
static const SOption _vidModePatch[4];
|
||||||
|
static const SOption _debugger[3];
|
||||||
static const SOption _hooktype[8];
|
static const SOption _hooktype[8];
|
||||||
static const SOption _exitTo[5];
|
static const SOption _exitTo[5];
|
||||||
static map<u8, u8> _installed_cios;
|
static map<u8, u8> _installed_cios;
|
||||||
|
@ -505,7 +505,8 @@ void CMenu::_showGameSettings(void)
|
|||||||
i = min((u32)m_gcfg2.getInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u);
|
i = min((u32)m_gcfg2.getInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u);
|
||||||
m_btnMgr.setText(m_gameSettingsLblEmulationVal, _t(CMenu::_SaveEmu[i].id, CMenu::_SaveEmu[i].text));
|
m_btnMgr.setText(m_gameSettingsLblEmulationVal, _t(CMenu::_SaveEmu[i].id, CMenu::_SaveEmu[i].text));
|
||||||
|
|
||||||
m_btnMgr.setText(m_gameSettingsLblDebuggerV, m_gcfg2.getBool(id, "debugger", false) ? _t("gecko", L"Gecko") : _t("def", L"Default"));
|
i = min((u32)m_gcfg2.getInt(id, "debugger", 0), ARRAY_SIZE(CMenu::_debugger) - 1u);
|
||||||
|
m_btnMgr.setText(m_gameSettingsLblDebuggerV, _t(CMenu::_debugger[i].id, CMenu::_debugger[i].text));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMenu::_gameSettings(void)
|
void CMenu::_gameSettings(void)
|
||||||
@ -695,7 +696,8 @@ void CMenu::_gameSettings(void)
|
|||||||
}
|
}
|
||||||
else if(m_btnMgr.selected(m_gameSettingsBtnDebuggerP) || m_btnMgr.selected(m_gameSettingsBtnDebuggerM))
|
else if(m_btnMgr.selected(m_gameSettingsBtnDebuggerP) || m_btnMgr.selected(m_gameSettingsBtnDebuggerM))
|
||||||
{
|
{
|
||||||
m_gcfg2.setBool(id, "debugger", !m_gcfg2.getBool(id, "debugger", 0));
|
s8 direction = m_btnMgr.selected(m_gameSettingsBtnDebuggerP) ? 1 : -1;
|
||||||
|
m_gcfg2.setInt(id, "debugger", (int)loopNum((u32)m_gcfg2.getInt(id, "debugger", 0) + direction, ARRAY_SIZE(CMenu::_debugger)));
|
||||||
_showGameSettings();
|
_showGameSettings();
|
||||||
}
|
}
|
||||||
else if(m_btnMgr.selected(m_gameSettingsBtnApploader))
|
else if(m_btnMgr.selected(m_gameSettingsBtnApploader))
|
||||||
|
@ -214,7 +214,7 @@ const CMenu::SOption CMenu::_vidModePatch[4] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const CMenu::SOption CMenu::_hooktype[8] = {
|
const CMenu::SOption CMenu::_hooktype[8] = {
|
||||||
{ "disabled", L"Disabled" },
|
{ "hook_auto", L"AUTO" },
|
||||||
{ "hooktype1", L"VBI" },
|
{ "hooktype1", L"VBI" },
|
||||||
{ "hooktype2", L"KPAD read" },
|
{ "hooktype2", L"KPAD read" },
|
||||||
{ "hooktype3", L"Joypad" },
|
{ "hooktype3", L"Joypad" },
|
||||||
@ -224,6 +224,12 @@ const CMenu::SOption CMenu::_hooktype[8] = {
|
|||||||
{ "hooktype7", L"AXNextFrame" },
|
{ "hooktype7", L"AXNextFrame" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const CMenu::SOption CMenu::_debugger[3] = {
|
||||||
|
{ "disabled", L"Disabled" },
|
||||||
|
{ "dbg_gecko", L"Gecko" },
|
||||||
|
{ "dbgfwrite", L"OSReport" },
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
0 No Hook
|
0 No Hook
|
||||||
1 VBI
|
1 VBI
|
||||||
@ -907,7 +913,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
|
|||||||
u8 nodisc = min((u32)m_gcfg2.getInt(id, "no_disc_patch", 0), ARRAY_SIZE(CMenu::_NoDVD) - 1u);
|
u8 nodisc = min((u32)m_gcfg2.getInt(id, "no_disc_patch", 0), ARRAY_SIZE(CMenu::_NoDVD) - 1u);
|
||||||
nodisc = (nodisc == 0) ? m_cfg.getInt(GC_DOMAIN, "no_disc_patch", 0) : nodisc-1;
|
nodisc = (nodisc == 0) ? m_cfg.getInt(GC_DOMAIN, "no_disc_patch", 0) : nodisc-1;
|
||||||
bool cheats = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool(GC_DOMAIN, "cheat", false));
|
bool cheats = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool(GC_DOMAIN, "cheat", false));
|
||||||
bool DML_debug = m_gcfg2.getBool(id, "debugger", false);
|
bool DML_debug = (m_gcfg2.getInt(id, "debugger", 0) == 1);
|
||||||
bool screenshot = m_gcfg2.getBool(id, "screenshot", false);
|
bool screenshot = m_gcfg2.getBool(id, "screenshot", false);
|
||||||
/* Generate gct path */
|
/* Generate gct path */
|
||||||
char GC_Path[1024];
|
char GC_Path[1024];
|
||||||
@ -1107,13 +1113,13 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
|||||||
if(!WII_Launch)
|
if(!WII_Launch)
|
||||||
{
|
{
|
||||||
hooktype = (u32) m_gcfg2.getInt(id, "hooktype", 0);
|
hooktype = (u32) m_gcfg2.getInt(id, "hooktype", 0);
|
||||||
debuggerselect = m_gcfg2.getBool(id, "debugger", false) ? 1 : 0;
|
debuggerselect = m_gcfg2.getInt(id, "debugger", 0);
|
||||||
|
if((cheat || debuggerselect == 1) && hooktype == 0)
|
||||||
if((debuggerselect || cheat) && hooktype == 0)
|
|
||||||
hooktype = 1;
|
hooktype = 1;
|
||||||
if(!debuggerselect && !cheat)
|
else if(!cheat && debuggerselect != 1)
|
||||||
hooktype = 0;
|
hooktype = 0;
|
||||||
if(cheat && hooktype)
|
|
||||||
|
if(cheat)
|
||||||
_loadFile(cheatFile, cheatSize, m_cheatDir.c_str(), fmt("%s.gct", id.c_str()));
|
_loadFile(cheatFile, cheatSize, m_cheatDir.c_str(), fmt("%s.gct", id.c_str()));
|
||||||
if(has_enabled_providers() && _initNetwork() == 0)
|
if(has_enabled_providers() && _initNetwork() == 0)
|
||||||
add_game_to_card(id.c_str());
|
add_game_to_card(id.c_str());
|
||||||
@ -1343,10 +1349,14 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
|||||||
|
|
||||||
bool use_led = m_gcfg2.getBool(id, "led", false);
|
bool use_led = m_gcfg2.getBool(id, "led", false);
|
||||||
bool cheat = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool(WII_DOMAIN, "cheat", false));
|
bool cheat = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool(WII_DOMAIN, "cheat", false));
|
||||||
debuggerselect = m_gcfg2.getBool(id, "debugger", false) ? 1 : 0; // debuggerselect is defined in fst.h
|
debuggerselect = m_gcfg2.getInt(id, "debugger", 0); // debuggerselect is defined in fst.h
|
||||||
if(id == "RPWE41" || id == "RPWZ41" || id == "SPXP41") // Prince of Persia, Rival Swords
|
if((id == "RPWE41" || id == "RPWZ41" || id == "SPXP41") && debuggerselect == 1) // Prince of Persia, Rival Swords
|
||||||
debuggerselect = false;
|
debuggerselect = 0;
|
||||||
hooktype = (u32)m_gcfg2.getInt(id, "hooktype", 0); // hooktype is defined in patchcode.h
|
hooktype = (u32)m_gcfg2.getInt(id, "hooktype", 0); // hooktype is defined in patchcode.h
|
||||||
|
if((cheat || debuggerselect == 1) && hooktype == 0)
|
||||||
|
hooktype = 1;
|
||||||
|
else if(!cheat && debuggerselect != 1)
|
||||||
|
hooktype = 0;
|
||||||
|
|
||||||
u8 *cheatFile = NULL;
|
u8 *cheatFile = NULL;
|
||||||
u8 *gameconfig = NULL;
|
u8 *gameconfig = NULL;
|
||||||
@ -1365,8 +1375,6 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
|||||||
if(cheat)
|
if(cheat)
|
||||||
_loadFile(cheatFile, cheatSize, m_cheatDir.c_str(), fmt("%s.gct", id.c_str()));
|
_loadFile(cheatFile, cheatSize, m_cheatDir.c_str(), fmt("%s.gct", id.c_str()));
|
||||||
_loadFile(gameconfig, gameconfigSize, m_txtCheatDir.c_str(), "gameconfig.txt");
|
_loadFile(gameconfig, gameconfigSize, m_txtCheatDir.c_str(), "gameconfig.txt");
|
||||||
if(!debuggerselect && cheatFile == NULL)
|
|
||||||
hooktype = 0;
|
|
||||||
|
|
||||||
if(strlen(rtrn) == 4)
|
if(strlen(rtrn) == 4)
|
||||||
returnTo = rtrn[0] << 24 | rtrn[1] << 16 | rtrn[2] << 8 | rtrn[3];
|
returnTo = rtrn[0] << 24 | rtrn[1] << 16 | rtrn[2] << 8 | rtrn[3];
|
||||||
|
Loading…
Reference in New Issue
Block a user