*Fixed scrolling of Text

*Fixed HomebrewXML - Long Description not being loaded completely but only a part.
This commit is contained in:
dimok321 2010-09-17 16:15:18 +00:00
parent 044c48a1bc
commit b7071bc7b3
5 changed files with 145 additions and 137 deletions

View File

@ -2,8 +2,8 @@
<app version="1"> <app version="1">
<name> USB Loader GX</name> <name> USB Loader GX</name>
<coder>USB Loader GX Team</coder> <coder>USB Loader GX Team</coder>
<version>1.0 r945</version> <version>1.0 r946</version>
<release_date>201009171347</release_date> <release_date>201009171539</release_date>
<short_description>Loads games from USB-devices</short_description> <short_description>Loads games from USB-devices</short_description>
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times. <long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller. The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.

View File

@ -9,59 +9,62 @@
#include "HomebrewXML.h" #include "HomebrewXML.h"
HomebrewXML::HomebrewXML() { #define ENTRIE_SIZE 8192
strcpy(name,"");
strcpy(coder,"");
strcpy(version,"");
strcpy(releasedate,"");
strcpy(shortdescription,"");
strcpy(longdescription,"");
}
HomebrewXML::~HomebrewXML() { int HomebrewXML::LoadHomebrewXMLData(const char* filename)
} {
int HomebrewXML::LoadHomebrewXMLData(const char* filename) {
mxml_node_t *nodedataHB = NULL; mxml_node_t *nodedataHB = NULL;
mxml_node_t *nodetreeHB = NULL; mxml_node_t *nodetreeHB = NULL;
char tmp1[40];
/* Load XML file */ /* Load XML file */
FILE *filexml; FILE *filexml;
filexml = fopen(filename, "rb"); filexml = fopen(filename, "rb");
if (!filexml) { if (!filexml)
return -1; return -1;
}
nodetreeHB = mxmlLoadFile(NULL, filexml, MXML_OPAQUE_CALLBACK); nodetreeHB = mxmlLoadFile(NULL, filexml, MXML_OPAQUE_CALLBACK);
fclose(filexml); fclose(filexml);
if (nodetreeHB == NULL) { if (nodetreeHB == NULL)
return -2; return -2;
}
nodedataHB = mxmlFindElement(nodetreeHB, nodetreeHB, "app", NULL, NULL, MXML_DESCEND); nodedataHB = mxmlFindElement(nodetreeHB, nodetreeHB, "app", NULL, NULL, MXML_DESCEND);
if (nodedataHB == NULL) { if (nodedataHB == NULL)
return -5; return -5;
}
GetTextFromNode(nodedataHB, nodedataHB, (char*) "name", NULL, NULL, MXML_DESCEND, name,sizeof(name)); char * Entrie = new char[ENTRIE_SIZE];
GetTextFromNode(nodedataHB, nodedataHB, (char*) "coder", NULL, NULL, MXML_DESCEND, coder,sizeof(coder));
GetTextFromNode(nodedataHB, nodedataHB, (char*) "version", NULL, NULL, MXML_DESCEND, version,sizeof(version));
GetTextFromNode(nodedataHB, nodedataHB, (char*) "release_date", NULL, NULL, MXML_DESCEND, tmp1,sizeof(tmp1));
GetTextFromNode(nodedataHB, nodedataHB, (char*) "short_description", NULL, NULL, MXML_DESCEND, shortdescription,sizeof(shortdescription));
GetTextFromNode(nodedataHB, nodedataHB, (char*) "long_description", NULL, NULL, MXML_DESCEND, longdescription,sizeof(longdescription));
int len = (strlen(tmp1)-6); //length of the date string without the 200000 at the end GetTextFromNode(nodedataHB, nodedataHB, (char*) "name", NULL, NULL, MXML_DESCEND, Entrie, ENTRIE_SIZE);
Name = Entrie;
GetTextFromNode(nodedataHB, nodedataHB, (char*) "coder", NULL, NULL, MXML_DESCEND, Entrie, ENTRIE_SIZE);
Coder = Entrie;
GetTextFromNode(nodedataHB, nodedataHB, (char*) "version", NULL, NULL, MXML_DESCEND, Entrie, ENTRIE_SIZE);
Version = Entrie;
GetTextFromNode(nodedataHB, nodedataHB, (char*) "short_description", NULL, NULL, MXML_DESCEND, Entrie, ENTRIE_SIZE);
ShortDescription = Entrie;
GetTextFromNode(nodedataHB, nodedataHB, (char*) "long_description", NULL, NULL, MXML_DESCEND, Entrie, ENTRIE_SIZE);
LongDescription = Entrie;
GetTextFromNode(nodedataHB, nodedataHB, (char*) "release_date", NULL, NULL, MXML_DESCEND, Entrie, ENTRIE_SIZE);
int len = (strlen(Entrie)-6); //length of the date string without the 200000 at the end
if (len == 8) if (len == 8)
snprintf(releasedate, sizeof(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]); snprintf(Entrie, ENTRIE_SIZE, "%c%c/%c%c/%c%c%c%c", Entrie[4],Entrie[5],Entrie[6],Entrie[7],Entrie[0],Entrie[1],Entrie[2],Entrie[3]);
else if (len == 6) else if (len == 6)
snprintf(releasedate, sizeof(releasedate), "%c%c/%c%c%c%c", tmp1[4],tmp1[5],tmp1[0],tmp1[1],tmp1[2],tmp1[3]); snprintf(Entrie, ENTRIE_SIZE, "%c%c/%c%c%c%c", Entrie[4],Entrie[5],Entrie[0],Entrie[1],Entrie[2],Entrie[3]);
else snprintf(releasedate, sizeof(releasedate), "%s", tmp1); else
snprintf(Entrie, ENTRIE_SIZE, "%s", Entrie);
Releasedate = Entrie;
free(nodedataHB); free(nodedataHB);
free(nodetreeHB); free(nodetreeHB);
delete [] Entrie;
return 1; return 1;
} }

