From 4ca4ab10614fe74c77b4ea86e0866a76662feeb0 Mon Sep 17 00:00:00 2001 From: dimok321 <15055714+dimok789@users.noreply.github.com> Date: Sun, 14 Jun 2009 10:08:41 +0000 Subject: [PATCH] *Fixed some issues *Added 16:9 forwarder *Changed video mode change behaviour *Added new GameSetting "Online fix" NOTE: Online fix is ONLY needed if you initialize network inside the loader and start an Online Game and ONLY if your boot cios is the same as GameSettings IOS (which is default). That Game would need an IOS Reload before start to be able to play it online BUT this IOS Reload mostly causes Blackscreens. I made this option so you dont have to avoid initializing network. If you have different boot IOS than gamesettings IOS this fix doesnt matter too. --- source/language/language.c | 5 +++++ source/language/language.h | 1 + source/menu.cpp | 26 ++++++++++---------------- source/settings/Settings.cpp | 30 ++++++++++++++++++++---------- source/settings/cfg.c | 22 +++++++++++++++------- source/settings/cfg.h | 2 ++ source/usbloader/disc.c | 33 ++++++++++++++++++--------------- 7 files changed, 71 insertions(+), 48 deletions(-) diff --git a/source/language/language.c b/source/language/language.c index c6c624dc..db015eaa 100644 --- a/source/language/language.c +++ b/source/language/language.c @@ -177,6 +177,7 @@ snprintf(LANGUAGE.OFF, sizeof(LANGUAGE.OFF), "OFF"); snprintf(LANGUAGE.OfficialSite, sizeof(LANGUAGE.OfficialSite), "Official Site"); snprintf(LANGUAGE.ON, sizeof(LANGUAGE.ON), "ON"); snprintf(LANGUAGE.OnlyInstall, sizeof(LANGUAGE.OnlyInstall), "Only for Install"); +snprintf(LANGUAGE.Onlinefix, sizeof(LANGUAGE.Onlinefix), "Online fix"); snprintf(LANGUAGE.Parentalcontrol, sizeof(LANGUAGE.Parentalcontrol), "Parental Control"); snprintf(LANGUAGE.Partition, sizeof(LANGUAGE.Partition), "Partition"); snprintf(LANGUAGE.Password, sizeof(LANGUAGE.Password), "Password"); @@ -870,6 +871,10 @@ void language_set(char *name, char *val) strcopy(LANGUAGE.ON, val, sizeof(LANGUAGE.ON)); return; } + if (strcmp(name, "Onlinefix") == 0) { + strcopy(LANGUAGE.Onlinefix, val, sizeof(LANGUAGE.Onlinefix)); + return; + } if (strcmp(name, "Parentalcontrol") == 0) { strcopy(LANGUAGE.Parentalcontrol, val, sizeof(LANGUAGE.Parentalcontrol)); return; diff --git a/source/language/language.h b/source/language/language.h index 16504e8e..211c3d3e 100644 --- a/source/language/language.h +++ b/source/language/language.h @@ -176,6 +176,7 @@ struct LANGUAGE char ok[30]; char ON[30]; char OnlyInstall[50]; + char Onlinefix[50]; char Parentalcontrol[50]; char Partition[50]; char Password[50]; diff --git a/source/menu.cpp b/source/menu.cpp index eb4f1339..0dc1b31b 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -515,16 +515,10 @@ static int MenuDiscList() clockTimeBack.SetAlignment(THEME.clockAlign, ALIGN_TOP); clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y); clockTimeBack.SetFont(fontClock); - if (Settings.gameDisplay==grid || Settings.gameDisplay==carousel) { - clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y+3); - } GuiText clockTime(theTime, 40, (GXColor){THEME.clock_r, THEME.clock_g, THEME.clock_b, 240}); clockTime.SetAlignment(THEME.clockAlign, ALIGN_TOP); clockTime.SetPosition(THEME.clock_x, THEME.clock_y); clockTime.SetFont(fontClock); - if (Settings.gameDisplay==grid || Settings.gameDisplay==carousel) { - clockTime.SetPosition(THEME.clock_x, THEME.clock_y+3); - } HaltGui(); GuiWindow w(screenwidth, screenheight); @@ -1831,6 +1825,7 @@ int MainMenu(int menu) ocarinaChoice = game_cfg->ocarina; viChoice = game_cfg->vipatch; fix002 = game_cfg->errorfix002; + onlinefix = game_cfg->onlinegame; iosChoice = game_cfg->ios; } else { videoChoice = Settings.video; @@ -1843,6 +1838,7 @@ int MainMenu(int menu) iosChoice = i249; } fix002 = off; + onlinefix = off; } int ios2; switch(iosChoice) { @@ -1863,7 +1859,7 @@ int MainMenu(int menu) break; } - if(IOS_GetVersion() != ios2 || IsNetworkInit() == true) { + if(IOS_GetVersion() != ios2 || (IsNetworkInit() == true && onlinefix == on)) { ret = Sys_IosReload(ios2); if(ret < 0) { Sys_IosReload(249); @@ -1944,33 +1940,31 @@ int MainMenu(int menu) switch(videoChoice) { case discdefault: - videoselected = 0; + videoselected = 0; break; case pal50: - videoselected = 1; + videoselected = 1; break; case pal60: - videoselected = 2; + videoselected = 2; break; case ntsc: - videoselected = 3; + videoselected = 3; break; case systemdefault: - - videoselected = 4; + videoselected = 4; break; case patch: - - videoselected = 5; + videoselected = 5; break; default: - videoselected = 0; + videoselected = 0; break; } diff --git a/source/settings/Settings.cpp b/source/settings/Settings.cpp index 20fe4044..2035eaa3 100644 --- a/source/settings/Settings.cpp +++ b/source/settings/Settings.cpp @@ -37,7 +37,7 @@ int MenuSettings() int ret; int choice = 0; bool exit = false; - + // backup game language setting int opt_lang = 0; opt_lang = Settings.language; @@ -1635,17 +1635,17 @@ int MenuSettings() // if language has changed, reload titles int opt_langnew = 0; - opt_langnew = Settings.language; + opt_langnew = Settings.language; if (Settings.titlesOverride==1 && opt_lang != opt_langnew) { CFG_LoadXml(true, true, false); // open file, reload titles, do not keep in memory menu = MENU_DISCLIST; } - + HaltGui(); mainWindow->RemoveAll(); mainWindow->Append(bgImg); - + ResumeGui(); return menu; } @@ -1659,7 +1659,7 @@ int GameSettings(struct discHdr * header) bool exit = false; int ret; int retVal = 0; - + char gameName[31]; if (strlen(get_title(header)) < (27 + 3)) { @@ -1679,7 +1679,8 @@ int GameSettings(struct discHdr * header) options3.SetName(4, "IOS"); options3.SetName(5,"%s", LANGUAGE.Parentalcontrol); options3.SetName(6,"%s", LANGUAGE.Error002fix); - options3.SetName(7,"%s", LANGUAGE.Defaultgamesettings); + options3.SetName(7,"%s", LANGUAGE.Onlinefix); + options3.SetName(8,"%s", LANGUAGE.Defaultgamesettings); 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); @@ -1766,6 +1767,7 @@ int GameSettings(struct discHdr * header) iosChoice = game_cfg->ios; parentalcontrolChoice = game_cfg->parentalcontrol; fix002 = game_cfg->errorfix002; + onlinefix = game_cfg->onlinegame; } else { @@ -1780,10 +1782,11 @@ int GameSettings(struct discHdr * header) } parentalcontrolChoice = 0; fix002 = off; + onlinefix = off; } - + int opt_lang = languageChoice; // backup language setting - + ResumeGui(); while(!exit) @@ -1827,7 +1830,10 @@ int GameSettings(struct discHdr * header) if (fix002 == on) options3.SetValue(6,LANGUAGE.ON); else if (fix002 == off) options3.SetValue(6,LANGUAGE.OFF); - options3.SetValue(7, NULL); + if (onlinefix == on) options3.SetValue(7,LANGUAGE.ON); + else if (onlinefix == off) options3.SetValue(7,LANGUAGE.OFF); + + options3.SetValue(8, NULL); if(shutdown == 1) Sys_Shutdown(); @@ -1860,6 +1866,9 @@ int GameSettings(struct discHdr * header) fix002 = (fix002+1) % 2; break; case 7: + onlinefix = (onlinefix+1) % 2; + break; + case 8: int choice = WindowPrompt(LANGUAGE.Areyousure,0,LANGUAGE.Yes,LANGUAGE.Cancel,0,0); if(choice == 1) { videoChoice = discdefault; @@ -1867,6 +1876,7 @@ int GameSettings(struct discHdr * header) languageChoice = ConsoleLangDefault; ocarinaChoice = off; fix002 = off; + onlinefix = off; if(Settings.cios == ios222) { iosChoice = i222; } else { @@ -1888,7 +1898,7 @@ int GameSettings(struct discHdr * header) // if language has changed, reload titles int opt_langnew = 0; game_cfg = CFG_get_game_opt(header->id); - if (game_cfg) opt_langnew = game_cfg->language; + if (game_cfg) opt_langnew = game_cfg->language; if (Settings.titlesOverride==1 && opt_lang != opt_langnew) { CFG_LoadXml(true, true, false); // open file, reload titles, do not keep in memory } diff --git a/source/settings/cfg.c b/source/settings/cfg.c index 3a99d56b..3f16be37 100644 --- a/source/settings/cfg.c +++ b/source/settings/cfg.c @@ -36,6 +36,7 @@ u8 viChoice = 0; u8 iosChoice = 0; u8 parentalcontrolChoice = 0; u8 fix002 = 0; +u8 onlinefix = 0; u8 xflip = 0; u8 sort = 0; u8 fave = 0; @@ -267,7 +268,7 @@ void CFG_Default(int widescreen) // -1 = non forced Mode THEME.settingsTxt_g = 0; THEME.settingsTxt_b = 0; THEME.cover_x = 26; - THEME.cover_y = 55; + THEME.cover_y = 58; THEME.showID = 1; // THEME.maxcharacters = 36; THEME.id_x = 68; @@ -1141,6 +1142,7 @@ void cfg_set_game_opt(struct Game_CFG *game, u8 *id) game->ios = iosChoice; game->parentalcontrol = parentalcontrolChoice; game->errorfix002 = fix002; + game->onlinegame = onlinefix; } struct Game_NUM* cfg_get_game_num(u8 *id) @@ -1296,6 +1298,11 @@ void game_set(char *name, char *val) game->errorfix002 = opt_c; } } + if (strcmp("onlinegame", opt_name) == 0) { + if (sscanf(opt_val, "%hd", &opt_c) == 1) { + game->onlinegame = opt_c; + } + } } // next opt @@ -1439,9 +1446,10 @@ bool cfg_save_games() if (s) fprintf(f, "language:%s; ", s); fprintf(f, "ocarina:%d; ", cfg_game[i].ocarina); fprintf(f, "vipatch:%d; ", cfg_game[i].vipatch); - fprintf(f, "ios:%d;", cfg_game[i].ios); - fprintf(f, "pctrl:%d;", cfg_game[i].parentalcontrol); - fprintf(f, "errorfix002:%d;\n", cfg_game[i].errorfix002); + 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, "onlinegame:%d;\n", cfg_game[i].onlinegame); } fprintf(f, "# END\n"); fclose(f); @@ -1606,13 +1614,13 @@ void CFG_Load(void) Global_Default(); //global default depends on theme information CFG_LoadGlobal(); - + if (Settings.titlesOverride==1) CFG_LoadXml(true, true, false); // load titles, do not keep in memory - + // loaded after database to override database titles with custom titles snprintf(pathname, sizeof(pathname), "%stitles.txt", Settings.titlestxt_path); cfg_parsefile(pathname, &title_set); - + // cfg_parsearg(argc, argv); } diff --git a/source/settings/cfg.h b/source/settings/cfg.h index c9fc912f..7f0216df 100644 --- a/source/settings/cfg.h +++ b/source/settings/cfg.h @@ -155,6 +155,7 @@ extern u8 iosChoice; extern u8 faveChoice; extern u8 parentalcontrolChoice; extern u8 fix002; +extern u8 onlinefix; extern u8 xflip; extern u8 qboot; extern u8 sort; @@ -174,6 +175,7 @@ struct Game_CFG u8 ios; u8 parentalcontrol; u8 errorfix002; + u8 onlinegame; }; struct Game_NUM { diff --git a/source/usbloader/disc.c b/source/usbloader/disc.c index a4d26b19..f96635b5 100644 --- a/source/usbloader/disc.c +++ b/source/usbloader/disc.c @@ -22,21 +22,25 @@ static char gameid[8]; void __Disc_SetLowMem(void) -{ - /* Setup low memory */ - *(vu32 *)0x80000030 = 0x00000000; - *(vu32 *)0x80000060 = 0x38A00040; - *(vu32 *)0x800000E4 = 0x80431A80; +{ + *(vu32 *)0x80000020 = 0x0D15EA5E; // System Magic + *(vu32 *)0x80000024 = 0x00000001; // Version + + *(vu32 *)0x80000030 = 0x00000000; // Arena Low + *(vu32 *)0x800000F4 = 0x817E5480; // BI2 + *(vu32 *)0x800000F8 = 0x0E7BE2C0; // Console Bus Speed + *(vu32 *)0x800000FC = 0x2B73A840; // Console CPU Speed + + /* Setup low memory */ + *(vu32 *)0x80000060 = 0x38A00040; + *(vu32 *)0x800000E4 = 0x80431A80; *(vu32 *)0x800000EC = 0x81800000; - *(vu32 *)0x800000F4 = 0x817E5480; - *(vu32 *)0x800000F8 = 0x0E7BE2C0; - *(vu32 *)0x800000FC = 0x2B73A840; /* Copy disc ID */ memcpy((void *)0x80003180, (void *)0x80000000, 4); /* Flush cache */ - DCFlushRange((void *)0x80000000, 0x3F00); + DCFlushRange((void *)0x80000000, 0x17FFFFF); } void __Disc_SetVMode(u8 videoselected) @@ -95,19 +99,18 @@ void __Disc_SetVMode(u8 videoselected) break; case 1: - vmode_reg = 1; - progressive = (CONF_GetProgressiveScan() > 0) && VIDEO_HaveComponentCable(); - vmode = (progressive) ? &TVEurgb60Hz480Prog : &TVPal528IntDf; + vmode = &TVPal528IntDf; + vmode_reg = (vmode->viTVMode) >> 2; break; case 2: - vmode_reg = 5; progressive = (CONF_GetProgressiveScan() > 0) && VIDEO_HaveComponentCable(); - vmode = (progressive) ? &TVEurgb60Hz480Prog : &TVEurgb60Hz480IntDf; + vmode = (progressive) ? &TVNtsc480Prog : &TVEurgb60Hz480IntDf; + vmode_reg = (vmode->viTVMode) >> 2; break; case 3: - vmode_reg = 0; progressive = (CONF_GetProgressiveScan() > 0) && VIDEO_HaveComponentCable(); vmode = (progressive) ? &TVNtsc480Prog : &TVNtsc480IntDf; + vmode_reg = (vmode->viTVMode) >> 2; break; case 4: // vmode = VIDEO_GetPreferredMode(NULL);