fixed some code dumps from the coverwall and the xml stuff.

This commit is contained in:
giantpune 2009-06-11 08:13:08 +00:00
parent 6abaf293d8
commit d31a034d18
12 changed files with 467 additions and 402 deletions

File diff suppressed because one or more lines are too long

View File

@ -13,6 +13,8 @@
#include "getentries.h"
#include "SettingsPrompts.h"
#define MAXOPTIONS 11
/*** Extern functions ***/
extern void ResumeGui();
extern void HaltGui();
@ -225,7 +227,7 @@ int MenuSettings()
MainButton4.SetEffectGrow();
MainButton4.SetTrigger(&trigA);
customOptionList options2(10);
customOptionList options2(MAXOPTIONS);
GuiCustomOptionBrowser optionBrowser2(396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, 0, 150);
optionBrowser2.SetPosition(0, 90);
optionBrowser2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
@ -461,6 +463,7 @@ int MenuSettings()
w.Remove(&MainButton4);
titleTxt.SetText(LANGUAGE.GUISettings);
exit = false;
for(int i = 0; i <= MAXOPTIONS; i++) options2.SetName(i, NULL);
options2.SetName(0, "%s",LANGUAGE.AppLanguage);
options2.SetName(1, "%s",LANGUAGE.Display);
options2.SetName(2, "%s",LANGUAGE.Clock);
@ -471,7 +474,8 @@ int MenuSettings()
options2.SetName(7, "%s",LANGUAGE.Wiilight);
options2.SetName(8, "%s",LANGUAGE.Rumble);
options2.SetName(9, "%s",LANGUAGE.Unicodefix);
for(int i = 0; i < 10; i++) options2.SetValue(i, NULL);
options2.SetName(10, "%s",LANGUAGE.XMLTitles);
for(int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL);
optionBrowser2.SetScrollbar(1);
w.Append(&optionBrowser2);
optionBrowser2.SetClickable(true);
@ -509,7 +513,8 @@ int MenuSettings()
Settings.rumble = 0; //RUMBLE
if ( Settings.unicodefix > 2 )
Settings.unicodefix = 0;
if(Settings.titlesOverride >= 2)
Settings.titlesOverride = 0;
if(!strcmp("notset", Settings.language_path))
options2.SetValue(0, "%s", LANGUAGE.Default);
else
@ -552,6 +557,9 @@ int MenuSettings()
else if (Settings.unicodefix == 1) options2.SetValue(9,"%s",LANGUAGE.TChinese);
else if (Settings.unicodefix == 2) options2.SetValue(9,"%s",LANGUAGE.SChinese);
if (Settings.titlesOverride == 0) options2.SetValue(10,"%s",LANGUAGE.OFF);
else if (Settings.titlesOverride == 1) options2.SetValue(10,"%s",LANGUAGE.ON);
if(backBtn.GetState() == STATE_CLICKED)
{
backBtn.ResetState();
@ -657,6 +665,16 @@ int MenuSettings()
case 9:
Settings.unicodefix++;
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;
}
}
optionBrowser2.SetEffect(EFFECT_FADE, -20);
@ -686,6 +704,7 @@ int MenuSettings()
w.Remove(&MainButton4);
titleTxt.SetText(LANGUAGE.Gameload);
exit = false;
for(int i = 0; i <= MAXOPTIONS; i++) options2.SetName(i, NULL);
options2.SetName(0, "%s",LANGUAGE.VideoMode);
options2.SetName(1, "%s",LANGUAGE.VIDTVPatch);
options2.SetName(2, "%s",LANGUAGE.Language);
@ -693,10 +712,7 @@ int MenuSettings()
options2.SetName(4, "Ocarina");
options2.SetName(5,"%s", LANGUAGE.BootStandard);
options2.SetName(6, "%s",LANGUAGE.QuickBoot);
options2.SetName(7, NULL);
options2.SetName(8, NULL);
options2.SetName(9, NULL);
for(int i = 0; i < 10; i++) options2.SetValue(i, NULL);
for(int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL);
w.Append(&optionBrowser2);
optionBrowser2.SetClickable(true);
ResumeGui();
@ -849,17 +865,11 @@ int MenuSettings()
w.Remove(&MainButton4);
titleTxt.SetText(LANGUAGE.Parentalcontrol);
exit = false;
for(int i = 0; i <= MAXOPTIONS; i++) options2.SetName(i, NULL);
options2.SetName(0, "Console");
options2.SetName(1, "%s", LANGUAGE.Password);
options2.SetName(2, "%s",LANGUAGE.Controllevel);
options2.SetName(3, NULL);
options2.SetName(4, NULL);
options2.SetName(5, NULL);
options2.SetName(6, NULL);
options2.SetName(7, NULL);
options2.SetName(8, NULL);
options2.SetName(9, NULL);
for(int i = 0; i < 10; i++) options2.SetValue(i, NULL);
for(int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL);
w.Append(&optionBrowser2);
optionBrowser2.SetClickable(true);
ResumeGui();
@ -1016,17 +1026,11 @@ int MenuSettings()
w.Remove(&MainButton4);
titleTxt.SetText(LANGUAGE.Sound);
exit = false;
for(int i = 0; i <= MAXOPTIONS; i++) options2.SetName(i, NULL);
options2.SetName(0, "%s",LANGUAGE.Backgroundmusic);
options2.SetName(1, "%s",LANGUAGE.Volume);
options2.SetName(2, "%s",LANGUAGE.SFXVolume);
options2.SetName(3, NULL);
options2.SetName(4, NULL);
options2.SetName(5, NULL);
options2.SetName(6, NULL);
options2.SetName(7, NULL);
options2.SetName(8, NULL);
options2.SetName(9, NULL);
for(int i = 0; i < 10; i++) options2.SetValue(i, NULL);
for(int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL);
w.Append(&optionBrowser2);
optionBrowser2.SetClickable(true);
ResumeGui();
@ -1164,6 +1168,7 @@ int MenuSettings()
w.Remove(&MainButton4);
titleTxt.SetText(LANGUAGE.Custompaths);
exit = false;
for(int i = 0; i <= MAXOPTIONS; i++) options2.SetName(i, NULL);
if(Settings.godmode)
options2.SetName(0, "%s", LANGUAGE.CoverPath);
options2.SetName(1, "%s", LANGUAGE.DiscimagePath);
@ -1171,11 +1176,7 @@ int MenuSettings()
options2.SetName(3, "%s", LANGUAGE.Titlestxtpath);
options2.SetName(4, "%s", LANGUAGE.Updatepath);
options2.SetName(5, "%s", LANGUAGE.Cheatcodespath);
options2.SetName(6, NULL);
options2.SetName(7, NULL);
options2.SetName(8, NULL);
options2.SetName(9, NULL);
for(int i = 0; i < 10; i++) options2.SetValue(i, NULL);
for(int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL);
w.Append(&optionBrowser2);
optionBrowser2.SetClickable(true);
ResumeGui();