View File

@ -5,50 +5,39 @@
#ifndef ___HOMEBREWXML_H_ #ifndef ___HOMEBREWXML_H_
#define ___HOMEBREWXML_H_ #define ___HOMEBREWXML_H_
class HomebrewXML { #include <string>
public:
class HomebrewXML
{
public:
//!Constructor //!Constructor
//!\param path Path for the xml file //!\param path Path for the xml file
HomebrewXML(); HomebrewXML() { };
//!Destructor //!Destructor
~HomebrewXML(); ~HomebrewXML() { };
//!\param filename Filepath of the XML file //!\param filename Filepath of the XML file
int LoadHomebrewXMLData(const char* filename); int LoadHomebrewXMLData(const char* filename);
//! Get name //! Get name
char * GetName() { const char * GetName() { return Name.c_str(); };
return name;
}
//! Get coder //! Get coder
char * GetCoder() { const char * GetCoder() { return Coder.c_str(); };
return coder;
}
//! Get version //! Get version
char * GetVersion() { const char * GetVersion() { return Version.c_str(); };
return version;
}
//! Get releasedate //! Get releasedate
char * GetReleasedate() { const char * GetReleasedate() { return Releasedate.c_str(); };
return releasedate;
}
//! Get shortdescription //! Get shortdescription
char * GetShortDescription() { const char * GetShortDescription() { return ShortDescription.c_str(); };
return shortdescription;
}
//! Get longdescription //! Get longdescription
char * GetLongDescription() { const char * GetLongDescription() { return LongDescription.c_str(); };
return longdescription;
}
//! Set Name //! Set Name
void SetName(char * path) { void SetName(char * newName) { Name = newName; };
strlcpy(name, path, sizeof(name)); protected:
} std::string Name;
protected: std::string Coder;
char name[50]; std::string Version;
char coder[100]; std::string Releasedate;
char version[30]; std::string ShortDescription;
char releasedate[30]; std::string LongDescription;
char shortdescription[150];
char longdescription[500];
}; };
#endif #endif

View File

