minor cleanup to /dev/es, fix for grabbing titleid from the disc, and es_gettitledir

This commit is contained in:
LPFaint99 2011-08-21 18:25:01 -07:00
parent 3fb42f6bb6
commit 303d1b83eb
1 changed files with 11 additions and 17 deletions

View File

@ -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: // blindly grab the titleID from the disc - it's unencrypted at:
// offset 0x0F8001DC and 0x0F80044C // offset 0x0F8001DC and 0x0F80044C
VolumeHandler::RAWReadToPtr((u8*)&m_TitleID, (u64)0x0F8001DC, 8); VolumeHandler::GetVolume()->GetTitleID((u8*)&m_TitleID);
m_TitleID = Common::swap64(m_TitleID); m_TitleID = Common::swap64(m_TitleID);
} }
else else
@ -177,11 +177,11 @@ 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);
const DiscIO::INANDContentLoader& rNANDCOntent = AccessContentDevice(TitleID); const DiscIO::INANDContentLoader& rNANDContent = AccessContentDevice(TitleID);
u16 NumberOfPrivateContent = 0; 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) if ((u32)(TitleID>>32) == 0x00010000)
Memory::Write_U32(0, Buffer.PayloadBuffer[0].m_Address); 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); Memory::Write_U32(0, _CommandAddress + 0x4);
} }
else 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", 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; 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); u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
char* Path = (char*)Memory::GetPointer(Buffer.PayloadBuffer[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); 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); 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; u32 TMDViewCnt = 0;
if (Loader.IsValid()) 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 :/ // TODO: actually use this param in when writing to the outbuffer :/
MaxCount = Memory::Read_U32(Buffer.InBuffer[1].m_Address); 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); 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); 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]; return *m_NANDContent[_TitleID];
} }
@ -878,11 +873,10 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz)
{ {
return -1; return -1;
} }
std::string tmdPath = Common::GetTMDFileName(tmdTitleID), std::string tmdPath = Common::GetTMDFileName(tmdTitleID);
dataPath = Common::GetTitleDataPath(tmdTitleID);
File::CreateFullPath(tmdPath); File::CreateFullPath(tmdPath);
File::CreateFullPath(dataPath); File::CreateFullPath(Common::GetTitleDataPath(tmdTitleID));
if(!File::Exists(tmdPath)) if(!File::Exists(tmdPath))
{ {
File::IOFile _pTMDFile(tmdPath, "wb"); File::IOFile _pTMDFile(tmdPath, "wb");