summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorskidau <skidau@gmail.com>2013-09-05 21:29:04 +1000
committerskidau <skidau@gmail.com>2013-09-05 21:29:04 +1000
commitb2657f6a9b00a82f2c0baafdc7794487cce8fcbf (patch)
treeea116b4c5a10d86f3dd24eee0bf833da36902efb /Source
parent2fb0147967b34fcb61d0eb803f31a8fdc273b711 (diff)
Re-added the HLE code that creates the cdb.vff file on first launch of the Wii sysmenu.
Revert "Remove HLE_IPC_CreateVirtualFATFilesystem as it no longer takes 3 minutes to LLE like the comment says." This reverts commit 5d47fd1dde3ccdc286e2248db9967c278d694f5a.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp4
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp33
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.h1
3 files changed, 37 insertions, 1 deletions
diff --git a/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp b/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp
index d9d9b03021..519db4a92b 100644
--- a/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp
+++ b/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp
@@ -79,7 +79,9 @@ bool CBoot::Boot_WiiWAD(const char* _pFilename)
u64 titleID = ContentLoader.GetTitleID();
// create data directory
File::CreateFullPath(Common::GetTitleDataPath(titleID));
-
+
+ if (titleID == TITLEID_SYSMENU)
+ HLE_IPC_CreateVirtualFATFilesystem();
// setup wii mem
if (!SetupWiiMemory(ContentLoader.GetCountry()))
return false;
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
index e65b0c50ac..6e2f02e2be 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
@@ -32,6 +32,39 @@ std::string HLE_IPC_BuildFilename(std::string path_wii, int _size)
return path_full;
}
+void HLE_IPC_CreateVirtualFATFilesystem()
+{
+ const int cdbSize = 0x01400000;
+ const std::string cdbPath = Common::GetTitleDataPath(TITLEID_SYSMENU) + "cdb.vff";
+ if ((int)File::GetSize(cdbPath) < cdbSize)
+ {
+ // 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
+ const u8 cdbHDR[0x20] = {'V', 'F', 'F', 0x20, 0xfe, 0xff, 1, 0, 1, 0x40, 0, 0, 0, 0x20};
+ const u8 cdbFAT[4] = {0xf0, 0xff, 0xff, 0xff};
+
+ File::IOFile cdbFile(cdbPath, "wb");
+ if (cdbFile)
+ {
+ cdbFile.WriteBytes(cdbHDR, 0x20);
+ cdbFile.WriteBytes(cdbFAT, 0x4);
+ cdbFile.Seek(0x14020, SEEK_SET);
+ cdbFile.WriteBytes(cdbFAT, 0x4);
+ // 20 MiB file
+ cdbFile.Seek(cdbSize - 1, SEEK_SET);
+ // write the final 0 to 0 file from the second FAT to 20 MiB
+ cdbFile.WriteBytes(cdbHDR + 14, 1);
+ if (!cdbFile.IsGood())
+ {
+ cdbFile.Close();
+ File::Delete(cdbPath);
+ }
+ cdbFile.Flush();
+ cdbFile.Close();
+ }
+ }
+}
+
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
, m_Mode(0)
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.h
index 0cbfb70022..17dab453db 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.h
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.h
@@ -9,6 +9,7 @@
#include "FileUtil.h"
std::string HLE_IPC_BuildFilename(std::string _pFilename, int _size);
+void HLE_IPC_CreateVirtualFATFilesystem();
class CWII_IPC_HLE_Device_FileIO : public IWII_IPC_HLE_Device
{