@ -3518,6 +3518,7 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
long_descriptionTxt.SetPosition(46,117); long_descriptionTxt.SetPosition(46,117);
long_descriptionTxt.SetMaxWidth(360); long_descriptionTxt.SetMaxWidth(360);
long_descriptionTxt.SetLinesToDraw(pagesize); long_descriptionTxt.SetLinesToDraw(pagesize);
long_descriptionTxt.Refresh();
//convert filesize from u64 to char and put unit of measurement after it //convert filesize from u64 to char and put unit of measurement after it
char temp2[7]; char temp2[7];
@ -3604,42 +3605,49 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
mainWindow->ChangeFocus(&promptWindow); mainWindow->ChangeFocus(&promptWindow);
ResumeGui(); ResumeGui();
while (choice == -1) { while (choice == -1)
{
VIDEO_WaitVSync(); VIDEO_WaitVSync();
if (shutdown == 1) {
if (shutdown == 1)
{
wiilight(0); wiilight(0);
Sys_Shutdown(); Sys_Shutdown();
} }
if (reset == 1) else if (reset == 1)
{
wiilight(0);
Sys_Reboot(); Sys_Reboot();
if (btn1.GetState() == STATE_CLICKED) {
choice = 1;
} else if (btn2.GetState() == STATE_CLICKED) {
choice = 0;
} }
else if (screenShotBtn.GetState() == STATE_CLICKED) {
if (btn1.GetState() == STATE_CLICKED)
choice = 1;
else if (btn2.GetState() == STATE_CLICKED)
choice = 0;
else if (screenShotBtn.GetState() == STATE_CLICKED)
{
gprintf("\n\tscreenShotBtn clicked"); gprintf("\n\tscreenShotBtn clicked");
screenShotBtn.ResetState(); screenShotBtn.ResetState();
ScreenShot(); ScreenShot();
gprintf("...It's easy, mmmmmmKay"); gprintf("...It's easy, mmmmmmKay");
} }
else if ((arrowUpBtn.GetState()==STATE_CLICKED||arrowUpBtn.GetState()==STATE_HELD) ) { else if (arrowUpBtn.GetState() == STATE_CLICKED || arrowUpBtn.GetState() == STATE_HELD)
long_descriptionTxt.SetTextLine(long_descriptionTxt.GetCurrPos()-1); {
usleep(60000); long_descriptionTxt.PreviousLine();
usleep(6000);
if (!((ButtonsHold() & WPAD_BUTTON_UP)||(ButtonsHold() & PAD_BUTTON_UP))) if (!((ButtonsHold() & WPAD_BUTTON_UP)||(ButtonsHold() & PAD_BUTTON_UP)))
arrowUpBtn.ResetState(); arrowUpBtn.ResetState();
} else if ((arrowDownBtn.GetState()==STATE_CLICKED||arrowDownBtn.GetState()==STATE_HELD) }
&&long_descriptionTxt.GetTotalLinesCount()>pagesize else if (arrowDownBtn.GetState() == STATE_CLICKED || arrowDownBtn.GetState() == STATE_HELD)
&&long_descriptionTxt.GetCurrPos()-1<long_descriptionTxt.GetTotalLinesCount()-pagesize) { {
int l=0; long_descriptionTxt.NextLine();
l=long_descriptionTxt.GetCurrPos()+1;
long_descriptionTxt.SetTextLine(l);
usleep(60000); usleep(60000);
if (!((ButtonsHold() & WPAD_BUTTON_DOWN)||(ButtonsHold() & PAD_BUTTON_DOWN))) if (!((ButtonsHold() & WPAD_BUTTON_DOWN)||(ButtonsHold() & PAD_BUTTON_DOWN)))
arrowDownBtn.ResetState(); arrowDownBtn.ResetState();
} }
} }
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50); promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);

View File

