From f4758ca9c4145ef3cdd64de2e400e31273934271 Mon Sep 17 00:00:00 2001 From: "lustar.mii" Date: Fri, 9 Oct 2009 06:13:08 +0000 Subject: [PATCH] Fixed WiiTDB update for people who own more than 240 games. The custom URL now uses the full game ID to account for the recent proliferation of game IDs. Changed user agent so that the loader identifies itself as "USBLoaderGX (revision number)". Canceling the txt/csv export prompt will now close it without saving any file. Possible fix for issue 991 (endless rumble when changing theme path). --- gui.pnproj | 2 +- gui.pnps | 2 +- source/menu.cpp | 18 ++++++++---------- source/network/http.c | 9 +++++---- source/prompts/PromptWindows.cpp | 10 ++++++---- source/prompts/gameinfo.cpp | 10 ++++++---- source/settings/Settings.cpp | 2 ++ 7 files changed, 29 insertions(+), 24 deletions(-) diff --git a/gui.pnproj b/gui.pnproj index 0f61edd0..79647554 100644 --- a/gui.pnproj +++ b/gui.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/gui.pnps b/gui.pnps index 2154a81b..bef7a483 100644 --- a/gui.pnps +++ b/gui.pnps @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/menu.cpp b/source/menu.cpp index d552e552..d074e9ea 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -945,20 +945,18 @@ int MenuDiscList() { } } else if (gamecntBtn.GetState() == STATE_CLICKED && mountMethod!=3) { - + gamecntBtn.ResetState(); char linebuf[150]; snprintf(linebuf, sizeof(linebuf), "%s %sGameList ?",tr("Save Game List to"), Settings.update_path); - - choice = WindowPrompt(0,linebuf, "txt","csv",tr("Back")); - - if (save_gamelist(choice-1)) - WindowPrompt(0,tr("Saved"), tr("OK")); - else - WindowPrompt(tr("Error"),tr("Could not save."), tr("OK")); + choice = WindowPrompt(0,linebuf,"TXT","CSV",tr("Back")); + if (choice) { + if (save_gamelist(choice-1)) + WindowPrompt(0,tr("Saved"),tr("OK")); + else + WindowPrompt(tr("Error"),tr("Could not save."),tr("OK")); + } menu = MENU_DISCLIST; break; - - //gamecntBtn.ResetState(); } else if (homeBtn.GetState() == STATE_CLICKED) { s32 thetimeofbg = bgMusic->GetPlayTime(); diff --git a/source/network/http.c b/source/network/http.c index 948789fe..116e517a 100644 --- a/source/network/http.c +++ b/source/network/http.c @@ -1,5 +1,5 @@ #include "http.h" - +#include "../svnrev.h" extern char incommingIP[50]; @@ -10,7 +10,8 @@ extern char incommingIP[50]; const struct block emptyblock = {0, NULL}; //The maximum amount of bytes to send per net_write() call -#define NET_BUFFER_SIZE 1024 +//#define NET_BUFFER_SIZE 1024 +#define NET_BUFFER_SIZE 3600 // Write our message to the server static s32 send_message(s32 server, char *msg) { @@ -173,9 +174,9 @@ struct block downloadfile(const char *url) { } //Form a nice request header to send to the webserver - char* headerformat = "GET %s HTTP/1.0\r\nHost: %s\r\nUser-Agent: WiiEarthh 1.0\r\n\r\n";; + char* headerformat = "GET %s HTTP/1.0\r\nHost: %s\r\nUser-Agent: USBLoaderGX r%s\r\n\r\n";; char header[strlen(headerformat) + strlen(domain) + strlen(path)]; - sprintf(header, headerformat, path, domain); + sprintf(header, headerformat, path, domain, GetRev()); //Do the request and get the response send_message(connection, header); diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index d561c7c7..436244d7 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -2488,16 +2488,18 @@ int ProgressUpdateWindow() { } //make the URL to get XML based on our games - char XMLurl[2040]; + char XMLurl[3540]; // NET_BUFFER_SIZE in http.c needs to be set to size of XMLurl + 40 char filename[10]; __Menu_GetEntries(1); - snprintf(XMLurl,sizeof(XMLurl),"http://wiitdb.com/wiitdb.zip?LANG=%s?ID=",Settings.db_language); + snprintf(XMLurl,sizeof(XMLurl),"http://wiitdb.com/wiitdb.zip?LANG=%s&ID=",Settings.db_language); unsigned int i; for (i = 0; i < gameCnt ; i++) { struct discHdr* header = &gameList[i]; if (i<500) { - snprintf(filename,sizeof(filename),"%c%c%c", header->id[1], header->id[2], header->id[3]); - strncat(XMLurl, filename,3 ); + //snprintf(filename,sizeof(filename),"%c%c%c", header->id[1], header->id[2], header->id[3]); + //strncat(XMLurl,filename,3); + snprintf(filename,sizeof(filename),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); + strncat(XMLurl,filename,6); if ((i!=gameCnt-1)&&(i<500)) strncat(XMLurl, ",",1); } diff --git a/source/prompts/gameinfo.cpp b/source/prompts/gameinfo.cpp index e3f56ff9..0dceeaef 100644 --- a/source/prompts/gameinfo.cpp +++ b/source/prompts/gameinfo.cpp @@ -1085,16 +1085,18 @@ bool save_XML_URL() { // save xml url as as txt file for people without wifi //make sure that all games are added to the gamelist __Menu_GetEntries(1); - char XMLurl[2040]; + char XMLurl[3540]; char filename[10]; - snprintf(XMLurl,sizeof(XMLurl),"http://wiitdb.com/wiitdb.zip?LANG=%s?ID=", Settings.db_language); + snprintf(XMLurl,sizeof(XMLurl),"http://wiitdb.com/wiitdb.zip?LANG=%s&ID=", Settings.db_language); unsigned int i; for (i = 0; i < gameCnt ; i++) { struct discHdr* header = &gameList[i]; if (i<500) { - snprintf(filename,sizeof(filename),"%c%c%c", header->id[1], header->id[2], header->id[3]); - strncat(XMLurl, filename,3 ); + //snprintf(filename,sizeof(filename),"%c%c%c", header->id[1], header->id[2], header->id[3]); + //strncat(XMLurl, filename,3 ); + snprintf(filename,sizeof(filename),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); + strncat(XMLurl,filename,6); if ((i!=gameCnt-1)&&(i<500)) strncat(XMLurl, ",",1); } diff --git a/source/settings/Settings.cpp b/source/settings/Settings.cpp index eee444da..1c3142b8 100644 --- a/source/settings/Settings.cpp +++ b/source/settings/Settings.cpp @@ -1353,8 +1353,10 @@ int MenuSettings() { cfg_save_global(); } mainWindow->Remove(bgImg); + HaltGui(); CFG_Load(); CFG_LoadGlobal(); + ResumeGui(); menu = MENU_SETTINGS; #ifdef HW_RVL snprintf(imgPath, sizeof(imgPath), "%splayer1_point.png", CFG.theme_path);