Get rid of the annoying (and invalid issue creating) 3+ minutes to create cdb.vff

now creation is handled by the gui and takes < 1 second

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7291 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2011-03-05 05:10:28 +00:00
parent 708f6f7299
commit 3b1e7ac372

View File

@ -1310,6 +1310,27 @@ void CFrame::OnLoadWiiMenu(wxCommandEvent& event)
{ {
if (event.GetId() == IDM_LOAD_WII_MENU) if (event.GetId() == IDM_LOAD_WII_MENU)
{ {
const std::string cdbPath = Common::CreateTitleDataPath(TITLEID_SYSMENU) + "/cdb.vff";
if (!File::Exists(cdbPath))
{
// cdb.vff is a virtual Fat filesystem created on first launch of sysmenu
// we create it here as it is faster ~3 minutes for me when sysmenu does it ~1 second created here
u8 cdbHDR[0x20] = {'V', 'F', 'F', 0x20, 0xfe, 0xff, 1, 0, 1, 0x40, 0, 0, 0, 0x20};
u8 cdbFAT[4] = {0xf0, 0xff, 0xff, 0xff};
FILE * cdbFile = fopen(cdbPath.c_str(), "wb");
if (cdbFile)
{
bool success = true;
if (fwrite(cdbHDR, 0x20, 1, cdbFile) != 1) success = false;
if (fwrite(cdbFAT, 0x4, 1, cdbFile) != 1) success = false;
fseeko(cdbFile, 0x14020, SEEK_SET);
if (fwrite(cdbFAT, 0x4, 1, cdbFile) != 1)success = false;
fseeko(cdbFile, 0x01400000 - 1, SEEK_SET); // 20 MiB file
if (fwrite(cdbHDR+14, 1, 1, cdbFile) != 1) success = false; // write the final 0 to 0 file from the second FAT to 20 MiB
fclose(cdbFile);
if (!success) File::Delete(cdbPath);
}
}
BootGame(Common::CreateTitleContentPath(TITLEID_SYSMENU)); BootGame(Common::CreateTitleContentPath(TITLEID_SYSMENU));
} }
else else
@ -1344,7 +1365,9 @@ void CFrame::OnLoadWiiMenu(wxCommandEvent& event)
GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->SetText(wxString::Format(_("Load Wii System Menu %d%c"), sysmenuVersion, sysmenuRegion)); GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->SetText(wxString::Format(_("Load Wii System Menu %d%c"), sysmenuVersion, sysmenuRegion));
} }
} }
} }
} }
void CFrame::ConnectWiimote(int wm_idx, bool connect) void CFrame::ConnectWiimote(int wm_idx, bool connect)