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
This commit is contained in:
LPFaint99 2010-09-06 04:36:58 +00:00
parent 402b1d83e2
commit 3bdeb923ef
15 changed files with 140 additions and 84 deletions

View File

@ -757,6 +757,14 @@
RelativePath=".\Src\MsgHandler.h" RelativePath=".\Src\MsgHandler.h"
> >
</File> </File>
<File
RelativePath=".\Src\NandPaths.cpp"
>
</File>
<File
RelativePath=".\Src\NandPaths.h"
>
</File>
<File <File
RelativePath=".\Src\OpenCL.cpp" RelativePath=".\Src\OpenCL.cpp"
> >

View File

@ -110,7 +110,6 @@
#define MAIL_LOGS_DIR LOGS_DIR DIR_SEP "Mail" #define MAIL_LOGS_DIR LOGS_DIR DIR_SEP "Mail"
#define SHADERS_DIR "Shaders" #define SHADERS_DIR "Shaders"
#define WII_SYSCONF_DIR WII_USER_DIR DIR_SEP "shared2" DIR_SEP "sys" #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 // Filenames
// Files in the directory returned by GetUserPath(D_CONFIG_IDX) // Files in the directory returned by GetUserPath(D_CONFIG_IDX)

View File

@ -636,7 +636,6 @@ const char *GetUserPath(int DirIDX)
static char LogsDir[MAX_PATH] = {0}; static char LogsDir[MAX_PATH] = {0};
static char MailLogsDir[MAX_PATH] = {0}; static char MailLogsDir[MAX_PATH] = {0};
static char WiiSYSCONFDir[MAX_PATH] = {0}; static char WiiSYSCONFDir[MAX_PATH] = {0};
static char WiiMenuDir[MAX_PATH] = {0};
static char DolphinConfig[MAX_PATH] = {0}; static char DolphinConfig[MAX_PATH] = {0};
static char DebuggerConfig[MAX_PATH] = {0}; static char DebuggerConfig[MAX_PATH] = {0};
static char LoggerConfig[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(LogsDir, sizeof(LogsDir), "%s" LOGS_DIR DIR_SEP, UserDir);
snprintf(MailLogsDir, sizeof(MailLogsDir), "%s" MAIL_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(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(DolphinConfig, sizeof(DolphinConfig), "%s" DOLPHIN_CONFIG, ConfigDir);
snprintf(DebuggerConfig, sizeof(DebuggerConfig), "%s" DEBUGGER_CONFIG, ConfigDir); snprintf(DebuggerConfig, sizeof(DebuggerConfig), "%s" DEBUGGER_CONFIG, ConfigDir);
snprintf(LoggerConfig, sizeof(LoggerConfig), "%s" LOGGER_CONFIG, ConfigDir); snprintf(LoggerConfig, sizeof(LoggerConfig), "%s" LOGGER_CONFIG, ConfigDir);
@ -731,8 +729,6 @@ const char *GetUserPath(int DirIDX)
return MailLogsDir; return MailLogsDir;
case D_WIISYSCONF_IDX: case D_WIISYSCONF_IDX:
return WiiSYSCONFDir; return WiiSYSCONFDir;
case D_WIIMENU_IDX:
return WiiMenuDir;
case F_DOLPHINCONFIG_IDX: case F_DOLPHINCONFIG_IDX:
return DolphinConfig; return DolphinConfig;
case F_DEBUGGERCONFIG_IDX: case F_DEBUGGERCONFIG_IDX:

View File

@ -46,7 +46,6 @@ enum {
D_LOGS_IDX, D_LOGS_IDX,
D_MAILLOGS_IDX, D_MAILLOGS_IDX,
D_WIISYSCONF_IDX, D_WIISYSCONF_IDX,
D_WIIMENU_IDX,
F_DOLPHINCONFIG_IDX, F_DOLPHINCONFIG_IDX,
F_DEBUGGERCONFIG_IDX, F_DEBUGGERCONFIG_IDX,
F_LOGGERCONFIG_IDX, F_LOGGERCONFIG_IDX,

View File

@ -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 <string.h>
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;
}
};

View File

@ -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

View File

@ -26,6 +26,7 @@ files = [
"MemoryUtil.cpp", "MemoryUtil.cpp",
"Misc.cpp", "Misc.cpp",
"MsgHandler.cpp", "MsgHandler.cpp",
"NandPaths.cpp",
"OpenCL.cpp", "OpenCL.cpp",
"Plugin.cpp", "Plugin.cpp",
"PluginDSP.cpp", "PluginDSP.cpp",

View File

@ -54,6 +54,7 @@
#include "AES/aes.h" #include "AES/aes.h"
#include "../Boot/Boot_DOL.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) CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
@ -87,7 +88,7 @@ bool CWII_IPC_HLE_Device_es::Open(u32 _CommandAddress, u32 _Mode)
} }
else else
{ {
m_TitleIDs.push_back(0x0000000100000002ULL); m_TitleIDs.push_back(TITLEID_SYSMENU);
} }
} }
else if (VolumeHandler::IsValid()) else if (VolumeHandler::IsValid())
@ -439,7 +440,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
std::string TicketFilename = CreateTicketFileName(TitleID); std::string TicketFilename = Common::CreateTicketFileName(TitleID);
u32 ViewCount = 0; u32 ViewCount = 0;
if (File::Exists(TicketFilename.c_str())) if (File::Exists(TicketFilename.c_str()))
@ -454,7 +455,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
} }
else else
{ {
if (TitleID == 0x0000000100000002ull) if (TitleID == TITLEID_SYSMENU)
{ {
PanicAlert("There must be a ticket for 00000001/00000002. Prolly your NAND dump is incomplete"); PanicAlert("There must be a ticket for 00000001/00000002. Prolly your NAND dump is incomplete");
} }
@ -476,7 +477,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); 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())) if (File::Exists(TicketFilename.c_str()))
{ {
const u32 SIZE_OF_ONE_TICKET = 676; 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"); _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); u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
std::string TitlePath = CreateTitleContentPath(TitleID); const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitleID);
const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitlePath);
_dbg_assert_(WII_IPC_ES, Loader.IsValid()); _dbg_assert_(WII_IPC_ES, Loader.IsValid());
u32 TMDViewCnt = 0; 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); u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
u32 MaxCount = Memory::Read_U32(Buffer.InBuffer[1].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(TitleID);
const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitlePath);
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTMDVIEWCNT: title: %08x/%08x buffersize: %i", (u32)(TitleID >> 32), (u32)TitleID, MaxCount); 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); u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
u32 MaxCount = Memory::Read_U32(Buffer.InBuffer[1].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(TitleID);
const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitlePath);
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETSTOREDTMD: title: %08x/%08x buffersize: %i", (u32)(TitleID >> 32), (u32)TitleID, MaxCount); 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"); _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); u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
std::string TitlePath = CreateTitleContentPath(TitleID); const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitleID);
const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitlePath);
_dbg_assert_(WII_IPC_ES, Loader.IsValid()); _dbg_assert_(WII_IPC_ES, Loader.IsValid());
u32 TMDCnt = 0; u32 TMDCnt = 0;
@ -674,39 +671,30 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
break; break;
// =============================================================================================== case IOCTL_ES_LAUNCH:
// unsupported functions
// ===============================================================================================
case IOCTL_ES_LAUNCH:
{ {
_dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 2); _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 2);
bool bSuccess = false; bool bSuccess = false;
u16 IOSv = 0xffff; u16 IOSv = 0xffff;
u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
u32 view = Memory::Read_U32(Buffer.InBuffer[1].m_Address); u32 view = Memory::Read_U32(Buffer.InBuffer[1].m_Address);
u64 ticketid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+4); u64 ticketid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+4);
u32 devicetype = Memory::Read_U32(Buffer.InBuffer[1].m_Address+12); u32 devicetype = Memory::Read_U32(Buffer.InBuffer[1].m_Address+12);
u64 titleid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+16); u64 titleid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+16);
u16 access = Memory::Read_U16(Buffer.InBuffer[1].m_Address+24); 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" if ((u32)(TitleID>>32) != 0x00000001 || TitleID == TITLEID_SYSMENU)
"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)
{ {
std::string titlePath = CreateTitleContentPath(TitleID); const DiscIO::INANDContentLoader& ContentLoader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitleID);
const DiscIO::INANDContentLoader& ContentLoader = DiscIO::CNANDContentManager::Access().GetNANDLoader(titlePath);
if (ContentLoader.IsValid()) if (ContentLoader.IsValid())
{ {
u32 bootInd = ContentLoader.GetBootIndex(); u32 bootInd = ContentLoader.GetBootIndex();
const DiscIO::SNANDContent* pContent = ContentLoader.GetContentByIndex(bootInd); const DiscIO::SNANDContent* pContent = ContentLoader.GetContentByIndex(bootInd);
if (pContent) if (pContent)
{ {
LoadWAD(titlePath); LoadWAD(Common::CreateTitleContentPath(TitleID));
CDolLoader DolLoader(pContent->m_pData, pContent->m_Size); CDolLoader DolLoader(pContent->m_pData, pContent->m_Size);
PC = DolLoader.GetEntryPoint() | 0x80000000; PC = DolLoader.GetEntryPoint() | 0x80000000;
IOSv = ContentLoader.GetIosVersion(); IOSv = ContentLoader.GetIosVersion();
@ -722,6 +710,9 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
// someone with an affected game should test // someone with an affected game should test
IOSv = TitleID & 0xffff; 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" // Pass the "#002 check"
// Apploader should write the IOS version and revision to 0x3140, and compare it // 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... // 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; 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 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 //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 //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"); WARN_LOG(WII_IPC_ES,"IOCTL_ES_CHECKKOREAREGION: Title Checked for korean Keys");
Memory::Write_U32(ES_PARAMTER_SIZE_OR_ALIGNMENT , _CommandAddress + 0x4); Memory::Write_U32(ES_PARAMTER_SIZE_OR_ALIGNMENT , _CommandAddress + 0x4);
return true; 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: default:
WARN_LOG(WII_IPC_ES, "CWII_IPC_HLE_Device_es: 0x%x", Buffer.Parameter); 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()) if (itr != m_NANDContent.end())
return *itr->second; return *itr->second;
std::string TitlePath = CreateTitleContentPath(_TitleID); m_NANDContent[_TitleID] = &DiscIO::CNANDContentManager::Access().GetNANDLoader(_TitleID);
m_NANDContent[_TitleID] = &DiscIO::CNANDContentManager::Access().GetNANDLoader(TitlePath);
_dbg_assert_(WII_IPC_ES, m_NANDContent[_TitleID]->IsValid()); _dbg_assert_(WII_IPC_ES, m_NANDContent[_TitleID]->IsValid());
return *m_NANDContent[_TitleID]; return *m_NANDContent[_TitleID];
@ -792,19 +787,4 @@ bool CWII_IPC_HLE_Device_es::IsValid(u64 _TitleID) const
return false; 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;
}

View File

@ -141,9 +141,6 @@ private:
const DiscIO::INANDContentLoader& AccessContentDevice(u64 _TitleID); const DiscIO::INANDContentLoader& AccessContentDevice(u64 _TitleID);
bool IsValid(u64 _TitleID) const; bool IsValid(u64 _TitleID) const;
std::string CreateTicketFileName(u64 _TitleID) const;
std::string CreateTitleContentPath(u64 _TitleID) const;
}; };
#endif #endif

View File

@ -276,12 +276,12 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
//TODO: scrape the real amounts from somewhere... //TODO: scrape the real amounts from somewhere...
fs.BlockSize = 0x4000; fs.BlockSize = 0x4000;
fs.FreeBlocks = 0x5DEC; fs.FreeUserBlocks = 0x5DEC;
fs.UsedBlocks = 0x1DD4; fs.UsedUserBlocks = 0x1DD4;
fs.unk3 = 0x10; fs.FreeSysBlocks = 0x10;
fs.unk4 = 0x02F0; fs.UsedSysBlocks = 0x02F0;
fs.Free_INodes = 0x146B; fs.Free_INodes = 0x146B;
fs.unk5 = 0x0394; fs.Used_Inodes = 0x0394;
*(NANDStat*)Memory::GetPointer(_BufferOut) = fs; *(NANDStat*)Memory::GetPointer(_BufferOut) = fs;

View File

@ -22,12 +22,12 @@
struct NANDStat struct NANDStat
{ {
u32 BlockSize; u32 BlockSize;
u32 FreeBlocks; u32 FreeUserBlocks;
u32 UsedBlocks; u32 UsedUserBlocks;
u32 unk3; u32 FreeSysBlocks;
u32 unk4; u32 UsedSysBlocks;
u32 Free_INodes; u32 Free_INodes;
u32 unk5; // Used INodes? u32 Used_Inodes;
}; };
enum { enum {

View File

@ -372,6 +372,13 @@ const INANDContentLoader& CNANDContentManager::GetNANDLoader(const std::string&
return *m_Map[_rName]; return *m_Map[_rName];
} }
const INANDContentLoader& CNANDContentManager::GetNANDLoader(u64 _titleId)
{
std::string _rName = Common::CreateTitleContentPath(_titleId);
return GetNANDLoader(_rName);
}
cUIDsys::cUIDsys() cUIDsys::cUIDsys()
{ {
sprintf(uidSys, "%ssys/uid.sys", File::GetUserPath(D_WIIUSER_IDX)); sprintf(uidSys, "%ssys/uid.sys", File::GetUserPath(D_WIIUSER_IDX));
@ -401,7 +408,7 @@ cUIDsys::cUIDsys()
else else
{ {
SElement Element; SElement Element;
*(u64*)&(Element.titleID) = Common::swap64(0x0000000100000002ull); *(u64*)&(Element.titleID) = Common::swap64(TITLEID_SYSMENU);
*(u32*)&(Element.UID) = Common::swap32(lastUID++); *(u32*)&(Element.UID) = Common::swap32(lastUID++);
FILE* pFile = fopen(uidSys, "wb"); FILE* pFile = fopen(uidSys, "wb");

View File

@ -25,6 +25,7 @@
#include "Common.h" #include "Common.h"
#include "Blob.h" #include "Blob.h"
#include "Volume.h" #include "Volume.h"
#include "NandPaths.h"
namespace DiscIO namespace DiscIO
{ {
@ -80,7 +81,7 @@ public:
static CNANDContentManager& Access() { return m_Instance; } static CNANDContentManager& Access() { return m_Instance; }
const INANDContentLoader& GetNANDLoader(const std::string& _rName); const INANDContentLoader& GetNANDLoader(const std::string& _rName);
const INANDContentLoader& GetNANDLoader(u64 _titleId);
private: private:
CNANDContentManager() {}; CNANDContentManager() {};

View File

@ -71,7 +71,8 @@ IVolume::ECountry CountrySwitch(u8 CountryCode)
break; break;
default: 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; return IVolume::COUNTRY_UNKNOWN;
break; break;
} }

View File

@ -198,7 +198,7 @@ void CFrame::CreateMenu()
toolsMenu->Append(IDM_NETPLAY, _T("Start &NetPlay")); 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")); toolsMenu->Append(IDM_LOAD_WII_MENU, _T("Load Wii Menu"));
} }
@ -1122,7 +1122,7 @@ void CFrame::OnImportSave(wxCommandEvent& WXUNUSED (event))
if (!path.IsEmpty()) if (!path.IsEmpty())
{ {
CWiiSaveCrypted* saveFile = new CWiiSaveCrypted(path.ToUTF8().data()); CWiiSaveCrypted* saveFile = new CWiiSaveCrypted(path.mb_str());
delete saveFile; delete saveFile;
} }
} }
@ -1141,7 +1141,7 @@ void CFrame::OnLoadWiiMenu(wxCommandEvent& event)
{ {
if (event.GetId() == IDM_LOAD_WII_MENU) if (event.GetId() == IDM_LOAD_WII_MENU)
{ {
BootGame(std::string (File::GetUserPath(D_WIIMENU_IDX))); BootGame(Common::CreateTitleContentPath(TITLEID_SYSMENU));
} }
else else
{ {
@ -1317,11 +1317,9 @@ void CFrame::UpdateGUI()
GetMenuBar()->FindItem(IDM_LOADSTATE)->Enable(Initialized); GetMenuBar()->FindItem(IDM_LOADSTATE)->Enable(Initialized);
GetMenuBar()->FindItem(IDM_SAVESTATE)->Enable(Initialized); GetMenuBar()->FindItem(IDM_SAVESTATE)->Enable(Initialized);
// Misc // Misc
GetMenuBar()->FindItem(IDM_CHANGEDISC)->Enable(Initialized); GetMenuBar()->FindItem(IDM_CHANGEDISC)->Enable(Initialized);
if (DiscIO::CNANDContentManager::Access().GetNANDLoader if (DiscIO::CNANDContentManager::Access().GetNANDLoader(TITLEID_SYSMENU).IsValid())
(std::string(File::GetUserPath(D_WIIMENU_IDX))).IsValid())
GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized); GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized);
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)-> GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->