From 65a0d1bc59c0c21d6ecfc395999a6df2b1fbde31 Mon Sep 17 00:00:00 2001 From: Fledge68 Date: Sat, 24 Aug 2019 17:21:06 -0500 Subject: [PATCH] - minor coding changes for creating game lists. nothing new for end users. --- out/boot.dol | Bin 3516320 -> 3516320 bytes source/list/ListGenerator.cpp | 37 +++++++++++++++++++++------------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/out/boot.dol b/out/boot.dol index 9aebf155d459cef9b6e277864b060978ba6f9c3b..25b220bed18367d9599d3d527b1a014581a9674b 100644 GIT binary patch delta 479 zcmWm8&r8#B7zc2k%{70mr+qh@nZHwKwQ`oWV!91FMcz6}2O;5m5C?NN4=(+{SJ1;~ z!l#yzLgCjh!9a(fFPO+cL?W06$$^J16&?Z+`vZD=c=6`pf%o&Qlz-3)WCRI^aEdD7 z5?6#E9yjj(X)0)r^-C^9J}e%$W%NkQ@I+ksU+yZz9K^`;u#2$(+|1Lxu zhd0#7M?N94RqrY%-E=PBnz%*MHhG&~%Je$VkYD~==jZguNLUQlRKoI3`OsV3@ov`Q zXZ^rCYEen;rL?mMnW|`Mg(})muL|0>6Lb5fHeHWg-qqNJ{IaLL7^Cu5k1t1;-v@nh z8#PBieYrnWGW2~vG$?)l`rKEX`8ykU8X(;W=L66PH=qe_LNl~LE3`p7bU-KEf-dNW z9tc7&+=e?UoWJ|{lg!3KO|HIFGMSdiSg1o M^h^0a4=y_X0|{=rcK`qY delta 508 zcmWm8!Ap~I7zgn8*<4%ddfGd4mZg^EtaL6*W-Qw(grpq=y>*bJVuxVi1|2%I@(1ss z4x>rGS__Se&6i*YU;4dd(P1J%K@&m;9y;kkf)4fv^zHEB`}}?nJkPW6W1SWtD@Ztm zQ#1&d*dyG+Ble0$(IlEJZ>dH*s$BDKxM|18*1alQ-xsl|D(xJ1(weI0xJ2|!W}ot` ztN3tiq$oXkeoSxFT%I?a$UBmQ4oa%I7aSqFE58>wO*s{R$xRNl6R&ueyk_*geIZ)h zszlpHER~q&O`?yg_cf>7v@4&NvCAp#GB4AV%q;Q)YL$N%`5Fxyag$-cikrT)A9JnG zzNJRooc!v$ZcYU}JLtoi*Ya3w%FBU}hT8yti~&<=;;2y{Rvbiq+L z2HkKRPCyR?p%+fVDHSf99)9Z?m`SBFnx@IxXn%XhASx|%Z~Asxo5p`gyLx%*()hSG rIX0OXosgxAecy~stPlDj1OpI;GcX8e;hf6EhURb4wrY7d^u+NGsd>Vu diff --git a/source/list/ListGenerator.cpp b/source/list/ListGenerator.cpp index b4881d35..7e1f92fe 100644 --- a/source/list/ListGenerator.cpp +++ b/source/list/ListGenerator.cpp @@ -71,6 +71,8 @@ static void AddToList(const dir_discHdr *element) } */ + +/* used for adding wii games to the list */ static void AddISO(const char *GameID, const char *GameTitle, const char *GamePath, u32 GameColor, u8 Type) { @@ -107,6 +109,7 @@ static void AddISO(const char *GameID, const char *GameTitle, const char *GamePa m_cacheList.push_back(ListElement); } +/* read wbfs partition to add wii games to the list */ static void Create_Wii_WBFS_List(wbfs_t *handle) { for(u32 i = 0; i < wbfs_count_discs(handle); i++) @@ -119,7 +122,8 @@ static void Create_Wii_WBFS_List(wbfs_t *handle) } } -static void Create_Wii_EXT_List(char *FullPath) +/* add wii game iso(ntfs) or wbfs(fat) to the list. wbf1 and wbf2 are skipped and not added. */ +static void Add_Wii_Game(char *FullPath) { FILE *fp = fopen(FullPath, "rb"); if(fp) @@ -133,15 +137,16 @@ static void Create_Wii_EXT_List(char *FullPath) } } +/* add gamecube game to the list */ u8 gc_disc[1]; const char *FST_APPEND = "sys/boot.bin"; const u8 FST_APPEND_SIZE = strlen(FST_APPEND); static const u8 CISO_MAGIC[8] = {'C','I','S','O',0x00,0x00,0x20,0x00}; -static void Create_GC_List(char *FullPath) +static void Add_GameCube_Game(char *FullPath) { u32 hdr_offset = 0x00; FILE *fp = fopen(FullPath, "rb"); - if(!fp && strstr(FullPath, "/root") != NULL) //fst folder + if(!fp && strstr(FullPath, "/root") != NULL) //fst folder (extracted game) { *(strstr(FullPath, "/root") + 1) = '\0'; if(strlen(FullPath) + FST_APPEND_SIZE < MAX_MSG_SIZE) strcat(FullPath, FST_APPEND); @@ -174,27 +179,28 @@ static void Create_GC_List(char *FullPath) } } -const char *FolderTitle = NULL; -static void Create_Plugin_List(char *FullPath) +/* add plugin rom, song, or video to the list */ +const char *RomTitle = NULL; +static void Add_Plugin_Game(char *FullPath) { memset((void*)&ListElement, 0, sizeof(dir_discHdr)); strncpy(ListElement.path, FullPath, sizeof(ListElement.path) - 1); memcpy(ListElement.id, "PLUGIN", 6); - FolderTitle = strrchr(FullPath, '/') + 1; - *strrchr(FolderTitle, '.') = '\0'; + RomTitle = strrchr(FullPath, '/') + 1; + *strrchr(RomTitle, '.') = '\0'; char PluginMagicWord[9]; memset(PluginMagicWord, 0, sizeof(PluginMagicWord)); strncpy(PluginMagicWord, fmt("%08x", m_cacheList.Magic), 8); char CustomTitle[64]; memset(CustomTitle, 0, sizeof(CustomTitle)); - strncpy(CustomTitle, CustomTitles.getString(PluginMagicWord, FolderTitle).c_str(), 63); + strncpy(CustomTitle, CustomTitles.getString(PluginMagicWord, RomTitle).c_str(), 63); if(strlen(CustomTitle) > 0) mbstowcs(ListElement.title, CustomTitle, 63); else - mbstowcs(ListElement.title, FolderTitle, 63); + mbstowcs(ListElement.title, RomTitle, 63); Asciify(ListElement.title); ListElement.settings[0] = m_cacheList.Magic; //Plugin magic @@ -203,7 +209,8 @@ static void Create_Plugin_List(char *FullPath) m_cacheList.push_back(ListElement); } -static void Create_Homebrew_List(char *FullPath) +/* add homebrew boot.dol to the list */ +static void Add_Homebrew_Dol(char *FullPath) { if(strcasestr(FullPath, "boot.") == NULL) return; @@ -226,6 +233,7 @@ static void Create_Homebrew_List(char *FullPath) m_cacheList.push_back(ListElement); } +/* create channel list from nand or emu nand */ Channel *chan = NULL; static void Create_Channel_List(bool realNAND) { @@ -292,7 +300,7 @@ void ListGenerator::CreateList(u32 Flow, u32 Device, const string& Path, const v if(DeviceHandle.GetFSType(Device) == PART_FS_WBFS) Create_Wii_WBFS_List(DeviceHandle.GetWbfsHandle(Device)); else - GetFiles(Path.c_str(), FileTypes, Create_Wii_EXT_List, false); + GetFiles(Path.c_str(), FileTypes, Add_Wii_Game, false); } else if(Flow == COVERFLOW_CHANNEL) { @@ -305,11 +313,11 @@ void ListGenerator::CreateList(u32 Flow, u32 Device, const string& Path, const v else if(DeviceHandle.GetFSType(Device) != PART_FS_WBFS) { if(Flow == COVERFLOW_GAMECUBE) - GetFiles(Path.c_str(), FileTypes, Create_GC_List, true);//the only one that looks for a folder (/root) + GetFiles(Path.c_str(), FileTypes, Add_GameCube_Game, true);// true means to look for a folder (/root) else if(Flow == COVERFLOW_PLUGIN) - GetFiles(Path.c_str(), FileTypes, Create_Plugin_List, false, 30);//wow 30 subfolders! really? + GetFiles(Path.c_str(), FileTypes, Add_Plugin_Game, false, 30);//wow 30 subfolders! really? else if(Flow == COVERFLOW_HOMEBREW) - GetFiles(Path.c_str(), FileTypes, Create_Homebrew_List, false); + GetFiles(Path.c_str(), FileTypes, Add_Homebrew_Dol, false); } CloseConfigs(); if(!this->empty() && !DBName.empty()) /* Write a new Cache */ @@ -370,6 +378,7 @@ void GetFiles(const char *Path, const vector& FileTypes, SubPaths.clear(); } +/* create sourceflow list from current source_menu.ini */ void ListGenerator::createSFList(u8 maxBtns, Config &m_sourceMenuCfg, const string& sourceDir) { Clear();