mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-23 19:59:16 +01:00
-added possibility to use another folder for
gamecube games on usb, its a new config entry in DML section, dir_usb_games, default is the "games" folder. If you want for example "ngc", change the value to "%s:/ngc". (issue 19)
This commit is contained in:
parent
2247728e6a
commit
9472bd3d59
@ -6,7 +6,6 @@
|
|||||||
#include "gecko.h"
|
#include "gecko.h"
|
||||||
#include "fileOps.h"
|
#include "fileOps.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "defines.h"
|
|
||||||
|
|
||||||
#define SRAM_ENGLISH 0
|
#define SRAM_ENGLISH 0
|
||||||
#define SRAM_GERMAN 1
|
#define SRAM_GERMAN 1
|
||||||
@ -95,11 +94,11 @@ void set_language(u8 lang)
|
|||||||
while(!__SYS_SyncSram());
|
while(!__SYS_SyncSram());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DML_GameIsInstalled(char *discid, const char* partition)
|
bool DML_GameIsInstalled(char *discid, const char* partition, const char* dmlgamedir)
|
||||||
{
|
{
|
||||||
char folder[12];
|
char folder[50];
|
||||||
char source[300];
|
char source[300];
|
||||||
snprintf(folder, sizeof(folder), DML_DIR, partition);
|
snprintf(folder, sizeof(folder), dmlgamedir, partition);
|
||||||
snprintf(source, sizeof(source), "%s/%s/game.iso", folder, discid);
|
snprintf(source, sizeof(source), "%s/%s/game.iso", folder, discid);
|
||||||
|
|
||||||
FILE *f = fopen(source, "r");
|
FILE *f = fopen(source, "r");
|
||||||
|
@ -7,7 +7,7 @@ extern "C"
|
|||||||
#define GC_H_
|
#define GC_H_
|
||||||
void set_video_mode(int i);
|
void set_video_mode(int i);
|
||||||
void set_language(u8 lang);
|
void set_language(u8 lang);
|
||||||
bool DML_GameIsInstalled(char *discid, const char* partition);
|
bool DML_GameIsInstalled(char *discid, const char* partition, const char* dmlgamedir);
|
||||||
#endif //GC_H_
|
#endif //GC_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -152,7 +152,10 @@ s32 GCDump::DumpGame(progress_callback_t spinner, message_callback_t message, vo
|
|||||||
s32 ret = Disc_ReadGCHeader(&gcheader);
|
s32 ret = Disc_ReadGCHeader(&gcheader);
|
||||||
Asciify2(gcheader.title);
|
Asciify2(gcheader.title);
|
||||||
|
|
||||||
snprintf(folder, sizeof(folder), DML_DIR, gamepartition);
|
if(strncmp(gamepartition, "sd",2) != 0)
|
||||||
|
snprintf(folder, sizeof(folder), dmlgamedir, gamepartition);
|
||||||
|
else
|
||||||
|
snprintf(folder, sizeof(folder), DML_DIR, gamepartition);
|
||||||
if(!fsop_DirExist(folder))
|
if(!fsop_DirExist(folder))
|
||||||
makedir(folder);
|
makedir(folder);
|
||||||
snprintf(folder, sizeof(folder), "%s:/games/%s [%.06s]%s", gamepartition, gcheader.title, (char *)gcheader.id, j ? "2" : "");
|
snprintf(folder, sizeof(folder), "%s:/games/%s [%.06s]%s", gamepartition, gcheader.title, (char *)gcheader.id, j ? "2" : "");
|
||||||
|
@ -34,7 +34,7 @@ typedef void (*message_callback_t)(int message, int info, char *cinfo, void *use
|
|||||||
class GCDump
|
class GCDump
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Init(bool skip, bool comp, bool wexf, bool align, u32 nretry, u32 rsize, const char* partition)
|
void Init(bool skip, bool comp, bool wexf, bool align, u32 nretry, u32 rsize, const char* partition, const char* m_DMLgameDir)
|
||||||
{
|
{
|
||||||
skiponerror = skip;
|
skiponerror = skip;
|
||||||
compressed = comp;
|
compressed = comp;
|
||||||
@ -43,6 +43,7 @@ public:
|
|||||||
gc_nbrretry = nretry;
|
gc_nbrretry = nretry;
|
||||||
gc_readsize = rsize;
|
gc_readsize = rsize;
|
||||||
gamepartition = partition;
|
gamepartition = partition;
|
||||||
|
dmlgamedir = m_DMLgameDir;
|
||||||
gc_skipped = 0;
|
gc_skipped = 0;
|
||||||
}
|
}
|
||||||
s32 DumpGame(progress_callback_t spinner, message_callback_t message, void *spinner_data);
|
s32 DumpGame(progress_callback_t spinner, message_callback_t message, void *spinner_data);
|
||||||
@ -53,6 +54,7 @@ private:
|
|||||||
bool compressed;
|
bool compressed;
|
||||||
bool writeexfiles;
|
bool writeexfiles;
|
||||||
const char* gamepartition;
|
const char* gamepartition;
|
||||||
|
const char* dmlgamedir;
|
||||||
u8 Disc;
|
u8 Disc;
|
||||||
u8 Disc2;
|
u8 Disc2;
|
||||||
u32 gc_nbrretry;
|
u32 gc_nbrretry;
|
||||||
|
@ -249,6 +249,7 @@ void CMenu::init(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_show_dml = MIOSisDML();
|
m_show_dml = MIOSisDML();
|
||||||
|
m_DMLgameDir = m_cfg.getString("DML", "dir_usb_games", DML_DIR);
|
||||||
|
|
||||||
m_cfg.getString("NAND", "path", "").c_str();
|
m_cfg.getString("NAND", "path", "").c_str();
|
||||||
m_cfg.getInt("NAND", "partition", 0);
|
m_cfg.getInt("NAND", "partition", 0);
|
||||||
@ -263,7 +264,7 @@ void CMenu::init(void)
|
|||||||
m_ver = sfmt("%s/versions", m_appDir.c_str());
|
m_ver = sfmt("%s/versions", m_appDir.c_str());
|
||||||
m_app_update_zip = sfmt("%s/update.zip", m_appDir.c_str());
|
m_app_update_zip = sfmt("%s/update.zip", m_appDir.c_str());
|
||||||
m_data_update_zip = sfmt("%s/update.zip", m_dataDir.c_str());
|
m_data_update_zip = sfmt("%s/update.zip", m_dataDir.c_str());
|
||||||
//
|
|
||||||
m_cacheDir = m_cfg.getString("GENERAL", "dir_cache", sfmt("%s/cache", m_dataDir.c_str()));
|
m_cacheDir = m_cfg.getString("GENERAL", "dir_cache", sfmt("%s/cache", m_dataDir.c_str()));
|
||||||
m_settingsDir = m_cfg.getString("GENERAL", "dir_settings", sfmt("%s/settings", m_dataDir.c_str()));
|
m_settingsDir = m_cfg.getString("GENERAL", "dir_settings", sfmt("%s/settings", m_dataDir.c_str()));
|
||||||
m_languagesDir = m_cfg.getString("GENERAL", "dir_languages", sfmt("%s/languages", m_dataDir.c_str()));
|
m_languagesDir = m_cfg.getString("GENERAL", "dir_languages", sfmt("%s/languages", m_dataDir.c_str()));
|
||||||
@ -278,7 +279,6 @@ void CMenu::init(void)
|
|||||||
m_cheatDir = m_cfg.getString("GENERAL", "dir_cheat", sfmt("%s/gct", m_txtCheatDir.c_str()));
|
m_cheatDir = m_cfg.getString("GENERAL", "dir_cheat", sfmt("%s/gct", m_txtCheatDir.c_str()));
|
||||||
m_wipDir = m_cfg.getString("GENERAL", "dir_wip", sfmt("%s/wip", m_txtCheatDir.c_str()));
|
m_wipDir = m_cfg.getString("GENERAL", "dir_wip", sfmt("%s/wip", m_txtCheatDir.c_str()));
|
||||||
m_listCacheDir = m_cfg.getString("GENERAL", "dir_list_cache", sfmt("%s/lists", m_cacheDir.c_str()));
|
m_listCacheDir = m_cfg.getString("GENERAL", "dir_list_cache", sfmt("%s/lists", m_cacheDir.c_str()));
|
||||||
//
|
|
||||||
|
|
||||||
DeviceHandler::SetWatchdog(m_cfg.getUInt("GENERAL", "watchdog_timeout", 10));
|
DeviceHandler::SetWatchdog(m_cfg.getUInt("GENERAL", "watchdog_timeout", 10));
|
||||||
|
|
||||||
@ -1882,7 +1882,10 @@ bool CMenu::_loadDmlList()
|
|||||||
|
|
||||||
gprintf("%s\n", DeviceName[currentPartition]);
|
gprintf("%s\n", DeviceName[currentPartition]);
|
||||||
DeviceHandler::Instance()->Open_WBFS(currentPartition);
|
DeviceHandler::Instance()->Open_WBFS(currentPartition);
|
||||||
m_gameList.Load(sfmt(DML_DIR, DeviceName[currentPartition]), ".iso", m_cfg.getString("DML", "lastlanguage", "EN").c_str());
|
if(currentPartition != SD)
|
||||||
|
m_gameList.Load(sfmt(m_DMLgameDir.c_str(), DeviceName[currentPartition]), ".iso", m_cfg.getString("DML", "lastlanguage", "EN").c_str());
|
||||||
|
else
|
||||||
|
m_gameList.Load(sfmt(DML_DIR, DeviceName[currentPartition]), ".iso", m_cfg.getString("DML", "lastlanguage", "EN").c_str());
|
||||||
m_cfg.setString("DML", "lastlanguage", m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
|
m_cfg.setString("DML", "lastlanguage", m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
|
||||||
m_cfg.save();
|
m_cfg.save();
|
||||||
return m_gameList.size() > 0 ? true : false;
|
return m_gameList.size() > 0 ? true : false;
|
||||||
|
@ -81,7 +81,7 @@ private:
|
|||||||
std::string m_curChanId;
|
std::string m_curChanId;
|
||||||
|
|
||||||
u8 m_numCFVersions;
|
u8 m_numCFVersions;
|
||||||
//
|
|
||||||
std::string m_themeDataDir;
|
std::string m_themeDataDir;
|
||||||
std::string m_appDir;
|
std::string m_appDir;
|
||||||
std::string m_dataDir;
|
std::string m_dataDir;
|
||||||
@ -101,6 +101,7 @@ private:
|
|||||||
std::string m_settingsDir;
|
std::string m_settingsDir;
|
||||||
std::string m_languagesDir;
|
std::string m_languagesDir;
|
||||||
std::string m_listCacheDir;
|
std::string m_listCacheDir;
|
||||||
|
std::string m_DMLgameDir;
|
||||||
/* Updates */
|
/* Updates */
|
||||||
const char* m_app_update_url;
|
const char* m_app_update_url;
|
||||||
const char* m_data_update_url;
|
const char* m_data_update_url;
|
||||||
|
@ -446,19 +446,19 @@ void CMenu::_game(bool launch)
|
|||||||
dir_discHdr *hdr = m_cf.getHdr();
|
dir_discHdr *hdr = m_cf.getHdr();
|
||||||
if(currentPartition != SD && m_current_view == COVERFLOW_DML)
|
if(currentPartition != SD && m_current_view == COVERFLOW_DML)
|
||||||
{
|
{
|
||||||
char gcfolder[MAX_FAT_PATH];
|
char gcfolder[300];
|
||||||
sprintf(gcfolder, "%s [%s]", m_cf.getTitle().toUTF8().c_str(), (char *)hdr->hdr.id);
|
sprintf(gcfolder, "%s [%s]", m_cf.getTitle().toUTF8().c_str(), (char *)hdr->hdr.id);
|
||||||
if (DML_GameIsInstalled((char *)hdr->hdr.id, DeviceName[SD]))
|
if (DML_GameIsInstalled((char *)hdr->hdr.id, DeviceName[SD], DML_DIR))
|
||||||
{
|
{
|
||||||
memset(hdr->path,0,sizeof(hdr->path));
|
memset(hdr->path,0,sizeof(hdr->path));
|
||||||
sprintf(hdr->path,"%s",(char*)hdr->hdr.id);
|
sprintf(hdr->path,"%s",(char*)hdr->hdr.id);
|
||||||
}
|
}
|
||||||
else if(DML_GameIsInstalled(gcfolder, DeviceName[SD]))
|
else if(DML_GameIsInstalled(gcfolder, DeviceName[SD], DML_DIR))
|
||||||
{
|
{
|
||||||
memset(hdr->path,0,sizeof(hdr->path));
|
memset(hdr->path,0,sizeof(hdr->path));
|
||||||
sprintf(hdr->path,"%s",gcfolder);
|
sprintf(hdr->path,"%s",gcfolder);
|
||||||
}
|
}
|
||||||
else if(!DML_GameIsInstalled(hdr->path, DeviceName[SD]) && !_wbfsOp(CMenu::WO_COPY_GAME))
|
else if(!DML_GameIsInstalled(hdr->path, DeviceName[SD], DML_DIR) && !_wbfsOp(CMenu::WO_COPY_GAME))
|
||||||
break;
|
break;
|
||||||
currentPartition = SD;
|
currentPartition = SD;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ int CMenu::_GCgameInstaller(void *obj)
|
|||||||
u32 nretry = m.m_cfg.getUInt("DML", "num_retries", 5);
|
u32 nretry = m.m_cfg.getUInt("DML", "num_retries", 5);
|
||||||
u32 rsize = 1048576; //1MB
|
u32 rsize = 1048576; //1MB
|
||||||
|
|
||||||
m_gcdump.Init(skip, comp, wexf, alig, nretry, rsize,DeviceName[currentPartition]);
|
m_gcdump.Init(skip, comp, wexf, alig, nretry, rsize,DeviceName[currentPartition],m.m_DMLgameDir.c_str());
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -207,10 +207,10 @@ int CMenu::_GCgameInstaller(void *obj)
|
|||||||
int CMenu::_GCcopyGame(void *obj)
|
int CMenu::_GCcopyGame(void *obj)
|
||||||
{
|
{
|
||||||
CMenu &m = *(CMenu *)obj;
|
CMenu &m = *(CMenu *)obj;
|
||||||
char folder[12];
|
char folder[50];
|
||||||
char source[300];
|
char source[300];
|
||||||
char target[300];
|
char target[300];
|
||||||
snprintf(folder, sizeof(folder), DML_DIR, DeviceName[currentPartition]);
|
snprintf(folder, sizeof(folder), m.m_DMLgameDir.c_str(), DeviceName[currentPartition]);
|
||||||
snprintf(source, sizeof(source), "%s/%s", folder, m.m_cf.getHdr()->path);
|
snprintf(source, sizeof(source), "%s/%s", folder, m.m_cf.getHdr()->path);
|
||||||
memset(folder, 0, sizeof(folder));
|
memset(folder, 0, sizeof(folder));
|
||||||
snprintf(folder, sizeof(folder), DML_DIR, DeviceName[SD]);
|
snprintf(folder, sizeof(folder), DML_DIR, DeviceName[SD]);
|
||||||
@ -338,9 +338,14 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
|||||||
{
|
{
|
||||||
Disc_ReadGCHeader(&gcheader);
|
Disc_ReadGCHeader(&gcheader);
|
||||||
|
|
||||||
char gcfolder[MAX_FAT_PATH];
|
char gcfolder[300];
|
||||||
|
char dmlgamedir[50];
|
||||||
|
if(currentPartition != SD)
|
||||||
|
sprintf(dmlgamedir,"%s",m_DMLgameDir.c_str());
|
||||||
|
else
|
||||||
|
sprintf(dmlgamedir,"%s",DML_DIR);
|
||||||
sprintf(gcfolder, "%s [%s]", gcheader.title, (char *)gcheader.id);
|
sprintf(gcfolder, "%s [%s]", gcheader.title, (char *)gcheader.id);
|
||||||
if (_searchGamesByID((const char *) gcheader.id).size() != 0 || DML_GameIsInstalled((char *)gcheader.id, DeviceName[currentPartition]) || DML_GameIsInstalled(gcfolder, DeviceName[currentPartition]))
|
if (_searchGamesByID((const char *) gcheader.id).size() != 0 || DML_GameIsInstalled((char *)gcheader.id, DeviceName[currentPartition], dmlgamedir) || DML_GameIsInstalled(gcfolder, DeviceName[currentPartition], dmlgamedir))
|
||||||
{
|
{
|
||||||
error(_t("wbfsoperr4", L"Game already installed"));
|
error(_t("wbfsoperr4", L"Game already installed"));
|
||||||
out = true;
|
out = true;
|
||||||
@ -370,9 +375,12 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char folder[12];
|
char folder[50];
|
||||||
char source[300];
|
char source[300];
|
||||||
snprintf(folder, sizeof(folder), DML_DIR, DeviceName[currentPartition]);
|
if(currentPartition != SD)
|
||||||
|
snprintf(folder, sizeof(folder), m_DMLgameDir.c_str(), DeviceName[currentPartition]);
|
||||||
|
else
|
||||||
|
snprintf(folder, sizeof(folder), DML_DIR, DeviceName[currentPartition]);
|
||||||
snprintf(source, sizeof(source), "%s/%s", folder, m_cf.getHdr()->path);
|
snprintf(source, sizeof(source), "%s/%s", folder, m_cf.getHdr()->path);
|
||||||
fsop_deleteFolder(source);
|
fsop_deleteFolder(source);
|
||||||
upd_dml = true;
|
upd_dml = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user