View File

@ -355,6 +355,7 @@ void Global_Default(void)
Settings.unicodefix = 0;
Settings.wiilight = 1;
Settings.patchcountrystrings = 0;
Settings.titlesOverride = 0;
}
@ -980,6 +981,13 @@ void global_cfg_set(char *name, char *val)
}
return;
}
else if (strcmp(name, "titlesOverride") == 0) {
int i;
if (sscanf(val, "%d", &i) == 1) {
Settings.titlesOverride = i;
}
return;
}
else if (strcmp(name, "gameDisplay") == 0) {
int i;
if (sscanf(val, "%d", &i) == 1) {
@ -1216,6 +1224,7 @@ bool cfg_save_global()// save global settings
fprintf(f, "gameDisplay = %d\n ", Settings.gameDisplay);
fprintf(f, "update_path = %s\n ", Settings.update_path);
fprintf(f, "Cheatcodespath = %s\n ", Settings.Cheatcodespath);
fprintf(f, "titlesOverride = %d\n ", Settings.titlesOverride);
fprintf(f, "patchcountrystrings = %d\n ", Settings.patchcountrystrings);
fclose(f);
return true;
@ -1492,6 +1501,7 @@ bool cfg_load_global()
}
Settings.volume = 80;
Settings.sfxvolume = 80;
Settings.titlesOverride = 0;
return cfg_parsefile(GXGlobal_cfg, &global_cfg_set);
}
@ -1551,6 +1561,16 @@ bool CFG_forget_game_opt(u8 *id)
return cfg_save_games();
}
void CFG_LoadXml()
{
char pathname[200];
/* load renamed titles from proper names and game info XML, needs to be after cfg_load_games - Lustar */
snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.xml");
OpenXMLFile(pathname);
LoadTitlesFromXML("English", false); // options can be added to set force title language to any language and force Japanese title to English
}
void CFG_Load(void)
{
char pathname[200];
@ -1582,10 +1602,7 @@ void CFG_Load(void)
cfg_load_games();
cfg_load_game_num();
/* load renamed titles from proper names and game info XML, needs to be after cfg_load_games - Lustar */
//snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.zip");
//OpenXMLFile(pathname);
//LoadTitlesFromXML("English", false); // options can be added to set force title language to any language and force Japanese title to English
if (Settings.titlesOverride==1)CFG_LoadXml();
Global_Default(); //global default depends on theme information
CFG_LoadGlobal();

View File

@ -329,10 +329,12 @@ struct SSettings {
char ogg_path[150];
char update_path[150];
char Cheatcodespath[100];
int titlesOverride;
};
void CFG_LoadGlobal(void);
bool cfg_save_global(void);
void CFG_LoadXml();
//Astidof - End of modification
char *get_title(struct discHdr *header);

View File

@ -20,61 +20,6 @@
#include "xml.h"
GuiText * debugTxt = NULL;
int cnt;
GuiImageData * playersImgData = NULL;
GuiImage * playersImg = NULL;
GuiImageData * wifiplayersImgData = NULL;
GuiImage * wifiplayersImg = NULL;
GuiImage * ratingImg = NULL;
GuiImage * classiccontrollerImg;
GuiImage * nunchuckImg;
GuiImage * guitarImg;
GuiImage * drumsImg;
GuiImage * dancepadImg;
GuiImage * motionplusImg;
GuiImage * wheelImg;
GuiImage * balanceboardImg;
GuiImage * microphoneImg;
GuiImage * gcImg;
GuiImage * dialogBoxImg1;
GuiImage * dialogBoxImg2;
GuiImage * dialogBoxImg3;
GuiImage * dialogBoxImg4;
GuiImage * dialogBoxImg11;
GuiImage * dialogBoxImg22;
GuiImage * dialogBoxImg33;
GuiImage * dialogBoxImg44;
GuiImage * coverImg;
GuiImage * coverImg2;
GuiImageData * classiccontrollerImgData = NULL;
GuiImageData * nunchuckImgData = NULL;
GuiImageData * guitarImgData = NULL;
GuiImageData * drumsImgData = NULL;
GuiImageData * motionplusImgData = NULL;
GuiImageData * wheelImgData = NULL;
GuiImageData * balanceboardImgData = NULL;
GuiImageData * dancepadImgData = NULL;
GuiImageData * microphoneImgData = NULL;
GuiImageData * gamecubeImgData = NULL;
GuiImageData * ratingImgData = NULL;
GuiImageData * cover = NULL;
GuiText * releasedTxt = NULL;
GuiText * publisherTxt = NULL;
GuiText * developerTxt = NULL;
GuiText * titleTxt = NULL;
GuiText * synopsisTxt = NULL;
GuiText * genreTxt = NULL;
GuiText * betaTxt = NULL;
GuiText * beta1Txt = NULL;
GuiText ** wifiTxt = NULL;
/*** Extern variables ***/
extern GuiWindow * mainWindow;
extern GuiSound * bgMusic;
@ -85,61 +30,6 @@ extern u8 reset;
extern void ResumeGui();
extern void HaltGui();
void eatADick()
{
// use this to display variables on the window GuiText * debugTxt = NULL;
playersImgData = NULL;
playersImg = NULL;
wifiplayersImgData = NULL;
wifiplayersImg = NULL;
ratingImg = NULL;
classiccontrollerImg = NULL;
nunchuckImg = NULL;
guitarImg = NULL;
drumsImg = NULL;
dancepadImg = NULL;
motionplusImg = NULL;
wheelImg = NULL;
balanceboardImg = NULL;
microphoneImg = NULL;
gcImg = NULL;
dialogBoxImg1 = NULL;
dialogBoxImg2 = NULL;
dialogBoxImg3 = NULL;
dialogBoxImg4 = NULL;
dialogBoxImg11 = NULL;
dialogBoxImg22 = NULL;
dialogBoxImg33 = NULL;
dialogBoxImg44 = NULL;
coverImg = NULL;
coverImg2 = NULL;
classiccontrollerImgData = NULL;
nunchuckImgData = NULL;
guitarImgData = NULL;
drumsImgData = NULL;
motionplusImgData = NULL;
wheelImgData = NULL;
balanceboardImgData = NULL;
dancepadImgData = NULL;
microphoneImgData = NULL;
gamecubeImgData = NULL;
ratingImgData = NULL;
cover = NULL;
releasedTxt = NULL;
publisherTxt = NULL;
developerTxt = NULL;
titleTxt = NULL;
synopsisTxt = NULL;
genreTxt = NULL;
betaTxt = NULL;
beta1Txt = NULL;
}
/****************************************************************************
* gameinfo
@ -147,6 +37,19 @@ beta1Txt = NULL;
int
showGameInfo(char *ID, u8 *headerID)
{
u8 nodata=1;
//load the xml shit
char pathname[100];
snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.zip");
bool fileexists = OpenXMLFile(pathname);
if(!fileexists) {
snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.xml");
fileexists = OpenXMLFile(pathname);
}
if(fileexists) {
snprintf(pathname, sizeof(pathname), "English");
if (Settings.titlesOverride==1)LoadTitlesFromXML(pathname, false); // options can be added to set force title language to any language and force Japanese title to English
int choice = -1;
//int i = 0;
int y = 0, y1 = 32;
@ -164,6 +67,58 @@ showGameInfo(char *ID, u8 *headerID)
int newline=1;
u8 page =1;
// GuiText * debugTxt = NULL;
GuiImageData * playersImgData = NULL;
GuiImage * playersImg = NULL;
GuiImageData * wifiplayersImgData = NULL;
GuiImage * wifiplayersImg = NULL;
GuiImage * ratingImg = NULL;
GuiImage * classiccontrollerImg = NULL;
GuiImage * nunchuckImg = NULL;
GuiImage * guitarImg = NULL;
GuiImage * drumsImg = NULL;
GuiImage * dancepadImg = NULL;
GuiImage * motionplusImg = NULL;
GuiImage * wheelImg = NULL;
GuiImage * balanceboardImg = NULL;
GuiImage * microphoneImg = NULL;
GuiImage * gcImg = NULL;
GuiImage * dialogBoxImg1 = NULL;
GuiImage * dialogBoxImg2 = NULL;
GuiImage * dialogBoxImg3 = NULL;
GuiImage * dialogBoxImg4 = NULL;
GuiImage * dialogBoxImg11 = NULL;
GuiImage * dialogBoxImg22 = NULL;
GuiImage * dialogBoxImg33 = NULL;
GuiImage * dialogBoxImg44 = NULL;
GuiImage * coverImg = NULL;
GuiImage * coverImg2 = NULL;
GuiImageData * classiccontrollerImgData = NULL;
GuiImageData * nunchuckImgData = NULL;
GuiImageData * guitarImgData = NULL;
GuiImageData * drumsImgData = NULL;
GuiImageData * motionplusImgData = NULL;
GuiImageData * wheelImgData = NULL;
GuiImageData * balanceboardImgData = NULL;
GuiImageData * dancepadImgData = NULL;
GuiImageData * microphoneImgData = NULL;
GuiImageData * gamecubeImgData = NULL;
GuiImageData * ratingImgData = NULL;
GuiImageData * cover = NULL;
GuiText * releasedTxt = NULL;
GuiText * publisherTxt = NULL;
GuiText * developerTxt = NULL;
GuiText * titleTxt = NULL;
GuiText * synopsisTxt = NULL;
GuiText * genreTxt = NULL;
GuiText * betaTxt = NULL;
GuiText * beta1Txt = NULL;
GuiWindow gameinfoWindow(600,308);
gameinfoWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
gameinfoWindow.SetPosition(0, -50);
@ -207,14 +162,6 @@ showGameInfo(char *ID, u8 *headerID)
nextBtn.SetTrigger(&trigA);
gameinfoWindow.Append(&nextBtn);
//load the xml shit
char pathname[100];
snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.zip");
OpenXMLFile(pathname);
snprintf(pathname, sizeof(pathname), "English");
LoadTitlesFromXML(pathname, false); // options can be added to set force title language to any language and force Japanese title to English
/*struct Game_CFG *game_cfg = NULL;
int opt_lang;
char langtexttmp[11][22] =
@ -235,7 +182,7 @@ showGameInfo(char *ID, u8 *headerID)
} else {
opt_lang = Settings.language;
}*/
LoadGameInfoFromXML(ID,pathname);
if (LoadGameInfoFromXML(ID,pathname))nodata=0;
//LoadGameInfoFromXML(ID,langtexttmp[opt_lang]);
char linebuf[1000] = "";
char linebuf2[100] = "";
@ -462,16 +409,14 @@ showGameInfo(char *ID, u8 *headerID)
// # online players
if (strcmp(gameinfo.wifiplayers,"") != 0) {
if ((strcmp(gameinfo.wifiplayers,"") != 0) && (strcmp(gameinfo.wifiplayers,"0") != 0)){
wifiplayersImgData = new GuiImageData(wifi1_png);
if (atoi(gameinfo.wifiplayers)>1){
wifiplayersImgData= new GuiImageData(wifi2_png);}
if (atoi(gameinfo.wifiplayers)>2){
wifiplayersImgData= new GuiImageData(wifi4_png);}
if (atoi(gameinfo.wifiplayers)>4){
wifiplayersImgData= new GuiImageData(wifi8_png);}
wifiplayersImg = new GuiImage(wifiplayersImgData);
wifiplayersImg->SetWidescreen(CFG.widescreen);
wifiplayersImg->SetPosition(intputX , inputY);
@ -602,8 +547,8 @@ debugTxt = new GuiText(linebuf, 18, (GXColor){0,0,0, 255});
break;
}
}
if (strcmp(gameinfo.year,"") != 0)newline=1;
{snprintf(linebuf, sizeof(linebuf), "%s : %s%s", LANGUAGE.released, linebuf2, gameinfo.year);
if (strcmp(gameinfo.year,"") != 0){newline=1;
snprintf(linebuf, sizeof(linebuf), "%s : %s%s", LANGUAGE.released, linebuf2, gameinfo.year);
releasedTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
if (releasedTxt->GetWidth()>300) newline=2;
releasedTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); releasedTxt->SetPosition(-17,12+y); y+=(20 * newline);newline=1;
@ -647,9 +592,9 @@ debugTxt = new GuiText(linebuf, 18, (GXColor){0,0,0, 255});
// WiFi Shit commented out cause it has a code dump in it still
/*if (strcmp(gameinfo.wififeatures[0],"") != 0){
snprintf(linebuf, sizeof(linebuf), "%s:",LANGUAGE.wififeatures);
wifiTxt[0] = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
wifiTxt[0]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); wifiTxt[0]->SetPosition(205,12+y); y+=(20 * newline);
gameinfoWindow.Append(wifiTxt[0]);}
wifiTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
wifiTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); wifiTxt->SetPosition(205,12+y); y+=(20 * newline);
gameinfoWindow.Append(wifiTxt);}
for (int i=1;strcmp(gameinfo.wififeatures[i],"") != 0;i++)
{
snprintf(linebuf, sizeof(linebuf), "%s",gameinfo.wififeatures[i]);
@ -756,7 +701,64 @@ debugTxt = new GuiText(linebuf, 18, (GXColor){0,0,0, 255});
HaltGui();
mainWindow->Remove(&gameinfoWindow);
mainWindow->SetState(STATE_DEFAULT);
eatADick();
// use this to display variables on the window GuiText * debugTxt = NULL;
delete playersImgData;
delete playersImg;
delete wifiplayersImgData;
delete wifiplayersImg;
delete ratingImg;
delete classiccontrollerImg;
delete nunchuckImg;
delete guitarImg;
delete drumsImg;
delete dancepadImg;
delete motionplusImg;
delete wheelImg;
delete balanceboardImg;
delete microphoneImg;
delete gcImg;
delete dialogBoxImg1;
delete dialogBoxImg2;
delete dialogBoxImg3;
delete dialogBoxImg4;
delete dialogBoxImg11;
delete dialogBoxImg22;
delete dialogBoxImg33;
delete dialogBoxImg44;
delete coverImg;
delete coverImg2;
delete classiccontrollerImgData;
delete nunchuckImgData;
delete guitarImgData;
delete drumsImgData;
delete motionplusImgData;
delete wheelImgData;
delete balanceboardImgData;
delete dancepadImgData;
delete microphoneImgData;
delete gamecubeImgData;
delete ratingImgData;
delete cover;
delete releasedTxt;
delete publisherTxt;
delete developerTxt;
delete titleTxt;
delete synopsisTxt;
delete genreTxt;
delete betaTxt;
delete beta1Txt;
if (nodata==0)FreeXMLMemory();
//void FreeXMLDeletePart();
/*
nodeid
<dimok> nodefound
*/
ResumeGui();}
else {
gameinfoWindow2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
@ -765,6 +767,12 @@ debugTxt = new GuiText(linebuf, 18, (GXColor){0,0,0, 255});
mainWindow->Remove(&gameinfoWindow2);
mainWindow->SetState(STATE_DEFAULT);
ResumeGui();}
//FreeXMLMemory();
return choice;
/* File not found */
} else {
return -1;
}
}

