Fix IOCTL_ES_GETVIEWCNT (uninitialized data)

GH5 Loads again
use the existing function instead of checking titleid each time a NANDLoader is needed

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7547 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2011-05-16 22:46:35 +00:00
parent 8c304d912a
commit b5212821f8
2 changed files with 22 additions and 34 deletions

View File

@ -446,12 +446,8 @@ 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 retVal = 0; u32 retVal = 0;
std::string ContentPath = Common::GetTitleContentPath(TitleID); const DiscIO::INANDContentLoader& Loader = AccessContentDevice(TitleID);
if (m_TitleID == TitleID) u32 ViewCount = ViewCount = Loader.GetTIKSize() / DiscIO::INANDContentLoader::TICKET_SIZE;
ContentPath = m_ContentFile;
const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(ContentPath);
u32 ViewCount = Loader.GetTIKSize() / DiscIO::INANDContentLoader::TICKET_SIZE;
if (!ViewCount) if (!ViewCount)
{ {
@ -491,11 +487,8 @@ 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 maxViews = Memory::Read_U32(Buffer.InBuffer[1].m_Address); u32 maxViews = Memory::Read_U32(Buffer.InBuffer[1].m_Address);
u32 retVal = 0; u32 retVal = 0;
std::string ContentPath = Common::GetTitleContentPath(TitleID);
if (m_TitleID == TitleID)
ContentPath = m_ContentFile;
const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(ContentPath); const DiscIO::INANDContentLoader& Loader = AccessContentDevice(TitleID);
const u8 *Ticket = Loader.GetTIK(); const u8 *Ticket = Loader.GetTIK();
if (Ticket) if (Ticket)
@ -545,10 +538,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 TitleID_HI = (u32)(TitleID >> 32); u32 TitleID_HI = (u32)(TitleID >> 32);
std::string ContentPath = Common::GetTitleContentPath(TitleID); const DiscIO::INANDContentLoader& Loader = AccessContentDevice(TitleID);
if (m_TitleID == TitleID)
ContentPath = m_ContentFile;
const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(ContentPath);
// Assert if title is not a disc title and the loader is not valid // Assert if title is not a disc title and the loader is not valid
_dbg_assert_msg_(WII_IPC_ES, (TitleID_HI == 0x00010000) || (TitleID_HI == 0x00010004) || Loader.IsValid(), "Loader not valid for TitleID %08x/%08x", TitleID_HI, (u32)TitleID); _dbg_assert_msg_(WII_IPC_ES, (TitleID_HI == 0x00010000) || (TitleID_HI == 0x00010004) || Loader.IsValid(), "Loader not valid for TitleID %08x/%08x", TitleID_HI, (u32)TitleID);
@ -577,11 +567,8 @@ 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 ContentPath = Common::GetTitleContentPath(TitleID);
if (m_TitleID == TitleID)
ContentPath = m_ContentFile;
const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(ContentPath);
const DiscIO::INANDContentLoader& Loader = AccessContentDevice(TitleID);
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);
@ -655,7 +642,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);
const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitleID); const DiscIO::INANDContentLoader& Loader = AccessContentDevice(TitleID);
_dbg_assert_(WII_IPC_ES, Loader.IsValid()); _dbg_assert_(WII_IPC_ES, Loader.IsValid());
u32 TMDCnt = 0; u32 TMDCnt = 0;
@ -764,7 +751,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
if ((u32)(TitleID>>32) != 0x00000001 || TitleID == TITLEID_SYSMENU) if ((u32)(TitleID>>32) != 0x00000001 || TitleID == TITLEID_SYSMENU)
{ {
const DiscIO::INANDContentLoader& ContentLoader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TitleID); const DiscIO::INANDContentLoader& ContentLoader = AccessContentDevice(TitleID);
if (ContentLoader.IsValid()) if (ContentLoader.IsValid())
{ {
u32 bootInd = ContentLoader.GetBootIndex(); u32 bootInd = ContentLoader.GetBootIndex();

View File

@ -153,6 +153,7 @@ CNANDContentLoader::CNANDContentLoader(const std::string& _rName)
, m_TitleID(-1) , m_TitleID(-1)
, m_IosVersion(0x09) , m_IosVersion(0x09)
, m_BootIndex(-1) , m_BootIndex(-1)
, m_TIKSize(0)
, m_TIK(NULL) , m_TIK(NULL)
{ {
m_Valid = Initialize(_rName); m_Valid = Initialize(_rName);