diff options
author | bunnei <bunneidev@gmail.com> | 2015-06-08 05:39:37 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-06-17 04:34:39 +0200 |
commit | 71e8822d23c030311858e6fcc8480b9c52f13f39 (patch) | |
tree | 0a5f53cbcebc2c98c7c9c224cbc1a91c1b783366 /src/core/hle/function_wrappers.h | |
parent | Merge pull request #866 from lioncash/typo (diff) | |
download | yuzu-71e8822d23c030311858e6fcc8480b9c52f13f39.tar yuzu-71e8822d23c030311858e6fcc8480b9c52f13f39.tar.gz yuzu-71e8822d23c030311858e6fcc8480b9c52f13f39.tar.bz2 yuzu-71e8822d23c030311858e6fcc8480b9c52f13f39.tar.lz yuzu-71e8822d23c030311858e6fcc8480b9c52f13f39.tar.xz yuzu-71e8822d23c030311858e6fcc8480b9c52f13f39.tar.zst yuzu-71e8822d23c030311858e6fcc8480b9c52f13f39.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/function_wrappers.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h index 23c86a72d..5949cb470 100644 --- a/src/core/hle/function_wrappers.h +++ b/src/core/hle/function_wrappers.h @@ -9,11 +9,15 @@ #include "core/arm/arm_interface.h" #include "core/memory.h" #include "core/hle/hle.h" +#include "core/hle/result.h" namespace HLE { #define PARAM(n) Core::g_app_core->GetReg(n) +/// An invalid result code that is meant to be overwritten when a thread resumes from waiting +static const ResultCode RESULT_INVALID(0xDEADC0DE); + /** * HLE a function return from the current ARM11 userland process * @param res Result to return @@ -57,8 +61,11 @@ template<ResultCode func(s32*, u32*, s32, bool, s64)> void Wrap() { s32 param_1 = 0; s32 retval = func(¶m_1, (Handle*)Memory::GetPointer(PARAM(1)), (s32)PARAM(2), (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0))).raw; - Core::g_app_core->SetReg(1, (u32)param_1); - FuncReturn(retval); + + if (retval != RESULT_INVALID.raw) { + Core::g_app_core->SetReg(1, (u32)param_1); + FuncReturn(retval); + } } template<ResultCode func(u32, u32, u32, u32, s64)> void Wrap() { @@ -73,7 +80,11 @@ template<ResultCode func(u32*)> void Wrap(){ } template<ResultCode func(u32, s64)> void Wrap() { - FuncReturn(func(PARAM(0), (((s64)PARAM(3) << 32) | PARAM(2))).raw); + s32 retval = func(PARAM(0), (((s64)PARAM(3) << 32) | PARAM(2))).raw; + + if (retval != RESULT_INVALID.raw) { + FuncReturn(retval); + } } template<ResultCode func(void*, void*, u32)> void Wrap(){ |