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 685b3bbbd2fe..8a2cec7bea28 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 @@ -156,7 +156,7 @@ bool CWII_IPC_HLE_Device_FileIO::Open(u32 _CommandAddress, u32 _Mode) } else { - WARN_LOG(WII_IPC_FILEIO, "FileIO: Open failed - File doesn't exist %s", m_Filename.c_str()); + WARN_LOG(WII_IPC_FILEIO, "FileIO: Open (%s) failed - File doesn't exist %s", Modes[_Mode], m_Filename.c_str()); ReturnValue = FS_FILE_NOT_EXIST; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp index 6119eef325c1..8c87b29e9dbf 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp @@ -190,20 +190,34 @@ bool CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress) // this command sucks because it asks of the number of used // fsBlocks and inodes // It should be correct, but don't count on it... - std::string path(HLE_IPC_BuildFilename((const char*)Memory::GetPointer(CommandBuffer.InBuffer[0].m_Address), CommandBuffer.InBuffer[0].m_Size)); + const char *relativepath = (const char*)Memory::GetPointer(CommandBuffer.InBuffer[0].m_Address); + std::string path(HLE_IPC_BuildFilename(relativepath, CommandBuffer.InBuffer[0].m_Size)); u32 fsBlocks = 0; u32 iNodes = 0; INFO_LOG(WII_IPC_FILEIO, "IOCTL_GETUSAGE %s", path.c_str()); if (File::IsDirectory(path)) { - File::FSTEntry parentDir; - iNodes = File::ScanDirectoryTree(path, parentDir); - - u64 totalSize = ComputeTotalFileSize(parentDir); // "Real" size, to be converted to nand blocks + // LPFaint99: After I found that setting the number of inodes to the number of children + 1 for the directory itself + // I decided to compare with sneek which has the following 2 special cases which are + // Copyright (C) 2009-2011 crediar http://code.google.com/p/sneek/ + if ((memcmp(relativepath, "/title/00010001", 16 ) == 0 ) || + (memcmp(relativepath, "/title/00010005", 16) == 0 )) + { + fsBlocks = 23; // size is size/0x4000 + iNodes = 42; // empty folders return a FileCount of 1 + } + else + { + File::FSTEntry parentDir; + // add one for the folder itself, allows some games to create their save files + // R8XE52 (Jurassic: The Hunted), STEETR (Tetris Party Deluxe) now create their saves with this change + iNodes = 1 + File::ScanDirectoryTree(path, parentDir); - fsBlocks = (u32)(totalSize / (16 * 1024)); // one bock is 16kb + u64 totalSize = ComputeTotalFileSize(parentDir); // "Real" size, to be converted to nand blocks + fsBlocks = (u32)(totalSize / (16 * 1024)); // one bock is 16kb + } ReturnValue = FS_RESULT_OK; INFO_LOG(WII_IPC_FILEIO, "FS: fsBlock: %i, iNodes: %i", fsBlocks, iNodes); diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.cpp b/Source/Core/DiscIO/Src/NANDContentLoader.cpp index 7d6d131e6764..caae772283a0 100644 --- a/Source/Core/DiscIO/Src/NANDContentLoader.cpp +++ b/Source/Core/DiscIO/Src/NANDContentLoader.cpp @@ -212,7 +212,7 @@ bool CNANDContentLoader::Initialize(const std::string& _rName) } else { - SplitPath(TMDFileName, &m_Path, NULL, NULL); + m_Path = TMDFileName.substr(0, TMDFileName.find("title.tmd")); } File::IOFile pTMDFile(TMDFileName, "rb"); if (!pTMDFile) diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index ff1d7c03eb27..b4981c0d53de 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -662,7 +662,7 @@ void CFrame::DoOpen(bool Boot) _("Select the file to load"), wxEmptyString, wxEmptyString, wxEmptyString, _("All GC/Wii files (elf, dol, gcm, iso, ciso, gcz, wad)") + - wxString::Format(wxT("|*.elf;*.dol;*.gcm;*.iso;*.ciso;*.gcz;*.wad;*.dff|%s"), + wxString::Format(wxT("|*.elf;*.dol;*.gcm;*.iso;*.ciso;*.gcz;*.wad;*.dff;*.tmd|%s"), wxGetTranslation(wxALL_FILES)), wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);