-fixed incorrect url which was displayed if no cheat

file found
-added possibility to cheat in gamecube games, currently
wiiflow gct cheats folder needs to be on sd card for this,
otherwise DML cant find them
This commit is contained in:
fix94.1 2012-03-10 19:02:59 +00:00
parent 7633ac55c2
commit c1bfa9195b
4 changed files with 49 additions and 28 deletions

View File

@ -77,8 +77,10 @@ void CMenu::_CheatSettings()
{ {
SetupInput(); SetupInput();
string id = m_cf.getId();
m_cheatSettingsPage = 1; m_cheatSettingsPage = 1;
int txtavailable = m_cheatfile.openTxtfile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), m_cf.getId().c_str())); int txtavailable = m_cheatfile.openTxtfile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), id.c_str()));
_showCheatSettings(); _showCheatSettings();
_textCheatSettings(); _textCheatSettings();
@ -119,10 +121,10 @@ void CMenu::_CheatSettings()
} }
else if ((WBTN_2_HELD && WBTN_1_PRESSED) || (WBTN_1_HELD && WBTN_2_PRESSED)) else if ((WBTN_2_HELD && WBTN_1_PRESSED) || (WBTN_1_HELD && WBTN_2_PRESSED))
{ {
remove(fmt("%s/%s.gct", m_cheatDir.c_str(), m_cf.getId().c_str())); remove(fmt("%s/%s.gct", m_cheatDir.c_str(), id.c_str()));
remove(fmt("%s/%s.txt", m_txtCheatDir.c_str(), m_cf.getId().c_str())); remove(fmt("%s/%s.txt", m_txtCheatDir.c_str(), id.c_str()));
m_gcfg2.remove(m_cf.getId(), "cheat"); m_gcfg2.remove(id, "cheat");
m_gcfg2.remove(m_cf.getId(), "hooktype"); m_gcfg2.remove(id, "hooktype");
break; break;
} }
else if (BTN_A_PRESSED) else if (BTN_A_PRESSED)
@ -152,17 +154,17 @@ void CMenu::_CheatSettings()
if (selected) if (selected)
{ {
m_cheatfile.createGCT(fmt("%s/%s.gct", m_cheatDir.c_str(), m_cf.getId().c_str())); m_cheatfile.createGCT(fmt("%s/%s.gct", m_cheatDir.c_str(), id.c_str()));
m_gcfg2.setOptBool(m_cf.getId(), "cheat", 1); m_gcfg2.setOptBool(id, "cheat", 1);
m_gcfg2.setInt(m_cf.getId(), "hooktype", m_gcfg2.getInt(m_cf.getId(), "hooktype", 1)); m_gcfg2.setInt(id, "hooktype", m_gcfg2.getInt(id, "hooktype", 1));
} }
else else
{ {
remove(fmt("%s/%s.gct", m_cheatDir.c_str(), m_cf.getId().c_str())); remove(fmt("%s/%s.gct", m_cheatDir.c_str(), id.c_str()));
m_gcfg2.remove(m_cf.getId(), "cheat"); m_gcfg2.remove(id, "cheat");
m_gcfg2.remove(m_cf.getId(), "hooktype"); m_gcfg2.remove(id, "hooktype");
} }
m_cheatfile.createTXT(fmt("%s/%s.txt", m_txtCheatDir.c_str(), m_cf.getId().c_str())); m_cheatfile.createTXT(fmt("%s/%s.txt", m_txtCheatDir.c_str(), id.c_str()));
break; break;
} }
else if (m_btnMgr.selected(m_cheatBtnDownload)) else if (m_btnMgr.selected(m_cheatBtnDownload))
@ -234,7 +236,7 @@ void CMenu::_CheatSettings()
} }
_hideCheatDownload(); _hideCheatDownload();
txtavailable = m_cheatfile.openTxtfile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), m_cf.getId().c_str())); txtavailable = m_cheatfile.openTxtfile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), id.c_str()));
_showCheatSettings(); _showCheatSettings();
if (txtavailable) if (txtavailable)
@ -245,8 +247,9 @@ void CMenu::_CheatSettings()
if (m_cheatfile.getCnt() == 0) if (m_cheatfile.getCnt() == 0)
{ {
// cheat code not found, show result // cheat code not found, show result
char type = id[0] == 'S' ? 'R' : id[0];
m_btnMgr.setText(m_cheatLblItem[0], _t("cheat4", L"Download not found.")); m_btnMgr.setText(m_cheatLblItem[0], _t("cheat4", L"Download not found."));
m_btnMgr.setText(m_cheatLblItem[1], sfmt(GECKOURL, m_cf.getId().c_str())); m_btnMgr.setText(m_cheatLblItem[1], sfmt(GECKOURL, type, id.c_str()));
m_btnMgr.show(m_cheatLblItem[1]); m_btnMgr.show(m_cheatLblItem[1]);
} }
} }

