From 8a475cc7d356a817ce373780133cd121506bc6e8 Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Wed, 29 Feb 2012 18:11:35 +0000 Subject: [PATCH] -we shouldnt limit path length to 64, using the max fat path is better and fixes some codedumps when installing games with longer name --- source/gc/gc.c | 2 +- source/loader/gc_disc.cpp | 8 ++++---- source/menu/menu_wbfs.cpp | 17 ++++++----------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/source/gc/gc.c b/source/gc/gc.c index da296cb0..9c29a58c 100644 --- a/source/gc/gc.c +++ b/source/gc/gc.c @@ -125,7 +125,7 @@ void DML_RemoveGame(const char *discid, const char* partition) bool DML_GameIsInstalled(char *discid, const char* partition) { - char filepath[64]; + char filepath[MAX_FAT_PATH]; sprintf(filepath, "%s:/games/%s/game.iso", partition, discid); gprintf("Filepath on SD: %s\n", filepath); diff --git a/source/loader/gc_disc.cpp b/source/loader/gc_disc.cpp index 71f8849c..08109096 100644 --- a/source/loader/gc_disc.cpp +++ b/source/loader/gc_disc.cpp @@ -146,7 +146,7 @@ s32 GCDump::DumpGame(progress_callback_t spinner, message_callback_t message, vo u8 *ReadBuffer = (u8 *)MEM2_alloc(gc_readsize); u32 j; - + char *FSTNameOff = (char *)NULL; char folder[MAX_FAT_PATH]; @@ -154,7 +154,7 @@ s32 GCDump::DumpGame(progress_callback_t spinner, message_callback_t message, vo char gamepath[MAX_FAT_PATH]; bzero(gamepath, MAX_FAT_PATH); char minfo[74]; - + for( j=0; j<2; ++j) { bool done = false; @@ -207,9 +207,9 @@ s32 GCDump::DumpGame(progress_callback_t spinner, message_callback_t message, vo FSTNameOff = (char*)(FSTable + FSTEnt * 0x0C); FST *fst = (FST *)(FSTable); - + snprintf(minfo, sizeof(minfo), "[%.06s] %s", (char *)gcheader.id, gcheader.title); - + if(FSTTotal > FSTSize) message( 4, j+1, minfo, spinner_data); else diff --git a/source/menu/menu_wbfs.cpp b/source/menu/menu_wbfs.cpp index a8729fa6..eacf860d 100644 --- a/source/menu/menu_wbfs.cpp +++ b/source/menu/menu_wbfs.cpp @@ -168,7 +168,7 @@ int CMenu::_GCgameInstaller(void *obj) u64 free = (u64)stats.f_frsize * (u64)stats.f_bfree; u32 needed = 0; - + ret = m_gcdump.CheckSpace(&needed, comp, CMenu::_Messenger, obj); if(ret != 0) { @@ -212,12 +212,10 @@ int CMenu::_GCgameInstaller(void *obj) int CMenu::_GCcopyGame(void *obj) { CMenu &m = *(CMenu *)obj; - char partition[strlen(DeviceName[SD])]; - sprintf(partition,"%s:/",DeviceName[SD]); - if(fsop_GetFreeSpaceKb((char*)DeviceName[SD])path)) + if(fsop_GetFreeSpaceKb((char*)"sd:/")path)) { LWP_MutexLock(m.m_mutex); - m._setThrdMsg(wfmt(m._fmt("wbfsop10", L"Not enough space: %d blocks needed, %d available"), fsop_GetFolderKb(m.m_cf.getHdr()->path), fsop_GetFreeSpaceKb(partition)), 0.f); + m._setThrdMsg(wfmt(m._fmt("wbfsop10", L"Not enough space: %d blocks needed, %d available"), fsop_GetFolderKb(m.m_cf.getHdr()->path), fsop_GetFreeSpaceKb((char*)"sd:/")), 0.f); LWP_MutexUnlock(m.m_mutex); m.m_thrdWorking = false; return -1; @@ -226,11 +224,8 @@ int CMenu::_GCcopyGame(void *obj) { LWP_MutexLock(m.m_mutex); m._setThrdMsg(L"", 0); - char folder[10] = "sd:/games"; - if (!fsop_DirExist(folder)) - { - fsop_MakeFolder(folder); - } + if (!fsop_DirExist((char*)"sd:/games")) + fsop_MakeFolder((char*)"sd:/games"); char source[64]; char target[64]; sprintf(source, "%s:/games/%s", DeviceName[currentPartition], m.m_cf.getHdr()->path); @@ -343,7 +338,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op) { Disc_ReadGCHeader(&gcheader); - char gcfolder[64]; + char gcfolder[MAX_FAT_PATH]; 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])) {