-size calculation of gamecube dumper should be

more accurate now
-changed another path limit from 64 to 1024,
to prevent errors when trying to install gamecube
games from usb to sd with long name
This commit is contained in:
fix94.1 2012-03-01 19:36:17 +00:00
parent 151eca94a2
commit 152bde2c36
3 changed files with 35 additions and 21 deletions

View File

@ -426,7 +426,6 @@ s32 GCDump::CheckSpace(u32 *needed, bool comp, message_callback_t message, void
FSTTotal = *(vu32*)(ReadBuffer+0x42c); FSTTotal = *(vu32*)(ReadBuffer+0x42c);
GamePartOffset = *(vu32*)(ReadBuffer+0x434); GamePartOffset = *(vu32*)(ReadBuffer+0x434);
DataSize = *(vu32*)(ReadBuffer+0x438); DataSize = *(vu32*)(ReadBuffer+0x438);
DiscSize = DataSize + GamePartOffset; DiscSize = DataSize + GamePartOffset;
bool done = false; bool done = false;
@ -463,7 +462,11 @@ s32 GCDump::CheckSpace(u32 *needed, bool comp, message_callback_t message, void
u32 FSTEnt = *(u32*)(FSTable+0x08); u32 FSTEnt = *(u32*)(FSTable+0x08);
FST *fst = (FST *)(FSTable); FST *fst = (FST *)(FSTable);
size += (FSTOffset + FSTSize);
u32 i; u32 i;
u32 correction;
u32 align;
for( i=1; i < FSTEnt; ++i ) for( i=1; i < FSTEnt; ++i )
{ {
@ -473,7 +476,18 @@ s32 GCDump::CheckSpace(u32 *needed, bool comp, message_callback_t message, void
} }
else else
{ {
size += (fst[i].FileLength+31)&(~31); for(align = 0x8000; align > 2; align/=2)
{
if((fst[i].FileOffset & (align-1)) == 0 || force_32k_align)
{
correction = 0x00;
while(((size+correction) & (align-1)) != 0)
correction++;
size += correction;
break;
}
}
size += fst[i].FileLength;
} }
} }
MEM2_free(FSTBuffer); MEM2_free(FSTBuffer);

View File

@ -429,7 +429,7 @@ void CMenu::_game(bool launch)
{ {
char gcfolder[MAX_FAT_PATH]; char gcfolder[MAX_FAT_PATH];
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);
memset(hdr->path,0,256); memset(hdr->path,0,sizeof(hdr->path));
if (DML_GameIsInstalled((char *)hdr->hdr.id, DeviceName[SD])) if (DML_GameIsInstalled((char *)hdr->hdr.id, DeviceName[SD]))
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]))

View File

@ -226,8 +226,8 @@ int CMenu::_GCcopyGame(void *obj)
m._setThrdMsg(L"", 0); m._setThrdMsg(L"", 0);
if (!fsop_DirExist((char*)"sd:/games")) if (!fsop_DirExist((char*)"sd:/games"))
fsop_MakeFolder((char*)"sd:/games"); fsop_MakeFolder((char*)"sd:/games");
char source[64]; char source[MAX_FAT_PATH];
char target[64]; char target[MAX_FAT_PATH];
sprintf(source, "%s:/games/%s", DeviceName[currentPartition], m.m_cf.getHdr()->path); sprintf(source, "%s:/games/%s", DeviceName[currentPartition], m.m_cf.getHdr()->path);
sprintf(target, "sd:/games/%s", m.m_cf.getHdr()->path); sprintf(target, "sd:/games/%s", m.m_cf.getHdr()->path);
gprintf("Copying from: \n%s \nto: \n%s\n",source,target); gprintf("Copying from: \n%s \nto: \n%s\n",source,target);