mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-26 12:34:17 +01:00
minor changes
This commit is contained in:
parent
173bad8c6f
commit
fb0ed2eb65
@ -121,6 +121,9 @@ void ResetText()
|
|||||||
int
|
int
|
||||||
WindowPrompt(const char *title, const char *msg, const char *btn1Label, const char *btn2Label)
|
WindowPrompt(const char *title, const char *msg, const char *btn1Label, const char *btn2Label)
|
||||||
{
|
{
|
||||||
|
if(!mainWindow || ExitRequested || ShutdownRequested)
|
||||||
|
return 0;
|
||||||
|
|
||||||
int choice = -1;
|
int choice = -1;
|
||||||
|
|
||||||
GuiWindow promptWindow(448,288);
|
GuiWindow promptWindow(448,288);
|
||||||
|
@ -46,61 +46,64 @@ bool updateFound = false; // true if an app update was found
|
|||||||
|
|
||||||
void UpdateCheck()
|
void UpdateCheck()
|
||||||
{
|
{
|
||||||
// we can only check for the update if we have internet + SD
|
// we only check for an update if we have internet + SD/USB
|
||||||
if(!updateChecked && networkInit && (isMounted[DEVICE_SD] || isMounted[DEVICE_USB]))
|
if(updateChecked || !networkInit)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!isMounted[DEVICE_SD] && !isMounted[DEVICE_USB])
|
||||||
|
return;
|
||||||
|
|
||||||
|
updateChecked = true;
|
||||||
|
u8 tmpbuffer[256];
|
||||||
|
|
||||||
|
if (http_request("http://vba-wii.googlecode.com/svn/trunk/update.xml", NULL, tmpbuffer, 256, SILENT) <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
mxml_node_t *xml;
|
||||||
|
mxml_node_t *item;
|
||||||
|
|
||||||
|
xml = mxmlLoadString(NULL, (char *)tmpbuffer, MXML_TEXT_CALLBACK);
|
||||||
|
|
||||||
|
if(!xml)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// check settings version
|
||||||
|
item = mxmlFindElement(xml, xml, "app", "version", NULL, MXML_DESCEND);
|
||||||
|
if(item) // a version entry exists
|
||||||
{
|
{
|
||||||
updateChecked = true;
|
const char * version = mxmlElementGetAttr(item, "version");
|
||||||
u8 tmpbuffer[256];
|
|
||||||
|
|
||||||
if (http_request("http://vba-wii.googlecode.com/svn/trunk/update.xml", NULL, tmpbuffer, 256, SILENT) > 0)
|
if(version && strlen(version) == 5)
|
||||||
{
|
{
|
||||||
mxml_node_t *xml;
|
int verMajor = version[0] - '0';
|
||||||
mxml_node_t *item;
|
int verMinor = version[2] - '0';
|
||||||
|
int verPoint = version[4] - '0';
|
||||||
|
int curMajor = APPVERSION[0] - '0';
|
||||||
|
int curMinor = APPVERSION[2] - '0';
|
||||||
|
int curPoint = APPVERSION[4] - '0';
|
||||||
|
|
||||||
xml = mxmlLoadString(NULL, (char *)tmpbuffer, MXML_TEXT_CALLBACK);
|
// check that the versioning is valid and is a newer version
|
||||||
|
if((verMajor >= 0 && verMajor <= 9 &&
|
||||||
if(xml)
|
verMinor >= 0 && verMinor <= 9 &&
|
||||||
|
verPoint >= 0 && verPoint <= 9) &&
|
||||||
|
(verMajor > curMajor ||
|
||||||
|
(verMajor == curMajor && verMinor > curMinor) ||
|
||||||
|
(verMajor == curMajor && verMinor == curMinor && verPoint > curPoint)))
|
||||||
{
|
{
|
||||||
// check settings version
|
item = mxmlFindElement(xml, xml, "file", NULL, NULL, MXML_DESCEND);
|
||||||
item = mxmlFindElement(xml, xml, "app", "version", NULL, MXML_DESCEND);
|
if(item)
|
||||||
if(item) // a version entry exists
|
|
||||||
{
|
{
|
||||||
const char * version = mxmlElementGetAttr(item, "version");
|
const char * tmp = mxmlElementGetAttr(item, "url");
|
||||||
|
if(tmp)
|
||||||
if(version && strlen(version) == 5)
|
|
||||||
{
|
{
|
||||||
int verMajor = version[0] - '0';
|
snprintf(updateURL, 128, "%s", tmp);
|
||||||
int verMinor = version[2] - '0';
|
updateFound = true;
|
||||||
int verPoint = version[4] - '0';
|
|
||||||
int curMajor = APPVERSION[0] - '0';
|
|
||||||
int curMinor = APPVERSION[2] - '0';
|
|
||||||
int curPoint = APPVERSION[4] - '0';
|
|
||||||
|
|
||||||
// check that the versioning is valid and is a newer version
|
|
||||||
if((verMajor >= 0 && verMajor <= 9 &&
|
|
||||||
verMinor >= 0 && verMinor <= 9 &&
|
|
||||||
verPoint >= 0 && verPoint <= 9) &&
|
|
||||||
(verMajor > curMajor ||
|
|
||||||
(verMajor == curMajor && verMinor > curMinor) ||
|
|
||||||
(verMajor == curMajor && verMinor == curMinor && verPoint > curPoint)))
|
|
||||||
{
|
|
||||||
item = mxmlFindElement(xml, xml, "file", NULL, NULL, MXML_DESCEND);
|
|
||||||
if(item)
|
|
||||||
{
|
|
||||||
const char * tmp = mxmlElementGetAttr(item, "url");
|
|
||||||
if(tmp)
|
|
||||||
{
|
|
||||||
snprintf(updateURL, 128, "%s", tmp);
|
|
||||||
updateFound = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mxmlDelete(xml);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mxmlDelete(xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool unzipArchive(char * zipfilepath, char * unzipfolderpath)
|
static bool unzipArchive(char * zipfilepath, char * unzipfolderpath)
|
||||||
|
Loading…
Reference in New Issue
Block a user