View File

@ -119,7 +119,7 @@ void CMenu::_showGameSettings(void)
if(m_current_view != COVERFLOW_DML) if(m_current_view != COVERFLOW_DML)
g_numGCfPages = 4; g_numGCfPages = 4;
else else
g_numGCfPages = 1; g_numGCfPages = 2;
if (m_gameSettingsPage == 1) if (m_gameSettingsPage == 1)
{ {
@ -194,10 +194,13 @@ void CMenu::_showGameSettings(void)
m_btnMgr.show(m_gameSettingsBtnDebuggerP); m_btnMgr.show(m_gameSettingsBtnDebuggerP);
m_btnMgr.show(m_gameSettingsBtnDebuggerM); m_btnMgr.show(m_gameSettingsBtnDebuggerM);
m_btnMgr.show(m_gameSettingsLblHooktype); if(m_current_view != COVERFLOW_DML)
m_btnMgr.show(m_gameSettingsLblHooktypeVal); {
m_btnMgr.show(m_gameSettingsBtnHooktypeM); m_btnMgr.show(m_gameSettingsLblHooktype);
m_btnMgr.show(m_gameSettingsBtnHooktypeP); m_btnMgr.show(m_gameSettingsLblHooktypeVal);
m_btnMgr.show(m_gameSettingsBtnHooktypeM);
m_btnMgr.show(m_gameSettingsBtnHooktypeP);
}
m_btnMgr.show(m_gameSettingsLblOcarina); m_btnMgr.show(m_gameSettingsLblOcarina);
m_btnMgr.show(m_gameSettingsBtnOcarina); m_btnMgr.show(m_gameSettingsBtnOcarina);
@ -212,10 +215,13 @@ void CMenu::_showGameSettings(void)
m_btnMgr.hide(m_gameSettingsBtnDebuggerP); m_btnMgr.hide(m_gameSettingsBtnDebuggerP);
m_btnMgr.hide(m_gameSettingsBtnDebuggerM); m_btnMgr.hide(m_gameSettingsBtnDebuggerM);
m_btnMgr.hide(m_gameSettingsLblHooktype); if(m_current_view != COVERFLOW_DML)
m_btnMgr.hide(m_gameSettingsLblHooktypeVal); {
m_btnMgr.hide(m_gameSettingsBtnHooktypeM); m_btnMgr.hide(m_gameSettingsLblHooktype);
m_btnMgr.hide(m_gameSettingsBtnHooktypeP); m_btnMgr.hide(m_gameSettingsLblHooktypeVal);
m_btnMgr.hide(m_gameSettingsBtnHooktypeM);
m_btnMgr.hide(m_gameSettingsBtnHooktypeP);
}
m_btnMgr.hide(m_gameSettingsLblOcarina); m_btnMgr.hide(m_gameSettingsLblOcarina);
m_btnMgr.hide(m_gameSettingsBtnOcarina); m_btnMgr.hide(m_gameSettingsBtnOcarina);

View File

@ -639,9 +639,21 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
memset(DMLCfg, 0, sizeof(DML_CFG)); memset(DMLCfg, 0, sizeof(DML_CFG));
DMLCfg->Magicbytes = 0xD1050CF6; DMLCfg->Magicbytes = 0xD1050CF6;
DMLCfg->CfgVersion = 0x00000001; DMLCfg->CfgVersion = 0x00000001;
DMLCfg->VideoMode = DML_VID_NONE; DMLCfg->VideoMode |= DML_VID_NONE;
DMLCfg->Config = DML_CFG_GAME_PATH; DMLCfg->Config |= DML_CFG_GAME_PATH;
snprintf(DMLCfg->GamePath, sizeof(DMLCfg->GamePath), "/games/%s/game.iso", hdr->path); snprintf(DMLCfg->GamePath, sizeof(DMLCfg->GamePath), "/games/%s/game.iso", hdr->path);
if(m_gcfg2.testOptBool((char *)hdr->hdr.id, "cheat", m_cfg.getBool("GAMES", "cheat", false)))
{
DMLCfg->Config |= DML_CFG_CHEATS;
DMLCfg->Config |= DML_CFG_CHEAT_PATH;
const char *ptr;
if(strstr(m_cheatDir.c_str(), "sd:/") != NULL)
{
ptr = &m_cheatDir.c_str()[3];
snprintf(DMLCfg->CheatPath, sizeof(DMLCfg->CheatPath), "%s/%s", ptr, fmt("%s.gct", hdr->hdr.id));
}
gprintf("Cheat dir: %s\n", DMLCfg->CheatPath);
}
memcpy((void *)0xC0001700, DMLCfg, sizeof(DML_CFG)); memcpy((void *)0xC0001700, DMLCfg, sizeof(DML_CFG));
MEM2_free(DMLCfg); MEM2_free(DMLCfg);
} }