From 3bdeb923ef78eccd1efeae694d774d696a6da5d3 Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Mon, 6 Sep 2010 04:36:58 +0000 Subject: [PATCH] Some work towards launching by titleid rather than content path, update some var names in WII_IPC_HLE_Device_fs, filter out some spam logs from VolumeCommon git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6182 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Common.vcproj | 8 ++ Source/Core/Common/Src/CommonPaths.h | 1 - Source/Core/Common/Src/FileUtil.cpp | 4 - Source/Core/Common/Src/FileUtil.h | 1 - Source/Core/Common/Src/NandPaths.cpp | 40 ++++++++ Source/Core/Common/Src/NandPaths.h | 29 ++++++ Source/Core/Common/Src/SConscript | 1 + .../Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 92 ++++++++----------- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h | 3 - .../Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp | 10 +- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h | 10 +- Source/Core/DiscIO/Src/NANDContentLoader.cpp | 9 +- Source/Core/DiscIO/Src/NANDContentLoader.h | 3 +- Source/Core/DiscIO/Src/VolumeCommon.cpp | 3 +- Source/Core/DolphinWX/Src/FrameTools.cpp | 10 +- 15 files changed, 140 insertions(+), 84 deletions(-) create mode 100644 Source/Core/Common/Src/NandPaths.cpp create mode 100644 Source/Core/Common/Src/NandPaths.h diff --git a/Source/Core/Common/Common.vcproj b/Source/Core/Common/Common.vcproj index 5bfba22fc7..0e63a8359c 100644 --- a/Source/Core/Common/Common.vcproj +++ b/Source/Core/Common/Common.vcproj @@ -757,6 +757,14 @@ RelativePath=".\Src\MsgHandler.h" > + + + + diff --git a/Source/Core/Common/Src/CommonPaths.h b/Source/Core/Common/Src/CommonPaths.h index fd3d1e0d3c..a7f13c3ebd 100644 --- a/Source/Core/Common/Src/CommonPaths.h +++ b/Source/Core/Common/Src/CommonPaths.h @@ -110,7 +110,6 @@ #define MAIL_LOGS_DIR LOGS_DIR DIR_SEP "Mail" #define SHADERS_DIR "Shaders" #define WII_SYSCONF_DIR WII_USER_DIR DIR_SEP "shared2" DIR_SEP "sys" -#define WII_MENU_DIR WII_USER_DIR DIR_SEP "title" DIR_SEP "00000001" DIR_SEP "00000002" DIR_SEP "content" // Filenames // Files in the directory returned by GetUserPath(D_CONFIG_IDX) diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp index 7722d4aab4..9e8e2ac4cc 100644 --- a/Source/Core/Common/Src/FileUtil.cpp +++ b/Source/Core/Common/Src/FileUtil.cpp @@ -636,7 +636,6 @@ const char *GetUserPath(int DirIDX) static char LogsDir[MAX_PATH] = {0}; static char MailLogsDir[MAX_PATH] = {0}; static char WiiSYSCONFDir[MAX_PATH] = {0}; - static char WiiMenuDir[MAX_PATH] = {0}; static char DolphinConfig[MAX_PATH] = {0}; static char DebuggerConfig[MAX_PATH] = {0}; static char LoggerConfig[MAX_PATH] = {0}; @@ -679,7 +678,6 @@ const char *GetUserPath(int DirIDX) snprintf(LogsDir, sizeof(LogsDir), "%s" LOGS_DIR DIR_SEP, UserDir); snprintf(MailLogsDir, sizeof(MailLogsDir), "%s" MAIL_LOGS_DIR DIR_SEP, UserDir); snprintf(WiiSYSCONFDir, sizeof(WiiSYSCONFDir), "%s" WII_SYSCONF_DIR DIR_SEP, UserDir); - snprintf(WiiMenuDir, sizeof(WiiMenuDir), "%s" WII_MENU_DIR DIR_SEP, UserDir); snprintf(DolphinConfig, sizeof(DolphinConfig), "%s" DOLPHIN_CONFIG, ConfigDir); snprintf(DebuggerConfig, sizeof(DebuggerConfig), "%s" DEBUGGER_CONFIG, ConfigDir); snprintf(LoggerConfig, sizeof(LoggerConfig), "%s" LOGGER_CONFIG, ConfigDir); @@ -731,8 +729,6 @@ const char *GetUserPath(int DirIDX) return MailLogsDir; case D_WIISYSCONF_IDX: return WiiSYSCONFDir; - case D_WIIMENU_IDX: - return WiiMenuDir; case F_DOLPHINCONFIG_IDX: return DolphinConfig; case F_DEBUGGERCONFIG_IDX: diff --git a/Source/Core/Common/Src/FileUtil.h b/Source/Core/Common/Src/FileUtil.h index e0315f67d4..bf2a3118cb 100644 --- a/Source/Core/Common/Src/FileUtil.h +++ b/Source/Core/Common/Src/FileUtil.h @@ -46,7 +46,6 @@ enum { D_LOGS_IDX, D_MAILLOGS_IDX, D_WIISYSCONF_IDX, - D_WIIMENU_IDX, F_DOLPHINCONFIG_IDX, F_DEBUGGERCONFIG_IDX, F_LOGGERCONFIG_IDX, diff --git a/Source/Core/Common/Src/NandPaths.cpp b/Source/Core/Common/Src/NandPaths.cpp new file mode 100644 index 0000000000..4c0f263ead --- /dev/null +++ b/Source/Core/Common/Src/NandPaths.cpp @@ -0,0 +1,40 @@ +// Copyright (C) 2010 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#include "NandPaths.h" +#include "CommonPaths.h" +#include "FileUtil.h" +#include +namespace Common +{ +std::string CreateTicketFileName(u64 _TitleID) +{ + char TicketFilename[1024]; + sprintf(TicketFilename, "%sticket/%08x/%08x.tik", File::GetUserPath(D_WIIUSER_IDX), (u32)(_TitleID >> 32), (u32)_TitleID); + + return TicketFilename; +} + +std::string CreateTitleContentPath(u64 _TitleID) +{ + char ContentPath[1024]; + sprintf(ContentPath, "%stitle/%08x/%08x/content", File::GetUserPath(D_WIIUSER_IDX), (u32)(_TitleID >> 32), (u32)_TitleID); + + return ContentPath; +} + +}; \ No newline at end of file diff --git a/Source/Core/Common/Src/NandPaths.h b/Source/Core/Common/Src/NandPaths.h new file mode 100644 index 0000000000..54d4934a3d --- /dev/null +++ b/Source/Core/Common/Src/NandPaths.h @@ -0,0 +1,29 @@ +// Copyright (C) 2010 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __NANDPATHS_H__ +#define __NANDPATHS_H__ +#include "CommonTypes.h" + +#define TITLEID_SYSMENU 0x0000000100000002ull + +namespace Common +{ + std::string CreateTicketFileName(u64 _TitleID); + std::string CreateTitleContentPath(u64 _TitleID); +} +#endif diff --git a/Source/Core/Common/Src/SConscript b/Source/Core/Common/Src/SConscript index bbb83eb7a2..890ccd9c5f 100644 --- a/Source/Core/Common/Src/SConscript +++ b/Source/Core/Common/Src/SConscript @@ -26,6 +26,7 @@ files = [ "MemoryUtil.cpp", "Misc.cpp", "MsgHandler.cpp", + "NandPaths.cpp", "OpenCL.cpp", "Plugin.cpp", "PluginDSP.cpp", diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp index d1c41b83c0..b2c157da56 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp @@ -54,6 +54,7 @@ #include "AES/aes.h" #include "../Boot/Boot_DOL.h" +#include "NandPaths.h" CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& _rDeviceName) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) @@ -87,7 +88,7 @@ bool CWII_IPC_HLE_Device_es::Open(u32 _CommandAddress, u32 _Mode) } else { - m_TitleIDs.push_back(0x0000000100000002ULL); + m_TitleIDs.push_back(TITLEID_SYSMENU); } } else if (VolumeHandler::IsValid()) @@ -165,7 +166,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) // Return arbitrary device ID - TODO allow user to set value? Memory::Write_U32(0x31337f11, Buffer.PayloadBuffer[0].m_Address); Memory::Write_U32(0, _CommandAddress + 0x4); - return true; + return true; } break; @@ -439,7 +440,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); - std::string TicketFilename = CreateTicketFileName(TitleID); + std::string TicketFilename = Common::CreateTicketFileName(TitleID); u32 ViewCount = 0; if (File::Exists(TicketFilename.c_str())) @@ -454,17 +455,17 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) } else { - if (TitleID == 0x0000000100000002ull) + if (TitleID == TITLEID_SYSMENU) { PanicAlert("There must be a ticket for 00000001/00000002. Prolly your NAND dump is incomplete"); } - ViewCount = 0; - } + ViewCount = 0; + } INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETVIEWCNT for titleID: %08x/%08x (View Count = %i)", (u32)(TitleID>>32), (u32)TitleID, ViewCount); Memory::Write_U32(ViewCount, Buffer.PayloadBuffer[0].m_Address); - Memory::Write_U32(0, _CommandAddress + 0x4); + Memory::Write_U32(0, _CommandAddress + 0x4); return true; } break; @@ -476,7 +477,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); - std::string TicketFilename = CreateTicketFileName(TitleID); + std::string TicketFilename = Common::CreateTicketFileName(TitleID); if (File::Exists(TicketFilename.c_str())) { const u32 SIZE_OF_ONE_TICKET = 676; @@ -512,8 +513,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETTMDVIEWCNT no out buffer"); u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); - std::string TitlePath = CreateTitleContentPath(TitleID); - const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitlePath); + const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitleID); _dbg_assert_(WII_IPC_ES, Loader.IsValid()); u32 TMDViewCnt = 0; @@ -540,8 +540,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); u32 MaxCount = Memory::Read_U32(Buffer.InBuffer[1].m_Address); - std::string TitlePath = CreateTitleContentPath(TitleID); - const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitlePath); + const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitleID); INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTMDVIEWCNT: title: %08x/%08x buffersize: %i", (u32)(TitleID >> 32), (u32)TitleID, MaxCount); @@ -587,8 +586,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); u32 MaxCount = Memory::Read_U32(Buffer.InBuffer[1].m_Address); - std::string TitlePath = CreateTitleContentPath(TitleID); - const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitlePath); + const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitleID); INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETSTOREDTMD: title: %08x/%08x buffersize: %i", (u32)(TitleID >> 32), (u32)TitleID, MaxCount); @@ -622,8 +620,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_ES_GETSTOREDTMDSIZE no out buffer"); u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); - std::string TitlePath = CreateTitleContentPath(TitleID); - const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitlePath); + const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitleID); _dbg_assert_(WII_IPC_ES, Loader.IsValid()); u32 TMDCnt = 0; @@ -634,10 +631,10 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) } Memory::Write_U32(TMDCnt, Buffer.PayloadBuffer[0].m_Address); - Memory::Write_U32(0, _CommandAddress + 0x4); + Memory::Write_U32(0, _CommandAddress + 0x4); INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETSTOREDTMDSIZE: title: %08x/%08x (view size %i)", (u32)(TitleID >> 32), (u32)TitleID, TMDCnt); - return true; + return true; } break; @@ -674,39 +671,30 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) break; - // =============================================================================================== - // unsupported functions - // =============================================================================================== - case IOCTL_ES_LAUNCH: + case IOCTL_ES_LAUNCH: { _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 2); bool bSuccess = false; u16 IOSv = 0xffff; u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); - u32 view = Memory::Read_U32(Buffer.InBuffer[1].m_Address); u64 ticketid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+4); u32 devicetype = Memory::Read_U32(Buffer.InBuffer[1].m_Address+12); u64 titleid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+16); u16 access = Memory::Read_U16(Buffer.InBuffer[1].m_Address+24); -/* PanicAlert("IOCTL_ES_LAUNCH: src titleID %08x/%08x -> start %08x/%08x \n" - "This means that dolphin tries to relaunch the WiiMenu or" - "launches code from the an URL. Both wont work and dolphin will prolly hang...", - (u32)(TitleID>>32), (u32)TitleID, (u32)(titleid>>32), (u32)titleid ); -*/ - if ((u32)(TitleID>>32) != 0x00000001 || TitleID == 0x0000000100000002ull) + + if ((u32)(TitleID>>32) != 0x00000001 || TitleID == TITLEID_SYSMENU) { - std::string titlePath = CreateTitleContentPath(TitleID); - const DiscIO::INANDContentLoader& ContentLoader = DiscIO::CNANDContentManager::Access().GetNANDLoader(titlePath); + const DiscIO::INANDContentLoader& ContentLoader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitleID); if (ContentLoader.IsValid()) { u32 bootInd = ContentLoader.GetBootIndex(); const DiscIO::SNANDContent* pContent = ContentLoader.GetContentByIndex(bootInd); if (pContent) { - LoadWAD(titlePath); + LoadWAD(Common::CreateTitleContentPath(TitleID)); CDolLoader DolLoader(pContent->m_pData, pContent->m_Size); PC = DolLoader.GetEntryPoint() | 0x80000000; IOSv = ContentLoader.GetIosVersion(); @@ -722,6 +710,9 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) // someone with an affected game should test IOSv = TitleID & 0xffff; } + if (!bSuccess) + PanicAlert("IOCTL_ES_LAUNCH: Game tried to reload ios or a title that is not available in your nand dump\n" + "TitleID %016llx.\n Dolphin will likely hang now", TitleID); // Pass the "#002 check" // Apploader should write the IOS version and revision to 0x3140, and compare it // to 0x3188 to pass the check, but we don't do it, and i don't know where to read the IOS rev... @@ -741,19 +732,24 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) } break; - case IOCTL_ES_DIGETTICKETVIEW: // (Input: none, Output: 216 bytes) bug crediar :D - WARN_LOG(WII_IPC_ES, "IOCTL_ES_DIGETTICKETVIEW: this looks really wrong..."); - break; - - case IOCTL_ES_GETDEVICECERT: // (Input: none, Output: 384 bytes) - WARN_LOG(WII_IPC_ES, "IOCTL_ES_GETDEVICECERT: this looks really wrong..."); - break; case IOCTL_ES_CHECKKOREAREGION: //note by DacoTaco : name is unknown, i just tried to name it SOMETHING //IOS70 has this to let system menu 4.2 check if the console is region changed. it returns -1017 //if the IOS didn't find the korean keys and 0 if it does. 0 leads to a error 003 WARN_LOG(WII_IPC_ES,"IOCTL_ES_CHECKKOREAREGION: Title Checked for korean Keys"); Memory::Write_U32(ES_PARAMTER_SIZE_OR_ALIGNMENT , _CommandAddress + 0x4); return true; + + // =============================================================================================== + // unsupported functions + // =============================================================================================== + case IOCTL_ES_DIGETTICKETVIEW: // (Input: none, Output: 216 bytes) bug crediar :D + WARN_LOG(WII_IPC_ES, "IOCTL_ES_DIGETTICKETVIEW: this looks really wrong..."); + break; + + case IOCTL_ES_GETDEVICECERT: // (Input: none, Output: 384 bytes) + WARN_LOG(WII_IPC_ES, "IOCTL_ES_GETDEVICECERT: this looks really wrong..."); + break; + default: WARN_LOG(WII_IPC_ES, "CWII_IPC_HLE_Device_es: 0x%x", Buffer.Parameter); @@ -777,8 +773,7 @@ const DiscIO::INANDContentLoader& CWII_IPC_HLE_Device_es::AccessContentDevice(u6 if (itr != m_NANDContent.end()) return *itr->second; - std::string TitlePath = CreateTitleContentPath(_TitleID); - m_NANDContent[_TitleID] = &DiscIO::CNANDContentManager::Access().GetNANDLoader(TitlePath); + m_NANDContent[_TitleID] = &DiscIO::CNANDContentManager::Access().GetNANDLoader(_TitleID); _dbg_assert_(WII_IPC_ES, m_NANDContent[_TitleID]->IsValid()); return *m_NANDContent[_TitleID]; @@ -792,19 +787,4 @@ bool CWII_IPC_HLE_Device_es::IsValid(u64 _TitleID) const return false; } -std::string CWII_IPC_HLE_Device_es::CreateTicketFileName(u64 _TitleID) const -{ - char TicketFilename[1024]; - sprintf(TicketFilename, "%sticket/%08x/%08x.tik", File::GetUserPath(D_WIIUSER_IDX), (u32)(_TitleID >> 32), (u32)_TitleID); - - return TicketFilename; -} - -std::string CWII_IPC_HLE_Device_es::CreateTitleContentPath(u64 _TitleID) const -{ - char ContentPath[1024]; - sprintf(ContentPath, "%stitle/%08x/%08x/content", File::GetUserPath(D_WIIUSER_IDX), (u32)(_TitleID >> 32), (u32)_TitleID); - - return ContentPath; -} diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h index 1ddee88195..07ba5aeec9 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h @@ -141,9 +141,6 @@ private: const DiscIO::INANDContentLoader& AccessContentDevice(u64 _TitleID); bool IsValid(u64 _TitleID) const; - - std::string CreateTicketFileName(u64 _TitleID) const; - std::string CreateTitleContentPath(u64 _TitleID) const; }; #endif 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 8a0e1dc619..2b8dbbc61a 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 @@ -276,12 +276,12 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B //TODO: scrape the real amounts from somewhere... fs.BlockSize = 0x4000; - fs.FreeBlocks = 0x5DEC; - fs.UsedBlocks = 0x1DD4; - fs.unk3 = 0x10; - fs.unk4 = 0x02F0; + fs.FreeUserBlocks = 0x5DEC; + fs.UsedUserBlocks = 0x1DD4; + fs.FreeSysBlocks = 0x10; + fs.UsedSysBlocks = 0x02F0; fs.Free_INodes = 0x146B; - fs.unk5 = 0x0394; + fs.Used_Inodes = 0x0394; *(NANDStat*)Memory::GetPointer(_BufferOut) = fs; diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h index 164d864bfd..60e9127b81 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h @@ -22,12 +22,12 @@ struct NANDStat { u32 BlockSize; - u32 FreeBlocks; - u32 UsedBlocks; - u32 unk3; - u32 unk4; + u32 FreeUserBlocks; + u32 UsedUserBlocks; + u32 FreeSysBlocks; + u32 UsedSysBlocks; u32 Free_INodes; - u32 unk5; // Used INodes? + u32 Used_Inodes; }; enum { diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.cpp b/Source/Core/DiscIO/Src/NANDContentLoader.cpp index ae766af813..a67af7646d 100644 --- a/Source/Core/DiscIO/Src/NANDContentLoader.cpp +++ b/Source/Core/DiscIO/Src/NANDContentLoader.cpp @@ -372,6 +372,13 @@ const INANDContentLoader& CNANDContentManager::GetNANDLoader(const std::string& return *m_Map[_rName]; } +const INANDContentLoader& CNANDContentManager::GetNANDLoader(u64 _titleId) +{ + + std::string _rName = Common::CreateTitleContentPath(_titleId); + return GetNANDLoader(_rName); +} + cUIDsys::cUIDsys() { sprintf(uidSys, "%ssys/uid.sys", File::GetUserPath(D_WIIUSER_IDX)); @@ -401,7 +408,7 @@ cUIDsys::cUIDsys() else { SElement Element; - *(u64*)&(Element.titleID) = Common::swap64(0x0000000100000002ull); + *(u64*)&(Element.titleID) = Common::swap64(TITLEID_SYSMENU); *(u32*)&(Element.UID) = Common::swap32(lastUID++); FILE* pFile = fopen(uidSys, "wb"); diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.h b/Source/Core/DiscIO/Src/NANDContentLoader.h index aae832774b..fce9810791 100644 --- a/Source/Core/DiscIO/Src/NANDContentLoader.h +++ b/Source/Core/DiscIO/Src/NANDContentLoader.h @@ -25,6 +25,7 @@ #include "Common.h" #include "Blob.h" #include "Volume.h" +#include "NandPaths.h" namespace DiscIO { @@ -80,7 +81,7 @@ public: static CNANDContentManager& Access() { return m_Instance; } const INANDContentLoader& GetNANDLoader(const std::string& _rName); - + const INANDContentLoader& GetNANDLoader(u64 _titleId); private: CNANDContentManager() {}; diff --git a/Source/Core/DiscIO/Src/VolumeCommon.cpp b/Source/Core/DiscIO/Src/VolumeCommon.cpp index de8c22334f..fe4f3642ac 100644 --- a/Source/Core/DiscIO/Src/VolumeCommon.cpp +++ b/Source/Core/DiscIO/Src/VolumeCommon.cpp @@ -71,7 +71,8 @@ IVolume::ECountry CountrySwitch(u8 CountryCode) break; default: - WARN_LOG(DISCIO, "Unknown Country Code! %c", CountryCode); + if (CountryCode > 'A') // Silently ignore IOS wads + WARN_LOG(DISCIO, "Unknown Country Code! %c", CountryCode); return IVolume::COUNTRY_UNKNOWN; break; } diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 0a49ace45a..4e89fecbfa 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -198,7 +198,7 @@ void CFrame::CreateMenu() toolsMenu->Append(IDM_NETPLAY, _T("Start &NetPlay")); - if (DiscIO::CNANDContentManager::Access().GetNANDLoader(std::string (File::GetUserPath(D_WIIMENU_IDX))).IsValid()) + if (DiscIO::CNANDContentManager::Access().GetNANDLoader(TITLEID_SYSMENU).IsValid()) { toolsMenu->Append(IDM_LOAD_WII_MENU, _T("Load Wii Menu")); } @@ -1122,7 +1122,7 @@ void CFrame::OnImportSave(wxCommandEvent& WXUNUSED (event)) if (!path.IsEmpty()) { - CWiiSaveCrypted* saveFile = new CWiiSaveCrypted(path.ToUTF8().data()); + CWiiSaveCrypted* saveFile = new CWiiSaveCrypted(path.mb_str()); delete saveFile; } } @@ -1141,7 +1141,7 @@ void CFrame::OnLoadWiiMenu(wxCommandEvent& event) { if (event.GetId() == IDM_LOAD_WII_MENU) { - BootGame(std::string (File::GetUserPath(D_WIIMENU_IDX))); + BootGame(Common::CreateTitleContentPath(TITLEID_SYSMENU)); } else { @@ -1317,11 +1317,9 @@ void CFrame::UpdateGUI() GetMenuBar()->FindItem(IDM_LOADSTATE)->Enable(Initialized); GetMenuBar()->FindItem(IDM_SAVESTATE)->Enable(Initialized); - // Misc GetMenuBar()->FindItem(IDM_CHANGEDISC)->Enable(Initialized); - if (DiscIO::CNANDContentManager::Access().GetNANDLoader - (std::string(File::GetUserPath(D_WIIMENU_IDX))).IsValid()) + if (DiscIO::CNANDContentManager::Access().GetNANDLoader(TITLEID_SYSMENU).IsValid()) GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized); GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->