diff options
| author | JosJuice <josjuice@gmail.com> | 2015-11-17 21:39:46 +0100 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2015-11-17 21:39:46 +0100 |
| commit | 200540922937ac8b818bcb4368a04dfda9228dcb (patch) | |
| tree | a39fbf2e9db53fbbdffcd49837f4685c465c7318 /Source/Core | |
| parent | 24c7d23073f9e71101df10a870380cccd9f1a4ee (diff) | |
Do nothing when calling CopyToEmu with a length of 0
Gecko apparently tries to read 0 bytes from the DVD to 0x00000000.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/HW/Memmap.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Source/Core/Core/HW/Memmap.cpp b/Source/Core/Core/HW/Memmap.cpp index 467410d75b..2255d2cb16 100644 --- a/Source/Core/Core/HW/Memmap.cpp +++ b/Source/Core/Core/HW/Memmap.cpp @@ -253,6 +253,9 @@ static inline bool ValidCopyRange(u32 address, size_t size) void CopyFromEmu(void* data, u32 address, size_t size) { + if (size == 0) + return; + if (!ValidCopyRange(address, size)) { PanicAlert("Invalid range in CopyFromEmu. %zx bytes from 0x%08x", size, address); @@ -263,6 +266,9 @@ void CopyFromEmu(void* data, u32 address, size_t size) void CopyToEmu(u32 address, const void* data, size_t size) { + if (size == 0) + return; + if (!ValidCopyRange(address, size)) { PanicAlert("Invalid range in CopyToEmu. %zx bytes to 0x%08x", size, address); @@ -273,11 +279,12 @@ void CopyToEmu(u32 address, const void* data, size_t size) void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength) { + if (_iLength == 0) + return; + u8* ptr = GetPointer(_Address); if (ptr != nullptr) - { - memset(ptr,_iValue,_iLength); - } + memset(ptr, _iValue, _iLength); } std::string GetString(u32 em_address, size_t size) |
