remove all accesses to m_pContent

this fixes the crashes, but leaves the "else" part of ES_READCONTENT
temporarily broken until the next commit.

WAD access that are performed on the encrypted WAD will most likely fail
with this commit.
This commit is contained in:
BhaaL 2016-03-14 21:49:51 +01:00
parent 598c3dbe2f
commit 8fd2f05741
2 changed files with 13 additions and 10 deletions

View File

@ -163,7 +163,7 @@ void CWII_IPC_HLE_Device_es::DoState(PointerWrap& p)
SContentAccess& Access = pair.second;
Position = Access.m_Position;
TitleID = Access.m_TitleID;
Index = Access.m_pContent->m_Index;
Index = Access.m_Index;
p.Do(CFD);
p.Do(Position);
p.Do(TitleID);
@ -220,7 +220,8 @@ u32 CWII_IPC_HLE_Device_es::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index)
SContentAccess Access;
Access.m_Position = 0;
Access.m_pContent = pContent;
Access.m_Index = pContent->m_Index;
Access.m_Size = pContent->m_Size;
Access.m_TitleID = TitleID;
Access.m_pFile = nullptr;
@ -391,16 +392,17 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
u8* pDest = Memory::GetPointer(Addr);
if (rContent.m_Position + Size > rContent.m_pContent->m_Size)
if (rContent.m_Position + Size > rContent.m_Size)
{
Size = rContent.m_pContent->m_Size-rContent.m_Position;
Size = rContent.m_Size - rContent.m_Position;
}
if (Size > 0)
{
if (pDest)
{
if (rContent.m_pContent->m_data.empty())
// FIXME: this breaks WAD access (the else part), fixed in the next commit
//if (rContent.m_pContent->m_data.empty())
{
auto& pFile = rContent.m_pFile;
if (!pFile->Seek(rContent.m_Position, SEEK_SET))
@ -413,11 +415,11 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
ERROR_LOG(WII_IPC_ES, "ES: short read; returning uninitialized data!");
}
}
else
/*else
{
const u8* src = &rContent.m_pContent->m_data[rContent.m_Position];
memcpy(pDest, src, Size);
}
}*/
rContent.m_Position += Size;
}
@ -427,7 +429,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
}
}
INFO_LOG(WII_IPC_ES, "IOCTL_ES_READCONTENT: CFD %x, Address 0x%x, Size %i -> stream pos %i (Index %i)", CFD, Addr, Size, rContent.m_Position, rContent.m_pContent->m_Index);
INFO_LOG(WII_IPC_ES, "IOCTL_ES_READCONTENT: CFD %x, Address 0x%x, Size %i -> stream pos %i (Index %i)", CFD, Addr, Size, rContent.m_Position, rContent.m_Index);
Memory::Write_U32(Size, _CommandAddress + 0x4);
return GetDefaultReply();
@ -486,7 +488,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
break;
case 2: // END
rContent.m_Position = rContent.m_pContent->m_Size + Addr;
rContent.m_Position = rContent.m_Size + Addr;
break;
}

View File

@ -125,7 +125,8 @@ private:
{
u32 m_Position;
u64 m_TitleID;
const DiscIO::SNANDContent* m_pContent;
u16 m_Index;
u32 m_Size;
// This is a (raw) pointer to work around a MSVC bug.
File::IOFile* m_pFile;
};