*Added Anti 002 Fix to GlobalSettings which was made by WiiPower (Thanks)

NOTE: This fix is for games like Ghostbusters which don't work under IOS249 Rev10. With this fix on, this games work on Rev10 and you don't need to switch the cIOS all the time to play those games. For this option it is necessary that you turn ERROR 002 FIX ON.
This commit is contained in:
dimok321 2009-06-19 20:20:03 +00:00
parent 1ab0f813e2
commit c80332eff3
6 changed files with 47 additions and 0 deletions

View File

@ -35,6 +35,7 @@ void lang_default()
snprintf(LANGUAGE.ok, sizeof(LANGUAGE.ok), "OK");
snprintf(LANGUAGE.addToFavorite, sizeof(LANGUAGE.addToFavorite), "Favorite");
snprintf(LANGUAGE.all, sizeof(LANGUAGE.all), "Alphabetical");
snprintf(LANGUAGE.Anti002fix, sizeof(LANGUAGE.Anti002fix), "Anti 002 fix");
snprintf(LANGUAGE.AppLanguage, sizeof(LANGUAGE.AppLanguage), "App Language");
snprintf(LANGUAGE.Alternatedol, sizeof(LANGUAGE.Alternatedol), "Alternate DOL");
snprintf(LANGUAGE.t3Covers, sizeof(LANGUAGE.t3Covers), "3D Covers");
@ -322,6 +323,10 @@ void language_set(char *name, char *val)
strcopy(LANGUAGE.ok, val, sizeof(LANGUAGE.ok));
return;
}
if (strcmp(name, "Anti002fix") == 0) {
strcopy(LANGUAGE.Anti002fix, val, sizeof(LANGUAGE.Anti002fix));
return;
}
if (strcmp(name, "AppLanguage") == 0) {
strcopy(LANGUAGE.AppLanguage, val, sizeof(LANGUAGE.AppLanguage));
return;

View File

@ -32,6 +32,7 @@ struct LANGUAGE
char t3Covers[50];
char addToFavorite[50];
char all[30];
char Anti002fix[50];
char AppLanguage[50];
char available[20];
char Areyousure[50];

View File

@ -733,6 +733,7 @@ int MenuSettings()
options2.SetName(5,"%s", LANGUAGE.BootStandard);
options2.SetName(6, "%s",LANGUAGE.QuickBoot);
options2.SetName(7, "%s",LANGUAGE.Error002fix);
options2.SetName(8, "%s",LANGUAGE.Anti002fix);
for(int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL);
w.Append(&optionBrowser2);
optionBrowser2.SetClickable(true);
@ -761,6 +762,8 @@ int MenuSettings()
Settings.language = 0;
if(Settings.error002 >= settings_off_on_max)
Settings.error002 = 0;
if(Settings.anti002fix >= settings_off_on_max)
Settings.anti002fix = 0;
if (Settings.video == discdefault) options2.SetValue(0,"%s",LANGUAGE.DiscDefault);
else if (Settings.video == systemdefault) options2.SetValue(0,"%s",LANGUAGE.SystemDefault);
@ -800,6 +803,9 @@ int MenuSettings()
if (Settings.error002 == no) options2.SetValue(7,"%s",LANGUAGE.No);
else if (Settings.error002 == yes) options2.SetValue(7,"%s",LANGUAGE.Yes);
if (Settings.anti002fix == no) options2.SetValue(8,"%s",LANGUAGE.No);
else if (Settings.anti002fix == yes) options2.SetValue(8,"%s",LANGUAGE.Yes);
if(backBtn.GetState() == STATE_CLICKED)
{
backBtn.ResetState();
@ -866,6 +872,9 @@ int MenuSettings()
case 7:
Settings.error002++;
break;
case 8:
Settings.anti002fix++;
break;
}
}
optionBrowser2.SetEffect(EFFECT_FADE, -20);

View File

@ -333,6 +333,7 @@ void Global_Default(void)
Settings.titlesOverride = 0;
Settings.screensaver = 3;
Settings.error002 = 0;
Settings.anti002fix = 0;
}
@ -969,6 +970,13 @@ 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) {
@ -1227,6 +1235,7 @@ 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;
}

View File

@ -351,6 +351,7 @@ struct SSettings {
char Cheatcodespath[100];
int titlesOverride;
short error002;
short anti002fix;
};
void CFG_LoadGlobal(void);

View File

@ -220,6 +220,25 @@ bool Search_and_patch_Video_Modes(void *Address, u32 Size, GXRModeObj* Table[])
return found;
}
/** Anti 002 fix for cIOS 249 rev < 12 thanks to WiiPower **/
void Anti_002_fix(void *Address, int Size)
{
u8 SearchPattern[12] = { 0x2C, 0x00, 0x00, 0x00, 0x48, 0x00, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00 };
u8 PatchData[12] = { 0x2C, 0x00, 0x00, 0x00, 0x40, 0x82, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00 };
void *Addr = Address;
void *Addr_end = Address+Size;
while(Addr <= Addr_end-sizeof(SearchPattern))
{
if(memcmp(Addr, SearchPattern, sizeof(SearchPattern))==0)
{
memcpy(Addr,PatchData,sizeof(PatchData));
}
Addr += 4;
}
}
void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u8 vipatch)
{
GXRModeObj** table = NULL;
@ -268,6 +287,9 @@ void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u
if(patchcountrystring == 1)
PatchCountryStrings(dst, len);
if(Settings.anti002fix == on)
Anti_002_fix(dst, len);
}
s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol)