*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">
<name> USB Loader GX</name>
<coder>USB Loader GX Team</coder>
<version>1.0 r945</version>
<release_date>201009171347</release_date>
<version>1.0 r946</version>
<release_date>201009171539</release_date>
<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.
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.

View File

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

View File

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

View File

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

View File

@ -714,7 +714,7 @@ int showGameInfo(char *ID) {
snprintf(linebuf, sizeof(linebuf), "%s:",tr("WiFi Features"));
} else {
strcpy(linebuf,"");
}
}
wifiTxt[0] = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
wifiTxt[0]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
wifiTxt[0]->SetPosition(205,200+wifiY);
@ -729,7 +729,7 @@ int showGameInfo(char *ID) {
synopsisTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
synopsisTxt->SetPosition(0,0);
synopsisTxt->SetLinesToDraw(pagesize);
//synopsisTxt->SetFirstLine(12);
synopsisTxt->Refresh();
dialogBoxImg11 = new GuiImage(&dialogBox1);
dialogBoxImg11->SetAlignment(0,3);
@ -809,84 +809,92 @@ int showGameInfo(char *ID) {
backBtn.ResetState();
if (page==1) {
choice=1;
if(synopsisTxt)
delete synopsisTxt;
synopsisTxt = NULL;
break;
} else if (page==2) {
HaltGui();
gameinfoWindow2.Remove(&nextBtn);
gameinfoWindow2.Remove(&backBtn);
gameinfoWindow2.Remove(&homeBtn);
gameinfoWindow2.Remove(&screenShotBtn);
gameinfoWindow2.SetVisible(false);
gameinfoWindow2.Remove(&homeBtn);
gameinfoWindow2.Remove(&screenShotBtn);
gameinfoWindow2.SetVisible(false);
gameinfoWindow.SetVisible(true);
gameinfoWindow.Append(&backBtn);
gameinfoWindow.Append(&nextBtn);
gameinfoWindow.Append(&homeBtn);
gameinfoWindow.Append(&screenShotBtn);
mainWindow->Remove(&gameinfoWindow2);
gameinfoWindow.Append(&homeBtn);
gameinfoWindow.Append(&screenShotBtn);
mainWindow->Remove(&gameinfoWindow2);
ResumeGui();
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();
if (page==1) {
if (page==1)
{
HaltGui();
gameinfoWindow.Remove(&nextBtn);
gameinfoWindow.Remove(&backBtn);
gameinfoWindow.Remove(&homeBtn);
gameinfoWindow.Remove(&screenShotBtn);
gameinfoWindow.SetVisible(false);
gameinfoWindow.Remove(&homeBtn);
gameinfoWindow.Remove(&screenShotBtn);
gameinfoWindow.SetVisible(false);
gameinfoWindow2.SetVisible(true);
coverImg->SetPosition(15,30);
gameinfoWindow2.Append(&nextBtn);
gameinfoWindow2.Append(&backBtn);
gameinfoWindow2.Append(&homeBtn);
gameinfoWindow2.Append(&screenShotBtn);
mainWindow->Append(&gameinfoWindow2);
gameinfoWindow2.Append(&homeBtn);
gameinfoWindow2.Append(&screenShotBtn);
mainWindow->Append(&gameinfoWindow2);
ResumeGui();
page=2;
} else {
}
else
{
HaltGui();
gameinfoWindow2.Remove(&nextBtn);
gameinfoWindow2.Remove(&backBtn);
gameinfoWindow2.Remove(&homeBtn);
gameinfoWindow2.Remove(&screenShotBtn);
gameinfoWindow2.SetVisible(false);
gameinfoWindow2.Remove(&homeBtn);
gameinfoWindow2.Remove(&screenShotBtn);
gameinfoWindow2.SetVisible(false);
gameinfoWindow.SetVisible(true);
gameinfoWindow.Append(&backBtn);
gameinfoWindow.Append(&nextBtn);
gameinfoWindow.Append(&homeBtn);
gameinfoWindow.Append(&screenShotBtn);
mainWindow->Remove(&gameinfoWindow2);
gameinfoWindow.Append(&homeBtn);
gameinfoWindow.Append(&screenShotBtn);
mainWindow->Remove(&gameinfoWindow2);
ResumeGui();
page=1;
}
} else if ((upBtn.GetState()==STATE_CLICKED||upBtn.GetState()==STATE_HELD) && page==2) {
//int l=synopsisTxt->GetFirstLine()-1;
if (synopsisTxt->GetCurrPos()>1)
synopsisTxt->SetTextLine(synopsisTxt->GetCurrPos()-1);
}
else if ((upBtn.GetState() == STATE_CLICKED || upBtn.GetState() == STATE_HELD) && page == 2)
{
synopsisTxt->PreviousLine();
usleep(60000);
if (!((ButtonsHold() & WPAD_BUTTON_UP)||(ButtonsHold() & PAD_BUTTON_UP)))
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);
if (!((ButtonsHold() & WPAD_BUTTON_DOWN)||(ButtonsHold() & PAD_BUTTON_DOWN)))
dnBtn.ResetState();
} else if (homeBtn.GetState()==STATE_CLICKED) {
}
else if (homeBtn.GetState()==STATE_CLICKED)
{
if (page==1) {
choice=2;
if(synopsisTxt)
delete synopsisTxt;
synopsisTxt = NULL;
break;
} else if (page==2) {
@ -1103,10 +1111,10 @@ bool save_XML_URL() { // save xml url as as txt file for people without wifi
sleep(1);
return false;
}
char XMLurl[3540];
build_XML_URL(XMLurl,sizeof(XMLurl));
fprintf(f, "# USB Loader Has Saved this file\n");
fprintf(f, "# This URL was created based on your list of games and language settings.\n");
fclose(f);