From 18489a8858ef8fab1e85750d7b1bba0867ef3084 Mon Sep 17 00:00:00 2001 From: giantpune Date: Sat, 18 Jul 2009 11:04:13 +0000 Subject: [PATCH] load xml at startup and keep it in memory instead of each time the game info is called. it adds 1 second to my startup time with 100+ games. just testing to see if breaks anything doing it like this now that the xml is much smaller. --- source/menu.cpp | 3 ++- source/prompts/DiscBrowser.cpp | 10 ++++++++-- source/prompts/gameinfo.cpp | 2 ++ source/settings/cfg.c | 4 ++-- source/xml/xml.c | 3 +++ source/xml/xml.h | 3 +-- 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/source/menu.cpp b/source/menu.cpp index d266ee60..a7fb01a2 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -39,6 +39,7 @@ #include "listfiles.h" #include "fatmounter.h" #include "buffer.h" +#include "xml/xml.h" #include "usbloader/wdvd.h" @@ -1740,7 +1741,7 @@ int MainMenu(int menu) } - + CloseXMLDatabase(); ExitGUIThreads(); bgMusic->Stop(); delete bgMusic; diff --git a/source/prompts/DiscBrowser.cpp b/source/prompts/DiscBrowser.cpp index 8aabb5db..f94e53ec 100644 --- a/source/prompts/DiscBrowser.cpp +++ b/source/prompts/DiscBrowser.cpp @@ -261,21 +261,27 @@ int autoSelectDol(const char *id) if (strcmp(id,"RMZX69") == 0) return 492; if (strcmp(id,"RMZP69") == 0) return 492; - //if (strcmp(id,"REDP41") == 0) return 1957; + if (strcmp(id,"REDP41") == 0) return 1957; if (strcmp(id,"RSXP69") == 0) return 337; if (strcmp(id,"RNBX69") == 0) return 964; + if (strcmp(id,"RNFP69") == 0) return 1079; + if (strcmp(id,"RMLP7U") == 0) return 56; if (strcmp(id,"RKMP5D") == 0) return 290; + if (strcmp(id,"R5TP69") == 0) return 1493; + if (strcmp(id,"RHDP8P") == 0) return 149; -/* +/* Grand Slam R5TP69 1493 + Madden NFL08 RNFP69 1079 + Fifa08 RF8P69 463 Fifa08 RF8X69 464 Wii Sports Resort RZTP01 952 diff --git a/source/prompts/gameinfo.cpp b/source/prompts/gameinfo.cpp index adc179a3..f8336bee 100644 --- a/source/prompts/gameinfo.cpp +++ b/source/prompts/gameinfo.cpp @@ -24,6 +24,8 @@ extern GuiWindow * mainWindow; extern GuiSound * bgMusic; extern u8 shutdown; extern u8 reset; +extern struct gameXMLinfo gameinfo; +extern struct gameXMLinfo gameinfo_reset; /*** Extern functions ***/ extern void ResumeGui(); diff --git a/source/settings/cfg.c b/source/settings/cfg.c index 11c3a9ca..628c2b8d 100644 --- a/source/settings/cfg.c +++ b/source/settings/cfg.c @@ -1718,8 +1718,8 @@ void CFG_Load(void) Global_Default(); //global default depends on theme information CFG_LoadGlobal(); - if (Settings.titlesOverride==1) OpenXMLDatabase(Settings.titlestxt_path, Settings.db_language, Settings.db_JPtoEN, true, true, false); // open file, load titles, do not keep in memory - + //if (Settings.titlesOverride==1) OpenXMLDatabase(Settings.titlestxt_path, Settings.db_language, Settings.db_JPtoEN, true, true, false); // open file, load titles, do not keep in memory +OpenXMLDatabase(Settings.titlestxt_path, Settings.db_language, Settings.db_JPtoEN, true, Settings.titlesOverride==1?true:false, true); // loaded after database to override database titles with custom titles snprintf(pathname, sizeof(pathname), "%stitles.txt", Settings.titlestxt_path); cfg_parsefile(pathname, &title_set); diff --git a/source/xml/xml.c b/source/xml/xml.c index e129bfab..14faf64c 100644 --- a/source/xml/xml.c +++ b/source/xml/xml.c @@ -21,6 +21,9 @@ static char xmlcfg_filename[100] = "wiitdb.zip"; extern struct SSettings Settings; // for loader GX +struct gameXMLinfo gameinfo; +struct gameXMLinfo gameinfo_reset; + static char langlist[11][22] = diff --git a/source/xml/xml.h b/source/xml/xml.h index 82a909ef..c52b3d58 100644 --- a/source/xml/xml.h +++ b/source/xml/xml.h @@ -56,8 +56,7 @@ struct gameXMLinfo char iso_sha1[41]; } ; -struct gameXMLinfo gameinfo; -struct gameXMLinfo gameinfo_reset; + bool OpenXMLFile(char* filename); void LoadTitlesFromXML(char *langcode, bool forcejptoen);