diff --git a/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp b/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp index b3692c547e..b374f27703 100644 --- a/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp @@ -992,8 +992,7 @@ s32 cellGcmMapMainMemory(u32 ea, u32 size, vm::ptr offset) { cellGcmSys.warning("cellGcmMapMainMemory(ea=0x%x, size=0x%x, offset=*0x%x)", ea, size, offset); - if (size == 0) return CELL_OK; - if ((ea & 0xFFFFF) || (size & 0xFFFFF)) return CELL_GCM_ERROR_FAILURE; + if (!size || (ea & 0xFFFFF) || (size & 0xFFFFF)) return CELL_GCM_ERROR_FAILURE; u32 io = RSXIOMem.Map(ea, size); diff --git a/rpcs3/Emu/Cell/lv2/sys_rsx.cpp b/rpcs3/Emu/Cell/lv2/sys_rsx.cpp index 23367310e0..f8ccc14878 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rsx.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_rsx.cpp @@ -182,10 +182,13 @@ s32 sys_rsx_context_free(u32 context_id) s32 sys_rsx_context_iomap(u32 context_id, u32 io, u32 ea, u32 size, u64 flags) { sys_rsx.warning("sys_rsx_context_iomap(context_id=0x%x, io=0x%x, ea=0x%x, size=0x%x, flags=0x%llx)", context_id, io, ea, size, flags); - if (size == 0) return CELL_OK; - if (RSXIOMem.Map(ea, size, io)) - return CELL_OK; - return CELL_EINVAL; + + if (!RSXIOMem.Map(ea, size, io)) + { + return CELL_EINVAL; + } + + return CELL_OK; } /* diff --git a/rpcs3/Emu/Memory/Memory.cpp b/rpcs3/Emu/Memory/Memory.cpp index 4599109c51..744f1e924a 100644 --- a/rpcs3/Emu/Memory/Memory.cpp +++ b/rpcs3/Emu/Memory/Memory.cpp @@ -18,8 +18,6 @@ bool VirtualMemoryBlock::IsInMyRange(const u32 addr, const u32 size) u32 VirtualMemoryBlock::Map(u32 realaddr, u32 size) { - verify(HERE), (size); - for (u32 addr = m_range_start; addr <= m_range_start + m_range_size - 1 - GetReservedAmount() - size;) { bool is_good_addr = true; @@ -48,9 +46,7 @@ u32 VirtualMemoryBlock::Map(u32 realaddr, u32 size) bool VirtualMemoryBlock::Map(u32 realaddr, u32 size, u32 addr) { - verify(HERE), (size); - - if (!IsInMyRange(addr, size)) + if (!size || !IsInMyRange(addr, size)) { return false; }