mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-22 19:29:18 +01:00
For people who use two partitions (FAT32 and WBFS), wiitdb.zip won't be overwritten anymore when they update. The file is now loaded and saved as wiitdb_(partition).zip, so you can switch partitions and keep titles/infos. If wiitdb_(partition).zip is not found it loads wiitdb.zip. When exiting settings, the partition is now reloaded only when needed. WiiTDB update should work again for people who own more than 240 games. Fixed a rare crash that could be issue 1083.
This commit is contained in:
parent
b70af2d71d
commit
c97c887775
@ -147,5 +147,12 @@ int MenuCheck() {
|
|||||||
SDCard_Init();
|
SDCard_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// open database if needed, load titles if needed
|
||||||
|
OpenXMLDatabase(Settings.titlestxt_path,Settings.db_language, Settings.db_JPtoEN, true, Settings.titlesOverride==1?true:false, true);
|
||||||
|
|
||||||
|
// titles.txt loaded after database to override database titles with custom titles
|
||||||
|
//snprintf(pathname, sizeof(pathname), "%stitles.txt", Settings.titlestxt_path);
|
||||||
|
//cfg_parsefile(pathname, &title_set);
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
@ -175,8 +175,8 @@ struct block downloadfile(const char *url) {
|
|||||||
|
|
||||||
//Form a nice request header to send to the webserver
|
//Form a nice request header to send to the webserver
|
||||||
char* headerformat = "GET %s HTTP/1.0\r\nHost: %s\r\nReferer: %s\r\nUser-Agent: USBLoaderGX r%s\r\n\r\n";;
|
char* headerformat = "GET %s HTTP/1.0\r\nHost: %s\r\nReferer: %s\r\nUser-Agent: USBLoaderGX r%s\r\n\r\n";;
|
||||||
char header[strlen(headerformat) + strlen(domain) + strlen(path)+strlen(url)];
|
char header[strlen(headerformat) + strlen(path) + strlen(domain) + strlen(domain)];
|
||||||
sprintf(header, headerformat, path, domain, url, GetRev());
|
sprintf(header, headerformat, path, domain, domain, GetRev());
|
||||||
|
|
||||||
//Do the request and get the response
|
//Do the request and get the response
|
||||||
send_message(connection, header);
|
send_message(connection, header);
|
||||||
|
@ -57,6 +57,7 @@ extern u8 shutdown;
|
|||||||
extern u8 reset;
|
extern u8 reset;
|
||||||
extern u8 mountMethod;
|
extern u8 mountMethod;
|
||||||
extern struct discHdr *dvdheader;
|
extern struct discHdr *dvdheader;
|
||||||
|
extern char game_partition[6];
|
||||||
|
|
||||||
/*** Extern functions ***/
|
/*** Extern functions ***/
|
||||||
extern void ResumeGui();
|
extern void ResumeGui();
|
||||||
@ -2640,8 +2641,8 @@ int ProgressUpdateWindow() {
|
|||||||
char wiitdbpathtmp[200];
|
char wiitdbpathtmp[200];
|
||||||
struct block file = downloadfile(XMLurl);
|
struct block file = downloadfile(XMLurl);
|
||||||
if (file.data != NULL) {
|
if (file.data != NULL) {
|
||||||
snprintf(wiitdbpath, sizeof(wiitdbpath), "%swiitdb.zip", Settings.titlestxt_path);
|
snprintf(wiitdbpath, sizeof(wiitdbpath), "%swiitdb_%s.zip", Settings.titlestxt_path,game_partition);
|
||||||
snprintf(wiitdbpathtmp, sizeof(wiitdbpathtmp), "%swiitmp.zip", Settings.titlestxt_path);
|
snprintf(wiitdbpathtmp, sizeof(wiitdbpathtmp), "%swiitmp_%s.zip", Settings.titlestxt_path,game_partition);
|
||||||
rename(wiitdbpath,wiitdbpathtmp);
|
rename(wiitdbpath,wiitdbpathtmp);
|
||||||
pfile = fopen(wiitdbpath, "wb");
|
pfile = fopen(wiitdbpath, "wb");
|
||||||
fwrite(file.data,1,file.size,pfile);
|
fwrite(file.data,1,file.size,pfile);
|
||||||
@ -3020,8 +3021,8 @@ int ProgressUpdateWindow() {
|
|||||||
file = downloadfile(XMLurl);
|
file = downloadfile(XMLurl);
|
||||||
if (file.data != NULL) {
|
if (file.data != NULL) {
|
||||||
subfoldercreate(Settings.titlestxt_path);
|
subfoldercreate(Settings.titlestxt_path);
|
||||||
snprintf(wiitdbpath, sizeof(wiitdbpath), "%swiitdb.zip", Settings.titlestxt_path);
|
snprintf(wiitdbpath, sizeof(wiitdbpath), "%swiitdb_%s.zip", Settings.titlestxt_path,game_partition);
|
||||||
snprintf(wiitdbpathtmp, sizeof(wiitdbpathtmp), "%swiitmp.zip", Settings.titlestxt_path);
|
snprintf(wiitdbpathtmp, sizeof(wiitdbpathtmp), "%swiitmp_%s.zip", Settings.titlestxt_path,game_partition);
|
||||||
rename(wiitdbpath,wiitdbpathtmp);
|
rename(wiitdbpath,wiitdbpathtmp);
|
||||||
pfile = fopen(wiitdbpath, "wb");
|
pfile = fopen(wiitdbpath, "wb");
|
||||||
fwrite(file.data,1,file.size,pfile);
|
fwrite(file.data,1,file.size,pfile);
|
||||||
@ -3058,8 +3059,8 @@ int ProgressUpdateWindow() {
|
|||||||
struct block file = downloadfile(XMLurl);
|
struct block file = downloadfile(XMLurl);
|
||||||
if (file.data != NULL) {
|
if (file.data != NULL) {
|
||||||
subfoldercreate(Settings.titlestxt_path);
|
subfoldercreate(Settings.titlestxt_path);
|
||||||
snprintf(wiitdbpath, sizeof(wiitdbpath), "%swiitdb.zip", Settings.titlestxt_path);
|
snprintf(wiitdbpath, sizeof(wiitdbpath), "%swiitdb_%s.zip", Settings.titlestxt_path,game_partition);
|
||||||
snprintf(wiitdbpathtmp, sizeof(wiitdbpathtmp), "%swiitmp.zip", Settings.titlestxt_path);
|
snprintf(wiitdbpathtmp, sizeof(wiitdbpathtmp), "%swiitmp_%s.zip", Settings.titlestxt_path,game_partition);
|
||||||
rename(wiitdbpath,wiitdbpathtmp);
|
rename(wiitdbpath,wiitdbpathtmp);
|
||||||
FILE *pfile = fopen(wiitdbpath, "wb");
|
FILE *pfile = fopen(wiitdbpath, "wb");
|
||||||
fwrite(file.data,1,file.size,pfile);
|
fwrite(file.data,1,file.size,pfile);
|
||||||
|
@ -42,13 +42,11 @@ int showGameInfo(char *ID) {
|
|||||||
HaltGui();//put this first to try to get rid of the code dump caused by loading this window at the same time as loading images from the SD card
|
HaltGui();//put this first to try to get rid of the code dump caused by loading this window at the same time as loading images from the SD card
|
||||||
mainWindow->SetState(STATE_DISABLED);
|
mainWindow->SetState(STATE_DISABLED);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
//load the xml shit
|
|
||||||
bool databaseopened = true;
|
bool databaseopened = true;
|
||||||
//OpenXMLDatabase(Settings.titlestxt_path, Settings.db_language, Settings.db_JPtoEN, true, false, true); // open file, do not load titles, keep in memory
|
|
||||||
if (databaseopened) {
|
if (databaseopened) {
|
||||||
|
|
||||||
LoadGameInfoFromXML(ID, Settings.db_language);
|
LoadGameInfoFromXML(ID, Settings.db_language);
|
||||||
//CloseXMLDatabase();
|
|
||||||
|
|
||||||
bool showmeminfo = false;
|
bool showmeminfo = false;
|
||||||
|
|
||||||
@ -711,17 +709,19 @@ int showGameInfo(char *ID) {
|
|||||||
wifiY-=20;
|
wifiY-=20;
|
||||||
gameinfoWindow.Append(wifiTxt[i]);
|
gameinfoWindow.Append(wifiTxt[i]);
|
||||||
}
|
}
|
||||||
if (strcmp(gameinfo.wififeatures[1],"") != 0) {
|
if (strcmp(gameinfo.wififeatures[1],"") !=0) {
|
||||||
snprintf(linebuf, sizeof(linebuf), "%s:",tr("WiFi Features"));
|
snprintf(linebuf, sizeof(linebuf), "%s:",tr("WiFi Features"));
|
||||||
wifiTxt[0] = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
} else {
|
||||||
wifiTxt[0]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
strcpy(linebuf,"");
|
||||||
wifiTxt[0]->SetPosition(205,200+wifiY);
|
|
||||||
gameinfoWindow.Append(wifiTxt[0]);
|
|
||||||
}
|
}
|
||||||
|
wifiTxt[0] = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
||||||
|
wifiTxt[0]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||||
|
wifiTxt[0]->SetPosition(205,200+wifiY);
|
||||||
|
gameinfoWindow.Append(wifiTxt[0]);
|
||||||
|
|
||||||
//synopsis
|
//synopsis
|
||||||
int pagesize=12;
|
int pagesize=12;
|
||||||
if (strcmp(gameinfo.synopsis,"") != 0) {
|
if (strcmp(gameinfo.synopsis,"") !=0) {
|
||||||
snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.synopsis);
|
snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.synopsis);
|
||||||
synopsisTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
synopsisTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
||||||
synopsisTxt->SetMaxWidth(350,GuiText::WRAP);
|
synopsisTxt->SetMaxWidth(350,GuiText::WRAP);
|
||||||
@ -1112,7 +1112,7 @@ void MemInfoPrompt()
|
|||||||
|
|
||||||
void build_XML_URL(char *XMLurl, int XMLurlsize) {
|
void build_XML_URL(char *XMLurl, int XMLurlsize) {
|
||||||
__Menu_GetEntries(1);
|
__Menu_GetEntries(1);
|
||||||
// NET_BUFFER_SIZE in http.c needs to be set to size of XMLurl + 40
|
// NET_BUFFER_SIZE in http.c needs to be set to size of XMLurl + headerformat
|
||||||
char url[3540];
|
char url[3540];
|
||||||
char filename[10];
|
char filename[10];
|
||||||
snprintf(url,sizeof(url),"http://wiitdb.com/wiitdb.zip?LANG=%s&ID=", Settings.db_language);
|
snprintf(url,sizeof(url),"http://wiitdb.com/wiitdb.zip?LANG=%s&ID=", Settings.db_language);
|
||||||
|
@ -19,13 +19,13 @@
|
|||||||
#include "cfg.h"
|
#include "cfg.h"
|
||||||
#include "usbloader/partition_usbloader.h"
|
#include "usbloader/partition_usbloader.h"
|
||||||
#include "usbloader/utils.h"
|
#include "usbloader/utils.h"
|
||||||
|
#include "xml/xml.h"
|
||||||
|
|
||||||
#define MAXOPTIONS 13
|
#define MAXOPTIONS 13
|
||||||
|
|
||||||
/*** Extern functions ***/
|
/*** Extern functions ***/
|
||||||
extern void ResumeGui();
|
extern void ResumeGui();
|
||||||
extern void HaltGui();
|
extern void HaltGui();
|
||||||
extern bool Database(char* xmlfilepath, char* argdblang, bool argJPtoEN, bool openfile, bool loadtitles, bool keepopen);
|
|
||||||
extern void titles_default();
|
extern void titles_default();
|
||||||
|
|
||||||
/*** Extern variables ***/
|
/*** Extern variables ***/
|
||||||
@ -73,6 +73,9 @@ int MenuSettings()
|
|||||||
strcpy(opt_lang,Settings.language_path);
|
strcpy(opt_lang,Settings.language_path);
|
||||||
// backup title override setting
|
// backup title override setting
|
||||||
int opt_override = Settings.titlesOverride;
|
int opt_override = Settings.titlesOverride;
|
||||||
|
// backup partition index
|
||||||
|
u8 settingspartitionold = Settings.partition;
|
||||||
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -2052,23 +2055,30 @@ int MenuSettings()
|
|||||||
w.SetEffect(EFFECT_FADE, -20);
|
w.SetEffect(EFFECT_FADE, -20);
|
||||||
while (w.GetEffect()>0) usleep(50);
|
while (w.GetEffect()>0) usleep(50);
|
||||||
|
|
||||||
|
// if partition has changed, Reinitialize it
|
||||||
|
PartInfo pinfo = partitions.pinfo[Settings.partition];
|
||||||
|
load_from_fat = pinfo.fs_type == FS_TYPE_FAT32;
|
||||||
|
if (Settings.partition != settingspartitionold) {
|
||||||
|
WBFS_Close();
|
||||||
|
WBFS_OpenPart(load_from_fat, Settings.partition, partitions.pentry[Settings.partition].sector, partitions.pentry[Settings.partition].size, (char *) &game_partition);
|
||||||
|
}
|
||||||
|
|
||||||
// if language has changed, reload titles
|
// if language has changed, reload titles
|
||||||
char opt_langnew[100];
|
char opt_langnew[100];
|
||||||
strcpy(opt_langnew,Settings.language_path);
|
strcpy(opt_langnew,Settings.language_path);
|
||||||
int opt_overridenew = Settings.titlesOverride;
|
int opt_overridenew = Settings.titlesOverride;
|
||||||
if (strcmp(opt_lang,opt_langnew) || (opt_override != opt_overridenew && Settings.titlesOverride==1))
|
bool reloaddatabasefile = false;
|
||||||
OpenXMLDatabase(Settings.titlestxt_path, Settings.db_language, Settings.db_JPtoEN, false, Settings.titlesOverride==1?true:false, true); // open file, reload titles, keep in memory
|
if (strcmp(opt_lang,opt_langnew) || (opt_override != opt_overridenew && Settings.titlesOverride==1) || (Settings.partition != settingspartitionold)) {
|
||||||
// disable titles from database
|
if (Settings.partition != settingspartitionold) {
|
||||||
|
reloaddatabasefile = true;
|
||||||
|
CloseXMLDatabase();
|
||||||
|
}
|
||||||
|
OpenXMLDatabase(Settings.titlestxt_path, Settings.db_language, Settings.db_JPtoEN, reloaddatabasefile, Settings.titlesOverride==1?true:false, true); // open file, reload titles, keep in memory
|
||||||
|
}
|
||||||
|
// disable titles from database if setting has changed
|
||||||
if (opt_override != opt_overridenew && Settings.titlesOverride==0)
|
if (opt_override != opt_overridenew && Settings.titlesOverride==0)
|
||||||
titles_default();
|
titles_default();
|
||||||
|
|
||||||
// Reinitialize WBFS partition, it might have changed
|
|
||||||
PartInfo pinfo = partitions.pinfo[Settings.partition];
|
|
||||||
load_from_fat = pinfo.fs_type == FS_TYPE_FAT32;
|
|
||||||
WBFS_Close();
|
|
||||||
WBFS_OpenPart(load_from_fat, Settings.partition, partitions.pentry[Settings.partition].sector, partitions.pentry[Settings.partition].size, (char *) &game_partition);
|
|
||||||
|
|
||||||
HaltGui();
|
HaltGui();
|
||||||
|
|
||||||
mainWindow->RemoveAll();
|
mainWindow->RemoveAll();
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <ogcsys.h>
|
#include <ogcsys.h>
|
||||||
#include <mxml.h>
|
|
||||||
|
|
||||||
#include "language/gettext.h"
|
#include "language/gettext.h"
|
||||||
#include "listfiles.h"
|
#include "listfiles.h"
|
||||||
@ -1771,15 +1770,6 @@ void CFG_Load(void) {
|
|||||||
if (CONF_GetArea() == CONF_AREA_AUS)
|
if (CONF_GetArea() == CONF_AREA_AUS)
|
||||||
strcpy(Settings.db_language,"AU");
|
strcpy(Settings.db_language,"AU");
|
||||||
|
|
||||||
// open database if needed, load titles if needed
|
|
||||||
OpenXMLDatabase(Settings.titlestxt_path,Settings.db_language, Settings.db_JPtoEN, true, Settings.titlesOverride==1?true:false, true);
|
|
||||||
|
|
||||||
// titles.txt loaded after database to override database titles with custom titles
|
|
||||||
//took out this titles.txt shit because it is useless now. teh xml has all the titles in it
|
|
||||||
//snprintf(pathname, sizeof(pathname), "%stitles.txt", Settings.titlestxt_path);
|
|
||||||
//cfg_parsefile(pathname, &title_set);
|
|
||||||
|
|
||||||
// cfg_parsearg(argc, argv);
|
|
||||||
// if GUI language is set to default Settings.language_path needs to remain "notset" (if the detected setting was kept detection wouldn't work next time)
|
// if GUI language is set to default Settings.language_path needs to remain "notset" (if the detected setting was kept detection wouldn't work next time)
|
||||||
if (langisdefault)
|
if (langisdefault)
|
||||||
sprintf(Settings.language_path, "notset");
|
sprintf(Settings.language_path, "notset");
|
||||||
|
@ -11,18 +11,18 @@ Load game information from XML - Lustar
|
|||||||
//#include "cfg.h"
|
//#include "cfg.h"
|
||||||
//#include "xml.h"
|
//#include "xml.h"
|
||||||
|
|
||||||
|
extern struct SSettings Settings; // for loader GX
|
||||||
|
extern void title_set(char *id, char *title);
|
||||||
|
extern char* trimcopy(char *dest, char *src, int size);
|
||||||
|
extern char game_partition[6];
|
||||||
|
|
||||||
|
|
||||||
/* config */
|
/* config */
|
||||||
static bool xmldebug = false;
|
static bool xmldebug = false;
|
||||||
static char xmlcfg_filename[100] = "wiitdb.zip";
|
static char xmlcfg_filename[100] = "wiitdb";
|
||||||
static int xmlmaxsize = 1572864;
|
static int xmlmaxsize = 1572864;
|
||||||
|
|
||||||
|
|
||||||
extern struct SSettings Settings; // for loader GX
|
|
||||||
|
|
||||||
extern void title_set(char *id, char *title);
|
|
||||||
extern char* trimcopy(char *dest, char *src, int size);
|
|
||||||
|
|
||||||
struct gameXMLinfo gameinfo;
|
struct gameXMLinfo gameinfo;
|
||||||
struct gameXMLinfo gameinfo_reset;
|
struct gameXMLinfo gameinfo_reset;
|
||||||
|
|
||||||
@ -72,9 +72,11 @@ bool OpenXMLDatabase(char* xmlfilepath, char* argdblang, bool argJPtoEN, bool op
|
|||||||
char pathname[200];
|
char pathname[200];
|
||||||
snprintf(pathname, sizeof(pathname), "%s", xmlfilepath);
|
snprintf(pathname, sizeof(pathname), "%s", xmlfilepath);
|
||||||
if (xmlfilepath[strlen(xmlfilepath) - 1] != '/') snprintf(pathname, sizeof(pathname), "%s/",pathname);
|
if (xmlfilepath[strlen(xmlfilepath) - 1] != '/') snprintf(pathname, sizeof(pathname), "%s/",pathname);
|
||||||
snprintf(pathname, sizeof(pathname), "%s%s", pathname, xmlcfg_filename);
|
snprintf(pathname, sizeof(pathname), "%s%s_%s.zip", pathname, xmlcfg_filename, game_partition);
|
||||||
if (openfile) opensuccess = OpenXMLFile(pathname);
|
if (openfile) opensuccess = OpenXMLFile(pathname);
|
||||||
if (!opensuccess) {
|
if (!opensuccess) {
|
||||||
|
snprintf(pathname, sizeof(pathname), "%s", xmlfilepath);
|
||||||
|
if (xmlfilepath[strlen(xmlfilepath) - 1] != '/') snprintf(pathname, sizeof(pathname), "%s/",pathname);
|
||||||
snprintf(pathname, sizeof(pathname), "%swiitdb.zip", pathname);
|
snprintf(pathname, sizeof(pathname), "%swiitdb.zip", pathname);
|
||||||
if (openfile) opensuccess = OpenXMLFile(pathname);
|
if (openfile) opensuccess = OpenXMLFile(pathname);
|
||||||
}
|
}
|
||||||
@ -387,7 +389,7 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
char langcode[100] = "";
|
char langcode[100] = "";
|
||||||
if (!strcmp(langtxt,""))
|
if (!strcmp(langtxt,""))
|
||||||
langtxt = GetLangSettingFromGame(gameid);
|
langtxt = GetLangSettingFromGame(gameid);
|
||||||
strcpy(langcode,ConvertLangTextToCode(langtxt));
|
strlcpy(langcode,ConvertLangTextToCode(langtxt),sizeof(langcode));
|
||||||
|
|
||||||
/* reset all game info */
|
/* reset all game info */
|
||||||
gameinfo = gameinfo_reset;
|
gameinfo = gameinfo_reset;
|
||||||
|
@ -36,7 +36,7 @@ EOF
|
|||||||
echo >&2
|
echo >&2
|
||||||
|
|
||||||
rev_new=`expr $rev_new + 1`
|
rev_new=`expr $rev_new + 1`
|
||||||
rev_date=`date +%Y%m%d%k%M`
|
rev_date=`date +%Y%m%d%H%M -u`
|
||||||
|
|
||||||
cat <<EOF > ./HBC/META.XML
|
cat <<EOF > ./HBC/META.XML
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
Loading…
Reference in New Issue
Block a user