View File

@ -5,6 +5,7 @@
#include "main.h"
struct discHdr * gameList;
u32 gameCnt;
s32 gameSelected, gameStart;

View File

@ -273,6 +273,8 @@ snprintf(LANGUAGE.december, sizeof(LANGUAGE.december), "Dec");
snprintf(LANGUAGE.developedby, sizeof(LANGUAGE.developedby), "Developed by");
snprintf(LANGUAGE.publishedby, sizeof(LANGUAGE.publishedby), "Published by");
snprintf(LANGUAGE.wififeatures, sizeof(LANGUAGE.wififeatures), "WiFi Features");
snprintf(LANGUAGE.XMLTitles, sizeof(LANGUAGE.XMLTitles), "Titles from XML");
};

View File

@ -26,6 +26,7 @@ struct LANGUAGE
char october[15];
char november[15];
char december[15];
char XMLTitles[15];
char wififeatures[20];

View File

@ -773,6 +773,17 @@ void GuiGameGrid::Update(GuiTrigger * t)
if (goback==1)mover2= (mover2<0? mover2+1:mover2-1);
if (mover2==0)goback=0;
/*u16 buttons = ButtonsHold();
if(buttons & WPAD_BUTTON_B) {
int x = t->wpad.ir.x;
int center = this->GetWidth()/2;
if (x<center)goLeft=12;
else if (x>center)goRight=12;
usleep(x<center? x*250:((center*2 - x)*250));
for(int i=0; i<pagesize; i++) {game[i]->Draw();}
//return;
}*/
// navigation
if(!focus || gameCnt <= pagesize || (game[bob[0]]->GetEffect() && game[bob[pagesize-1]]->GetEffect()))
@ -1047,6 +1058,7 @@ void GuiGameGrid::Update(GuiTrigger * t)
if (goRight>0){
if (mover<11){
//int offset1 = listOffset-1, offset2 = listOffset-2;
for (int i=1; i<(rows+1); i++){
@ -1288,8 +1300,8 @@ void GuiGameGrid::Update(GuiTrigger * t)
}
if (btnRowUp->GetState() == STATE_CLICKED) {
if (rows==1)this->ChangeRows(2);
else if (rows==2)this->ChangeRows(3);
if ((rows==1)&&(gameCnt>=16))this->ChangeRows(2);
else if ((rows==2)&&(gameCnt>=42))this->ChangeRows(3);
btnRowUp->ResetState();
return;
}
@ -1316,7 +1328,7 @@ void GuiGameGrid::Reload(struct discHdr * l, int count)
delete cover[i];
}
delete [] bob;
//delete [] bob;
delete [] game;
delete [] coverImg;
delete [] cover;
@ -1330,18 +1342,19 @@ void GuiGameGrid::Reload(struct discHdr * l, int count)
focus = 1; // allow focus
firstPic = 0;
clickedItem = -1;
speed = SHIFT_SPEED;
gameCnt=count;
//speed = SHIFT_SPEED;
char imgPath[100];
if ((count<42)&&(rows==3))rows=2;
if ((count<16)&&(rows==2))rows=1;
if (count<42)rows=2;
if (count<16)rows=1;
//rows=1;
if (rows==1)pagesize = 6;
else if (rows==2)pagesize = 16;
else if (rows==3)pagesize = 42;
//gameIndex = new int[pagesize];
game = new GuiButton * [pagesize];
bob = new int[pagesize];
//bob = new int[pagesize];
coverImg = new GuiImage * [gameCnt];
cover = new GuiImageData * [gameCnt];
@ -1349,6 +1362,8 @@ void GuiGameGrid::Reload(struct discHdr * l, int count)
bob[i]=i;
}
firstPic=0;
char ID[4];
char IDfull[7];
@ -1402,159 +1417,159 @@ void GuiGameGrid::Reload(struct discHdr * l, int count)
if (rows==1)
{
game[0]->SetPosition(-70,74);
game[1]->SetPosition(88,74);
game[2]->SetPosition(239,74);
game[3]->SetPosition(390,74);
game[4]->SetPosition(550,74);
game[bob[0]]->SetPosition(-70,74);
game[bob[1]]->SetPosition(88,74);
game[bob[2]]->SetPosition(239,74);
game[bob[3]]->SetPosition(390,74);
game[bob[4]]->SetPosition(550,74);
game[0]->SetSkew(-10,-44,10,-26,10,26,-10,44);
game[1]->SetSkew(-6,-22,6,-14,6,14,-6,22);
game[2]->SetSkew(0,-11,0,-11,0,11,0,11);
game[3]->SetSkew(-6,-14,6,-22,6,22,-6,14);
game[4]->SetSkew(-10,-26,10,-44,10,44,-10,26);
game[bob[0]]->SetSkew(-10,-44,10,-26,10,26,-10,44);
game[bob[1]]->SetSkew(-6,-22,6,-14,6,14,-6,22);
game[bob[2]]->SetSkew(0,-11,0,-11,0,11,0,11);
game[bob[3]]->SetSkew(-6,-14,6,-22,6,22,-6,14);
game[bob[4]]->SetSkew(-10,-26,10,-44,10,44,-10,26);
}
else if (rows ==2)
{
game[0]->SetPosition(3,50);
game[1]->SetPosition(3,193);
game[2]->SetPosition(97,50);
game[3]->SetPosition(97,193);
game[4]->SetPosition(187,50);
game[5]->SetPosition(187,193);
game[6]->SetPosition(272,50);
game[7]->SetPosition(272,193);
game[8]->SetPosition(358,50);
game[9]->SetPosition(358,193);
game[10]->SetPosition(449,50);
game[11]->SetPosition(449,193);
game[12]->SetPosition(545,50);
game[13]->SetPosition(545,193);
game[14]->SetPosition(700,0);
game[15]->SetPosition(700,0);
game[bob[0]]->SetPosition(3,50);
game[bob[1]]->SetPosition(3,193);
game[bob[2]]->SetPosition(97,50);
game[bob[3]]->SetPosition(97,193);
game[bob[4]]->SetPosition(187,50);
game[bob[5]]->SetPosition(187,193);
game[bob[6]]->SetPosition(272,50);
game[bob[7]]->SetPosition(272,193);
game[bob[8]]->SetPosition(358,50);
game[bob[9]]->SetPosition(358,193);
game[bob[10]]->SetPosition(449,50);
game[bob[11]]->SetPosition(449,193);
game[bob[12]]->SetPosition(545,50);
game[bob[13]]->SetPosition(545,193);
game[bob[14]]->SetPosition(700,0);
game[bob[15]]->SetPosition(700,0);
game[0]->SetSkew(-4.5,-49,4.5,-27,4.5,0,-4.5,0);
game[1]->SetSkew(-4.5,0,4.5,0,4.5,27,-4.5,49);
game[2]->SetSkew(-4,-22,4,-14,4,0,-4,0);
game[3]->SetSkew(-4,0,4,0,4,14,-4,22);
game[4]->SetSkew(0,-9,0,-5,0,0,0,0);
game[5]->SetSkew(0,0,0,0,0,5,0,9);
game[6]->SetSkew(0,0,0,0,0,0,0,0);
game[7]->SetSkew(0,0,0,0,0,0,0,0);
game[8]->SetSkew(0,-5,0,-9,0,0,0,0);
game[9]->SetSkew(0,0,0,0,0,9,0,5);
game[10]->SetSkew(-4,-14,4,-22,4,0,-4,0);
game[11]->SetSkew(-4,0,4,0,4,22,-4,14);
game[12]->SetSkew(-4.5,-27,4.5,-49,4.5,0,-4.5,0);
game[13]->SetSkew(-4.5,0,4.5,0,4.5,49,-4.5,27);
game[bob[0]]->SetSkew(-4.5,-49,4.5,-27,4.5,0,-4.5,0);
game[bob[1]]->SetSkew(-4.5,0,4.5,0,4.5,27,-4.5,49);
game[bob[2]]->SetSkew(-4,-22,4,-14,4,0,-4,0);
game[bob[3]]->SetSkew(-4,0,4,0,4,14,-4,22);
game[bob[4]]->SetSkew(0,-9,0,-5,0,0,0,0);
game[bob[5]]->SetSkew(0,0,0,0,0,5,0,9);
game[bob[6]]->SetSkew(0,0,0,0,0,0,0,0);
game[bob[7]]->SetSkew(0,0,0,0,0,0,0,0);
game[bob[8]]->SetSkew(0,-5,0,-9,0,0,0,0);
game[bob[9]]->SetSkew(0,0,0,0,0,9,0,5);
game[bob[10]]->SetSkew(-4,-14,4,-22,4,0,-4,0);
game[bob[11]]->SetSkew(-4,0,4,0,4,22,-4,14);
game[bob[12]]->SetSkew(-4.5,-27,4.5,-49,4.5,0,-4.5,0);
game[bob[13]]->SetSkew(-4.5,0,4.5,0,4.5,49,-4.5,27);
}
else if (rows==3)
{
game[0]->SetPosition(13,58);
game[1]->SetPosition(13,153);
game[2]->SetPosition(13,250);
game[bob[0]]->SetPosition(13,58);
game[bob[1]]->SetPosition(13,153);
game[bob[2]]->SetPosition(13,250);
game[3]->SetPosition(68,67);
game[4]->SetPosition(68,153);
game[5]->SetPosition(68,239);
game[bob[3]]->SetPosition(68,67);
game[bob[4]]->SetPosition(68,153);
game[bob[5]]->SetPosition(68,239);
game[6]->SetPosition(120,74);
game[7]->SetPosition(120,153);
game[8]->SetPosition(120,232);
game[bob[6]]->SetPosition(120,74);
game[bob[7]]->SetPosition(120,153);
game[bob[8]]->SetPosition(120,232);
game[9]->SetPosition(170,78);
game[10]->SetPosition(170,153);
game[11]->SetPosition(170,228);
game[bob[9]]->SetPosition(170,78);
game[bob[10]]->SetPosition(170,153);
game[bob[11]]->SetPosition(170,228);
game[12]->SetPosition(214,80);
game[13]->SetPosition(214,153);
game[14]->SetPosition(214,226);
game[bob[12]]->SetPosition(214,80);
game[bob[13]]->SetPosition(214,153);
game[bob[14]]->SetPosition(214,226);
game[15]->SetPosition(258,81);
game[16]->SetPosition(258,153);
game[17]->SetPosition(258,224);
game[bob[15]]->SetPosition(258,81);
game[bob[16]]->SetPosition(258,153);
game[bob[17]]->SetPosition(258,224);
game[18]->SetPosition(302,81);
game[19]->SetPosition(302,153);
game[20]->SetPosition(302,223);
game[bob[18]]->SetPosition(302,81);
game[bob[19]]->SetPosition(302,153);
game[bob[20]]->SetPosition(302,223);
game[21]->SetPosition(346,81);
game[22]->SetPosition(346,153);
game[23]->SetPosition(346,223);
game[bob[21]]->SetPosition(346,81);
game[bob[22]]->SetPosition(346,153);
game[bob[23]]->SetPosition(346,223);
game[24]->SetPosition(390,80);
game[25]->SetPosition(390,153);
game[26]->SetPosition(390,225);
game[bob[24]]->SetPosition(390,80);
game[bob[25]]->SetPosition(390,153);
game[bob[26]]->SetPosition(390,225);
game[27]->SetPosition(434,77);
game[28]->SetPosition(434,153);
game[29]->SetPosition(434,227);
game[bob[27]]->SetPosition(434,77);
game[bob[28]]->SetPosition(434,153);
game[bob[29]]->SetPosition(434,227);
game[30]->SetPosition(484,73);
game[31]->SetPosition(484,153);
game[32]->SetPosition(484,231);
game[bob[30]]->SetPosition(484,73);
game[bob[31]]->SetPosition(484,153);
game[bob[32]]->SetPosition(484,231);
game[33]->SetPosition(537,67);
game[34]->SetPosition(537,153);
game[35]->SetPosition(537,239);
game[bob[33]]->SetPosition(537,67);
game[bob[34]]->SetPosition(537,153);
game[bob[35]]->SetPosition(537,239);
game[36]->SetPosition(591,58);
game[37]->SetPosition(591,153);
game[38]->SetPosition(591,250);
game[bob[36]]->SetPosition(591,58);
game[bob[37]]->SetPosition(591,153);
game[bob[38]]->SetPosition(591,250);
game[0]->SetSkew(-38,-110,15,-42,15,65,-38,32);
game[1]->SetSkew(-38,-75,15,-48,15,45,-38,72);
game[2]->SetSkew(-38,-52,15,-70,15,27,-38,100);
game[bob[0]]->SetSkew(-38,-110,15,-42,15,65,-38,32);
game[bob[1]]->SetSkew(-38,-75,15,-48,15,45,-38,72);
game[bob[2]]->SetSkew(-38,-52,15,-70,15,27,-38,100);
game[3]->SetSkew(-38,-70,15,-24,15,40,-38,27);
game[4]->SetSkew(-38,-50,15,-35,15,40,-38,50);
game[5]->SetSkew(-38,-34,15,-47,15,24,-38,58);
game[bob[3]]->SetSkew(-38,-70,15,-24,15,40,-38,27);
game[bob[4]]->SetSkew(-38,-50,15,-35,15,40,-38,50);
game[bob[5]]->SetSkew(-38,-34,15,-47,15,24,-38,58);
game[6]->SetSkew(-27,-55,19,-22,19,30,-27,22);
game[7]->SetSkew(-27,-40,19,-30,19,30,-27,40);
game[8]->SetSkew(-27,-20,19,-30,19,20,-27,50);
game[bob[6]]->SetSkew(-27,-55,19,-22,19,30,-27,22);
game[bob[7]]->SetSkew(-27,-40,19,-30,19,30,-27,40);
game[bob[8]]->SetSkew(-27,-20,19,-30,19,20,-27,50);
game[9]->SetSkew(-19,-28,0,-17,0,15,-19,10);
game[10]->SetSkew(-19,-30,0,-20,0,12,-19,30);
game[11]->SetSkew(-19,-15,0,-20,0,10,-19,24);
game[bob[9]]->SetSkew(-19,-28,0,-17,0,15,-19,10);
game[bob[10]]->SetSkew(-19,-30,0,-20,0,12,-19,30);
game[bob[11]]->SetSkew(-19,-15,0,-20,0,10,-19,24);
game[12]->SetSkew(-10,-20,3,-13,3,14,-10,10);
game[13]->SetSkew(-10,-20,3,-18,3,18,-10,20);
game[14]->SetSkew(-10,-10,3,-10,3,0,-10,10);
game[bob[12]]->SetSkew(-10,-20,3,-13,3,14,-10,10);
game[bob[13]]->SetSkew(-10,-20,3,-18,3,18,-10,20);
game[bob[14]]->SetSkew(-10,-10,3,-10,3,0,-10,10);
game[15]->SetSkew(-10,-15,3,-12,3,13,-10,13);
game[16]->SetSkew(-10,-17,3,-10,3,10,-10,17);
game[17]->SetSkew(-10,-10,3,-15,3,10,-10,10);
game[bob[15]]->SetSkew(-10,-15,3,-12,3,13,-10,13);
game[bob[16]]->SetSkew(-10,-17,3,-10,3,10,-10,17);
game[bob[17]]->SetSkew(-10,-10,3,-15,3,10,-10,10);
game[18]->SetSkew(-10,-10,3,-10,3,14,-10,14);
game[19]->SetSkew(-10,-10,3,-10,3,10,-10,10);//middle
game[20]->SetSkew(-10,-10,3,-10,3,10,-10,10);
game[bob[18]]->SetSkew(-10,-10,3,-10,3,14,-10,14);
game[bob[19]]->SetSkew(-10,-10,3,-10,3,10,-10,10);//middle
game[bob[20]]->SetSkew(-10,-10,3,-10,3,10,-10,10);
game[21]->SetSkew(-14,-10,4,-20,3,10,-14,10);
game[22]->SetSkew(-14,-10,4,-17,3,17,-14,10);
game[23]->SetSkew(-14,-10,4,-10,3,10,-14,10);
game[bob[21]]->SetSkew(-14,-10,4,-20,3,10,-14,10);
game[bob[22]]->SetSkew(-14,-10,4,-17,3,17,-14,10);
game[bob[23]]->SetSkew(-14,-10,4,-10,3,10,-14,10);
game[24]->SetSkew(-10,-13,3,-20,3,14,-10,10);
game[25]->SetSkew(-10,-18,3,-20,3,20,-10,18);
game[26]->SetSkew(-10,-10,3,-10,3,20,-10,5);
game[bob[24]]->SetSkew(-10,-13,3,-20,3,14,-10,10);
game[bob[25]]->SetSkew(-10,-18,3,-20,3,20,-10,18);
game[bob[26]]->SetSkew(-10,-10,3,-10,3,20,-10,5);
game[27]->SetSkew(-19,-17,0,-28,0,10,-19,15);
game[28]->SetSkew(-19,-20,0,-30,0,30,-19,12);
game[29]->SetSkew(-19,-20,0,-15,0,30,-19,10);
game[bob[27]]->SetSkew(-19,-17,0,-28,0,10,-19,15);
game[bob[28]]->SetSkew(-19,-20,0,-30,0,30,-19,12);
game[bob[29]]->SetSkew(-19,-20,0,-15,0,30,-19,10);
game[30]->SetSkew(-27,-22,19,-55,19,22,-27,30);
game[31]->SetSkew(-27,-30,19,-40,19,40,-27,30);
game[32]->SetSkew(-27,-30,19,-20,19,55,-27,20);
game[bob[30]]->SetSkew(-27,-22,19,-55,19,22,-27,30);
game[bob[31]]->SetSkew(-27,-30,19,-40,19,40,-27,30);
game[bob[32]]->SetSkew(-27,-30,19,-20,19,55,-27,20);
game[33]->SetSkew(-38,-24,15,-70,15,27,-38,40);
game[34]->SetSkew(-38,-35,15,-50,15,50,-38,40);
game[35]->SetSkew(-38,-47,15,-34,15,58,-38,24);
game[bob[33]]->SetSkew(-38,-24,15,-70,15,27,-38,40);
game[bob[34]]->SetSkew(-38,-35,15,-50,15,50,-38,40);
game[bob[35]]->SetSkew(-38,-47,15,-34,15,58,-38,24);
game[36]->SetSkew(-38,-42,15,-110,15,32,-38,60);
game[37]->SetSkew(-38,-48,15,-75,15,70,-38,45);
game[38]->SetSkew(-38,-70,15,-52,15,100,-38,27);
game[bob[36]]->SetSkew(-38,-42,15,-110,15,32,-38,60);
game[bob[37]]->SetSkew(-38,-48,15,-75,15,70,-38,45);
game[bob[38]]->SetSkew(-38,-70,15,-52,15,100,-38,27);
}

