From dda5ca5c73acee260678f562afeb0cad44f49f1b Mon Sep 17 00:00:00 2001 From: "fires.gc" Date: Mon, 23 Feb 2009 19:19:38 +0000 Subject: [PATCH] fixed read content of ES git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2392 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h index 0efd565d1f..70deaaf53a 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h @@ -176,8 +176,16 @@ public: u8* pSrc = &rContent.m_pContent->m_pData[rContent.m_Position]; u8* pDest = Memory::GetPointer(Addr); - memcpy(pDest,pSrc, Size); - rContent.m_Position += Size; + if (rContent.m_Position + Size > rContent.m_pContent->m_Size) + { + Size = rContent.m_pContent->m_Size-rContent.m_Position; + } + + if (Size > 0) + { + memcpy(pDest,pSrc, Size); + rContent.m_Position += Size; + } LOG(WII_IPC_ES, "ES: IOCTL_ES_READCONTENT: CFD %x, Addr 0x%x, Size %i -> stream pos %i", CFD, Addr, Size, rContent.m_Position); @@ -217,6 +225,7 @@ public: break; case 1: // CUR + rContent.m_Position += Addr; break; case 2: // END