diff --git a/source/menu.cpp b/source/menu.cpp index f9db920e..9b082730 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -1245,30 +1245,22 @@ static int MenuDiscList() { wiilight(0); + if(isInserted(bootDevice)) { //////////save game play count//////////////// - extern u8 favorite; - extern u16 count; struct Game_NUM* game_num = CFG_get_game_num(header->id); - if (game_num) - { - favorite = game_num->favorite; - count = game_num->count; + if (game_num) { + favoritevar = game_num->favorite; + playcount = game_num->count; + } else { + favoritevar = 0; + playcount = 0; + } + playcount += 1; - }count+=1; + CFG_save_game_num(header->id); + } - //if(isSdInserted()) { - if(isInserted(bootDevice)) { - if (CFG_save_game_num(header->id)) - { - //WindowPrompt(LANGUAGE.SuccessfullySaved, 0, LANGUAGE.ok, 0,0,0); - } - else - { - WindowPrompt(LANGUAGE.SaveFailed, 0, LANGUAGE.ok, 0,0,0); - } - } - ////////////end save play count////////////// menu = MENU_EXIT; break; } diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index 43b82cc5..2afc223f 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -325,30 +325,30 @@ void WindowScreensaver() { int i = 0; bool exit = false; - + /* initialize random seed: */ srand ( time(NULL) ); - + GuiImageData GXlogo(gxlogo_png); GuiImage GXlogoImg(&GXlogo); GXlogoImg.SetPosition(172,152); GXlogoImg.SetAlignment(ALIGN_LEFT,ALIGN_TOP); - + GuiImage BackgroundImg(640,480,(GXColor){0, 0, 0, 255}); BackgroundImg.SetPosition(0,0); - BackgroundImg.SetAlignment(ALIGN_LEFT,ALIGN_TOP); - + BackgroundImg.SetAlignment(ALIGN_LEFT,ALIGN_TOP); + GuiWindow screensaverWindow(screenwidth,screenheight); screensaverWindow.Append(&BackgroundImg); screensaverWindow.Append(&GXlogoImg); - + HaltGui(); mainWindow->SetState(STATE_DISABLED); mainWindow->Append(&screensaverWindow); ResumeGui(); while(!exit) - { + { i++; if(IsWpadConnected()) { @@ -362,7 +362,7 @@ void WindowScreensaver() } } - + HaltGui(); mainWindow->Remove(&screensaverWindow); mainWindow->SetState(STATE_DEFAULT); @@ -943,9 +943,6 @@ int GameWindowPrompt() char ID[5]; char IDFull[7]; - u8 faveChoice = 0; - u16 playCount = 0; - GuiWindow promptWindow(472,320); promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); promptWindow.SetPosition(0, -10); @@ -1228,14 +1225,14 @@ int GameWindowPrompt() struct Game_NUM* game_num = CFG_get_game_num(header->id); if (game_num) { - playCount = game_num->count; - faveChoice = game_num->favorite; + playcount = game_num->count; + favoritevar = game_num->favorite; } else { - playCount = 0; - faveChoice = 0; + playcount = 0; + favoritevar = 0; } - playcntTxt.SetTextf("%s: %i",LANGUAGE.Plays, playCount); - btnFavoriteImg.SetImage(faveChoice ? &imgFavorite : &imgNotFavorite); + playcntTxt.SetTextf("%s: %i",LANGUAGE.Plays, playcount); + btnFavoriteImg.SetImage(favoritevar ? &imgFavorite : &imgNotFavorite); nameTxt.SetPosition(0, 1); @@ -1261,28 +1258,20 @@ int GameWindowPrompt() if(reset == 1) //for reset button Sys_Reboot(); - if(btn1.GetState() == STATE_CLICKED) { //boot - //////////save game play count//////////////// - extern u8 favorite; - extern u16 count; + if(btn1.GetState() == STATE_CLICKED) { + //playcounter struct Game_NUM* game_num = CFG_get_game_num(header->id); - if (game_num) - { - favorite = game_num->favorite; - count = game_num->count;//count+=1; - }count+=1; - //if(isSdInserted()) { + if (game_num) { + favoritevar = game_num->favorite; + playcount = game_num->count; + } else { + favoritevar = 0; + playcount = 0; + } + playcount += 1; if(isInserted(bootDevice)) { - if (CFG_save_game_num(header->id)) - { - //WindowPrompt(LANGUAGE.SuccessfullySaved, 0, LANGUAGE.ok, 0,0,0); + CFG_save_game_num(header->id); } - else - { - //WindowPrompt(LANGUAGE.SaveFailed, 0, LANGUAGE.ok, 0,0,0); - } - } - ////////////end save play count////////////// choice = 1; SDCard_deInit(); @@ -1308,17 +1297,17 @@ int GameWindowPrompt() else if(btnFavorite.GetState() == STATE_CLICKED){//switch favorite //if(isSdInserted()) { if(isInserted(bootDevice)) { - faveChoice = !faveChoice; - btnFavoriteImg.SetImage(faveChoice ? &imgFavorite : &imgNotFavorite); - extern u8 favorite; - extern u8 count; - struct Game_NUM* game_num = CFG_get_game_num(header->id); + struct Game_NUM * game_num = CFG_get_game_num(header->id); if (game_num) { - favorite = game_num->favorite; - count = game_num->count; + playcount = game_num->count; + favoritevar = game_num->favorite; + } else { + playcount = 0; + favoritevar = 0; } - favorite = faveChoice; - CFG_save_game_num(header->id); + favoritevar = (favoritevar + 1) % 2; + CFG_save_game_num(header->id); + btnFavoriteImg.SetImage(favoritevar ? &imgFavorite : &imgNotFavorite); } btnFavorite.ResetState(); } diff --git a/source/settings/cfg.c b/source/settings/cfg.c index b3581ffc..3f13af06 100644 --- a/source/settings/cfg.c +++ b/source/settings/cfg.c @@ -37,8 +37,8 @@ u8 fave = 0; u8 qboot = 0; u8 wsprompt = 0; u8 keyset = 0; -u8 favorite = 0; -u16 count = 0; +u8 favoritevar = 0; +u16 playcount = 0; u8 listDisplay = 0; #define TITLE_MAX 65 @@ -1161,8 +1161,8 @@ void cfg_set_game_num(struct Game_NUM *game, u8 *id) { strncpy((char*)game->id, (char*)id, 6); game->id[6] = 0; - game->favorite = favorite; - game->count = count; + game->favorite = favoritevar; + game->count = playcount; } diff --git a/source/settings/cfg.h b/source/settings/cfg.h index da1dd377..007bb396 100644 --- a/source/settings/cfg.h +++ b/source/settings/cfg.h @@ -141,9 +141,6 @@ struct THEME short pagesize; }; - - - extern struct CFG CFG; extern struct THEME THEME; extern u8 ocarinaChoice; @@ -152,7 +149,6 @@ extern u8 videoChoice; extern u8 languageChoice; extern u8 viChoice; extern u8 iosChoice; -extern u8 faveChoice; extern u8 parentalcontrolChoice; extern u8 fix002; extern u8 reloadblock; @@ -165,6 +161,8 @@ extern u8 fave; extern u8 wsprompt; extern u8 keyset; extern u8 gameDisplay; +extern u16 playcount; +extern u8 favoritevar; struct Game_CFG diff --git a/source/usbloader/apploader.c b/source/usbloader/apploader.c index df85b6e2..e5bfdd01 100644 --- a/source/usbloader/apploader.c +++ b/source/usbloader/apploader.c @@ -220,7 +220,7 @@ 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 **/ +/** Anti 002 fix for IOS 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 };