View File

@ -298,6 +298,7 @@ void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, u8 data[]
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);
}
/****************************************************************************
* Menu_DrawRectangle
*

View File

@ -11,12 +11,12 @@ Load game information from XML - Lustar
#include "unzip/unzip.h"
bool xmldebug = false;
static bool xmldebug = false;
extern struct SSettings Settings; // for loader GX
char langlist[11][22] =
static char langlist[11][22] =
{{"Console Default"},
{"Japanese"},
{"English"},
@ -29,7 +29,7 @@ char langlist[11][22] =
{"T. Chinese"},
{"Korean"}};
char langcodes[11][22] =
static char langcodes[11][22] =
{{""},
{"JA"},
{"EN"},
@ -42,18 +42,30 @@ char langcodes[11][22] =
{"ZH"},
{"KO"}};
char element_text[5000];
static char element_text[5000];
mxml_node_t *nodetree;
mxml_node_t *nodedata;
mxml_node_t *nodeid;
mxml_node_t *nodeidtmp;
mxml_node_t *nodefound;
mxml_index_t *nodeindex;
mxml_index_t *nodeindextmp;
static mxml_node_t *nodetree=NULL;
static mxml_node_t *nodedata=NULL;
static mxml_node_t *nodeid=NULL;
static mxml_node_t *nodeidtmp=NULL;
static mxml_node_t *nodefound=NULL;
static mxml_index_t *nodeindex=NULL;
static mxml_index_t *nodeindextmp=NULL;
int xmlloadtime = 0;
void FreeXMLDeletePart()
{
/* free memory */
mxmlIndexDelete(nodeindex);
mxmlIndexDelete(nodeindextmp);
mxmlDelete(nodeid);
mxmlDelete(nodeidtmp);
mxmlDelete(nodefound);
mxmlDelete(nodedata);
mxmlDelete(nodetree);
}
/* get_text() taken as is from mini-mxml example mxmldoc.c */
/* get_text() - Get the text for a node. */
@ -256,8 +268,9 @@ void LoadTitlesFromXML(char *langtxt, bool forcejptoen)
/* langtxt: set to "English","French","German", to force language for all titles, or "" to load title depending on each game's setting */
/* forcejptoen: set to true to load English title instead of Japanese title when game is set to Japanese */
{
if (nodeindex == NULL)
return;
return ;
bool forcelang = false;
if (strcmp(langtxt,""))
@ -305,11 +318,13 @@ void LoadTitlesFromXML(char *langtxt, bool forcejptoen)
/* load title from nodes */
nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", "EN", MXML_NO_DESCEND);
if (nodefound != NULL) {
if (nodefound != NULL){// &&(Settings.titlesOverride==1)){
GetTextFromNode(nodefound, nodedata, "title", NULL, NULL, MXML_DESCEND, title_text_EN);
}
nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", langcode, MXML_NO_DESCEND);
if (nodefound != NULL) {
GetTextFromNode(nodefound, nodedata, "title", NULL, NULL, MXML_DESCEND, title_text);
}
/* fall back to English title if prefered language was not found */
@ -355,12 +370,12 @@ void GetPublisherFromGameid(char *idtxt, char *dest)
}
void LoadGameInfoFromXML(char* gameid, char* langtxt)
bool LoadGameInfoFromXML(char* gameid, char* langtxt)
/* gameid: full game id */
/* langcode: "English","French","German" */
{
{ bool exist=false;
if (nodeindex == NULL)
return;
return exist;
/* convert language text into ISO 639 two-letter language codes */
char langcode[100] = "";
@ -375,7 +390,7 @@ void LoadGameInfoFromXML(char* gameid, char* langtxt)
/* search for game matching gameid */
while (strcmp(element_text,gameid) != 0)
{
{ exist=true;
nodeid = mxmlIndexFind(nodeindex,"id", NULL);
if (nodeid != NULL) {
get_text(nodeid, element_text, sizeof(element_text));
@ -411,12 +426,13 @@ void LoadGameInfoFromXML(char* gameid, char* langtxt)
/* text from child elements */
nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", "EN", MXML_NO_DESCEND);
if (nodefound != NULL) {
//if (Settings.titlesOverride==1)
GetTextFromNode(nodefound, nodedata, "title", NULL, NULL, MXML_DESCEND, gameinfo.title_EN);
GetTextFromNode(nodefound, nodedata, "synopsis", NULL, NULL, MXML_DESCEND, gameinfo.synopsis_EN);
}
nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", langcode, MXML_NO_DESCEND);
if (nodefound != NULL) {
GetTextFromNode(nodefound, nodedata, "title", NULL, NULL, MXML_DESCEND, gameinfo.title);
//GetTextFromNode(nodefound, nodedata, "title", NULL, NULL, MXML_DESCEND, gameinfo.title);
GetTextFromNode(nodefound, nodedata, "synopsis", NULL, NULL, MXML_DESCEND, gameinfo.synopsis);
}
// fall back to English title and synopsis if prefered language was not found
@ -509,10 +525,10 @@ void LoadGameInfoFromXML(char* gameid, char* langtxt)
ConvertRating(gameinfo.ratingvalue, gameinfo.ratingtype, "PEGI",gameinfo.ratingvaluePEGI);
//PrintGameInfo();
} else {
exist=true;
} else {exist=false;
/*game not found */
}
}return exist;
}

View File

@ -50,13 +50,14 @@ struct gameXMLinfo gameinfo;
struct gameXMLinfo gameinfo_reset;
bool OpenXMLFile(char* filename);
void LoadGameInfoFromXML(char* gameid, char* langcode);
bool LoadGameInfoFromXML(char* gameid, char* langcode);
void LoadTitlesFromXML(char *langcode, bool forcejptoen);
void GetPublisherFromGameid(char *idtxt, char *dest);
char *ConvertLangTextToCode(char *langtext);
void ConvertRating(char *ratingvalue, char *fromrating, char *torating, char *destvalue);
void PrintGameInfo(bool showfullinfo);
void FreeXMLMemory();
void FreeXMLDeletePart();
void title_set(char *id, char *title);