From 63206eb9a81ff8ce7f3003e1804175e6930249c4 Mon Sep 17 00:00:00 2001 From: Exzap <13877693+Exzap@users.noreply.github.com> Date: Fri, 16 Sep 2022 14:25:38 +0200 Subject: [PATCH] coreinit: Return error code instead of success in Acquire failure (#260) Spotted by @Fs00 It's currently not known if any games are affected by this --- src/Cafe/OS/libs/coreinit/coreinit_DynLoad.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Cafe/OS/libs/coreinit/coreinit_DynLoad.cpp b/src/Cafe/OS/libs/coreinit/coreinit_DynLoad.cpp index f6559b65..c8b05124 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_DynLoad.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_DynLoad.cpp @@ -94,14 +94,13 @@ namespace coreinit RPLLoader_Link(); RPLLoader_CallEntrypoints(); rplHandle = RPLLoader_GetHandleByModuleName(libName); - if (rplHandle == RPL_INVALID_HANDLE) - rplHandle = 0; } - - *moduleHandleOut = rplHandle; - // return module not found error code if (rplHandle == RPL_INVALID_HANDLE) - return 0xFFFCFFE9; + *moduleHandleOut = 0; + else + *moduleHandleOut = rplHandle; + if (rplHandle == RPL_INVALID_HANDLE) + return 0xFFFCFFE9; // module not found return 0; }