mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Move the cdb.vff file creation out of the wx code
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7293 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
278cb45eb9
commit
a037ff2358
@ -49,6 +49,33 @@ std::string HLE_IPC_BuildFilename(const char* _pFilename, int _size)
|
|||||||
return path_full;
|
return path_full;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HLE_IPC_CreateVirtualFATFilesystem()
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
// 20 MiB file
|
||||||
|
fseeko(cdbFile, 0x01400000 - 1, SEEK_SET);
|
||||||
|
// write the final 0 to 0 file from the second FAT to 20 MiB
|
||||||
|
if (fwrite(cdbHDR+14, 1, 1, cdbFile) != 1) success = false;
|
||||||
|
fclose(cdbFile);
|
||||||
|
if (!success) File::Delete(cdbPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_FileIO::CWII_IPC_HLE_Device_FileIO(u32 _DeviceID, const std::string& _rDeviceName)
|
CWII_IPC_HLE_Device_FileIO::CWII_IPC_HLE_Device_FileIO(u32 _DeviceID, const std::string& _rDeviceName)
|
||||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName, false) // not a real hardware
|
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName, false) // not a real hardware
|
||||||
, m_pFileHandle(NULL)
|
, m_pFileHandle(NULL)
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "WII_IPC_HLE_Device.h"
|
#include "WII_IPC_HLE_Device.h"
|
||||||
|
|
||||||
std::string HLE_IPC_BuildFilename(const char* _pFilename, int _size);
|
std::string HLE_IPC_BuildFilename(const char* _pFilename, int _size);
|
||||||
|
void HLE_IPC_CreateVirtualFATFilesystem();
|
||||||
|
|
||||||
class CWII_IPC_HLE_Device_FileIO : public IWII_IPC_HLE_Device
|
class CWII_IPC_HLE_Device_FileIO : public IWII_IPC_HLE_Device
|
||||||
{
|
{
|
||||||
|
@ -63,6 +63,7 @@ Core::GetWindowHandle().
|
|||||||
#include "HW/GCPad.h"
|
#include "HW/GCPad.h"
|
||||||
#include "HW/Wiimote.h"
|
#include "HW/Wiimote.h"
|
||||||
#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
|
#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
|
||||||
|
#include "IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
|
||||||
#include "State.h"
|
#include "State.h"
|
||||||
#include "VolumeHandler.h"
|
#include "VolumeHandler.h"
|
||||||
#include "NANDContentLoader.h"
|
#include "NANDContentLoader.h"
|
||||||
@ -1310,27 +1311,7 @@ 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";
|
HLE_IPC_CreateVirtualFATFilesystem();
|
||||||
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user