mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Better error reporting for ES / NANDContentLoader.
This commit is contained in:
@ -197,7 +197,15 @@ bool CWII_IPC_HLE_Device_es::Close(u32 _CommandAddress, bool _bForce)
|
|||||||
|
|
||||||
u32 CWII_IPC_HLE_Device_es::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index)
|
u32 CWII_IPC_HLE_Device_es::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index)
|
||||||
{
|
{
|
||||||
const DiscIO::SNANDContent* pContent = AccessContentDevice(TitleID).GetContentByIndex(Index);
|
const DiscIO::INANDContentLoader& Loader = AccessContentDevice(TitleID);
|
||||||
|
|
||||||
|
if (!Loader.IsValid())
|
||||||
|
{
|
||||||
|
WARN_LOG(WII_IPC_ES, "ES: loader not valid for %llx", TitleID);
|
||||||
|
return 0xffffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
const DiscIO::SNANDContent* pContent = Loader.GetContentByIndex(Index);
|
||||||
|
|
||||||
if (pContent == NULL)
|
if (pContent == NULL)
|
||||||
{
|
{
|
||||||
@ -375,7 +383,8 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
|
|||||||
|
|
||||||
if (Size > 0)
|
if (Size > 0)
|
||||||
{
|
{
|
||||||
if (pDest) {
|
if (pDest)
|
||||||
|
{
|
||||||
if (rContent.m_pContent->m_pData)
|
if (rContent.m_pContent->m_pData)
|
||||||
{
|
{
|
||||||
u8* pSrc = &rContent.m_pContent->m_pData[rContent.m_Position];
|
u8* pSrc = &rContent.m_pContent->m_pData[rContent.m_Position];
|
||||||
@ -384,8 +393,15 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
File::IOFile* pFile = &rContent.m_File;
|
File::IOFile* pFile = &rContent.m_File;
|
||||||
pFile->Seek(rContent.m_Position, SEEK_SET);
|
if (!pFile->Seek(rContent.m_Position, SEEK_SET))
|
||||||
pFile->ReadBytes(pDest, Size);
|
{
|
||||||
|
ERROR_LOG(WII_IPC_ES, "ES: couldn't seek!");
|
||||||
|
}
|
||||||
|
WARN_LOG(WII_IPC_ES, "2 %p", pFile->GetHandle());
|
||||||
|
if (!pFile->ReadBytes(pDest, Size))
|
||||||
|
{
|
||||||
|
ERROR_LOG(WII_IPC_ES, "ES: short read; returning uninitialized data!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rContent.m_Position += Size;
|
rContent.m_Position += Size;
|
||||||
} else {
|
} else {
|
||||||
|
@ -213,8 +213,8 @@ bool CNANDContentLoader::Initialize(const std::string& _rName)
|
|||||||
File::IOFile pTMDFile(TMDFileName, "rb");
|
File::IOFile pTMDFile(TMDFileName, "rb");
|
||||||
if (!pTMDFile)
|
if (!pTMDFile)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(DISCIO, "CreateFromDirectory: error opening %s",
|
WARN_LOG(DISCIO, "CreateFromDirectory: error opening %s",
|
||||||
TMDFileName.c_str());
|
TMDFileName.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
u32 pTMDSize = (u32)File::GetSize(TMDFileName);
|
u32 pTMDSize = (u32)File::GetSize(TMDFileName);
|
||||||
@ -222,8 +222,7 @@ bool CNANDContentLoader::Initialize(const std::string& _rName)
|
|||||||
pTMDFile.ReadBytes(pTMD, (size_t)pTMDSize);
|
pTMDFile.ReadBytes(pTMD, (size_t)pTMDSize);
|
||||||
pTMDFile.Close();
|
pTMDFile.Close();
|
||||||
}
|
}
|
||||||
if (!pTMD)
|
|
||||||
return false;
|
|
||||||
memcpy(m_TMDView, pTMD + 0x180, TMD_VIEW_SIZE);
|
memcpy(m_TMDView, pTMD + 0x180, TMD_VIEW_SIZE);
|
||||||
memcpy(m_TMDHeader, pTMD, TMD_HEADER_SIZE);
|
memcpy(m_TMDHeader, pTMD, TMD_HEADER_SIZE);
|
||||||
|
|
||||||
@ -276,7 +275,10 @@ bool CNANDContentLoader::Initialize(const std::string& _rName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Be graceful about incorrect tmds.
|
// Be graceful about incorrect tmds.
|
||||||
rContent.m_Size = (u32) File::GetSize(rContent.m_Filename);
|
if (File::Exists(rContent.m_Filename))
|
||||||
|
{
|
||||||
|
rContent.m_Size = (u32) File::GetSize(rContent.m_Filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] pTMD;
|
delete [] pTMD;
|
||||||
|
Reference in New Issue
Block a user