mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-12-23 02:11:55 +01:00
put in a possible "fix" for the disappearing cursors that some people are getting. when menu_disclist is called the cursors are deleted and recreated. so at least if they do go away, this may make them come back.
make the homebrew menu read the XML data from meta.xml file. put this data on the homebrew buttons and prompt. there is 4 structs created globally that hold the XML daa. i tried to make them pointers but i got errors so i'll leave it like this and let dimok fix it :P
This commit is contained in:
parent
83f5dc29de
commit
a02013f03f
@ -17,6 +17,7 @@
|
||||
#include "filelist.h"
|
||||
#include "sys.h"
|
||||
#include "listfiles.h"
|
||||
#include "../xml/xml.h"
|
||||
|
||||
/*** Extern functions ***/
|
||||
extern void ResumeGui();
|
||||
@ -31,6 +32,11 @@ extern u8 reset;
|
||||
|
||||
bool boothomebrew = false;
|
||||
|
||||
struct homebrewXMLinfo HB0;
|
||||
struct homebrewXMLinfo HB1;
|
||||
struct homebrewXMLinfo HB2;
|
||||
struct homebrewXMLinfo HB3;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* roundup Function
|
||||
@ -170,13 +176,23 @@ int MenuHomebrewBrowse()
|
||||
GuiText MainButton1Txt(MainButtonText, 18, (GXColor){0, 0, 0, 255});
|
||||
MainButton1Txt.SetMaxWidth(MainButton1Img.GetWidth()-150, GuiText::DOTTED);
|
||||
MainButton1Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton1Txt.SetPosition(148, 0);
|
||||
MainButton1Txt.SetPosition(148, -12);
|
||||
GuiText MainButton1aTxt(MainButtonText, 18, (GXColor){0, 0, 0, 255});
|
||||
MainButton1aTxt.SetMaxWidth(MainButton1Img.GetWidth()-150, GuiText::DOTTED);
|
||||
MainButton1aTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton1aTxt.SetPosition(148, 15);
|
||||
GuiText MainButton1aoverTxt(MainButtonText, 18, (GXColor){0, 0, 0, 255});
|
||||
MainButton1aoverTxt.SetMaxWidth(MainButton1Img.GetWidth()-150, GuiText::SCROLL);
|
||||
MainButton1aoverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton1aoverTxt.SetPosition(148, 15);
|
||||
GuiButton MainButton1(MainButton1Img.GetWidth(), MainButton1Img.GetHeight());
|
||||
MainButton1.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
MainButton1.SetPosition(0, 90);
|
||||
MainButton1.SetImage(&MainButton1Img);
|
||||
MainButton1.SetImageOver(&MainButton1ImgOver);
|
||||
MainButton1.SetLabel(&MainButton1Txt);
|
||||
MainButton1.SetLabel(&MainButton1aTxt,1);
|
||||
MainButton1.SetLabelOver(&MainButton1aoverTxt,1);
|
||||
MainButton1.SetSoundOver(&btnSoundOver);
|
||||
MainButton1.SetSoundClick(&btnClick1);
|
||||
MainButton1.SetEffectGrow();
|
||||
@ -186,14 +202,24 @@ int MenuHomebrewBrowse()
|
||||
GuiImage MainButton2ImgOver(&MainButtonImgOverData);
|
||||
GuiText MainButton2Txt(MainButtonText, 18, (GXColor){0, 0, 0, 255});
|
||||
MainButton2Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton2Txt.SetPosition(148, 0);
|
||||
MainButton2Txt.SetPosition(148, -12);
|
||||
MainButton2Txt.SetMaxWidth(MainButton2Img.GetWidth()-150, GuiText::DOTTED);
|
||||
GuiText MainButton2aTxt(MainButtonText, 18, (GXColor){0, 0, 0, 255});
|
||||
MainButton2aTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton2aTxt.SetPosition(148, 15);
|
||||
MainButton2aTxt.SetMaxWidth(MainButton2Img.GetWidth()-150, GuiText::DOTTED);
|
||||
GuiText MainButton2aoverTxt(MainButtonText, 18, (GXColor){0, 0, 0, 255});
|
||||
MainButton2aoverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton2aoverTxt.SetPosition(148, 15);
|
||||
MainButton2aoverTxt.SetMaxWidth(MainButton2Img.GetWidth()-150, GuiText::SCROLL);
|
||||
GuiButton MainButton2(MainButton2Img.GetWidth(), MainButton2Img.GetHeight());
|
||||
MainButton2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
MainButton2.SetPosition(0, 160);
|
||||
MainButton2.SetImage(&MainButton2Img);
|
||||
MainButton2.SetImageOver(&MainButton2ImgOver);
|
||||
MainButton2.SetLabel(&MainButton2Txt);
|
||||
MainButton2.SetLabel(&MainButton2aTxt,1);
|
||||
MainButton2.SetLabelOver(&MainButton2aoverTxt,1);
|
||||
MainButton2.SetSoundOver(&btnSoundOver);
|
||||
MainButton2.SetSoundClick(&btnClick1);
|
||||
MainButton2.SetEffectGrow();
|
||||
@ -203,14 +229,24 @@ int MenuHomebrewBrowse()
|
||||
GuiImage MainButton3ImgOver(&MainButtonImgOverData);
|
||||
GuiText MainButton3Txt(MainButtonText, 18, (GXColor){0, 0, 0, 255});
|
||||
MainButton3Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton3Txt.SetPosition(148, 0);
|
||||
MainButton3Txt.SetPosition(148, -12);
|
||||
MainButton3Txt.SetMaxWidth(MainButton3Img.GetWidth()-150, GuiText::DOTTED);
|
||||
GuiText MainButton3aTxt(MainButtonText, 18, (GXColor){0, 0, 0, 255});
|
||||
MainButton3aTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton3aTxt.SetPosition(148, 15);
|
||||
MainButton3aTxt.SetMaxWidth(MainButton3Img.GetWidth()-150, GuiText::DOTTED);
|
||||
GuiText MainButton3aoverTxt(MainButtonText, 18, (GXColor){0, 0, 0, 255});
|
||||
MainButton3aoverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton3aoverTxt.SetPosition(148, 15);
|
||||
MainButton3aoverTxt.SetMaxWidth(MainButton3Img.GetWidth()-150, GuiText::SCROLL);
|
||||
GuiButton MainButton3(MainButton3Img.GetWidth(), MainButton3Img.GetHeight());
|
||||
MainButton3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
MainButton3.SetPosition(0, 230);
|
||||
MainButton3.SetImage(&MainButton3Img);
|
||||
MainButton3.SetImageOver(&MainButton3ImgOver);
|
||||
MainButton3.SetLabel(&MainButton3Txt);
|
||||
MainButton3.SetLabel(&MainButton3aTxt,1);
|
||||
MainButton3.SetLabelOver(&MainButton3aoverTxt,1);
|
||||
MainButton3.SetSoundOver(&btnSoundOver);
|
||||
MainButton3.SetSoundClick(&btnClick1);
|
||||
MainButton3.SetEffectGrow();
|
||||
@ -220,14 +256,24 @@ int MenuHomebrewBrowse()
|
||||
GuiImage MainButton4ImgOver(&MainButtonImgOverData);
|
||||
GuiText MainButton4Txt(MainButtonText, 18, (GXColor){0, 0, 0, 255});
|
||||
MainButton4Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton4Txt.SetPosition(148, 0);
|
||||
MainButton4Txt.SetPosition(148, -12);
|
||||
MainButton4Txt.SetMaxWidth(MainButton4Img.GetWidth()-150, GuiText::DOTTED);
|
||||
GuiText MainButton4aTxt(MainButtonText, 18, (GXColor){0, 0, 0, 255});
|
||||
MainButton4aTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton4aTxt.SetPosition(148, 15);
|
||||
MainButton4aTxt.SetMaxWidth(MainButton4Img.GetWidth()-150, GuiText::DOTTED);
|
||||
GuiText MainButton4aoverTxt(MainButtonText, 18, (GXColor){0, 0, 0, 255});
|
||||
MainButton4aoverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
MainButton4aoverTxt.SetPosition(148, 15);
|
||||
MainButton4aoverTxt.SetMaxWidth(MainButton4Img.GetWidth()-150, GuiText::SCROLL);
|
||||
GuiButton MainButton4(MainButton4Img.GetWidth(), MainButton4Img.GetHeight());
|
||||
MainButton4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
MainButton4.SetPosition(0, 300);
|
||||
MainButton4.SetImage(&MainButton4Img);
|
||||
MainButton4.SetImageOver(&MainButton4ImgOver);
|
||||
MainButton4.SetLabel(&MainButton4Txt);
|
||||
MainButton4.SetLabel(&MainButton4aTxt,1);
|
||||
MainButton4.SetLabelOver(&MainButton4aoverTxt,1);
|
||||
MainButton4.SetSoundOver(&btnSoundOver);
|
||||
MainButton4.SetSoundClick(&btnClick1);
|
||||
MainButton4.SetEffectGrow();
|
||||
@ -319,61 +365,182 @@ int MenuHomebrewBrowse()
|
||||
w.Append(&homo);
|
||||
w.Append(&GoRightBtn);
|
||||
w.Append(&GoLeftBtn);
|
||||
|
||||
|
||||
char metapath[200];
|
||||
if(pageToDisplay == pages) {
|
||||
int buttonsleft = filecount-(pages-1)*4;
|
||||
char * shortpath = NULL;
|
||||
char temp[200];
|
||||
|
||||
if(buttonsleft > 0) {
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset)), "%s", HomebrewFiles.GetFilepath(fileoffset));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset));
|
||||
MainButton1Txt.SetText(MainButtonText);
|
||||
|
||||
if(LoadHomebrewXMLData(metapath,0)>0){
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", HB0.name);
|
||||
MainButton1Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", HB0.shortdescription);
|
||||
MainButton1aTxt.SetText(MainButtonText);
|
||||
MainButton1aoverTxt.SetText(MainButtonText);
|
||||
}
|
||||
else{
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset)), "%s", HomebrewFiles.GetFilepath(fileoffset));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset));
|
||||
snprintf(HB0.name, sizeof(HB0.name), "%s", MainButtonText);
|
||||
MainButton1Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), " ");
|
||||
MainButton1aTxt.SetText(MainButtonText);
|
||||
MainButton1aoverTxt.SetText(MainButtonText);
|
||||
}
|
||||
w.Append(&MainButton1);
|
||||
}
|
||||
if(buttonsleft > 1) {
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset+1)), "%s", HomebrewFiles.GetFilepath(fileoffset+1));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset+1));
|
||||
MainButton2Txt.SetText(MainButtonText);
|
||||
snprintf(metapath, sizeof(metapath), "%smeta.xml", HomebrewFiles.GetFilepath(fileoffset+1));
|
||||
if(LoadHomebrewXMLData(metapath,1)>0){
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", HB1.name);
|
||||
MainButton2Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", HB1.shortdescription);
|
||||
MainButton2aTxt.SetText(MainButtonText);
|
||||
MainButton2aoverTxt.SetText(MainButtonText);
|
||||
}
|
||||
else{
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset+1)), "%s", HomebrewFiles.GetFilepath(fileoffset+1));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset+1));
|
||||
snprintf(HB1.name, sizeof(HB1.name), "%s", MainButtonText);
|
||||
MainButton2Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), " ");
|
||||
MainButton2aoverTxt.SetText(MainButtonText);
|
||||
MainButton2aTxt.SetText(MainButtonText);
|
||||
}
|
||||
w.Append(&MainButton2);
|
||||
}
|
||||
if(buttonsleft > 2) {
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset+2)), "%s", HomebrewFiles.GetFilepath(fileoffset+2));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset+2));
|
||||
MainButton3Txt.SetText(MainButtonText);
|
||||
snprintf(metapath, sizeof(metapath), "%smeta.xml", HomebrewFiles.GetFilepath(fileoffset+2));
|
||||
if(LoadHomebrewXMLData(metapath,2)>0){
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", HB2.name);
|
||||
MainButton3Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", HB2.shortdescription);
|
||||
MainButton3aTxt.SetText(MainButtonText);
|
||||
MainButton3aoverTxt.SetText(MainButtonText);
|
||||
}
|
||||
else{
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset+2)), "%s", HomebrewFiles.GetFilepath(fileoffset+2));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset+2));
|
||||
snprintf(HB2.name, sizeof(HB2.name), "%s", MainButtonText);
|
||||
MainButton3Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), " ");
|
||||
MainButton3aoverTxt.SetText(MainButtonText);
|
||||
MainButton3aTxt.SetText(MainButtonText);
|
||||
}
|
||||
w.Append(&MainButton3);
|
||||
}
|
||||
if(buttonsleft > 3) {
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset+3)), "%s", HomebrewFiles.GetFilepath(fileoffset+3));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset+3));
|
||||
MainButton4Txt.SetText(MainButtonText);
|
||||
snprintf(metapath, sizeof(metapath), "%smeta.xml", HomebrewFiles.GetFilepath(fileoffset+3));
|
||||
if(LoadHomebrewXMLData(metapath,3)>0){
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", HB3.name);
|
||||
MainButton4Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", HB3.shortdescription);
|
||||
MainButton4aTxt.SetText(MainButtonText);
|
||||
MainButton4aoverTxt.SetText(MainButtonText);
|
||||
}
|
||||
else{
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset+3)), "%s", HomebrewFiles.GetFilepath(fileoffset+3));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset+3));
|
||||
snprintf(HB3.name, sizeof(HB3.name), "%s", MainButtonText);
|
||||
MainButton4Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), " ");
|
||||
MainButton4aTxt.SetText(MainButtonText);
|
||||
MainButton4aoverTxt.SetText(MainButtonText);
|
||||
}
|
||||
w.Append(&MainButton4);
|
||||
}
|
||||
} else {
|
||||
char temp[200];
|
||||
char *shortpath = NULL;
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset)), "%s", HomebrewFiles.GetFilepath(fileoffset));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset));
|
||||
MainButton1Txt.SetText(MainButtonText);
|
||||
//btn1
|
||||
snprintf(metapath, sizeof(metapath), "%smeta.xml", HomebrewFiles.GetFilepath(fileoffset));
|
||||
if(LoadHomebrewXMLData(metapath,0)>0){
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", HB0.name);
|
||||
MainButton1Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", HB0.shortdescription);
|
||||
MainButton1aTxt.SetText(MainButtonText);
|
||||
MainButton1aoverTxt.SetText(MainButtonText);
|
||||
}
|
||||
else{
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset)), "%s", HomebrewFiles.GetFilepath(fileoffset));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset));
|
||||
snprintf(HB0.name, sizeof(HB0.name), "%s", MainButtonText);
|
||||
MainButton1Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), " ");
|
||||
MainButton1aTxt.SetText(MainButtonText);
|
||||
MainButton1aoverTxt.SetText(MainButtonText);
|
||||
}
|
||||
w.Append(&MainButton1);
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset+1)), "%s", HomebrewFiles.GetFilepath(fileoffset+1));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset+1));
|
||||
MainButton2Txt.SetText(MainButtonText);
|
||||
|
||||
//btn2
|
||||
snprintf(metapath, sizeof(metapath), "%smeta.xml", HomebrewFiles.GetFilepath(fileoffset+1));
|
||||
if(LoadHomebrewXMLData(metapath,1)>0){
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", HB1.name);
|
||||
MainButton2Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", HB1.shortdescription);
|
||||
MainButton2aTxt.SetText(MainButtonText);
|
||||
MainButton2aoverTxt.SetText(MainButtonText);
|
||||
}
|
||||
else{
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset+1)), "%s", HomebrewFiles.GetFilepath(fileoffset+1));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset+1));
|
||||
snprintf(HB1.name, sizeof(HB1.name), "%s", MainButtonText);
|
||||
MainButton2Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), " ");
|
||||
MainButton2aoverTxt.SetText(MainButtonText);
|
||||
MainButton2aTxt.SetText(MainButtonText);
|
||||
}
|
||||
w.Append(&MainButton2);
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset+2)), "%s", HomebrewFiles.GetFilepath(fileoffset+2));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset+2));
|
||||
MainButton3Txt.SetText(MainButtonText);
|
||||
|
||||
//btn3
|
||||
snprintf(metapath, sizeof(metapath), "%smeta.xml", HomebrewFiles.GetFilepath(fileoffset+2));
|
||||
if(LoadHomebrewXMLData(metapath,2)>0){
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", HB2.name);
|
||||
MainButton3Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", HB2.shortdescription);
|
||||
MainButton3aTxt.SetText(MainButtonText);
|
||||
MainButton3aoverTxt.SetText(MainButtonText);
|
||||
}
|
||||
else{
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset+2)), "%s", HomebrewFiles.GetFilepath(fileoffset+2));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset+2));
|
||||
snprintf(HB2.name, sizeof(HB2.name), "%s", MainButtonText);
|
||||
MainButton3Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), " ");
|
||||
MainButton3aoverTxt.SetText(MainButtonText);
|
||||
MainButton3aTxt.SetText(MainButtonText);
|
||||
}
|
||||
w.Append(&MainButton3);
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset+3)), "%s", HomebrewFiles.GetFilepath(fileoffset+3));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset+3));
|
||||
MainButton4Txt.SetText(MainButtonText);
|
||||
|
||||
//btn4
|
||||
snprintf(metapath, sizeof(metapath), "%smeta.xml", HomebrewFiles.GetFilepath(fileoffset+3));
|
||||
if(LoadHomebrewXMLData(metapath,3)>0){
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", HB3.name);
|
||||
MainButton4Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", HB3.shortdescription);
|
||||
MainButton4aTxt.SetText(MainButtonText);
|
||||
MainButton4aoverTxt.SetText(MainButtonText);
|
||||
}
|
||||
else{
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset+3)), "%s", HomebrewFiles.GetFilepath(fileoffset+3));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset+3));
|
||||
snprintf(HB3.name, sizeof(HB3.name), "%s", MainButtonText);
|
||||
MainButton4Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), " ");
|
||||
MainButton4aTxt.SetText(MainButtonText);
|
||||
MainButton4aoverTxt.SetText(MainButtonText);
|
||||
}
|
||||
w.Append(&MainButton4);
|
||||
}
|
||||
|
||||
@ -419,21 +586,23 @@ int MenuHomebrewBrowse()
|
||||
if(MainButton1.GetState() == STATE_CLICKED) {
|
||||
char temp[200];
|
||||
char iconpath[200];
|
||||
char metapath[200];
|
||||
char * shortpath = NULL;
|
||||
|
||||
//write iconpath
|
||||
snprintf(metapath, sizeof(metapath), "%smeta.xml", HomebrewFiles.GetFilepath(fileoffset));
|
||||
|
||||
//write iconpath
|
||||
snprintf(iconpath, sizeof(iconpath), "%sicon.png", HomebrewFiles.GetFilepath(fileoffset));
|
||||
|
||||
//get filesize
|
||||
snprintf(temp, sizeof(temp), "%s%s", HomebrewFiles.GetFilepath(fileoffset),HomebrewFiles.GetFilename(fileoffset));
|
||||
u64 filesize = FileSize(temp);
|
||||
|
||||
u64 filesize = HomebrewFiles.GetFilesize(fileoffset);
|
||||
//write short filename
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset)), "%s", HomebrewFiles.GetFilepath(fileoffset));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(temp, sizeof(temp), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset));
|
||||
|
||||
int choice = HBCWindowPrompt(temp, 0, 0,0, 0, iconpath, filesize);
|
||||
int choice = HBCWindowPrompt(HB0.name, HB0.coder, HB0.version, HB0.releasedate, HB0.longdescription, iconpath, filesize);
|
||||
if(choice == 1) {
|
||||
boothomebrew = true;
|
||||
menu = MENU_EXIT;
|
||||
@ -445,21 +614,23 @@ int MenuHomebrewBrowse()
|
||||
else if(MainButton2.GetState() == STATE_CLICKED) {
|
||||
char temp[200];
|
||||
char iconpath[200];
|
||||
char metapath[200];
|
||||
char * shortpath = NULL;
|
||||
|
||||
//write iconpath
|
||||
snprintf(metapath, sizeof(metapath), "%smeta.xml", HomebrewFiles.GetFilepath(fileoffset+1));
|
||||
|
||||
//write iconpath
|
||||
snprintf(iconpath, sizeof(iconpath), "%sicon.png", HomebrewFiles.GetFilepath(fileoffset+1));
|
||||
|
||||
//get filesize
|
||||
snprintf(temp, sizeof(temp), "%s%s", HomebrewFiles.GetFilepath(fileoffset+1),HomebrewFiles.GetFilename(fileoffset+1));
|
||||
u64 filesize = FileSize(temp);
|
||||
|
||||
u64 filesize = HomebrewFiles.GetFilesize(fileoffset+1);
|
||||
//write short filename
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset+1)), "%s", HomebrewFiles.GetFilepath(fileoffset+1));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(temp, sizeof(temp), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset+1));
|
||||
|
||||
int choice = HBCWindowPrompt(temp, 0, 0,0, 0, iconpath, filesize);
|
||||
int choice = HBCWindowPrompt(HB1.name, HB1.coder, HB1.version, HB1.releasedate, HB1.longdescription, iconpath, filesize);
|
||||
if(choice == 1) {
|
||||
boothomebrew = true;
|
||||
menu = MENU_EXIT;
|
||||
@ -471,22 +642,24 @@ int MenuHomebrewBrowse()
|
||||
else if(MainButton3.GetState() == STATE_CLICKED) {
|
||||
char temp[200];
|
||||
char iconpath[200];
|
||||
char metapath[200];
|
||||
char * shortpath = NULL;
|
||||
|
||||
//write iconpath
|
||||
snprintf(metapath, sizeof(metapath), "%smeta.xml", HomebrewFiles.GetFilepath(fileoffset+2));
|
||||
|
||||
//write iconpath
|
||||
snprintf(iconpath, sizeof(iconpath), "%sicon.png", HomebrewFiles.GetFilepath(fileoffset+2));
|
||||
|
||||
//get filesize
|
||||
snprintf(temp, sizeof(temp), "%s%s", HomebrewFiles.GetFilepath(fileoffset+2),HomebrewFiles.GetFilename(fileoffset+2));
|
||||
u64 filesize = FileSize(temp);
|
||||
|
||||
u64 filesize = HomebrewFiles.GetFilesize(fileoffset+2);
|
||||
//write short filename
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset+2)), "%s", HomebrewFiles.GetFilepath(fileoffset+2));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(temp, sizeof(temp), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset+2));
|
||||
|
||||
int choice = HBCWindowPrompt(temp, 0, 0,0, 0, iconpath, filesize);
|
||||
if(choice == 1) {
|
||||
int choice = HBCWindowPrompt(HB2.name, HB2.coder, HB2.version, HB2.releasedate, HB2.longdescription, iconpath, filesize);
|
||||
if(choice == 1) {
|
||||
boothomebrew = true;
|
||||
menu = MENU_EXIT;
|
||||
snprintf(Settings.selected_homebrew, sizeof(Settings.selected_homebrew), "%s%s", HomebrewFiles.GetFilepath(fileoffset+2), HomebrewFiles.GetFilename(fileoffset+2));
|
||||
@ -497,21 +670,23 @@ int MenuHomebrewBrowse()
|
||||
else if(MainButton4.GetState() == STATE_CLICKED) {
|
||||
char temp[200];
|
||||
char iconpath[200];
|
||||
char metapath[200];
|
||||
char * shortpath = NULL;
|
||||
|
||||
//write iconpath
|
||||
snprintf(metapath, sizeof(metapath), "%smeta.xml", HomebrewFiles.GetFilepath(fileoffset+3));
|
||||
|
||||
//write iconpath
|
||||
snprintf(iconpath, sizeof(iconpath), "%sicon.png", HomebrewFiles.GetFilepath(fileoffset+3));
|
||||
|
||||
//get filesize
|
||||
snprintf(temp, sizeof(temp), "%s%s", HomebrewFiles.GetFilepath(fileoffset+3),HomebrewFiles.GetFilename(fileoffset+3));
|
||||
u64 filesize = FileSize(temp);
|
||||
|
||||
u64 filesize = HomebrewFiles.GetFilesize(fileoffset+3);
|
||||
//write short filename
|
||||
snprintf(temp, strlen(HomebrewFiles.GetFilepath(fileoffset+3)), "%s", HomebrewFiles.GetFilepath(fileoffset+3));
|
||||
shortpath = strrchr(temp, '/');
|
||||
snprintf(temp, sizeof(temp), "%s/%s", shortpath, HomebrewFiles.GetFilename(fileoffset+3));
|
||||
|
||||
int choice = HBCWindowPrompt(temp, 0, 0,0, 0, iconpath, filesize);
|
||||
int choice = HBCWindowPrompt(HB3.name, HB3.coder, HB3.version, HB3.releasedate, HB3.longdescription, iconpath, filesize);
|
||||
if(choice == 1) {
|
||||
boothomebrew = true;
|
||||
menu = MENU_EXIT;
|
||||
|
@ -104,20 +104,7 @@ bool checkfile(char * path)
|
||||
return false;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* FileSize
|
||||
*
|
||||
* Get filesize in bytes. u64 for files bigger than 4GB
|
||||
***************************************************************************/
|
||||
u64 FileSize(const char * filepath)
|
||||
{
|
||||
struct stat filestat;
|
||||
|
||||
if (stat(filepath, &filestat) != 0)
|
||||
return 0;
|
||||
|
||||
return filestat.st_size;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -11,7 +11,6 @@ char * GetFileName(int i);
|
||||
int GetAllDirFiles(char * filespath);
|
||||
bool subfoldercreate(char * fullpath);
|
||||
bool checkfile(char * path);
|
||||
u64 FileSize(const char * filepath);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -229,31 +229,26 @@ int MenuDiscList()
|
||||
char ID[4];
|
||||
char IDfull[7];
|
||||
u32 covert = 0;
|
||||
char imgPath[100];
|
||||
|
||||
//this is here to test the HBCwindow prompt. when its done being tested, this shit can go away.
|
||||
/* char db1[50];
|
||||
char db2[50];
|
||||
char db3[50];
|
||||
char db4[50];
|
||||
char db5[500];
|
||||
char db6[50];
|
||||
char db7[50];
|
||||
snprintf(db1, sizeof(db1), "name of the app");
|
||||
snprintf(db2, sizeof(db2), "coder coder coder coder coder coder coder ");
|
||||
snprintf(db3, sizeof(db3), "0.0.1");
|
||||
snprintf(db4, sizeof(db4), "02/04/1973");
|
||||
snprintf(db5, sizeof(db5), "long description-- htdeantudantd oentadu ahu tuih suntihuntsohntehi uei oui oi oue iueinubnsueto intoe iueti ueti ueioue inuet ouinto io ueintoe ioe uinoe ioeunitoe inu oei nyf .pnf vid uivx qnuitoe duied uientd ueidnuietd i euindt uie uindtuie dda udhoan doent ahuen oadhnt uda ntudhaoen adhoeun oadhnt udan uehaduh odenahuen danuehanuhaenua euntoadh enta uenhoad ut anuehad uhoa uho enhta udoantudhe ahuen ahtud a");
|
||||
snprintf(db6, sizeof(db6), "24TB");
|
||||
snprintf(db7, sizeof(db7), "SD:/APPS/FTPII/ICON.PNG");
|
||||
|
||||
|
||||
HBCWindowPrompt(db1, db2, db3,db4, db5, db7, db6);
|
||||
|
||||
|
||||
|
||||
*/
|
||||
WDVD_GetCoverStatus(&covert);
|
||||
u32 covertOld=covert;
|
||||
|
||||
|
||||
//i put this here to take care of the disappearing cursors
|
||||
//at least untill we know why they go away
|
||||
#ifdef HW_RVL
|
||||
for(int i = 0; i < 4; i++)
|
||||
delete pointer[i];
|
||||
snprintf(imgPath, sizeof(imgPath), "%splayer1_point.png", CFG.theme_path);
|
||||
pointer[0] = new GuiImageData(imgPath, player1_point_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%splayer2_point.png", CFG.theme_path);
|
||||
pointer[1] = new GuiImageData(imgPath, player2_point_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%splayer3_point.png", CFG.theme_path);
|
||||
pointer[2] = new GuiImageData(imgPath, player3_point_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%splayer4_point.png", CFG.theme_path);
|
||||
pointer[3] = new GuiImageData(imgPath, player4_point_png);
|
||||
#endif
|
||||
|
||||
|
||||
//SCREENSAVER
|
||||
@ -262,7 +257,6 @@ HBCWindowPrompt(db1, db2, db3,db4, db5, db7, db6);
|
||||
|
||||
datagB=0;
|
||||
int menu = MENU_NONE, dataef=0;
|
||||
char imgPath[100];
|
||||
__Menu_GetEntries();
|
||||
|
||||
f32 freespace, used, size = 0.0;
|
||||
|
@ -3078,14 +3078,14 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
|
||||
nameTxt.SetMaxWidth(430, GuiText::SCROLL);
|
||||
|
||||
|
||||
if (coder)
|
||||
if (strcmp(coder,""))
|
||||
snprintf(tmp, sizeof(tmp), "Coded by: %s",coder);
|
||||
GuiText coderTxt(tmp, 16, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
coderTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
coderTxt.SetPosition(180,30);
|
||||
coderTxt.SetMaxWidth(280);
|
||||
|
||||
if (version)
|
||||
if (strcmp(version,""))
|
||||
snprintf(tmp, sizeof(tmp), "Version: %s",version);
|
||||
GuiText versionTxt(tmp,16 , (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
versionTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
@ -3102,7 +3102,7 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
|
||||
int pagesize = 6;
|
||||
GuiText long_descriptionTxt(long_description, 20, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
long_descriptionTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
long_descriptionTxt.SetPosition(46,120);
|
||||
long_descriptionTxt.SetPosition(46,117);
|
||||
long_descriptionTxt.SetMaxWidth(360);
|
||||
long_descriptionTxt.SetNumLines(pagesize);
|
||||
|
||||
@ -3135,11 +3135,6 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
|
||||
filesizeTxt.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||
filesizeTxt.SetPosition(-40,12);
|
||||
|
||||
/*GuiText msgTxt(msg, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
msgTxt.SetPosition(0,-40);
|
||||
msgTxt.SetMaxWidth(430);*/
|
||||
|
||||
GuiText btn1Txt(tr("Load"), 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
GuiImage btn1Img(&btnOutline);
|
||||
if (Settings.wsprompt == yes){
|
||||
@ -3168,17 +3163,17 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
|
||||
btn2.SetPosition(-40, 2);
|
||||
|
||||
promptWindow.Append(&dialogBoxImg);
|
||||
if (long_description)promptWindow.Append(&whiteBoxImg);
|
||||
if (long_description)promptWindow.Append(&scrollbarImg);
|
||||
if (long_description)promptWindow.Append(&arrowDownBtn);
|
||||
if (long_description)promptWindow.Append(&arrowUpBtn);
|
||||
if (strcmp(long_description,""))promptWindow.Append(&whiteBoxImg);
|
||||
if (strcmp(long_description,""))promptWindow.Append(&scrollbarImg);
|
||||
if (strcmp(long_description,""))promptWindow.Append(&arrowDownBtn);
|
||||
if (strcmp(long_description,""))promptWindow.Append(&arrowUpBtn);
|
||||
|
||||
if (name)promptWindow.Append(&nameTxt);
|
||||
if (version)promptWindow.Append(&versionTxt);
|
||||
if (coder)promptWindow.Append(&coderTxt);
|
||||
if (release_date)promptWindow.Append(&release_dateTxt);
|
||||
if (long_description)promptWindow.Append(&long_descriptionTxt);
|
||||
if (filesize)promptWindow.Append(&filesizeTxt);
|
||||
if (strcmp(name,""))promptWindow.Append(&nameTxt);
|
||||
if (strcmp(version,""))promptWindow.Append(&versionTxt);
|
||||
if (strcmp(coder,""))promptWindow.Append(&coderTxt);
|
||||
if (strcmp(release_date,""))promptWindow.Append(&release_dateTxt);
|
||||
if (strcmp(long_description,""))promptWindow.Append(&long_descriptionTxt);
|
||||
promptWindow.Append(&filesizeTxt);
|
||||
if (iconExist)promptWindow.Append(iconImg);
|
||||
promptWindow.Append(&btn1);
|
||||
promptWindow.Append(&btn2);
|
||||
|
148
source/xml/xml.c
148
source/xml/xml.c
@ -24,6 +24,12 @@ extern struct SSettings Settings; // for loader GX
|
||||
struct gameXMLinfo gameinfo;
|
||||
struct gameXMLinfo gameinfo_reset;
|
||||
|
||||
extern struct homebrewXMLinfo HB0;
|
||||
extern struct homebrewXMLinfo HB1;
|
||||
extern struct homebrewXMLinfo HB2;
|
||||
extern struct homebrewXMLinfo HB3;
|
||||
|
||||
|
||||
|
||||
|
||||
static char langlist[11][22] =
|
||||
@ -752,3 +758,145 @@ static char * get_text(mxml_node_t *node, char *buffer, int buflen) /* O - Text
|
||||
return (buffer);
|
||||
}
|
||||
|
||||
int LoadHomebrewXMLData(char* filename,int i)
|
||||
{
|
||||
int ret;
|
||||
if (i>3){
|
||||
ret= -20;
|
||||
goto noXML;}
|
||||
|
||||
mxml_node_t *nodedataHB=NULL;
|
||||
mxml_node_t *nodetreeHB=NULL;
|
||||
char tmp1[40];
|
||||
|
||||
/* Load XML file */
|
||||
FILE *filexml;
|
||||
filexml = fopen(filename, "rb");
|
||||
if (!filexml)
|
||||
{ret= -1;
|
||||
goto noXML;}
|
||||
|
||||
nodetreeHB = mxmlLoadFile(NULL, filexml, MXML_NO_CALLBACK);
|
||||
fclose(filexml);
|
||||
|
||||
if (nodetreeHB == NULL)
|
||||
{ret= -2;
|
||||
goto noXML;}
|
||||
|
||||
nodedataHB = mxmlFindElement(nodetreeHB, nodetreeHB, "app", NULL, NULL, MXML_DESCEND);
|
||||
if (nodedataHB == NULL) {
|
||||
ret= -5;
|
||||
goto noXML;
|
||||
}
|
||||
|
||||
//int len = (strlen(entered)-1);
|
||||
//if(entered[len] !='/')
|
||||
/* text from elements */
|
||||
if (i==0){
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "name", NULL, NULL, MXML_DESCEND, HB0.name,sizeof(HB0.name));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "coder", NULL, NULL, MXML_DESCEND, HB0.coder,sizeof(HB0.coder));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "version", NULL, NULL, MXML_DESCEND, HB0.version,sizeof(HB0.version));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "release_date", NULL, NULL, MXML_DESCEND, tmp1,sizeof(tmp1));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "short_description", NULL, NULL, MXML_DESCEND, HB0.shortdescription,sizeof(HB0.shortdescription));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "long_description", NULL, NULL, MXML_DESCEND, HB0.longdescription,sizeof(HB0.longdescription));
|
||||
|
||||
int len = (strlen(tmp1)-6);//length of the date string without the 200000 at the end
|
||||
if (len==8)
|
||||
snprintf(HB0.releasedate, sizeof(HB0.releasedate), "%c%c/%c%c/%c%c%c%c", tmp1[4],tmp1[5],tmp1[6],tmp1[7],tmp1[0],tmp1[1],tmp1[2],tmp1[3]);
|
||||
else if (len==6)
|
||||
snprintf(HB0.releasedate, sizeof(HB0.releasedate), "%c%c/%c%c%c%c", tmp1[4],tmp1[5],tmp1[0],tmp1[1],tmp1[2],tmp1[3]);
|
||||
else snprintf(HB0.releasedate, sizeof(HB0.releasedate), "%s", tmp1);
|
||||
|
||||
}
|
||||
else if (i==1){
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "name", NULL, NULL, MXML_DESCEND, HB1.name,sizeof(HB1.name));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "coder", NULL, NULL, MXML_DESCEND, HB1.coder,sizeof(HB1.coder));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "version", NULL, NULL, MXML_DESCEND, HB1.version,sizeof(HB1.version));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "release_date", NULL, NULL, MXML_DESCEND, tmp1,sizeof(tmp1));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "short_description", NULL, NULL, MXML_DESCEND, HB1.shortdescription,sizeof(HB1.shortdescription));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "long_description", NULL, NULL, MXML_DESCEND, HB1.longdescription,sizeof(HB1.longdescription));
|
||||
|
||||
|
||||
int len = (strlen(tmp1)-6);//length of the date string without the 200000 at the end
|
||||
if (len==8)
|
||||
snprintf(HB1.releasedate, sizeof(HB1.releasedate), "%c%c/%c%c/%c%c%c%c", tmp1[4],tmp1[5],tmp1[6],tmp1[7],tmp1[0],tmp1[1],tmp1[2],tmp1[3]);
|
||||
else if (len==6)
|
||||
snprintf(HB1.releasedate, sizeof(HB1.releasedate), "%c%c/%c%c%c%c", tmp1[4],tmp1[5],tmp1[0],tmp1[1],tmp1[2],tmp1[3]);
|
||||
else snprintf(HB1.releasedate, sizeof(HB1.releasedate), "%s", tmp1);
|
||||
|
||||
}
|
||||
else if (i==2){
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "name", NULL, NULL, MXML_DESCEND, HB2.name,sizeof(HB2.name));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "coder", NULL, NULL, MXML_DESCEND, HB2.coder,sizeof(HB2.coder));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "version", NULL, NULL, MXML_DESCEND, HB2.version,sizeof(HB2.version));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "release_date", NULL, NULL, MXML_DESCEND, tmp1,sizeof(tmp1));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "short_description", NULL, NULL, MXML_DESCEND, HB2.shortdescription,sizeof(HB2.shortdescription));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "long_description", NULL, NULL, MXML_DESCEND, HB2.longdescription,sizeof(HB2.longdescription));
|
||||
|
||||
int len = (strlen(tmp1)-6);//length of the date string without the 200000 at the end
|
||||
if (len==8)
|
||||
snprintf(HB2.releasedate, sizeof(HB2.releasedate), "%c%c/%c%c/%c%c%c%c", tmp1[4],tmp1[5],tmp1[6],tmp1[7],tmp1[0],tmp1[1],tmp1[2],tmp1[3]);
|
||||
else if (len==6)
|
||||
snprintf(HB2.releasedate, sizeof(HB2.releasedate), "%c%c/%c%c%c%c", tmp1[4],tmp1[5],tmp1[0],tmp1[1],tmp1[2],tmp1[3]);
|
||||
else snprintf(HB2.releasedate, sizeof(HB2.releasedate), "%s", tmp1);
|
||||
|
||||
}
|
||||
else if (i==3){
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "name", NULL, NULL, MXML_DESCEND, HB3.name,sizeof(HB3.name));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "coder", NULL, NULL, MXML_DESCEND, HB3.coder,sizeof(HB3.coder));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "version", NULL, NULL, MXML_DESCEND, HB3.version,sizeof(HB3.version));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "release_date", NULL, NULL, MXML_DESCEND, tmp1,sizeof(tmp1));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "short_description", NULL, NULL, MXML_DESCEND, HB3.shortdescription,sizeof(HB3.shortdescription));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, "long_description", NULL, NULL, MXML_DESCEND, HB3.longdescription,sizeof(HB3.longdescription));
|
||||
|
||||
int len = (strlen(tmp1)-6);//length of the date string without the 200000 at the end
|
||||
if (len==8)
|
||||
snprintf(HB3.releasedate, sizeof(HB3.releasedate), "%c%c/%c%c/%c%c%c%c", tmp1[4],tmp1[5],tmp1[6],tmp1[7],tmp1[0],tmp1[1],tmp1[2],tmp1[3]);
|
||||
else if (len==6)
|
||||
snprintf(HB3.releasedate, sizeof(HB3.releasedate), "%c%c/%c%c%c%c", tmp1[4],tmp1[5],tmp1[0],tmp1[1],tmp1[2],tmp1[3]);
|
||||
else snprintf(HB3.releasedate, sizeof(HB3.releasedate), "%s", tmp1);
|
||||
|
||||
}
|
||||
ret =1;
|
||||
free(nodedataHB);
|
||||
free(nodetreeHB);
|
||||
goto end;
|
||||
noXML:
|
||||
if (i==0){
|
||||
strcpy(HB0.name,"");
|
||||
strcpy(HB0.coder,"");
|
||||
strcpy(HB0.version,"");
|
||||
strcpy(HB0.releasedate,"");
|
||||
strcpy(HB0.shortdescription,"");
|
||||
strcpy(HB0.longdescription,"");
|
||||
|
||||
}
|
||||
else if (i==1){
|
||||
strcpy(HB1.name,"");
|
||||
strcpy(HB1.coder,"");
|
||||
strcpy(HB1.version,"");
|
||||
strcpy(HB1.releasedate,"");
|
||||
strcpy(HB1.shortdescription,"");
|
||||
strcpy(HB1.longdescription,"");
|
||||
}
|
||||
else if (i==2){
|
||||
strcpy(HB2.name,"");
|
||||
strcpy(HB2.coder,"");
|
||||
strcpy(HB2.version,"");
|
||||
strcpy(HB2.releasedate,"");
|
||||
strcpy(HB2.shortdescription,"");
|
||||
strcpy(HB2.longdescription,"");
|
||||
}
|
||||
else if (i==3){
|
||||
strcpy(HB3.name,"");
|
||||
strcpy(HB3.coder,"");
|
||||
strcpy(HB3.version,"");
|
||||
strcpy(HB3.releasedate,"");
|
||||
strcpy(HB3.shortdescription,"");
|
||||
strcpy(HB3.longdescription,"");
|
||||
}
|
||||
end:
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -56,9 +56,19 @@ struct gameXMLinfo
|
||||
char iso_sha1[41];
|
||||
} ;
|
||||
|
||||
struct homebrewXMLinfo
|
||||
{
|
||||
char name[50];
|
||||
char coder[50];
|
||||
char version[30];
|
||||
char releasedate[30];
|
||||
char shortdescription[150];
|
||||
char longdescription[500];
|
||||
} ;
|
||||
|
||||
|
||||
bool OpenXMLFile(char* filename);
|
||||
int LoadHomebrewXMLData(char* filename,int i);
|
||||
void LoadTitlesFromXML(char *langcode, bool forcejptoen);
|
||||
void GetPublisherFromGameid(char *idtxt, char *dest, int destsize);
|
||||
char *ConvertLangTextToCode(char *langtext);
|
||||
|
Loading…
Reference in New Issue
Block a user