2016-04-02 18:00:47 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Copyright (C) 2012 FIX94
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
****************************************************************************/
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <unistd.h>
|
2021-09-20 15:30:12 +02:00
|
|
|
#include <regex>
|
2016-04-02 18:00:47 +02:00
|
|
|
#include "ListGenerator.hpp"
|
|
|
|
#include "cache.hpp"
|
|
|
|
#include "channel/channels.h"
|
|
|
|
#include "devicemounter/DeviceHandler.hpp"
|
|
|
|
#include "fileOps/fileOps.h"
|
|
|
|
#include "gui/coverflow.hpp"
|
|
|
|
#include "gui/text.hpp"
|
-updating wiiflow lite to beta 4.3.0
-fixed using categories to hide GC disc 2's. Apparently this has never really worked right for some time or ever.
-fixed deleting the cached cover texture file for plugin games. Delete cover for plugins only deletes the cached texture file (.wfc)
-fixed favorites and adultonly (parental lock) for plugin games. Apparently I may have broke this a few revisions back.
-favorites and adultonly for plugin games now have their own domains in gamecfg1- [FAVORITES_PLUGINS] and [ADULTONLY_PLUGINS]. just makes it more organized.
-only wii, GC, channels are added to [PLAYCOUNT] and [LAST_PLAYED] in gamecfg1.
-now loading gamecfg1 at startup and leaving it loaded till exit. no more loading it and unloading all the time.
-fixed scrolling for game_info synopsis, credits, and help text.
-made source menu buttons wider for wiiflow default. old 80x80, now 100x80. looks better.
-display music info now defaults to off
-screensaver_disabled now defaults to yes
-show GC view button is now on by default no matter what. the only way it is disabled is if you edit wiiflow.ini manually. this is how all the view buttons work.
-removed hiding homebrew button but if wiiflow locked it won't work or in sourceflow it won't show.
-dump_list is now under [GENERAL] instead of each view. Also only works for Wii, GC, and channels.
-sorting only works for Wii, GC, and Channels now. disabled for sourceflow, plugins, homebrew, and combined view.
-now if no games are found a message is shown with the current path so you can see where wiiflow is looking. (except for plugins)
-removed auto create emuNAND for emuNAND view if gamelist is empty. just go to settings>NAND settings if you want to extract or disable it.
-now when no games are found all buttons at bottom are still accessible allowing you to change the view or go to settings and change current partition or path and even extract your NAND to create a EmuNAND. Or go to Home Menu and Install a Wii or GC game.
-removed auto extract NAND to emuNAND when launching a Wii game with EmuNAND save. Now a message is diplayed saying 'emuNAND for saves not found - using real NAND'.
-made the speed at which cover titles fade in/out almost instantly.
-removed update button from Home Menu. online update code is still there but not used and probably won't be used any more as there just isn't a need for it now.
-removed ftp button from Home Menu and all code for the FTP server. I just use WiiXplorer's FTP server. it seems to work better for me.
-disabled keep USB Alive thread for now. i think there's a possibilty it might be the cause of my SD/USB files getting corrupted.
-removed Btn B and - combo to switch partitions. didn't seem useful anymore.
-redid nand emulation settings menu. looks like this now:
pg1
Select EmuNAND
EmuNAND Enulation
Select SaveNAND
SaveNAND Emulation
pg2
Extract Saves All
Missing
Extract NAND
Select Saves Partition
-no longer blocking Select Plugin menu and View icons when using source menu combined view
-now Select Plugins Menu is like switching to plugin view but you get to choose the plugins first
-now [PLUGIN] partition= is the default partition for all plugins. to change individual plugins add 'romPartition=x' to the plugin ini. x is the partition number 0 thru 8 with SD being 0. this is how my usbloadergx plugin mod works.
2016-10-05 01:44:13 +02:00
|
|
|
#include "loader/sys.h"
|
2016-04-02 18:00:47 +02:00
|
|
|
|
2019-11-27 14:28:54 +01:00
|
|
|
ListGenerator m_cacheList;// needed by the static void functions since they are not part of ListGenerator class.
|
|
|
|
dir_discHdr ListElement;
|
2016-04-02 18:00:47 +02:00
|
|
|
Config CustomTitles;
|
|
|
|
GameTDB gameTDB;
|
2019-09-11 22:57:16 +02:00
|
|
|
Config romNamesDB;
|
2023-01-21 00:53:52 +01:00
|
|
|
const char *platformName;
|
2019-09-11 22:57:16 +02:00
|
|
|
string pluginsDataDir;
|
2021-09-20 15:30:12 +02:00
|
|
|
std::regex fileNameSkipRegex;
|
2016-04-02 18:00:47 +02:00
|
|
|
|
2021-09-20 15:30:12 +02:00
|
|
|
void ListGenerator::Init(const char *settingsDir, const char *Language,
|
|
|
|
const char *plgnsDataDir, const std::string& fileNameSkipPattern)
|
2016-04-02 18:00:47 +02:00
|
|
|
{
|
|
|
|
if(settingsDir != NULL)
|
|
|
|
{
|
|
|
|
gameTDB_Path = fmt("%s/wiitdb.xml", settingsDir);
|
|
|
|
CustomTitlesPath = fmt("%s/" CTITLES_FILENAME, settingsDir);
|
|
|
|
}
|
|
|
|
if(Language != NULL) gameTDB_Language = Language;
|
2019-09-11 22:57:16 +02:00
|
|
|
if(plgnsDataDir != NULL) pluginsDataDir = fmt("%s", plgnsDataDir);
|
2021-09-20 15:30:12 +02:00
|
|
|
|
|
|
|
fileNameSkipRegex = std::regex(fileNameSkipPattern,
|
|
|
|
std::regex_constants::extended |
|
|
|
|
std::regex_constants::icase);
|
2016-04-02 18:00:47 +02:00
|
|
|
}
|
|
|
|
|
-updating wiiflow lite to beta 4.3.0
-fixed using categories to hide GC disc 2's. Apparently this has never really worked right for some time or ever.
-fixed deleting the cached cover texture file for plugin games. Delete cover for plugins only deletes the cached texture file (.wfc)
-fixed favorites and adultonly (parental lock) for plugin games. Apparently I may have broke this a few revisions back.
-favorites and adultonly for plugin games now have their own domains in gamecfg1- [FAVORITES_PLUGINS] and [ADULTONLY_PLUGINS]. just makes it more organized.
-only wii, GC, channels are added to [PLAYCOUNT] and [LAST_PLAYED] in gamecfg1.
-now loading gamecfg1 at startup and leaving it loaded till exit. no more loading it and unloading all the time.
-fixed scrolling for game_info synopsis, credits, and help text.
-made source menu buttons wider for wiiflow default. old 80x80, now 100x80. looks better.
-display music info now defaults to off
-screensaver_disabled now defaults to yes
-show GC view button is now on by default no matter what. the only way it is disabled is if you edit wiiflow.ini manually. this is how all the view buttons work.
-removed hiding homebrew button but if wiiflow locked it won't work or in sourceflow it won't show.
-dump_list is now under [GENERAL] instead of each view. Also only works for Wii, GC, and channels.
-sorting only works for Wii, GC, and Channels now. disabled for sourceflow, plugins, homebrew, and combined view.
-now if no games are found a message is shown with the current path so you can see where wiiflow is looking. (except for plugins)
-removed auto create emuNAND for emuNAND view if gamelist is empty. just go to settings>NAND settings if you want to extract or disable it.
-now when no games are found all buttons at bottom are still accessible allowing you to change the view or go to settings and change current partition or path and even extract your NAND to create a EmuNAND. Or go to Home Menu and Install a Wii or GC game.
-removed auto extract NAND to emuNAND when launching a Wii game with EmuNAND save. Now a message is diplayed saying 'emuNAND for saves not found - using real NAND'.
-made the speed at which cover titles fade in/out almost instantly.
-removed update button from Home Menu. online update code is still there but not used and probably won't be used any more as there just isn't a need for it now.
-removed ftp button from Home Menu and all code for the FTP server. I just use WiiXplorer's FTP server. it seems to work better for me.
-disabled keep USB Alive thread for now. i think there's a possibilty it might be the cause of my SD/USB files getting corrupted.
-removed Btn B and - combo to switch partitions. didn't seem useful anymore.
-redid nand emulation settings menu. looks like this now:
pg1
Select EmuNAND
EmuNAND Enulation
Select SaveNAND
SaveNAND Emulation
pg2
Extract Saves All
Missing
Extract NAND
Select Saves Partition
-no longer blocking Select Plugin menu and View icons when using source menu combined view
-now Select Plugins Menu is like switching to plugin view but you get to choose the plugins first
-now [PLUGIN] partition= is the default partition for all plugins. to change individual plugins add 'romPartition=x' to the plugin ini. x is the partition number 0 thru 8 with SD being 0. this is how my usbloadergx plugin mod works.
2016-10-05 01:44:13 +02:00
|
|
|
void ListGenerator::Clear(void)
|
|
|
|
{
|
|
|
|
m_cacheList.clear();
|
|
|
|
vector<dir_discHdr>().swap(m_cacheList);
|
|
|
|
}
|
|
|
|
|
2016-04-02 18:00:47 +02:00
|
|
|
void ListGenerator::OpenConfigs()
|
|
|
|
{
|
|
|
|
gameTDB.OpenFile(gameTDB_Path.c_str());
|
|
|
|
if(gameTDB.IsLoaded())
|
|
|
|
gameTDB.SetLanguageCode(gameTDB_Language.c_str());
|
|
|
|
CustomTitles.load(CustomTitlesPath.c_str());
|
2021-05-11 22:57:08 +02:00
|
|
|
CustomTitles.groupCustomTitles();
|
2016-04-02 18:00:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ListGenerator::CloseConfigs()
|
|
|
|
{
|
|
|
|
if(gameTDB.IsLoaded())
|
|
|
|
gameTDB.CloseFile();
|
|
|
|
if(CustomTitles.loaded())
|
|
|
|
CustomTitles.unload();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
static const u32 LIST_TMP_SIZE = 5000;
|
|
|
|
dir_discHdr *tmpList = NULL;
|
|
|
|
u32 tmpListPos = 0;
|
|
|
|
static void AddToList(const dir_discHdr *element)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
*/
|
2019-08-25 00:21:06 +02:00
|
|
|
|
|
|
|
/* used for adding wii games to the list */
|
2016-04-02 18:00:47 +02:00
|
|
|
static void AddISO(const char *GameID, const char *GameTitle, const char *GamePath,
|
|
|
|
u32 GameColor, u8 Type)
|
|
|
|
{
|
|
|
|
memset((void*)&ListElement, 0, sizeof(dir_discHdr));
|
2016-06-20 23:03:40 +02:00
|
|
|
ListElement.index = m_cacheList.size();
|
2023-01-21 00:53:52 +01:00
|
|
|
|
2016-04-02 18:00:47 +02:00
|
|
|
if(GameID != NULL) strncpy(ListElement.id, GameID, 6);
|
2023-01-21 00:53:52 +01:00
|
|
|
|
2016-04-02 18:00:47 +02:00
|
|
|
if(GamePath != NULL) strncpy(ListElement.path, GamePath, sizeof(ListElement.path) - 1);
|
2023-01-21 00:53:52 +01:00
|
|
|
|
2016-04-02 18:00:47 +02:00
|
|
|
ListElement.casecolor = CustomTitles.getColor("COVERS", ListElement.id, GameColor).intVal();
|
2023-01-21 00:53:52 +01:00
|
|
|
|
2018-05-17 01:33:56 +02:00
|
|
|
char CustomTitle[64];
|
|
|
|
memset(CustomTitle, 0, sizeof(CustomTitle));
|
|
|
|
strncpy(CustomTitle, CustomTitles.getString("TITLES", ListElement.id).c_str(), 63);
|
2023-01-21 00:53:52 +01:00
|
|
|
|
2018-05-17 01:33:56 +02:00
|
|
|
const char *gameTDB_Title = NULL;
|
2016-04-02 18:00:47 +02:00
|
|
|
if(gameTDB.IsLoaded())
|
|
|
|
{
|
2023-01-21 00:53:52 +01:00
|
|
|
/* set the released year */
|
|
|
|
int PublishDate = gameTDB.GetPublishDate(ListElement.id);
|
|
|
|
int year = PublishDate >> 16;
|
|
|
|
ListElement.year = year;
|
2016-04-02 18:00:47 +02:00
|
|
|
if(ListElement.casecolor == GameColor)
|
|
|
|
ListElement.casecolor = gameTDB.GetCaseColor(ListElement.id);
|
|
|
|
ListElement.wifi = gameTDB.GetWifiPlayers(ListElement.id);
|
|
|
|
ListElement.players = gameTDB.GetPlayers(ListElement.id);
|
2018-05-17 01:33:56 +02:00
|
|
|
if(strlen(CustomTitle) == 0)
|
|
|
|
gameTDB.GetTitle(ListElement.id, gameTDB_Title);
|
2016-04-02 18:00:47 +02:00
|
|
|
}
|
|
|
|
if(!ValidColor(ListElement.casecolor))
|
|
|
|
ListElement.casecolor = CoverFlow.InternalCoverColor(ListElement.id, GameColor);
|
|
|
|
|
2018-05-17 01:33:56 +02:00
|
|
|
if(strlen(CustomTitle) > 0)
|
2016-04-02 18:00:47 +02:00
|
|
|
mbstowcs(ListElement.title, CustomTitle, 63);
|
2018-05-17 01:33:56 +02:00
|
|
|
else if(gameTDB_Title != NULL && gameTDB_Title[0] != '\0')
|
|
|
|
mbstowcs(ListElement.title, gameTDB_Title, 63);
|
2016-04-02 18:00:47 +02:00
|
|
|
else if(GameTitle != NULL)
|
|
|
|
mbstowcs(ListElement.title, GameTitle, 63);
|
|
|
|
Asciify(ListElement.title);
|
|
|
|
|
|
|
|
ListElement.type = Type;
|
2016-06-20 23:03:40 +02:00
|
|
|
m_cacheList.push_back(ListElement);
|
2016-04-02 18:00:47 +02:00
|
|
|
}
|
|
|
|
|
2019-08-25 00:21:06 +02:00
|
|
|
/* read wbfs partition to add wii games to the list */
|
2016-04-02 18:00:47 +02:00
|
|
|
static void Create_Wii_WBFS_List(wbfs_t *handle)
|
|
|
|
{
|
|
|
|
for(u32 i = 0; i < wbfs_count_discs(handle); i++)
|
|
|
|
{
|
|
|
|
memset((void*)&wii_hdr, 0, sizeof(discHdr));
|
|
|
|
s32 ret = wbfs_get_disc_info(handle, i, (u8*)&wii_hdr, sizeof(discHdr), NULL);
|
|
|
|
if(ret == 0 && wii_hdr.magic == WII_MAGIC)
|
|
|
|
AddISO((const char*)wii_hdr.id, (const char*)wii_hdr.title,
|
|
|
|
NULL, 0xFFFFFF, TYPE_WII_GAME);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-25 00:21:06 +02:00
|
|
|
/* 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)
|
2016-04-02 18:00:47 +02:00
|
|
|
{
|
|
|
|
FILE *fp = fopen(FullPath, "rb");
|
|
|
|
if(fp)
|
|
|
|
{
|
|
|
|
fseek(fp, strcasestr(FullPath, ".wbfs") != NULL ? 512 : 0, SEEK_SET);
|
|
|
|
fread((void*)&wii_hdr, 1, sizeof(discHdr), fp);
|
|
|
|
if(wii_hdr.magic == WII_MAGIC)
|
|
|
|
AddISO((const char*)wii_hdr.id, (const char*)wii_hdr.title,
|
|
|
|
FullPath, 0xFFFFFF, TYPE_WII_GAME);
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-25 00:21:06 +02:00
|
|
|
/* add gamecube game to the list */
|
2016-04-02 18:00:47 +02:00
|
|
|
u8 gc_disc[1];
|
|
|
|
const char *FST_APPEND = "sys/boot.bin";
|
|
|
|
const u8 FST_APPEND_SIZE = strlen(FST_APPEND);
|
2017-09-22 00:03:41 +02:00
|
|
|
static const u8 CISO_MAGIC[8] = {'C','I','S','O',0x00,0x00,0x20,0x00};
|
2019-08-25 00:21:06 +02:00
|
|
|
static void Add_GameCube_Game(char *FullPath)
|
2016-04-02 18:00:47 +02:00
|
|
|
{
|
2017-09-22 00:03:41 +02:00
|
|
|
u32 hdr_offset = 0x00;
|
2016-04-02 18:00:47 +02:00
|
|
|
FILE *fp = fopen(FullPath, "rb");
|
2019-08-25 00:21:06 +02:00
|
|
|
if(!fp && strstr(FullPath, "/root") != NULL) //fst folder (extracted game)
|
2016-04-02 18:00:47 +02:00
|
|
|
{
|
|
|
|
*(strstr(FullPath, "/root") + 1) = '\0';
|
2019-12-15 23:02:10 +01:00
|
|
|
if(strlen(FullPath) + FST_APPEND_SIZE < MAX_MSG_SIZE) strcat(FullPath, FST_APPEND);// append "sys/boot.bin" to end of path
|
2016-04-02 18:00:47 +02:00
|
|
|
fp = fopen(FullPath, "rb");
|
|
|
|
}
|
|
|
|
if(fp)
|
|
|
|
{
|
|
|
|
fread((void*)&gc_hdr, 1, sizeof(gc_discHdr), fp);
|
2017-09-22 00:03:41 +02:00
|
|
|
//check for CISO disc image and change offset to read the true header
|
|
|
|
if(!memcmp((void*)&gc_hdr, CISO_MAGIC, sizeof(CISO_MAGIC)))
|
|
|
|
{
|
|
|
|
hdr_offset = 0x8000;
|
|
|
|
fseek(fp, hdr_offset, SEEK_SET);
|
|
|
|
fread((void*)&gc_hdr, 1, sizeof(gc_discHdr), fp);
|
|
|
|
}
|
2016-04-02 18:00:47 +02:00
|
|
|
if(gc_hdr.magic == GC_MAGIC)
|
|
|
|
{
|
|
|
|
/* Check for disc 2 */
|
2017-09-22 00:03:41 +02:00
|
|
|
fseek(fp, hdr_offset + 0x06, SEEK_SET);
|
2016-04-02 18:00:47 +02:00
|
|
|
fread(gc_disc, 1, 1, fp);
|
2019-12-15 23:02:10 +01:00
|
|
|
if(!gc_disc[0])// If not disc 2 add game iso
|
|
|
|
AddISO((const char*)gc_hdr.id, (const char*)gc_hdr.title, FullPath, 0x000000, TYPE_GC_GAME);
|
2016-04-02 18:00:47 +02:00
|
|
|
}
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-25 00:21:06 +02:00
|
|
|
/* add homebrew boot.dol to the list */
|
|
|
|
static void Add_Homebrew_Dol(char *FullPath)
|
2016-04-02 18:00:47 +02:00
|
|
|
{
|
|
|
|
if(strcasestr(FullPath, "boot.") == NULL)
|
|
|
|
return;
|
|
|
|
memset((void*)&ListElement, 0, sizeof(dir_discHdr));
|
2016-06-20 23:03:40 +02:00
|
|
|
ListElement.index = m_cacheList.size();
|
2016-04-02 18:00:47 +02:00
|
|
|
*strrchr(FullPath, '/') = '\0';
|
|
|
|
strncpy(ListElement.path, FullPath, sizeof(ListElement.path) - 1);
|
2018-05-29 11:59:57 +02:00
|
|
|
memcpy(ListElement.id, "HB_APP", 6);
|
2016-04-02 18:00:47 +02:00
|
|
|
|
2019-09-09 22:17:52 +02:00
|
|
|
const char *FolderTitle = strrchr(FullPath, '/') + 1;
|
2016-04-02 18:00:47 +02:00
|
|
|
ListElement.casecolor = CustomTitles.getColor("COVERS", FolderTitle, 0xFFFFFF).intVal();
|
|
|
|
const string &CustomTitle = CustomTitles.getString("TITLES", FolderTitle);
|
|
|
|
if(CustomTitle.size() > 0)
|
|
|
|
mbstowcs(ListElement.title, CustomTitle.c_str(), 63);
|
|
|
|
else
|
|
|
|
mbstowcs(ListElement.title, FolderTitle, 63);
|
|
|
|
Asciify(ListElement.title);
|
|
|
|
|
|
|
|
ListElement.type = TYPE_HOMEBREW;
|
2016-06-20 23:03:40 +02:00
|
|
|
m_cacheList.push_back(ListElement);
|
2016-04-02 18:00:47 +02:00
|
|
|
}
|
|
|
|
|
2019-08-25 00:21:06 +02:00
|
|
|
/* create channel list from nand or emu nand */
|
2016-04-02 18:00:47 +02:00
|
|
|
Channel *chan = NULL;
|
2019-11-27 14:28:54 +01:00
|
|
|
static void Create_Channel_List()
|
2016-04-02 18:00:47 +02:00
|
|
|
{
|
|
|
|
for(u32 i = 0; i < ChannelHandle.Count(); i++)
|
|
|
|
{
|
|
|
|
chan = ChannelHandle.GetChannel(i);
|
2022-09-07 16:33:31 +02:00
|
|
|
if(strlen(chan->id) == 0)
|
2016-04-02 18:00:47 +02:00
|
|
|
continue; // Skip invalid channels
|
|
|
|
memset((void*)&ListElement, 0, sizeof(dir_discHdr));
|
2016-06-20 23:03:40 +02:00
|
|
|
ListElement.index = m_cacheList.size();
|
2016-04-02 18:00:47 +02:00
|
|
|
ListElement.settings[0] = TITLE_UPPER(chan->title);
|
|
|
|
ListElement.settings[1] = TITLE_LOWER(chan->title);
|
2023-05-20 00:55:44 +02:00
|
|
|
if(chan->title == HBC_108)// HBC_108 ID is odd and does not work for gametdb. JODI, LULZ, and OHBC do work.
|
2018-05-29 11:59:57 +02:00
|
|
|
memcpy(ListElement.id, "JODI", 4);
|
-updating wiiflow lite to beta 4.3.0
-fixed using categories to hide GC disc 2's. Apparently this has never really worked right for some time or ever.
-fixed deleting the cached cover texture file for plugin games. Delete cover for plugins only deletes the cached texture file (.wfc)
-fixed favorites and adultonly (parental lock) for plugin games. Apparently I may have broke this a few revisions back.
-favorites and adultonly for plugin games now have their own domains in gamecfg1- [FAVORITES_PLUGINS] and [ADULTONLY_PLUGINS]. just makes it more organized.
-only wii, GC, channels are added to [PLAYCOUNT] and [LAST_PLAYED] in gamecfg1.
-now loading gamecfg1 at startup and leaving it loaded till exit. no more loading it and unloading all the time.
-fixed scrolling for game_info synopsis, credits, and help text.
-made source menu buttons wider for wiiflow default. old 80x80, now 100x80. looks better.
-display music info now defaults to off
-screensaver_disabled now defaults to yes
-show GC view button is now on by default no matter what. the only way it is disabled is if you edit wiiflow.ini manually. this is how all the view buttons work.
-removed hiding homebrew button but if wiiflow locked it won't work or in sourceflow it won't show.
-dump_list is now under [GENERAL] instead of each view. Also only works for Wii, GC, and channels.
-sorting only works for Wii, GC, and Channels now. disabled for sourceflow, plugins, homebrew, and combined view.
-now if no games are found a message is shown with the current path so you can see where wiiflow is looking. (except for plugins)
-removed auto create emuNAND for emuNAND view if gamelist is empty. just go to settings>NAND settings if you want to extract or disable it.
-now when no games are found all buttons at bottom are still accessible allowing you to change the view or go to settings and change current partition or path and even extract your NAND to create a EmuNAND. Or go to Home Menu and Install a Wii or GC game.
-removed auto extract NAND to emuNAND when launching a Wii game with EmuNAND save. Now a message is diplayed saying 'emuNAND for saves not found - using real NAND'.
-made the speed at which cover titles fade in/out almost instantly.
-removed update button from Home Menu. online update code is still there but not used and probably won't be used any more as there just isn't a need for it now.
-removed ftp button from Home Menu and all code for the FTP server. I just use WiiXplorer's FTP server. it seems to work better for me.
-disabled keep USB Alive thread for now. i think there's a possibilty it might be the cause of my SD/USB files getting corrupted.
-removed Btn B and - combo to switch partitions. didn't seem useful anymore.
-redid nand emulation settings menu. looks like this now:
pg1
Select EmuNAND
EmuNAND Enulation
Select SaveNAND
SaveNAND Emulation
pg2
Extract Saves All
Missing
Extract NAND
Select Saves Partition
-no longer blocking Select Plugin menu and View icons when using source menu combined view
-now Select Plugins Menu is like switching to plugin view but you get to choose the plugins first
-now [PLUGIN] partition= is the default partition for all plugins. to change individual plugins add 'romPartition=x' to the plugin ini. x is the partition number 0 thru 8 with SD being 0. this is how my usbloadergx plugin mod works.
2016-10-05 01:44:13 +02:00
|
|
|
else
|
|
|
|
strncpy(ListElement.id, chan->id, 4);
|
2016-04-02 18:00:47 +02:00
|
|
|
ListElement.casecolor = CustomTitles.getColor("COVERS", ListElement.id, 0xFFFFFF).intVal();
|
2018-05-17 01:33:56 +02:00
|
|
|
char CustomTitle[64];
|
|
|
|
memset(CustomTitle, 0, sizeof(CustomTitle));
|
|
|
|
strncpy(CustomTitle, CustomTitles.getString("TITLES", ListElement.id).c_str(), 63);
|
|
|
|
const char *gameTDB_Title = NULL;
|
2016-04-02 18:00:47 +02:00
|
|
|
if(gameTDB.IsLoaded())
|
|
|
|
{
|
2023-01-21 00:53:52 +01:00
|
|
|
/* set the released year */
|
|
|
|
int PublishDate = gameTDB.GetPublishDate(ListElement.id);
|
|
|
|
int year = PublishDate >> 16;
|
|
|
|
ListElement.year = year;
|
2016-04-02 18:00:47 +02:00
|
|
|
if(ListElement.casecolor == 0xFFFFFF)
|
|
|
|
ListElement.casecolor = gameTDB.GetCaseColor(ListElement.id);
|
|
|
|
ListElement.wifi = gameTDB.GetWifiPlayers(ListElement.id);
|
|
|
|
ListElement.players = gameTDB.GetPlayers(ListElement.id);
|
2018-05-17 01:33:56 +02:00
|
|
|
if(strlen(CustomTitle) == 0)
|
|
|
|
gameTDB.GetTitle(ListElement.id, gameTDB_Title);
|
2016-04-02 18:00:47 +02:00
|
|
|
}
|
2018-05-17 01:33:56 +02:00
|
|
|
if(strlen(CustomTitle) > 0)
|
2016-04-02 18:00:47 +02:00
|
|
|
mbstowcs(ListElement.title, CustomTitle, 63);
|
2018-05-17 01:33:56 +02:00
|
|
|
else if(gameTDB_Title != NULL && gameTDB_Title[0] != '\0')
|
|
|
|
mbstowcs(ListElement.title, gameTDB_Title, 63);
|
2016-04-02 18:00:47 +02:00
|
|
|
else
|
|
|
|
wcsncpy(ListElement.title, chan->name, 64);
|
2019-11-27 14:28:54 +01:00
|
|
|
if(!NANDemuView)
|
2016-06-20 23:03:40 +02:00
|
|
|
ListElement.type = TYPE_CHANNEL;
|
|
|
|
else
|
|
|
|
ListElement.type = TYPE_EMUCHANNEL;
|
|
|
|
m_cacheList.push_back(ListElement);
|
2016-04-02 18:00:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-11 22:57:16 +02:00
|
|
|
/* add plugin rom, song, or video to the list. */
|
|
|
|
static void Add_Plugin_Game(char *FullPath)
|
|
|
|
{
|
2021-09-13 20:55:27 +02:00
|
|
|
/* only add disc 1 of multi disc games */
|
2021-09-15 18:45:06 +02:00
|
|
|
const char *RomFilename = strrchr(FullPath, '/') + 1;
|
2021-09-20 15:30:12 +02:00
|
|
|
|
|
|
|
if (std::regex_search(std::string(FullPath), fileNameSkipRegex))
|
|
|
|
{
|
|
|
|
//gprintf("Add_Plugin_Game: skipping '%s'\n", FullPath);
|
2021-09-13 20:55:27 +02:00
|
|
|
return;
|
2021-09-20 15:30:12 +02:00
|
|
|
}
|
2021-09-13 20:55:27 +02:00
|
|
|
|
2023-01-10 01:06:01 +01:00
|
|
|
/* Get roms's filename without the extra ()'s or []'s */
|
2022-05-07 00:55:01 +02:00
|
|
|
string ShortName = m_plugin.GetRomName(FullPath);
|
|
|
|
//gprintf("Add_Plugin_Game: fullName=%s, shortName=%s\n", FullPath, ShortName.c_str());
|
|
|
|
|
2019-09-11 22:57:16 +02:00
|
|
|
/* get rom's ID */
|
|
|
|
string romID = "";
|
|
|
|
if(gameTDB.IsLoaded())
|
|
|
|
{
|
|
|
|
/* Get 6 character unique romID (from Screenscraper.fr) using shortName. if fails then use CRC or CD serial to get romID */
|
2023-01-21 00:53:52 +01:00
|
|
|
romID = m_plugin.GetRomId(FullPath, m_cacheList.Magic, romNamesDB, pluginsDataDir.c_str(), platformName, ShortName.c_str());
|
2019-09-11 22:57:16 +02:00
|
|
|
}
|
|
|
|
if(romID.empty())
|
|
|
|
romID = "PLUGIN";
|
|
|
|
//gprintf("romID=%s\n", romID.c_str());
|
|
|
|
|
|
|
|
/* add rom to list */
|
|
|
|
memset((void*)&ListElement, 0, sizeof(dir_discHdr));
|
|
|
|
|
|
|
|
strncpy(ListElement.path, FullPath, sizeof(ListElement.path) - 1);
|
|
|
|
strncpy(ListElement.id, romID.c_str(), 6);
|
|
|
|
|
|
|
|
/* Get titles - Rom filename, custom title, and database xml title */
|
2021-09-15 18:45:06 +02:00
|
|
|
*strrchr(RomFilename, '.') = '\0';// remove extension
|
2019-09-11 22:57:16 +02:00
|
|
|
|
2023-01-10 01:06:01 +01:00
|
|
|
string customTitle;
|
|
|
|
customTitle = CustomTitles.getStringCustomTitles(m_plugin.PluginMagicWord, RomFilename, "");// old format
|
|
|
|
if(romID != "PLUGIN")
|
|
|
|
{
|
|
|
|
if(!customTitle.empty())
|
|
|
|
{
|
|
|
|
CustomTitles.setString(platformName, romID, customTitle);// convert old format to new format
|
|
|
|
CustomTitles.removeCustomTitles(m_plugin.PluginMagicWord, RomFilename);// remove old format
|
|
|
|
}
|
|
|
|
else
|
|
|
|
customTitle = CustomTitles.getString(platformName, romID, "");// new format
|
|
|
|
}
|
2019-09-11 22:57:16 +02:00
|
|
|
|
|
|
|
const char *gameTDB_Title = NULL;
|
2019-11-27 14:28:54 +01:00
|
|
|
if(gameTDB.IsLoaded() && customTitle.empty() && m_cacheList.usePluginDBTitles)
|
2019-11-18 16:27:21 +01:00
|
|
|
gameTDB.GetTitle(ListElement.id, gameTDB_Title, true);
|
2019-09-11 22:57:16 +02:00
|
|
|
|
|
|
|
/* set the roms title */
|
2019-10-07 19:15:41 +02:00
|
|
|
if(!customTitle.empty())
|
|
|
|
mbstowcs(ListElement.title, customTitle.c_str(), 63);
|
2019-09-11 22:57:16 +02:00
|
|
|
else if(gameTDB_Title != NULL && gameTDB_Title[0] != '\0')
|
|
|
|
mbstowcs(ListElement.title, gameTDB_Title, 63);
|
|
|
|
else
|
|
|
|
mbstowcs(ListElement.title, RomFilename, 63);
|
|
|
|
Asciify(ListElement.title);
|
|
|
|
|
2023-01-21 00:53:52 +01:00
|
|
|
/* set the released year */
|
|
|
|
int year = 0;
|
|
|
|
if(romID != "PLUGIN" && gameTDB.IsLoaded())
|
|
|
|
{
|
|
|
|
int PublishDate = gameTDB.GetPublishDate(romID.c_str());
|
|
|
|
year = PublishDate >> 16;
|
|
|
|
}
|
|
|
|
ListElement.year = year;
|
|
|
|
|
2019-09-11 22:57:16 +02:00
|
|
|
ListElement.settings[0] = m_cacheList.Magic; //Plugin magic
|
|
|
|
ListElement.casecolor = m_cacheList.Color;
|
|
|
|
ListElement.type = TYPE_PLUGIN;
|
|
|
|
m_cacheList.push_back(ListElement);
|
|
|
|
}
|
|
|
|
|
2020-02-02 21:25:05 +01:00
|
|
|
/* the [GameDomain] is used as the path even though it isn't the path */
|
|
|
|
/* the [GameDomain] is usually short without any '/' */
|
|
|
|
/* in scummvm.ini the path is the path without the exe or main app file added on */
|
|
|
|
void ListGenerator::ParseScummvmINI(Config &ini, const char *Device, const char *datadir, const char *platform, const string& DBName, bool UpdateCache)
|
|
|
|
{
|
|
|
|
Clear();
|
|
|
|
if(!DBName.empty())
|
|
|
|
{
|
|
|
|
if(UpdateCache)
|
|
|
|
fsop_deleteFile(DBName.c_str());
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CCache(*this, DBName, LOAD);
|
|
|
|
if(!this->empty())
|
|
|
|
return;
|
|
|
|
fsop_deleteFile(DBName.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gprintf("Parsing scummvm.ini\n");
|
|
|
|
if(!ini.loaded())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Config m_crc;
|
|
|
|
if(platform != NULL)
|
2022-08-08 20:23:23 +02:00
|
|
|
{
|
2020-02-02 21:25:05 +01:00
|
|
|
m_crc.load(fmt("%s/%s/%s.ini", datadir, platform, platform));
|
2022-08-08 20:23:23 +02:00
|
|
|
/* Load platform name.xml database to get game's info using the gameID */
|
|
|
|
gameTDB.OpenFile(fmt("%s/%s/%s.xml", datadir, platform, platform));
|
|
|
|
if(gameTDB.IsLoaded())
|
|
|
|
gameTDB.SetLanguageCode(gameTDB_Language.c_str());
|
|
|
|
}
|
2020-02-02 21:25:05 +01:00
|
|
|
|
|
|
|
const char *GameDomain = ini.firstDomain().c_str();
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
if(strlen(GameDomain) < 2)
|
|
|
|
break;
|
2022-08-08 20:23:23 +02:00
|
|
|
// GameName has to be at least as large as the longest key in m_crc,
|
|
|
|
// otherwise the game won't be found.
|
|
|
|
char GameName[128];
|
2020-02-02 21:25:05 +01:00
|
|
|
memset(GameName, 0, sizeof(GameName));
|
2022-08-08 20:23:23 +02:00
|
|
|
strncpy(GameName, ini.getString(GameDomain, "description").c_str(), sizeof(GameName)-1);
|
2020-02-02 21:25:05 +01:00
|
|
|
if(strlen(GameName) < 2 || strncasecmp(Device, ini.getString(GameDomain, "path").c_str(), 2) != 0)
|
|
|
|
{
|
|
|
|
GameDomain = ini.nextDomain().c_str();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get shortName */
|
|
|
|
char *cp;
|
|
|
|
if((cp = strstr(GameName, " (")) != NULL)
|
|
|
|
*cp = '\0';
|
|
|
|
|
|
|
|
/* get Game ID */
|
|
|
|
string GameID = "PLUGIN";
|
|
|
|
// Get game ID based on GameName
|
|
|
|
if(m_crc.loaded() && m_crc.has(platform, GameName))
|
|
|
|
{
|
|
|
|
vector<string> searchID = m_crc.getStrings(platform, GameName, '|');
|
|
|
|
if(!searchID[0].empty())
|
|
|
|
GameID = searchID[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
memset((void*)&ListElement, 0, sizeof(dir_discHdr));
|
|
|
|
memcpy(ListElement.id, GameID.c_str(), 6);
|
2022-08-08 20:23:23 +02:00
|
|
|
|
|
|
|
const char *gameTDB_Title = NULL;
|
|
|
|
if(gameTDB.IsLoaded() && m_cacheList.usePluginDBTitles)
|
|
|
|
{
|
|
|
|
gameTDB.GetTitle(ListElement.id, gameTDB_Title, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(gameTDB_Title != NULL && gameTDB_Title[0] != '\0')
|
|
|
|
mbstowcs(ListElement.title, gameTDB_Title, 63);
|
|
|
|
else
|
|
|
|
mbstowcs(ListElement.title, GameName, 63);
|
|
|
|
Asciify(ListElement.title);
|
2020-03-19 23:38:32 +01:00
|
|
|
strcpy(ListElement.path, GameDomain);
|
2022-08-08 20:23:23 +02:00
|
|
|
|
2023-01-21 00:53:52 +01:00
|
|
|
/* set the released year */
|
|
|
|
int year = 0;
|
|
|
|
if(GameID != "PLUGIN" && gameTDB.IsLoaded())
|
|
|
|
{
|
|
|
|
int PublishDate = gameTDB.GetPublishDate(GameID.c_str());
|
|
|
|
year = PublishDate >> 16;
|
|
|
|
}
|
|
|
|
ListElement.year = year;
|
|
|
|
|
2020-02-02 21:25:05 +01:00
|
|
|
ListElement.settings[0] = m_cacheList.Magic; //scummvm magic
|
|
|
|
ListElement.casecolor = m_cacheList.Color;
|
|
|
|
ListElement.type = TYPE_PLUGIN;
|
|
|
|
m_cacheList.push_back(ListElement);
|
|
|
|
GameDomain = ini.nextDomain().c_str();
|
|
|
|
}
|
|
|
|
m_crc.unload();
|
2023-01-21 00:53:52 +01:00
|
|
|
CloseConfigs();
|
2020-02-02 21:25:05 +01:00
|
|
|
if(!this->empty() && !DBName.empty()) /* Write a new Cache */
|
|
|
|
CCache(*this, DBName, SAVE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* note: scummvm games are parsed above */
|
2023-01-21 00:53:52 +01:00
|
|
|
void ListGenerator::CreateRomList(const char *platform, const string& romsDir, const vector<string>& FileTypes, const string& DBName, bool UpdateCache)
|
2019-09-11 22:57:16 +02:00
|
|
|
{
|
|
|
|
Clear();
|
|
|
|
if(!DBName.empty())
|
|
|
|
{
|
|
|
|
if(UpdateCache)
|
|
|
|
fsop_deleteFile(DBName.c_str());
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CCache(*this, DBName, LOAD);
|
|
|
|
if(!this->empty())
|
|
|
|
return;
|
|
|
|
fsop_deleteFile(DBName.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-21 00:53:52 +01:00
|
|
|
platformName = platform;// done to use it in add plugin game
|
|
|
|
if(platformName != NULL)
|
2019-09-11 22:57:16 +02:00
|
|
|
{
|
2023-01-21 00:53:52 +01:00
|
|
|
/* Load rom names and crc database */
|
|
|
|
romNamesDB.load(fmt("%s/%s/%s.ini", pluginsDataDir.c_str(), platformName, platformName));
|
|
|
|
|
|
|
|
/* Load platform name.xml database to get game's info using the gameID */
|
|
|
|
gameTDB.OpenFile(fmt("%s/%s/%s.xml", pluginsDataDir.c_str(), platformName, platformName));
|
|
|
|
if(gameTDB.IsLoaded())
|
|
|
|
gameTDB.SetLanguageCode(gameTDB_Language.c_str());
|
2019-09-11 22:57:16 +02:00
|
|
|
}
|
|
|
|
CustomTitles.load(CustomTitlesPath.c_str());
|
2021-05-11 22:57:08 +02:00
|
|
|
CustomTitles.groupCustomTitles();
|
2023-01-21 00:53:52 +01:00
|
|
|
|
2019-09-11 22:57:16 +02:00
|
|
|
GetFiles(romsDir.c_str(), FileTypes, Add_Plugin_Game, false, 30);//wow 30 subfolders! really?
|
2023-01-21 00:53:52 +01:00
|
|
|
|
2019-09-11 22:57:16 +02:00
|
|
|
CloseConfigs();
|
|
|
|
romNamesDB.unload();
|
2023-01-21 00:53:52 +01:00
|
|
|
|
2019-09-11 22:57:16 +02:00
|
|
|
if(!this->empty() && !DBName.empty()) /* Write a new Cache */
|
|
|
|
CCache(*this, DBName, SAVE);
|
|
|
|
}
|
|
|
|
|
2020-02-02 21:25:05 +01:00
|
|
|
void ListGenerator::CreateList(u32 Flow, const string& Path, const vector<string>& FileTypes, const string& DBName, bool UpdateCache)
|
2016-04-02 18:00:47 +02:00
|
|
|
{
|
-updating wiiflow lite to beta 4.3.0
-fixed using categories to hide GC disc 2's. Apparently this has never really worked right for some time or ever.
-fixed deleting the cached cover texture file for plugin games. Delete cover for plugins only deletes the cached texture file (.wfc)
-fixed favorites and adultonly (parental lock) for plugin games. Apparently I may have broke this a few revisions back.
-favorites and adultonly for plugin games now have their own domains in gamecfg1- [FAVORITES_PLUGINS] and [ADULTONLY_PLUGINS]. just makes it more organized.
-only wii, GC, channels are added to [PLAYCOUNT] and [LAST_PLAYED] in gamecfg1.
-now loading gamecfg1 at startup and leaving it loaded till exit. no more loading it and unloading all the time.
-fixed scrolling for game_info synopsis, credits, and help text.
-made source menu buttons wider for wiiflow default. old 80x80, now 100x80. looks better.
-display music info now defaults to off
-screensaver_disabled now defaults to yes
-show GC view button is now on by default no matter what. the only way it is disabled is if you edit wiiflow.ini manually. this is how all the view buttons work.
-removed hiding homebrew button but if wiiflow locked it won't work or in sourceflow it won't show.
-dump_list is now under [GENERAL] instead of each view. Also only works for Wii, GC, and channels.
-sorting only works for Wii, GC, and Channels now. disabled for sourceflow, plugins, homebrew, and combined view.
-now if no games are found a message is shown with the current path so you can see where wiiflow is looking. (except for plugins)
-removed auto create emuNAND for emuNAND view if gamelist is empty. just go to settings>NAND settings if you want to extract or disable it.
-now when no games are found all buttons at bottom are still accessible allowing you to change the view or go to settings and change current partition or path and even extract your NAND to create a EmuNAND. Or go to Home Menu and Install a Wii or GC game.
-removed auto extract NAND to emuNAND when launching a Wii game with EmuNAND save. Now a message is diplayed saying 'emuNAND for saves not found - using real NAND'.
-made the speed at which cover titles fade in/out almost instantly.
-removed update button from Home Menu. online update code is still there but not used and probably won't be used any more as there just isn't a need for it now.
-removed ftp button from Home Menu and all code for the FTP server. I just use WiiXplorer's FTP server. it seems to work better for me.
-disabled keep USB Alive thread for now. i think there's a possibilty it might be the cause of my SD/USB files getting corrupted.
-removed Btn B and - combo to switch partitions. didn't seem useful anymore.
-redid nand emulation settings menu. looks like this now:
pg1
Select EmuNAND
EmuNAND Enulation
Select SaveNAND
SaveNAND Emulation
pg2
Extract Saves All
Missing
Extract NAND
Select Saves Partition
-no longer blocking Select Plugin menu and View icons when using source menu combined view
-now Select Plugins Menu is like switching to plugin view but you get to choose the plugins first
-now [PLUGIN] partition= is the default partition for all plugins. to change individual plugins add 'romPartition=x' to the plugin ini. x is the partition number 0 thru 8 with SD being 0. this is how my usbloadergx plugin mod works.
2016-10-05 01:44:13 +02:00
|
|
|
Clear();
|
2016-04-02 18:00:47 +02:00
|
|
|
if(!DBName.empty())
|
|
|
|
{
|
|
|
|
if(UpdateCache)
|
|
|
|
fsop_deleteFile(DBName.c_str());
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CCache(*this, DBName, LOAD);
|
|
|
|
if(!this->empty())
|
|
|
|
return;
|
|
|
|
fsop_deleteFile(DBName.c_str());
|
|
|
|
}
|
|
|
|
}
|
-updating wiiflow lite to beta 4.3.0
-fixed using categories to hide GC disc 2's. Apparently this has never really worked right for some time or ever.
-fixed deleting the cached cover texture file for plugin games. Delete cover for plugins only deletes the cached texture file (.wfc)
-fixed favorites and adultonly (parental lock) for plugin games. Apparently I may have broke this a few revisions back.
-favorites and adultonly for plugin games now have their own domains in gamecfg1- [FAVORITES_PLUGINS] and [ADULTONLY_PLUGINS]. just makes it more organized.
-only wii, GC, channels are added to [PLAYCOUNT] and [LAST_PLAYED] in gamecfg1.
-now loading gamecfg1 at startup and leaving it loaded till exit. no more loading it and unloading all the time.
-fixed scrolling for game_info synopsis, credits, and help text.
-made source menu buttons wider for wiiflow default. old 80x80, now 100x80. looks better.
-display music info now defaults to off
-screensaver_disabled now defaults to yes
-show GC view button is now on by default no matter what. the only way it is disabled is if you edit wiiflow.ini manually. this is how all the view buttons work.
-removed hiding homebrew button but if wiiflow locked it won't work or in sourceflow it won't show.
-dump_list is now under [GENERAL] instead of each view. Also only works for Wii, GC, and channels.
-sorting only works for Wii, GC, and Channels now. disabled for sourceflow, plugins, homebrew, and combined view.
-now if no games are found a message is shown with the current path so you can see where wiiflow is looking. (except for plugins)
-removed auto create emuNAND for emuNAND view if gamelist is empty. just go to settings>NAND settings if you want to extract or disable it.
-now when no games are found all buttons at bottom are still accessible allowing you to change the view or go to settings and change current partition or path and even extract your NAND to create a EmuNAND. Or go to Home Menu and Install a Wii or GC game.
-removed auto extract NAND to emuNAND when launching a Wii game with EmuNAND save. Now a message is diplayed saying 'emuNAND for saves not found - using real NAND'.
-made the speed at which cover titles fade in/out almost instantly.
-removed update button from Home Menu. online update code is still there but not used and probably won't be used any more as there just isn't a need for it now.
-removed ftp button from Home Menu and all code for the FTP server. I just use WiiXplorer's FTP server. it seems to work better for me.
-disabled keep USB Alive thread for now. i think there's a possibilty it might be the cause of my SD/USB files getting corrupted.
-removed Btn B and - combo to switch partitions. didn't seem useful anymore.
-redid nand emulation settings menu. looks like this now:
pg1
Select EmuNAND
EmuNAND Enulation
Select SaveNAND
SaveNAND Emulation
pg2
Extract Saves All
Missing
Extract NAND
Select Saves Partition
-no longer blocking Select Plugin menu and View icons when using source menu combined view
-now Select Plugins Menu is like switching to plugin view but you get to choose the plugins first
-now [PLUGIN] partition= is the default partition for all plugins. to change individual plugins add 'romPartition=x' to the plugin ini. x is the partition number 0 thru 8 with SD being 0. this is how my usbloadergx plugin mod works.
2016-10-05 01:44:13 +02:00
|
|
|
OpenConfigs();
|
2019-11-27 14:28:54 +01:00
|
|
|
u32 Device = DeviceHandle.PathToDriveType(Path.c_str());
|
2016-04-02 18:00:47 +02:00
|
|
|
if(Flow == COVERFLOW_WII)
|
|
|
|
{
|
|
|
|
if(DeviceHandle.GetFSType(Device) == PART_FS_WBFS)
|
|
|
|
Create_Wii_WBFS_List(DeviceHandle.GetWbfsHandle(Device));
|
|
|
|
else
|
2019-08-25 00:21:06 +02:00
|
|
|
GetFiles(Path.c_str(), FileTypes, Add_Wii_Game, false);
|
2016-04-02 18:00:47 +02:00
|
|
|
}
|
|
|
|
else if(Flow == COVERFLOW_CHANNEL)
|
|
|
|
{
|
|
|
|
ChannelHandle.Init(gameTDB_Language);
|
2019-11-27 14:28:54 +01:00
|
|
|
Create_Channel_List();
|
2016-04-02 18:00:47 +02:00
|
|
|
}
|
|
|
|
else if(DeviceHandle.GetFSType(Device) != PART_FS_WBFS)
|
|
|
|
{
|
|
|
|
if(Flow == COVERFLOW_GAMECUBE)
|
2019-08-25 00:21:06 +02:00
|
|
|
GetFiles(Path.c_str(), FileTypes, Add_GameCube_Game, true);// true means to look for a folder (/root)
|
2016-04-02 18:00:47 +02:00
|
|
|
else if(Flow == COVERFLOW_HOMEBREW)
|
2019-08-25 00:21:06 +02:00
|
|
|
GetFiles(Path.c_str(), FileTypes, Add_Homebrew_Dol, false);
|
2016-04-02 18:00:47 +02:00
|
|
|
}
|
|
|
|
CloseConfigs();
|
|
|
|
if(!this->empty() && !DBName.empty()) /* Write a new Cache */
|
|
|
|
CCache(*this, DBName, SAVE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool IsFileSupported(const char *File, const vector<string>& FileTypes)
|
|
|
|
{
|
2021-09-15 19:31:12 +02:00
|
|
|
auto fileName = std::string(File);
|
|
|
|
for (auto & fileType : FileTypes)
|
2016-04-02 18:00:47 +02:00
|
|
|
{
|
2021-09-15 19:31:12 +02:00
|
|
|
if (fileName.length() >= fileType.length() &&
|
2021-09-17 10:46:12 +02:00
|
|
|
std::equal(fileName.end() - fileType.length(),
|
|
|
|
fileName.end(), fileType.begin(),
|
|
|
|
[](const char & c1, const char & c2)
|
|
|
|
{
|
|
|
|
return (c1 == c2 ||
|
|
|
|
std::toupper(c1) ==
|
|
|
|
std::toupper(c2));
|
|
|
|
}))
|
2016-04-02 18:00:47 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *NewFileName = NULL;
|
|
|
|
char *FullPathChar = NULL;
|
|
|
|
dirent *pent = NULL;
|
|
|
|
DIR *pdir = NULL;
|
|
|
|
void GetFiles(const char *Path, const vector<string>& FileTypes,
|
|
|
|
FileAdder AddFile, bool CompareFolders, u32 max_depth, u32 depth)
|
|
|
|
{
|
|
|
|
vector<string> SubPaths;
|
|
|
|
|
|
|
|
pdir = opendir(Path);
|
|
|
|
if(pdir == NULL)
|
|
|
|
return;
|
|
|
|
while((pent = readdir(pdir)) != NULL)
|
|
|
|
{
|
|
|
|
if(pent->d_name[0] == '.')
|
|
|
|
continue;
|
|
|
|
FullPathChar = fmt("%s/%s", Path, pent->d_name);
|
|
|
|
if(pent->d_type == DT_DIR)
|
|
|
|
{
|
2016-04-03 02:31:02 +02:00
|
|
|
if(CompareFolders && IsFileSupported(pent->d_name, FileTypes))//if root folder for extracted gc games
|
2016-04-02 18:00:47 +02:00
|
|
|
{
|
|
|
|
AddFile(FullPathChar);
|
|
|
|
continue;
|
|
|
|
}
|
2019-07-24 19:47:02 +02:00
|
|
|
else if(depth < max_depth && strcmp(pent->d_name, "samples") != 0) //skip samples folder in mame roms folder
|
2016-04-02 18:00:47 +02:00
|
|
|
SubPaths.push_back(FullPathChar);
|
|
|
|
}
|
|
|
|
else if(pent->d_type == DT_REG)
|
|
|
|
{
|
2021-09-15 19:31:12 +02:00
|
|
|
if(IsFileSupported(pent->d_name, FileTypes))
|
2016-04-02 18:00:47 +02:00
|
|
|
{
|
|
|
|
AddFile(FullPathChar);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closedir(pdir);
|
|
|
|
for(vector<string>::const_iterator p = SubPaths.begin(); p != SubPaths.end(); ++p)
|
|
|
|
GetFiles(p->c_str(), FileTypes, AddFile, CompareFolders, max_depth, depth + 1);
|
|
|
|
SubPaths.clear();
|
|
|
|
}
|
2016-04-03 03:12:11 +02:00
|
|
|
|
2019-08-25 00:21:06 +02:00
|
|
|
/* create sourceflow list from current source_menu.ini */
|
2018-09-26 17:28:01 +02:00
|
|
|
void ListGenerator::createSFList(u8 maxBtns, Config &m_sourceMenuCfg, const string& sourceDir)
|
2016-04-03 03:12:11 +02:00
|
|
|
{
|
-updating wiiflow lite to beta 4.3.0
-fixed using categories to hide GC disc 2's. Apparently this has never really worked right for some time or ever.
-fixed deleting the cached cover texture file for plugin games. Delete cover for plugins only deletes the cached texture file (.wfc)
-fixed favorites and adultonly (parental lock) for plugin games. Apparently I may have broke this a few revisions back.
-favorites and adultonly for plugin games now have their own domains in gamecfg1- [FAVORITES_PLUGINS] and [ADULTONLY_PLUGINS]. just makes it more organized.
-only wii, GC, channels are added to [PLAYCOUNT] and [LAST_PLAYED] in gamecfg1.
-now loading gamecfg1 at startup and leaving it loaded till exit. no more loading it and unloading all the time.
-fixed scrolling for game_info synopsis, credits, and help text.
-made source menu buttons wider for wiiflow default. old 80x80, now 100x80. looks better.
-display music info now defaults to off
-screensaver_disabled now defaults to yes
-show GC view button is now on by default no matter what. the only way it is disabled is if you edit wiiflow.ini manually. this is how all the view buttons work.
-removed hiding homebrew button but if wiiflow locked it won't work or in sourceflow it won't show.
-dump_list is now under [GENERAL] instead of each view. Also only works for Wii, GC, and channels.
-sorting only works for Wii, GC, and Channels now. disabled for sourceflow, plugins, homebrew, and combined view.
-now if no games are found a message is shown with the current path so you can see where wiiflow is looking. (except for plugins)
-removed auto create emuNAND for emuNAND view if gamelist is empty. just go to settings>NAND settings if you want to extract or disable it.
-now when no games are found all buttons at bottom are still accessible allowing you to change the view or go to settings and change current partition or path and even extract your NAND to create a EmuNAND. Or go to Home Menu and Install a Wii or GC game.
-removed auto extract NAND to emuNAND when launching a Wii game with EmuNAND save. Now a message is diplayed saying 'emuNAND for saves not found - using real NAND'.
-made the speed at which cover titles fade in/out almost instantly.
-removed update button from Home Menu. online update code is still there but not used and probably won't be used any more as there just isn't a need for it now.
-removed ftp button from Home Menu and all code for the FTP server. I just use WiiXplorer's FTP server. it seems to work better for me.
-disabled keep USB Alive thread for now. i think there's a possibilty it might be the cause of my SD/USB files getting corrupted.
-removed Btn B and - combo to switch partitions. didn't seem useful anymore.
-redid nand emulation settings menu. looks like this now:
pg1
Select EmuNAND
EmuNAND Enulation
Select SaveNAND
SaveNAND Emulation
pg2
Extract Saves All
Missing
Extract NAND
Select Saves Partition
-no longer blocking Select Plugin menu and View icons when using source menu combined view
-now Select Plugins Menu is like switching to plugin view but you get to choose the plugins first
-now [PLUGIN] partition= is the default partition for all plugins. to change individual plugins add 'romPartition=x' to the plugin ini. x is the partition number 0 thru 8 with SD being 0. this is how my usbloadergx plugin mod works.
2016-10-05 01:44:13 +02:00
|
|
|
Clear();
|
2016-04-03 03:12:11 +02:00
|
|
|
char btn_selected[256];
|
2018-09-26 17:28:01 +02:00
|
|
|
for(u8 i = 0; i <= maxBtns; i++)
|
2016-04-03 03:12:11 +02:00
|
|
|
{
|
|
|
|
memset(btn_selected, 0, 256);
|
2018-09-26 17:28:01 +02:00
|
|
|
strncpy(btn_selected, fmt("BUTTON_%i", i), 255);
|
2016-11-07 16:06:00 +01:00
|
|
|
const char *source = m_sourceMenuCfg.getString(btn_selected, "source","").c_str();
|
|
|
|
if(source == NULL)
|
2016-04-03 03:12:11 +02:00
|
|
|
continue;
|
|
|
|
const char *path = fmt("%s/%s", sourceDir.c_str(), m_sourceMenuCfg.getString(btn_selected, "image", "").c_str());
|
2016-11-07 16:06:00 +01:00
|
|
|
|
2016-04-03 03:12:11 +02:00
|
|
|
memset((void*)&ListElement, 0, sizeof(dir_discHdr));
|
2016-06-20 23:03:40 +02:00
|
|
|
ListElement.index = m_cacheList.size();
|
2018-05-29 11:59:57 +02:00
|
|
|
memcpy(ListElement.id, "SOURCE", 6);
|
2016-04-03 03:12:11 +02:00
|
|
|
strncpy(ListElement.path, path, sizeof(ListElement.path) - 1);
|
|
|
|
ListElement.casecolor = 0xFFFFFF;
|
|
|
|
ListElement.type = TYPE_SOURCE;
|
2018-09-26 17:28:01 +02:00
|
|
|
ListElement.settings[0] = i;
|
|
|
|
//const char *title = m_sourceMenuCfg.getString(btn_selected, "title", fmt("title_%i", i)).c_str();
|
2018-05-29 11:59:57 +02:00
|
|
|
char SourceTitle[64];
|
|
|
|
memset(SourceTitle, 0, sizeof(SourceTitle));
|
2018-09-26 17:28:01 +02:00
|
|
|
strncpy(SourceTitle, m_sourceMenuCfg.getString(btn_selected, "title", fmt("title_%i", i)).c_str(), 63);
|
2018-05-29 11:59:57 +02:00
|
|
|
mbstowcs(ListElement.title, SourceTitle, 63);
|
2016-04-03 03:12:11 +02:00
|
|
|
Asciify(ListElement.title);
|
2016-06-20 23:03:40 +02:00
|
|
|
m_cacheList.push_back(ListElement);
|
2016-04-03 03:12:11 +02:00
|
|
|
}
|
2021-09-15 19:31:12 +02:00
|
|
|
}
|