*This should fix the GameCounter problem probably.

This commit is contained in:
dimok321 2009-06-19 23:20:18 +00:00
parent 0fdf3a252e
commit 0258de337e
5 changed files with 52 additions and 73 deletions

View File

@ -1245,30 +1245,22 @@ static int MenuDiscList()
{ {
wiilight(0); wiilight(0);
if(isInserted(bootDevice)) {
//////////save game play count//////////////// //////////save game play count////////////////
extern u8 favorite;
extern u16 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) if (game_num) {
{ favoritevar = game_num->favorite;
favorite = game_num->favorite; playcount = game_num->count;
count = 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; menu = MENU_EXIT;
break; break;
} }

View File

@ -943,9 +943,6 @@ int GameWindowPrompt()
char ID[5]; char ID[5];
char IDFull[7]; char IDFull[7];
u8 faveChoice = 0;
u16 playCount = 0;
GuiWindow promptWindow(472,320); GuiWindow promptWindow(472,320);
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10); promptWindow.SetPosition(0, -10);
@ -1228,14 +1225,14 @@ int GameWindowPrompt()
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) { if (game_num) {
playCount = game_num->count; playcount = game_num->count;
faveChoice = game_num->favorite; favoritevar = game_num->favorite;
} else { } else {
playCount = 0; playcount = 0;
faveChoice = 0; favoritevar = 0;
} }
playcntTxt.SetTextf("%s: %i",LANGUAGE.Plays, playCount); playcntTxt.SetTextf("%s: %i",LANGUAGE.Plays, playcount);
btnFavoriteImg.SetImage(faveChoice ? &imgFavorite : &imgNotFavorite); btnFavoriteImg.SetImage(favoritevar ? &imgFavorite : &imgNotFavorite);
nameTxt.SetPosition(0, 1); nameTxt.SetPosition(0, 1);
@ -1261,28 +1258,20 @@ int GameWindowPrompt()
if(reset == 1) //for reset button if(reset == 1) //for reset button
Sys_Reboot(); Sys_Reboot();
if(btn1.GetState() == STATE_CLICKED) { //boot if(btn1.GetState() == STATE_CLICKED) {
//////////save game play count//////////////// //playcounter
extern u8 favorite;
extern u16 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) if (game_num) {
{ favoritevar = game_num->favorite;
favorite = game_num->favorite; playcount = game_num->count;
count = game_num->count;//count+=1; } else {
}count+=1; favoritevar = 0;
//if(isSdInserted()) { playcount = 0;
}
playcount += 1;
if(isInserted(bootDevice)) { if(isInserted(bootDevice)) {
if (CFG_save_game_num(header->id)) 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//////////////
choice = 1; choice = 1;
SDCard_deInit(); SDCard_deInit();
@ -1308,17 +1297,17 @@ int GameWindowPrompt()
else if(btnFavorite.GetState() == STATE_CLICKED){//switch favorite else if(btnFavorite.GetState() == STATE_CLICKED){//switch favorite
//if(isSdInserted()) { //if(isSdInserted()) {
if(isInserted(bootDevice)) { if(isInserted(bootDevice)) {
faveChoice = !faveChoice; struct Game_NUM * game_num = CFG_get_game_num(header->id);
btnFavoriteImg.SetImage(faveChoice ? &imgFavorite : &imgNotFavorite);
extern u8 favorite;
extern u8 count;
struct Game_NUM* game_num = CFG_get_game_num(header->id);
if (game_num) { if (game_num) {
favorite = game_num->favorite; playcount = game_num->count;
count = game_num->count; favoritevar = game_num->favorite;
} else {
playcount = 0;
favoritevar = 0;
} }
favorite = faveChoice; favoritevar = (favoritevar + 1) % 2;
CFG_save_game_num(header->id); CFG_save_game_num(header->id);
btnFavoriteImg.SetImage(favoritevar ? &imgFavorite : &imgNotFavorite);
} }
btnFavorite.ResetState(); btnFavorite.ResetState();
} }

View File

@ -37,8 +37,8 @@ u8 fave = 0;
u8 qboot = 0; u8 qboot = 0;
u8 wsprompt = 0; u8 wsprompt = 0;
u8 keyset = 0; u8 keyset = 0;
u8 favorite = 0; u8 favoritevar = 0;
u16 count = 0; u16 playcount = 0;
u8 listDisplay = 0; u8 listDisplay = 0;
#define TITLE_MAX 65 #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); strncpy((char*)game->id, (char*)id, 6);
game->id[6] = 0; game->id[6] = 0;
game->favorite = favorite; game->favorite = favoritevar;
game->count = count; game->count = playcount;
} }

View File

@ -141,9 +141,6 @@ struct THEME
short pagesize; short pagesize;
}; };
extern struct CFG CFG; extern struct CFG CFG;
extern struct THEME THEME; extern struct THEME THEME;
extern u8 ocarinaChoice; extern u8 ocarinaChoice;
@ -152,7 +149,6 @@ extern u8 videoChoice;
extern u8 languageChoice; extern u8 languageChoice;
extern u8 viChoice; extern u8 viChoice;
extern u8 iosChoice; extern u8 iosChoice;
extern u8 faveChoice;
extern u8 parentalcontrolChoice; extern u8 parentalcontrolChoice;
extern u8 fix002; extern u8 fix002;
extern u8 reloadblock; extern u8 reloadblock;
@ -165,6 +161,8 @@ extern u8 fave;
extern u8 wsprompt; extern u8 wsprompt;
extern u8 keyset; extern u8 keyset;
extern u8 gameDisplay; extern u8 gameDisplay;
extern u16 playcount;
extern u8 favoritevar;
struct Game_CFG struct Game_CFG

View File

@ -220,7 +220,7 @@ bool Search_and_patch_Video_Modes(void *Address, u32 Size, GXRModeObj* Table[])
return found; 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) void Anti_002_fix(void *Address, int Size)
{ {
u8 SearchPattern[12] = { 0x2C, 0x00, 0x00, 0x00, 0x48, 0x00, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00 }; u8 SearchPattern[12] = { 0x2C, 0x00, 0x00, 0x00, 0x48, 0x00, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00 };