@ -729,7 +729,7 @@ int showGameInfo(char *ID) {
synopsisTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); synopsisTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
synopsisTxt->SetPosition(0,0); synopsisTxt->SetPosition(0,0);
synopsisTxt->SetLinesToDraw(pagesize); synopsisTxt->SetLinesToDraw(pagesize);
//synopsisTxt->SetFirstLine(12); synopsisTxt->Refresh();
dialogBoxImg11 = new GuiImage(&dialogBox1); dialogBoxImg11 = new GuiImage(&dialogBox1);
dialogBoxImg11->SetAlignment(0,3); dialogBoxImg11->SetAlignment(0,3);
@ -809,6 +809,8 @@ int showGameInfo(char *ID) {
backBtn.ResetState(); backBtn.ResetState();
if (page==1) { if (page==1) {
choice=1; choice=1;
if(synopsisTxt)
delete synopsisTxt;
synopsisTxt = NULL; synopsisTxt = NULL;
break; break;
} else if (page==2) { } else if (page==2) {
@ -827,10 +829,14 @@ int showGameInfo(char *ID) {
ResumeGui(); ResumeGui();
page=1; page=1;
} }
} else if (((nextBtn.GetState()==STATE_CLICKED)||(nextBtn.GetState()==STATE_HELD))&& }
(strcmp(gameinfo.synopsis,"") != 0)) { else if (((nextBtn.GetState()==STATE_CLICKED)||(nextBtn.GetState()==STATE_HELD))&&
(strcmp(gameinfo.synopsis,"") != 0))
{
nextBtn.ResetState(); nextBtn.ResetState();
if (page==1) {
if (page==1)
{
HaltGui(); HaltGui();
gameinfoWindow.Remove(&nextBtn); gameinfoWindow.Remove(&nextBtn);
gameinfoWindow.Remove(&backBtn); gameinfoWindow.Remove(&backBtn);
@ -846,7 +852,9 @@ int showGameInfo(char *ID) {
mainWindow->Append(&gameinfoWindow2); mainWindow->Append(&gameinfoWindow2);
ResumeGui(); ResumeGui();
page=2; page=2;
} else { }
else
{
HaltGui(); HaltGui();
gameinfoWindow2.Remove(&nextBtn); gameinfoWindow2.Remove(&nextBtn);
gameinfoWindow2.Remove(&backBtn); gameinfoWindow2.Remove(&backBtn);
@ -863,30 +871,30 @@ int showGameInfo(char *ID) {
page=1; page=1;
} }
} else if ((upBtn.GetState()==STATE_CLICKED||upBtn.GetState()==STATE_HELD) && page==2) { }
//int l=synopsisTxt->GetFirstLine()-1; else if ((upBtn.GetState() == STATE_CLICKED || upBtn.GetState() == STATE_HELD) && page == 2)
if (synopsisTxt->GetCurrPos()>1) {
synopsisTxt->SetTextLine(synopsisTxt->GetCurrPos()-1); synopsisTxt->PreviousLine();
usleep(60000); usleep(60000);
if (!((ButtonsHold() & WPAD_BUTTON_UP)||(ButtonsHold() & PAD_BUTTON_UP))) if (!((ButtonsHold() & WPAD_BUTTON_UP)||(ButtonsHold() & PAD_BUTTON_UP)))
upBtn.ResetState(); upBtn.ResetState();
} else if ((dnBtn.GetState()==STATE_CLICKED||dnBtn.GetState()==STATE_HELD) && page==2
&&synopsisTxt->GetTotalLinesCount()>pagesize
&&synopsisTxt->GetCurrPos()-1<synopsisTxt->GetTotalLinesCount()-pagesize) {
int l=0;
//if(synopsisTxt->GetTotalLines()>pagesize)
l=synopsisTxt->GetCurrPos()+1;
//if (l>(synopsisTxt->GetTotalLines()+1)-pagesize) }
//l=(synopsisTxt->GetTotalLines()+1)-pagesize; else if ((dnBtn.GetState() == STATE_CLICKED || dnBtn.GetState() == STATE_HELD) && page==2)
{
synopsisTxt->NextLine();
synopsisTxt->SetTextLine(l);
usleep(60000); usleep(60000);
if (!((ButtonsHold() & WPAD_BUTTON_DOWN)||(ButtonsHold() & PAD_BUTTON_DOWN))) if (!((ButtonsHold() & WPAD_BUTTON_DOWN)||(ButtonsHold() & PAD_BUTTON_DOWN)))
dnBtn.ResetState(); dnBtn.ResetState();
} else if (homeBtn.GetState()==STATE_CLICKED) { }
else if (homeBtn.GetState()==STATE_CLICKED)
{
if (page==1) { if (page==1) {
choice=2; choice=2;
if(synopsisTxt)
delete synopsisTxt;
synopsisTxt = NULL; synopsisTxt = NULL;
break; break;
} else if (page==2) { } else if (page==2) {