From d58f540a8197ef84717eff3cdcca42baa249af1e Mon Sep 17 00:00:00 2001 From: giantpune Date: Thu, 25 Jun 2009 15:58:16 +0000 Subject: [PATCH] combine 002fix and anti fix into 1 settings. off/on/anti. tested and working in main settings and game settings. --- source/menu.cpp | 20 +++++-------------- source/settings/Settings.cpp | 37 +++++++++++------------------------- source/settings/cfg.c | 17 ----------------- source/settings/cfg.h | 7 ++++--- source/usbloader/apploader.c | 6 +++--- source/usbloader/apploader.h | 2 +- source/usbloader/disc.c | 8 ++++---- source/usbloader/disc.h | 4 ++-- 8 files changed, 30 insertions(+), 71 deletions(-) diff --git a/source/menu.cpp b/source/menu.cpp index 2e719204..530102c9 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -1863,7 +1863,6 @@ int MainMenu(int menu) ocarinaChoice = game_cfg->ocarina; viChoice = game_cfg->vipatch; fix002 = game_cfg->errorfix002; - fix002anti = game_cfg->errorfix002anti; iosChoice = game_cfg->ios; countrystrings = game_cfg->patchcountrystrings; alternatedol = game_cfg->loadalternatedol; @@ -1879,7 +1878,6 @@ int MainMenu(int menu) iosChoice = i249; } fix002 = Settings.error002; - fix002anti = Settings.anti002fix; countrystrings = Settings.patchcountrystrings; alternatedol = off; reloadblock = off; @@ -1931,21 +1929,13 @@ int MainMenu(int menu) break; case off: errorfixer002 = 0; + break; + case anti: + errorfixer002 = 2; break; } - u8 errorfixer002anti = 0; - switch(fix002anti) - { - case on: - errorfixer002anti = 1; - break; - case off: - errorfixer002anti = 0; - break; - } - - switch(languageChoice) + switch(languageChoice) { case ConsoleLangDefault: configbytes[0] = 0xCD; @@ -2061,7 +2051,7 @@ int MainMenu(int menu) break; } - ret = Disc_WiiBoot(videoselected, cheat, vipatch, countrystrings, errorfixer002, alternatedol, errorfixer002anti); + ret = Disc_WiiBoot(videoselected, cheat, vipatch, countrystrings, errorfixer002, alternatedol); if (ret < 0) { Sys_LoadMenu(); } diff --git a/source/settings/Settings.cpp b/source/settings/Settings.cpp index 6a18ce1a..d6720740 100644 --- a/source/settings/Settings.cpp +++ b/source/settings/Settings.cpp @@ -718,7 +718,6 @@ int MenuSettings() options2.SetName(5,"%s", tr("Boot/Standard")); options2.SetName(6, "%s",tr("Quick Boot")); options2.SetName(7, "%s",tr("Error 002 fix")); - options2.SetName(8, "%s",tr("Anti 002 fix")); for(int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL); w.Append(&optionBrowser2); optionBrowser2.SetClickable(true); @@ -745,11 +744,9 @@ int MenuSettings() Settings.cios = 0; if ( Settings.language >= settings_language_max) Settings.language = 0; - if(Settings.error002 >= settings_off_on_max) + if(Settings.error002 >= settings_off_on_max+1) Settings.error002 = 0; - if(Settings.anti002fix >= settings_off_on_max) - Settings.anti002fix = 0; - + if (Settings.video == discdefault) options2.SetValue(0,"%s",tr("Disc Default")); else if (Settings.video == systemdefault) options2.SetValue(0,"%s",tr("System Default")); else if (Settings.video == patch) options2.SetValue(0,"%s",tr("AutoPatch")); @@ -787,9 +784,7 @@ int MenuSettings() if (Settings.error002 == no) options2.SetValue(7,"%s",tr("No")); else if (Settings.error002 == yes) options2.SetValue(7,"%s",tr("Yes")); - - if (Settings.anti002fix == no) options2.SetValue(8,"%s",tr("No")); - else if (Settings.anti002fix == yes) options2.SetValue(8,"%s",tr("Yes")); + else if (Settings.error002 == anti) options2.SetValue(7,"%s",tr("Anti")); if(backBtn.GetState() == STATE_CLICKED) { @@ -857,9 +852,7 @@ int MenuSettings() case 7: Settings.error002++; break; - case 8: - Settings.anti002fix++; - break; + } } optionBrowser2.SetEffect(EFFECT_FADE, -20); @@ -1744,7 +1737,7 @@ int GameSettings(struct discHdr * header) strncat(gameName, "...", 3); } - customOptionList options3(13); + customOptionList options3(12); options3.SetName(0,"%s", tr("Video Mode")); options3.SetName(1,"%s", tr("VIDTV Patch")); options3.SetName(2,"%s", tr("Game Language")); @@ -1755,9 +1748,8 @@ int GameSettings(struct discHdr * header) options3.SetName(7,"%s", tr("Patch Country Strings")); options3.SetName(8,"%s", tr("Alternate DOL")); options3.SetName(9,"%s", tr("Block IOS Reload")); - options3.SetName(10,"%s", tr("Anti Error 002 fix")); - options3.SetName(11,"%s", tr("Reset Playcounter")); - options3.SetName(12,"%s", tr("Default Gamesettings")); + options3.SetName(10,"%s", tr("Reset Playcounter")); + options3.SetName(11,"%s", tr("Default Gamesettings")); GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume); GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume); @@ -1853,7 +1845,6 @@ int GameSettings(struct discHdr * header) iosChoice = game_cfg->ios; parentalcontrolChoice = game_cfg->parentalcontrol; fix002 = game_cfg->errorfix002; - fix002anti = game_cfg->errorfix002anti; countrystrings = game_cfg->patchcountrystrings; alternatedol = game_cfg->loadalternatedol; reloadblock = game_cfg->iosreloadblock; @@ -1871,7 +1862,6 @@ int GameSettings(struct discHdr * header) } parentalcontrolChoice = 0; fix002 = Settings.error002; - fix002anti = Settings.anti002fix; countrystrings = Settings.patchcountrystrings; alternatedol = off; reloadblock = off; @@ -1922,6 +1912,7 @@ int GameSettings(struct discHdr * header) if (fix002 == on) options3.SetValue(6,tr("ON")); else if (fix002 == off) options3.SetValue(6,tr("OFF")); + else if (fix002 == anti) options3.SetValue(6,tr("Anti")); if (countrystrings == on) options3.SetValue(7,tr("ON")); else if (countrystrings == off) options3.SetValue(7,tr("OFF")); @@ -1932,9 +1923,7 @@ int GameSettings(struct discHdr * header) if (reloadblock == on) options3.SetValue(9,tr("ON")); else if (reloadblock == off) options3.SetValue(9,tr("OFF")); - if (fix002anti == on) options3.SetValue(10,tr("ON")); - else if (fix002anti == off) options3.SetValue(10,tr("OFF")); - + options3.SetValue(11, NULL); @@ -1968,7 +1957,7 @@ int GameSettings(struct discHdr * header) parentalcontrolChoice = (parentalcontrolChoice + 1) % 5; break; case 6: - fix002 = (fix002+1) % 2; + fix002 = (fix002+1) % 3; break; case 7: countrystrings = (countrystrings+1) % 2; @@ -1980,9 +1969,6 @@ int GameSettings(struct discHdr * header) reloadblock = (reloadblock+1) % 2; break; case 10: - fix002anti = (fix002anti+1) % 2; - break; - case 11: int result; result = WindowPrompt(tr("Are you sure?"),0,tr("Yes"),tr("Cancel"),0,0); if(result == 1) { @@ -2000,7 +1986,7 @@ int GameSettings(struct discHdr * header) } } break; - case 12: + case 11: int choice = WindowPrompt(tr("Are you sure?"),0,tr("Yes"),tr("Cancel"),0,0); if(choice == 1) { videoChoice = Settings.video; @@ -2008,7 +1994,6 @@ int GameSettings(struct discHdr * header) languageChoice = Settings.language; ocarinaChoice = Settings.ocarina; fix002 = Settings.error002; - fix002anti = Settings.anti002fix; countrystrings = Settings.patchcountrystrings; alternatedol = off; reloadblock = off; diff --git a/source/settings/cfg.c b/source/settings/cfg.c index 8279cff4..eda8e188 100644 --- a/source/settings/cfg.c +++ b/source/settings/cfg.c @@ -26,7 +26,6 @@ u8 viChoice = 0; u8 iosChoice = 0; u8 parentalcontrolChoice = 0; u8 fix002 = 0; -u8 fix002anti = 0; u8 reloadblock = 0; u8 countrystrings = 0; u8 alternatedol = 0; @@ -342,7 +341,6 @@ void Global_Default(void) snprintf(Settings.db_language, sizeof(Settings.db_language), empty); Settings.db_JPtoEN = 0; Settings.screensaver = 3; - Settings.anti002fix = 0; } @@ -982,13 +980,6 @@ void global_cfg_set(char *name, char *val) } return; } - else if (strcmp(name, "anti002fix") == 0) { - int i; - if (sscanf(val, "%d", &i) == 1) { - Settings.anti002fix = i; - } - return; - } else if (strcmp(name, "titlesOverride") == 0) { int i; if (sscanf(val, "%d", &i) == 1) { @@ -1160,7 +1151,6 @@ void cfg_set_game_opt(struct Game_CFG *game, u8 *id) game->ios = iosChoice; game->parentalcontrol = parentalcontrolChoice; game->errorfix002 = fix002; - game->errorfix002anti = fix002anti; game->iosreloadblock = reloadblock; game->patchcountrystrings = countrystrings; game->loadalternatedol = alternatedol; @@ -1258,7 +1248,6 @@ bool cfg_save_global()// save global settings fprintf(f, "patchcountrystrings = %d\n ", Settings.patchcountrystrings); fprintf(f, "screensaver = %d\n ", Settings.screensaver); fprintf(f, "error002 = %d\n ", Settings.error002); - fprintf(f, "anti002fix = %d\n ", Settings.anti002fix); fclose(f); return true; } @@ -1326,11 +1315,6 @@ void game_set(char *name, char *val) game->errorfix002 = opt_c; } } - if (strcmp("errorfix002anti", opt_name) == 0) { - if (sscanf(opt_val, "%hd", &opt_c) == 1) { - game->errorfix002anti = opt_c; - } - } if (strcmp("iosreloadblock", opt_name) == 0) { if (sscanf(opt_val, "%hd", &opt_c) == 1) { game->iosreloadblock = opt_c; @@ -1491,7 +1475,6 @@ bool cfg_save_games() fprintf(f, "ios:%d; ", cfg_game[i].ios); fprintf(f, "pctrl:%d; ", cfg_game[i].parentalcontrol); fprintf(f, "errorfix002:%d; ", cfg_game[i].errorfix002); - fprintf(f, "errorfix002anti:%d; ", cfg_game[i].errorfix002anti); fprintf(f, "iosreloadblock:%d; ", cfg_game[i].iosreloadblock); fprintf(f, "patchcountrystrings:%d; ", cfg_game[i].patchcountrystrings); fprintf(f, "loadalternatedol:%d;\n", cfg_game[i].loadalternatedol); diff --git a/source/settings/cfg.h b/source/settings/cfg.h index 250cfaa6..eb2d8a53 100644 --- a/source/settings/cfg.h +++ b/source/settings/cfg.h @@ -152,7 +152,6 @@ extern u8 viChoice; extern u8 iosChoice; extern u8 parentalcontrolChoice; extern u8 fix002; -extern u8 fix002anti; extern u8 reloadblock; extern u8 countrystrings; extern u8 alternatedol; @@ -177,7 +176,6 @@ struct Game_CFG u8 ios; u8 parentalcontrol; u8 errorfix002; - u8 errorfix002anti; u8 iosreloadblock; u8 loadalternatedol; u8 patchcountrystrings; @@ -232,6 +230,10 @@ enum { on, settings_off_on_max // always the last entry }; +enum { + anti=2, +}; + enum { GameID, @@ -356,7 +358,6 @@ struct SSettings { char db_url[200]; char db_language[100]; int db_JPtoEN; - short anti002fix; }; void CFG_LoadGlobal(void); diff --git a/source/usbloader/apploader.c b/source/usbloader/apploader.c index ea8d2469..321a7cb6 100644 --- a/source/usbloader/apploader.c +++ b/source/usbloader/apploader.c @@ -288,12 +288,12 @@ void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u PatchCountryStrings(dst, len); //if(Settings.anti002fix == on) - if(fix002anti == on) + if(fix002 == 2) Anti_002_fix(dst, len); } -s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u8 error002fixanti) +s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol) { app_entry appldr_entry; app_init appldr_init; @@ -325,7 +325,7 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 /* Initialize apploader */ appldr_init(__noprint); - if((error002fix) || (error002fixanti)){ + if(error002fix!=0){ /* ERROR 002 fix (thanks to WiiPower for sharing this)*/ *(u32 *)0x80003140 = *(u32 *)0x80003188; } diff --git a/source/usbloader/apploader.h b/source/usbloader/apploader.h index 1795c8e0..7f658ee9 100644 --- a/source/usbloader/apploader.h +++ b/source/usbloader/apploader.h @@ -10,7 +10,7 @@ extern "C" typedef void (*entry_point)(void); /* Prototypes */ -s32 Apploader_Run(entry_point *, u8, u8, u8, u8, u8, u8, u8); +s32 Apploader_Run(entry_point *, u8, u8, u8, u8, u8, u8); #ifdef __cplusplus } diff --git a/source/usbloader/disc.c b/source/usbloader/disc.c index 767bcc27..08004a62 100644 --- a/source/usbloader/disc.c +++ b/source/usbloader/disc.c @@ -261,7 +261,7 @@ s32 Disc_IsWii(void) return 0; } -s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u8 error002fixanti) +s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol) { entry_point p_entry; @@ -273,7 +273,7 @@ s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 pa return ret; /* Run apploader */ - ret = Apploader_Run(&p_entry, cheat, videoselected, vipatch, patchcountrystring, error002fix, alternatedol, error002fixanti); + ret = Apploader_Run(&p_entry, cheat, videoselected, vipatch, patchcountrystring, error002fix, alternatedol); if (ret < 0) return ret; @@ -308,7 +308,7 @@ s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 pa return 0; } -s32 Disc_WiiBoot(u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u8 error002fixanti) +s32 Disc_WiiBoot(u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol) { u64 offset; s32 ret; @@ -319,7 +319,7 @@ s32 Disc_WiiBoot(u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, return ret; /* Boot partition */ - return Disc_BootPartition(offset, videoselected, cheat, vipatch, patchcountrystring, error002fix, alternatedol, error002fixanti); + return Disc_BootPartition(offset, videoselected, cheat, vipatch, patchcountrystring, error002fix, alternatedol); } void PatchCountryStrings(void *Address, int Size) diff --git a/source/usbloader/disc.h b/source/usbloader/disc.h index 021c8cfa..5c9d200c 100644 --- a/source/usbloader/disc.h +++ b/source/usbloader/disc.h @@ -46,8 +46,8 @@ void __Disc_SetLowMem(void); s32 Disc_SetUSB(u8 *); s32 Disc_ReadHeader(void *); s32 Disc_IsWii(void); -s32 Disc_BootPartition(u64, u8, u8, u8, u8, u8, u8,u8); -s32 Disc_WiiBoot(u8, u8, u8, u8, u8, u8, u8); +s32 Disc_BootPartition(u64, u8, u8, u8, u8, u8, u8); +s32 Disc_WiiBoot(u8, u8, u8, u8, u8, u8); void PatchCountryStrings(void *Address, int Size); #ifdef __cplusplus