WiiFlow_Lite/source/list/ListGenerator.cpp

401 lines
13 KiB
C++
Raw Normal View History

/****************************************************************************
* 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>
#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"
ListGenerator m_cacheList;
Config CustomTitles;
GameTDB gameTDB;
dir_discHdr ListElement;
void ListGenerator::Init(const char *settingsDir, const char *Language)
{
if(settingsDir != NULL)
{
gameTDB_Path = fmt("%s/wiitdb.xml", settingsDir);
CustomTitlesPath = fmt("%s/" CTITLES_FILENAME, settingsDir);
}
if(Language != NULL) gameTDB_Language = Language;
}
-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);
}
void ListGenerator::OpenConfigs()
{
gameTDB.OpenFile(gameTDB_Path.c_str());
if(gameTDB.IsLoaded())
gameTDB.SetLanguageCode(gameTDB_Language.c_str());
CustomTitles.load(CustomTitlesPath.c_str());
}
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)
{
}
*/
static void AddISO(const char *GameID, const char *GameTitle, const char *GamePath,
u32 GameColor, u8 Type)
{
memset((void*)&ListElement, 0, sizeof(dir_discHdr));
ListElement.index = m_cacheList.size();
if(GameID != NULL) strncpy(ListElement.id, GameID, 6);
if(GamePath != NULL) strncpy(ListElement.path, GamePath, sizeof(ListElement.path) - 1);
ListElement.casecolor = CustomTitles.getColor("COVERS", ListElement.id, GameColor).intVal();
char CustomTitle[64];
memset(CustomTitle, 0, sizeof(CustomTitle));
strncpy(CustomTitle, CustomTitles.getString("TITLES", ListElement.id).c_str(), 63);
const char *gameTDB_Title = NULL;
if(gameTDB.IsLoaded())
{
if(ListElement.casecolor == GameColor)
ListElement.casecolor = gameTDB.GetCaseColor(ListElement.id);
ListElement.wifi = gameTDB.GetWifiPlayers(ListElement.id);
ListElement.players = gameTDB.GetPlayers(ListElement.id);
if(strlen(CustomTitle) == 0)
gameTDB.GetTitle(ListElement.id, gameTDB_Title);
}
if(!ValidColor(ListElement.casecolor))
ListElement.casecolor = CoverFlow.InternalCoverColor(ListElement.id, GameColor);
if(strlen(CustomTitle) > 0)
mbstowcs(ListElement.title, CustomTitle, 63);
else if(gameTDB_Title != NULL && gameTDB_Title[0] != '\0')
mbstowcs(ListElement.title, gameTDB_Title, 63);
else if(GameTitle != NULL)
mbstowcs(ListElement.title, GameTitle, 63);
Asciify(ListElement.title);
ListElement.type = Type;
m_cacheList.push_back(ListElement);
}
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);
}
}
static void Create_Wii_EXT_List(char *FullPath)
{
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);
}
}
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)
{
u32 hdr_offset = 0x00;
FILE *fp = fopen(FullPath, "rb");
if(!fp && strstr(FullPath, "/root") != NULL) //fst folder
{
*(strstr(FullPath, "/root") + 1) = '\0';
if(strlen(FullPath) + FST_APPEND_SIZE < MAX_MSG_SIZE) strcat(FullPath, FST_APPEND);
fp = fopen(FullPath, "rb");
}
if(fp)
{
fread((void*)&gc_hdr, 1, sizeof(gc_discHdr), fp);
//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);
}
if(gc_hdr.magic == GC_MAGIC)
{
AddISO((const char*)gc_hdr.id, (const char*)gc_hdr.title,
FullPath, 0x000000, TYPE_GC_GAME);
/* Check for disc 2 */
fseek(fp, hdr_offset + 0x06, SEEK_SET);
fread(gc_disc, 1, 1, fp);
if(gc_disc[0])
{
wcslcat(m_cacheList.back().title, L" disc 2", 63);
m_cacheList.back().settings[0] = 1;
}
}
fclose(fp);
}
}
const char *FolderTitle = NULL;
static void Create_Plugin_List(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';
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);
if(strlen(CustomTitle) > 0)
mbstowcs(ListElement.title, CustomTitle, 63);
else
mbstowcs(ListElement.title, FolderTitle, 63);
Asciify(ListElement.title);
ListElement.settings[0] = m_cacheList.Magic; //Plugin magic
ListElement.casecolor = m_cacheList.Color;
ListElement.type = TYPE_PLUGIN;
m_cacheList.push_back(ListElement);
}
static void Create_Homebrew_List(char *FullPath)
{
if(strcasestr(FullPath, "boot.") == NULL)
return;
memset((void*)&ListElement, 0, sizeof(dir_discHdr));
ListElement.index = m_cacheList.size();
*strrchr(FullPath, '/') = '\0';
strncpy(ListElement.path, FullPath, sizeof(ListElement.path) - 1);
memcpy(ListElement.id, "HB_APP", 6);
FolderTitle = strrchr(FullPath, '/') + 1;
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;
m_cacheList.push_back(ListElement);
}
Channel *chan = NULL;
static void Create_Channel_List(bool realNAND)
{
for(u32 i = 0; i < ChannelHandle.Count(); i++)
{
chan = ChannelHandle.GetChannel(i);
if(chan->id == NULL)
continue; // Skip invalid channels
memset((void*)&ListElement, 0, sizeof(dir_discHdr));
ListElement.index = m_cacheList.size();
ListElement.settings[0] = TITLE_UPPER(chan->title);
ListElement.settings[1] = TITLE_LOWER(chan->title);
-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
if(chan->title == HBC_108)
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);
ListElement.casecolor = CustomTitles.getColor("COVERS", ListElement.id, 0xFFFFFF).intVal();
char CustomTitle[64];
memset(CustomTitle, 0, sizeof(CustomTitle));
strncpy(CustomTitle, CustomTitles.getString("TITLES", ListElement.id).c_str(), 63);
const char *gameTDB_Title = NULL;
if(gameTDB.IsLoaded())
{
if(ListElement.casecolor == 0xFFFFFF)
ListElement.casecolor = gameTDB.GetCaseColor(ListElement.id);
ListElement.wifi = gameTDB.GetWifiPlayers(ListElement.id);
ListElement.players = gameTDB.GetPlayers(ListElement.id);
if(strlen(CustomTitle) == 0)
gameTDB.GetTitle(ListElement.id, gameTDB_Title);
}
if(strlen(CustomTitle) > 0)
mbstowcs(ListElement.title, CustomTitle, 63);
else if(gameTDB_Title != NULL && gameTDB_Title[0] != '\0')
mbstowcs(ListElement.title, gameTDB_Title, 63);
else
wcsncpy(ListElement.title, chan->name, 64);
if(realNAND)
ListElement.type = TYPE_CHANNEL;
else
ListElement.type = TYPE_EMUCHANNEL;
m_cacheList.push_back(ListElement);
}
}
void ListGenerator::CreateList(u32 Flow, u32 Device, const string& Path, const vector<string>& FileTypes,
const string& DBName, bool UpdateCache)
{
-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();
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();
if(Flow == COVERFLOW_WII)
{
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);
}
else if(Flow == COVERFLOW_CHANNEL)
{
ChannelHandle.Init(gameTDB_Language);
if(Device == 9)
Create_Channel_List(true);
else
Create_Channel_List(false);
}
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)
else if(Flow == COVERFLOW_PLUGIN)
GetFiles(Path.c_str(), FileTypes, Create_Plugin_List, false, 30);//wow 30 subfolders! really?
else if(Flow == COVERFLOW_HOMEBREW)
GetFiles(Path.c_str(), FileTypes, Create_Homebrew_List, false);
}
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)
{
for(vector<string>::const_iterator cmp = FileTypes.begin(); cmp != FileTypes.end(); ++cmp)
{
if(strcasecmp(File, cmp->c_str()) == 0)
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)
{
if(CompareFolders && IsFileSupported(pent->d_name, FileTypes))//if root folder for extracted gc games
{
AddFile(FullPathChar);
continue;
}
else if(depth < max_depth) //thanks libntfs (fail opendir) and thanks seekdir (slowass speed)
SubPaths.push_back(FullPathChar);
}
else if(pent->d_type == DT_REG)
{
NewFileName = strrchr(pent->d_name, '.');//the extension
if(NewFileName == NULL) NewFileName = pent->d_name;
if(IsFileSupported(NewFileName, FileTypes))
{
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();
}
void ListGenerator::createSFList(u8 maxBtns, Config &m_sourceMenuCfg, const string& sourceDir)
{
-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();
char btn_selected[256];
for(u8 i = 0; i <= maxBtns; i++)
{
memset(btn_selected, 0, 256);
strncpy(btn_selected, fmt("BUTTON_%i", i), 255);
-updated NIN_CFG_VERSION to 7 for Nintendont argsboot and added triforce arcade option to game settings menu. tested and working. -fixed wii u widescreen option in game config menu. should properly work now. thanks pBullet! -added a fix for coverflow titles display when coverflow has 3 or more rows. for some reason 3 or more rows caused the title to display improperly. -removed **disabled** message from source menu. no need for it - was a stupid idea. if you don't want it to display then remove it from your source menu or don't add it. when a view is disabled in wiiflow_lite.ini then only that view icon is disabled from showing on the main menu screen. -removed titles.ini which wasn't really used except for displaying the return to channel in settings. I googled it and nothing really showed up. it seemed to be the same as custom_titles.ini - it seemed useless. -removed cacheing sourceflow list. the list is never big enuff to worry about cacheing. plus if you add or remove source btns you won't have to reload cache for the changes to take effect. -removed max_source_btns from wiiflow_lite.ini - added code to get highest source menu btn so now source menu can have as many buttons as you like. -removed Manage Languages Menu - restored option to just change wiiflow language. no need for downloading languages and the google link didn't work anyway. when i make a pack all the languages will be included. -added flat cover options for sourceflow and homebrew view. can be turned on/off via their config menu's accessed via 'HOME' btn. -added config menu for homebrew view - press 'HOME' btn while in homebrew view to access it. config menu options are - switch apps partition, adjust coverflow, smallbox on/off, and flat covers on/off. -updated config menu for source menu/flow. options include - sourceflow on/off, adjust coverflow, smallbox on/off, flat covers on/off, and for source menu only - multisource on/off. -added coverflow layouts/versions for individual plugins - which means each plugin can have its own coverflow layout without affecting the others. -set HQ cover to default to ON -made it so coverflow doesn't reload every time you access another menu or change favorites or whatever. -added error messages to game and app launching if any of the bin files needed for launching are missing. previously whenever these errors occurred wiiflow would just exit without the user knowing why. Now the error message should display before exit so the user has an idea what went wrong. had to move cleanup() back some for the errors to show. hopefully that doesn't cause out of mem issues for users with large game collections. -added error messages to game config menu. now all config options will show but if you can't use it then a error shows telling you. such as 'use neek2o' will be available but if you set it to on and neek2o isn't installed then an error message shows. added error msgs for extracting and flashing saves too. -added show_mem=yes/no option to wiiflow_lite.ini under [DEBUG]. manually edit wiiflow_lite.ini to turn it on/off. if set to 'yes' wiiflow will show how much free mem is available on screen. no need to compile wiiflow for this option anymore. -cleaned up some of the boot up code. -starting a random game - just hold 'B' and press '-'. no longer press'B' on config or question mark icon and no need to allow it in wiiflow_lite.ini
2016-11-07 16:06:00 +01:00
const char *source = m_sourceMenuCfg.getString(btn_selected, "source","").c_str();
if(source == NULL)
continue;
const char *path = fmt("%s/%s", sourceDir.c_str(), m_sourceMenuCfg.getString(btn_selected, "image", "").c_str());
-updated NIN_CFG_VERSION to 7 for Nintendont argsboot and added triforce arcade option to game settings menu. tested and working. -fixed wii u widescreen option in game config menu. should properly work now. thanks pBullet! -added a fix for coverflow titles display when coverflow has 3 or more rows. for some reason 3 or more rows caused the title to display improperly. -removed **disabled** message from source menu. no need for it - was a stupid idea. if you don't want it to display then remove it from your source menu or don't add it. when a view is disabled in wiiflow_lite.ini then only that view icon is disabled from showing on the main menu screen. -removed titles.ini which wasn't really used except for displaying the return to channel in settings. I googled it and nothing really showed up. it seemed to be the same as custom_titles.ini - it seemed useless. -removed cacheing sourceflow list. the list is never big enuff to worry about cacheing. plus if you add or remove source btns you won't have to reload cache for the changes to take effect. -removed max_source_btns from wiiflow_lite.ini - added code to get highest source menu btn so now source menu can have as many buttons as you like. -removed Manage Languages Menu - restored option to just change wiiflow language. no need for downloading languages and the google link didn't work anyway. when i make a pack all the languages will be included. -added flat cover options for sourceflow and homebrew view. can be turned on/off via their config menu's accessed via 'HOME' btn. -added config menu for homebrew view - press 'HOME' btn while in homebrew view to access it. config menu options are - switch apps partition, adjust coverflow, smallbox on/off, and flat covers on/off. -updated config menu for source menu/flow. options include - sourceflow on/off, adjust coverflow, smallbox on/off, flat covers on/off, and for source menu only - multisource on/off. -added coverflow layouts/versions for individual plugins - which means each plugin can have its own coverflow layout without affecting the others. -set HQ cover to default to ON -made it so coverflow doesn't reload every time you access another menu or change favorites or whatever. -added error messages to game and app launching if any of the bin files needed for launching are missing. previously whenever these errors occurred wiiflow would just exit without the user knowing why. Now the error message should display before exit so the user has an idea what went wrong. had to move cleanup() back some for the errors to show. hopefully that doesn't cause out of mem issues for users with large game collections. -added error messages to game config menu. now all config options will show but if you can't use it then a error shows telling you. such as 'use neek2o' will be available but if you set it to on and neek2o isn't installed then an error message shows. added error msgs for extracting and flashing saves too. -added show_mem=yes/no option to wiiflow_lite.ini under [DEBUG]. manually edit wiiflow_lite.ini to turn it on/off. if set to 'yes' wiiflow will show how much free mem is available on screen. no need to compile wiiflow for this option anymore. -cleaned up some of the boot up code. -starting a random game - just hold 'B' and press '-'. no longer press'B' on config or question mark icon and no need to allow it in wiiflow_lite.ini
2016-11-07 16:06:00 +01:00
memset((void*)&ListElement, 0, sizeof(dir_discHdr));
ListElement.index = m_cacheList.size();
memcpy(ListElement.id, "SOURCE", 6);
strncpy(ListElement.path, path, sizeof(ListElement.path) - 1);
ListElement.casecolor = 0xFFFFFF;
ListElement.type = TYPE_SOURCE;
ListElement.settings[0] = i;
//const char *title = m_sourceMenuCfg.getString(btn_selected, "title", fmt("title_%i", i)).c_str();
char SourceTitle[64];
memset(SourceTitle, 0, sizeof(SourceTitle));
strncpy(SourceTitle, m_sourceMenuCfg.getString(btn_selected, "title", fmt("title_%i", i)).c_str(), 63);
mbstowcs(ListElement.title, SourceTitle, 63);
Asciify(ListElement.title);
m_cacheList.push_back(ListElement);
}
}