-changed a few things about the addition in r183 again, if

you want to have the gamecube games in the usb folder
"ngc" you now also just need to set the ini to "ngc",
no need for "%s:/ngc" anymore (thanks r-win for few tips)
This commit is contained in:
fix94.1 2012-03-07 21:03:27 +00:00
parent 5ff5952db3
commit 63dbed3f68
5 changed files with 28 additions and 28 deletions

View File

@ -218,9 +218,9 @@ s32 GCDump::DumpGame(progress_callback_t spinner, message_callback_t message, vo
char *FSTNameOff = (char *)NULL;
char folder[MAX_FAT_PATH];
bzero(folder, MAX_FAT_PATH);
bzero(folder, MAX_FAT_PATH);
char gamepath[MAX_FAT_PATH];
bzero(gamepath, MAX_FAT_PATH);
bzero(gamepath, MAX_FAT_PATH);
char minfo[74];
for( j=0; j<2; ++j)
@ -230,16 +230,20 @@ s32 GCDump::DumpGame(progress_callback_t spinner, message_callback_t message, vo
s32 ret = Disc_ReadGCHeader(&gcheader);
Asciify2(gcheader.title);
if(strncmp(gamepartition, "sd", 2) != 0)
snprintf(folder, sizeof(folder), dmlgamedir, gamepartition); //WTF??
else
snprintf(folder, sizeof(folder), DML_DIR, gamepartition);
snprintf(folder, sizeof(folder), sfmt((strncmp(gamepartition, "sd", 2) != 0) ? usb_dml_game_dir : DML_DIR, gamepartition).c_str());
if(!fsop_DirExist(folder))
{
gprintf("Creating directory: %s", folder);
makedir(folder);
snprintf(folder, sizeof(folder), "%s:/games/%s [%.06s]%s", gamepartition, gcheader.title, (char *)gcheader.id, j ? "2" : "");
}
memset(folder, 0, sizeof(folder));
snprintf(folder, sizeof(folder), "%s/%s [%.06s]%s", sfmt((strncmp(gamepartition, "sd", 2) != 0) ? usb_dml_game_dir : DML_DIR, gamepartition).c_str(), gcheader.title, (char *)gcheader.id, j ? "2" : "");
if(!fsop_DirExist(folder))
{
gprintf("Creating directory: %s", folder);
makedir(folder);
}
ret = __DiscReadRaw(ReadBuffer, 0, 0x440);
if(ret > 0)
@ -298,9 +302,13 @@ s32 GCDump::DumpGame(progress_callback_t spinner, message_callback_t message, vo
if(writeexfiles)
{
snprintf(folder, sizeof(folder), "%s:/games/%s [%.06s]%s/sys", gamepartition, gcheader.title, (char *)gcheader.id, j ? "2" : "");
memset(folder, 0, sizeof(folder));
snprintf(folder, sizeof(folder), "%s/%s [%.06s]%s/sys", sfmt((strncmp(gamepartition, "sd", 2) != 0) ? usb_dml_game_dir : DML_DIR, gamepartition).c_str(), gcheader.title, (char *)gcheader.id, j ? "2" : "");
if(!fsop_DirExist(folder))
{
gprintf("Creating directory: %s", folder);
makedir(folder);
}
gprintf("Writing %s/boot.bin\n", folder);
snprintf(gamepath, sizeof(gamepath), "%s/boot.bin", folder);
@ -315,7 +323,7 @@ s32 GCDump::DumpGame(progress_callback_t spinner, message_callback_t message, vo
gc_done += __DiscWrite(gamepath, 0x2440, ApploaderSize, ReadBuffer, spinner, spinner_data);
}
snprintf(gamepath, sizeof(gamepath), "%s:/games/%s [%.06s]%s/game.iso", gamepartition, gcheader.title, (char *)gcheader.id, j ? "2" : "");
snprintf(gamepath, sizeof(gamepath), "%s/%s [%.06s]%s/game.iso", sfmt((strncmp(gamepartition, "sd", 2) != 0) ? usb_dml_game_dir : DML_DIR, gamepartition).c_str(), gcheader.title, (char *)gcheader.id, j ? "2" : "");
gprintf("Writing %s\n", gamepath);
if(compressed)

View File

@ -43,7 +43,7 @@ public:
gc_nbrretry = nretry;
gc_readsize = rsize;
gamepartition = partition;
dmlgamedir = m_DMLgameDir;
usb_dml_game_dir = m_DMLgameDir;
gc_skipped = 0;
}
s32 DumpGame(progress_callback_t spinner, message_callback_t message, void *spinner_data);
@ -54,7 +54,7 @@ private:
bool compressed;
bool writeexfiles;
const char* gamepartition;
const char* dmlgamedir;
const char* usb_dml_game_dir;
u8 Disc;
u8 Disc2;
u32 gc_nbrretry;

View File

@ -249,7 +249,7 @@ void CMenu::init(void)
}
else
m_show_dml = MIOSisDML();
m_DMLgameDir = m_cfg.getString("DML", "dir_usb_games", DML_DIR);
m_DMLgameDir = sfmt("%%s:/%s", m_cfg.getString("DML", "dir_usb_games", "games").c_str());
m_cfg.getString("NAND", "path", "").c_str();
m_cfg.getInt("NAND", "partition", 0);

View File

@ -450,13 +450,13 @@ void CMenu::_game(bool launch)
sprintf(gcfolder, "%s [%s]", m_cf.getTitle().toUTF8().c_str(), (char *)hdr->hdr.id);
if (DML_GameIsInstalled((char *)hdr->hdr.id, DeviceName[SD], DML_DIR))
{
memset(hdr->path,0,sizeof(hdr->path));
sprintf(hdr->path,"%s",(char*)hdr->hdr.id);
memset(hdr->path, 0, sizeof(hdr->path));
snprintf(hdr->path, sizeof(hdr->path), "%s", (char*)hdr->hdr.id);
}
else if(DML_GameIsInstalled(gcfolder, DeviceName[SD], DML_DIR))
{
memset(hdr->path,0,sizeof(hdr->path));
sprintf(hdr->path,"%s",gcfolder);
memset(hdr->path, 0, sizeof(hdr->path));
snprintf(hdr->path, sizeof(hdr->path), "%s", gcfolder);
}
else if(!DML_GameIsInstalled(hdr->path, DeviceName[SD], DML_DIR) && !_wbfsOp(CMenu::WO_COPY_GAME))
break;

View File

@ -344,11 +344,8 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
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);
snprintf(dmlgamedir, sizeof(dmlgamedir), "%s", (currentPartition != SD) ? m_DMLgameDir.c_str() : DML_DIR);
snprintf(gcfolder, sizeof(gcfolder), "%s [%s]", gcheader.title, (char *)gcheader.id);
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"));
@ -379,13 +376,8 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
}
else
{
char folder[50];
char source[300];
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", sfmt((char *)m_cf.getHdr()->path, DeviceName[currentPartition]).c_str());
fsop_deleteFolder(source);
upd_dml = true;
}