From d7ba8f7312875cfcff725dc658bbd4732a4b6166 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 2 Mar 2014 13:59:34 -0800 Subject: [PATCH] Correct error code for reads into a bad pointer. Per tests this is generally -1. --- Core/HLE/sceIo.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index da3ef85e7a..40feefd0b4 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -764,10 +764,13 @@ bool __IoRead(int &result, int id, u32 data_addr, int size) { return true; } } else { - ERROR_LOG_REPORT(SCEIO, "sceIoRead Reading into bad pointer %08x", data_addr); - // TODO: Returning 0 because it wasn't being sign-extended in async result before. - // What should this do? - result = 0; + if (size != 0) { + // TODO: For some combinations of bad pointer + size, SCE_KERNEL_ERROR_ILLEGAL_ADDR. + // Seems like only for kernel RAM. For most cases, it really is -1. + result = -1; + } else { + result = 0; + } return true; } } else {