From cdc9f7afbd81b8e3bf94e346d8c488e3801c27a2 Mon Sep 17 00:00:00 2001 From: dimok321 <15055714+dimok789@users.noreply.github.com> Date: Sat, 20 Jun 2009 08:19:01 +0000 Subject: [PATCH] *Fixed mess up with lustars merge. *Added Playcounter Reset to GameSettings (545 fixed the PlayCounter not GameCounter :P) *Added global PlayCounter reset function (its not used yet) *Probably fixed the issue some HDDs had ("No partition found") *Probably fixed cursor disappearing after downloading update --- source/language/language.c | 10 ++++++++ source/language/language.h | 2 ++ source/menu.cpp | 42 ++++---------------------------- source/prompts/PromptWindows.cpp | 1 + source/settings/Settings.cpp | 31 ++++++++++++++++------- source/settings/cfg.c | 39 ++++++++++++++++++++++++++--- source/settings/cfg.h | 4 +-- 7 files changed, 77 insertions(+), 52 deletions(-) diff --git a/source/language/language.c b/source/language/language.c index d0a769e3..06572fc1 100644 --- a/source/language/language.c +++ b/source/language/language.c @@ -199,6 +199,7 @@ snprintf(LANGUAGE.ReloadSD, sizeof(LANGUAGE.ReloadSD), "Reload SD"); snprintf(LANGUAGE.RenameGameonWBFS, sizeof(LANGUAGE.RenameGameonWBFS), "Rename Game on WBFS"); snprintf(LANGUAGE.Restart, sizeof(LANGUAGE.Restart), "Restart"); snprintf(LANGUAGE.Restarting, sizeof(LANGUAGE.Restarting), "Restarting..."); +snprintf(LANGUAGE.Resetplaycounter, sizeof(LANGUAGE.Resetplaycounter), "Reset Playcounter"); snprintf(LANGUAGE.Return, sizeof(LANGUAGE.Return), "Return"); snprintf(LANGUAGE.released, sizeof(LANGUAGE.released), "Released"); snprintf(LANGUAGE.ReturntoWiiMenu, sizeof(LANGUAGE.ReturntoWiiMenu), "Return to Wii Menu"); @@ -210,6 +211,7 @@ snprintf(LANGUAGE.SaveFailed, sizeof(LANGUAGE.SaveFailed), "Save Failed"); snprintf(LANGUAGE.Specialthanksto, sizeof(LANGUAGE.Specialthanksto), "Special thanks to:"); snprintf(LANGUAGE.For, sizeof(LANGUAGE.For), "for"); snprintf(LANGUAGE.theUSBLoaderandreleasingthesourcecode, sizeof(LANGUAGE.theUSBLoaderandreleasingthesourcecode), "for the USB Loader source"); +snprintf(LANGUAGE.Screensaver, sizeof(LANGUAGE.Screensaver), "Screensaver"); snprintf(LANGUAGE.secondsleft, sizeof(LANGUAGE.secondsleft), "seconds left"); snprintf(LANGUAGE.Setasbackgroundmusic, sizeof(LANGUAGE.Setasbackgroundmusic), "Set as backgroundmusic?"); snprintf(LANGUAGE.SelectthePartition, sizeof(LANGUAGE.SelectthePartition), "Select the Partition"); @@ -998,6 +1000,10 @@ void language_set(char *name, char *val) strcopy(LANGUAGE.theUSBLoaderandreleasingthesourcecode, val, sizeof(LANGUAGE.theUSBLoaderandreleasingthesourcecode)); return; } + if (strcmp(name, "Screensaver") == 0) { + strcopy(LANGUAGE.Screensaver, val, sizeof(LANGUAGE.Screensaver)); + return; + } if (strcmp(name, "secondsleft") == 0) { strcopy(LANGUAGE.secondsleft, val, sizeof(LANGUAGE.secondsleft)); return; @@ -1246,6 +1252,10 @@ void language_set(char *name, char *val) strcopy(LANGUAGE.Restarting, val, sizeof(LANGUAGE.Restarting)); return; } + if (strcmp(name, "Resetplaycounter") == 0) { + strcopy(LANGUAGE.Resetplaycounter, val, sizeof(LANGUAGE.Resetplaycounter)); + return; + } if (strcmp(name, "available") == 0) { strcopy(LANGUAGE.available, val, sizeof(LANGUAGE.available)); return; diff --git a/source/language/language.h b/source/language/language.h index c2fbcb62..1659ad8b 100644 --- a/source/language/language.h +++ b/source/language/language.h @@ -197,6 +197,7 @@ struct LANGUAGE char RenameGameonWBFS[50]; char Restart[30]; char Restarting[20]; + char Resetplaycounter[50]; char Return[30]; char ReturntoWiiMenu[50]; char Right[30]; @@ -207,6 +208,7 @@ struct LANGUAGE char Specialthanksto[50]; char For[20]; char theUSBLoaderandreleasingthesourcecode[100]; + char Screensaver[50]; char secondsleft[50]; char SelectthePartition[50]; char youwanttoformat[50]; diff --git a/source/menu.cpp b/source/menu.cpp index 1042fd35..c30f5b0f 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -11,7 +11,6 @@ #include #include //CLOCK #include -#include #include "libwiigui/gui.h" #include "libwiigui/gui_gamegrid.h" @@ -1683,34 +1682,12 @@ static int MenuCheck() if(ret2 == 1) { Settings.cios = ios249; } else if(ret2 == 2) { - if(Settings.cios != ios222) - { - HaltGui(); - ret2 = Sys_IosReload(222); - if(ret2 < 0) - Sys_IosReload(249); - ResumeGui(); - if(ret2 < 0) { - Wpad_Init(); - WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR); - WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight); - WindowPrompt(LANGUAGE.YoudonthavecIOS,LANGUAGE.LoadingincIOS,LANGUAGE.ok, 0,0,0); - WPAD_Flush(0); - WPAD_Disconnect(0); - WPAD_Shutdown(); - } else { - Settings.cios = ios222; - load_ehc_module(); - } - } + Settings.cios = ios222; } else { Sys_LoadMenu(); } - ret2 = DiscWait(LANGUAGE.NoUSBDevice, LANGUAGE.WaitingforUSBDevice, 0, 0, 1); //reinitialize SD and USB - SDCard_Init(); - USBDevice_Init(); Wpad_Init(); WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR); WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight); @@ -1748,6 +1725,9 @@ static int MenuCheck() } } + SDCard_Init(); + USBDevice_Init(); + if(shutdown == 1) Sys_Shutdown(); if(reset == 1) @@ -1901,19 +1881,7 @@ int MainMenu(int menu) break; } - bool onlinefix = IsNetworkInit(); - if(onlinefix && IOS_GetVersion() == ios2) { - s32 kd_fd, ret; - STACK_ALIGN(u8, kd_buf, 0x20, 32); - - kd_fd = IOS_Open("/dev/net/kd/request", 0); - if (kd_fd >= 0) { - ret = IOS_Ioctl(kd_fd, 7, NULL, 0, kd_buf, 0x20); - if(ret >= 0) - onlinefix = false; // fixed no IOS reload needed - IOS_Close(kd_fd); - } - } + bool onlinefix = ShutdownWC24(); if(IOS_GetVersion() != ios2 || onlinefix == true) { ret = Sys_IosReload(ios2); if(ret < 0) { diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index d8d1192c..aa700a60 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -2310,6 +2310,7 @@ int ProgressUpdateWindow() pfile = fopen(dolpath, "wb"); u8 blockbuffer[BLOCKSIZE] ATTRIBUTE_ALIGN(32); for (s32 i = 0; i < filesize; i += BLOCKSIZE) { + VIDEO_WaitVSync(); prTxt.SetTextf("%i%%", 100*i/filesize); if ((Settings.wsprompt == yes) && (CFG.widescreen)) { progressbarImg.SetTile(80*i/filesize); diff --git a/source/settings/Settings.cpp b/source/settings/Settings.cpp index a819e836..b4fe9966 100644 --- a/source/settings/Settings.cpp +++ b/source/settings/Settings.cpp @@ -478,7 +478,7 @@ int MenuSettings() options2.SetName(7, "%s",LANGUAGE.Wiilight); options2.SetName(8, "%s",LANGUAGE.Rumble); options2.SetName(10, "%s",LANGUAGE.XMLTitles); - options2.SetName(11, "Screensaver"); + options2.SetName(11, "%s",LANGUAGE.Screensaver); for(int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL); optionBrowser2.SetScrollbar(1); w.Append(&optionBrowser2); @@ -673,14 +673,7 @@ int MenuSettings() case 9: break; case 10: - //HaltGui(); this isn't done on the fly yet. you have to restart the loader for it to take effect Settings.titlesOverride++; - //if(isInserted(bootDevice)) { - //cfg_save_global(); - //} - //CFG_Load(); - //__Menu_GetEntries(); - //ResumeGui(); break; case 11: Settings.screensaver++; @@ -1736,7 +1729,8 @@ int GameSettings(struct discHdr * header) options3.SetName(7,"%s", LANGUAGE.Patchcountrystrings); options3.SetName(8,"%s", LANGUAGE.Alternatedol); options3.SetName(9,"%s", LANGUAGE.Blockiosreload); - options3.SetName(10,"%s", LANGUAGE.Defaultgamesettings); + options3.SetName(10,"%s", LANGUAGE.Resetplaycounter); + options3.SetName(11,"%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); @@ -1901,6 +1895,7 @@ int GameSettings(struct discHdr * header) else if (reloadblock == off) options3.SetValue(9,LANGUAGE.OFF); options3.SetValue(10, NULL); + options3.SetValue(11, NULL); if(shutdown == 1) Sys_Shutdown(); @@ -1942,6 +1937,24 @@ int GameSettings(struct discHdr * header) reloadblock = (reloadblock+1) % 2; break; case 10: + int result; + result = WindowPrompt(LANGUAGE.Areyousure,0,LANGUAGE.Yes,LANGUAGE.Cancel,0,0); + if(result == 1) { + if(isInserted(bootDevice)) { + struct Game_NUM* game_num = CFG_get_game_num(header->id); + if (game_num) { + favoritevar = game_num->favorite; + playcount = game_num->count; + } else { + favoritevar = 0; + playcount = 0; + } + playcount = 0; + CFG_save_game_num(header->id); + } + } + break; + case 11: int choice = WindowPrompt(LANGUAGE.Areyousure,0,LANGUAGE.Yes,LANGUAGE.Cancel,0,0); if(choice == 1) { videoChoice = Settings.video; diff --git a/source/settings/cfg.c b/source/settings/cfg.c index 90b18b78..41c2d98c 100644 --- a/source/settings/cfg.c +++ b/source/settings/cfg.c @@ -11,8 +11,6 @@ #include "xml/xml.h" /* XML - Lustar*/ #include "cfg.h" - - struct SSettings Settings; @@ -1469,7 +1467,7 @@ bool cfg_save_games() fprintf(f, "errorfix002:%d; ", cfg_game[i].errorfix002); fprintf(f, "iosreloadblock:%d; ", cfg_game[i].iosreloadblock); fprintf(f, "patchcountrystrings:%d; ", cfg_game[i].patchcountrystrings); - fprintf(f, "loadalternatedol:%d; ", cfg_game[i].loadalternatedol); + fprintf(f, "loadalternatedol:%d;\n", cfg_game[i].loadalternatedol); } fprintf(f, "# END\n"); fclose(f); @@ -1509,6 +1507,39 @@ bool cfg_save_game_num() return true; } +bool CFG_reset_all_playcounters() +{ + FILE *f; + int i; + char GXGameFavorites_cfg[32]; + sprintf(GXGameFavorites_cfg, "%s/config", bootDevice); + mkdir(GXGameFavorites_cfg, 0777); + + sprintf(GXGameFavorites_cfg, "%s/config/GXGameFavorites.cfg", bootDevice); + f = fopen(GXGameFavorites_cfg, "w"); + if (!f) { + printf("Error saving %s\n", "GXGameFavorites.cfg"); + sleep(1); + return false; + } + fprintf(f, "# USB Loader settings file\n"); + fprintf(f, "# note: this file is automatically generated\n"); + fclose(f); + /* Closing and reopening because of a write issue we are having right now */ + f = fopen(GXGameFavorites_cfg, "w"); + fprintf(f, "# USB Loader settings file\n"); + fprintf(f, "# note: this file is automatically generated\n"); + fprintf(f, "# Num Games: %d\n", num_saved_game_num); + for (i=0; i