From 303d1b83eb09472a3f9a635d8c3b794a6c9b0286 Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Sun, 21 Aug 2011 18:25:01 -0700 Subject: [PATCH] minor cleanup to /dev/es, fix for grabbing titleid from the disc, and es_gettitledir --- .../Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) 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 83c7544734..2a33d01ed9 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 @@ -93,7 +93,7 @@ bool CWII_IPC_HLE_Device_es::Open(u32 _CommandAddress, u32 _Mode) { // blindly grab the titleID from the disc - it's unencrypted at: // offset 0x0F8001DC and 0x0F80044C - VolumeHandler::RAWReadToPtr((u8*)&m_TitleID, (u64)0x0F8001DC, 8); + VolumeHandler::GetVolume()->GetTitleID((u8*)&m_TitleID); m_TitleID = Common::swap64(m_TitleID); } else @@ -177,11 +177,11 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); - const DiscIO::INANDContentLoader& rNANDCOntent = AccessContentDevice(TitleID); + const DiscIO::INANDContentLoader& rNANDContent = AccessContentDevice(TitleID); u16 NumberOfPrivateContent = 0; - if (rNANDCOntent.IsValid()) // Not sure if dolphin will ever fail this check + if (rNANDContent.IsValid()) // Not sure if dolphin will ever fail this check { - NumberOfPrivateContent = rNANDCOntent.GetNumEntries(); + NumberOfPrivateContent = rNANDContent.GetNumEntries(); if ((u32)(TitleID>>32) == 0x00010000) Memory::Write_U32(0, Buffer.PayloadBuffer[0].m_Address); @@ -191,10 +191,10 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) Memory::Write_U32(0, _CommandAddress + 0x4); } else - Memory::Write_U32((u32)rNANDCOntent.GetContentSize(), _CommandAddress + 0x4); + Memory::Write_U32((u32)rNANDContent.GetContentSize(), _CommandAddress + 0x4); INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLECONTENTSCNT: TitleID: %08x/%08x content count %i", - (u32)(TitleID>>32), (u32)TitleID, rNANDCOntent.IsValid() ? NumberOfPrivateContent : (u32)rNANDCOntent.GetContentSize()); + (u32)(TitleID>>32), (u32)TitleID, rNANDContent.IsValid() ? NumberOfPrivateContent : (u32)rNANDContent.GetContentSize()); return true; } @@ -371,7 +371,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); char* Path = (char*)Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address); - sprintf(Path, "/%08x/%08x/data", (u32)(TitleID >> 32), (u32)TitleID); + sprintf(Path, "/title/%08x/%08x/data", (u32)(TitleID >> 32), (u32)TitleID); INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLEDIR: %s", Path); } @@ -539,11 +539,6 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) const DiscIO::INANDContentLoader& Loader = AccessContentDevice(TitleID); - // Assert if title is not a disc title and the loader is not valid - _dbg_assert_msg_(WII_IPC_ES, ((u32)(TitleID >> 32) == 0x00010000) || - ((u32)(TitleID >> 32) == 0x00010004) || Loader.IsValid(), - "Loader not valid for TitleID %08x/%08x", (u32)(TitleID >> 32), (u32)TitleID); - u32 TMDViewCnt = 0; if (Loader.IsValid()) { @@ -675,7 +670,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) // TODO: actually use this param in when writing to the outbuffer :/ MaxCount = Memory::Read_U32(Buffer.InBuffer[1].m_Address); } - const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitleID); + const DiscIO::INANDContentLoader& Loader = AccessContentDevice(TitleID); INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETSTOREDTMD: title: %08x/%08x buffersize: %i", (u32)(TitleID >> 32), (u32)TitleID, MaxCount); @@ -856,7 +851,7 @@ const DiscIO::INANDContentLoader& CWII_IPC_HLE_Device_es::AccessContentDevice(u6 m_NANDContent[_TitleID] = &DiscIO::CNANDContentManager::Access().GetNANDLoader(_TitleID); - _dbg_assert_msg_(WII_IPC_ES, m_NANDContent[_TitleID]->IsValid(), "NandContent not valid for TitleID %08x/%08x", (u32)(_TitleID >> 32), (u32)_TitleID); + _dbg_assert_msg_(WII_IPC_ES, ((u32)(_TitleID >> 32) == 0x00010000) || m_NANDContent[_TitleID]->IsValid(), "NandContent not valid for TitleID %08x/%08x", (u32)(_TitleID >> 32), (u32)_TitleID); return *m_NANDContent[_TitleID]; } @@ -878,11 +873,10 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz) { return -1; } - std::string tmdPath = Common::GetTMDFileName(tmdTitleID), - dataPath = Common::GetTitleDataPath(tmdTitleID); + std::string tmdPath = Common::GetTMDFileName(tmdTitleID); File::CreateFullPath(tmdPath); - File::CreateFullPath(dataPath); + File::CreateFullPath(Common::GetTitleDataPath(tmdTitleID)); if(!File::Exists(tmdPath)) { File::IOFile _pTMDFile(tmdPath, "wb");