summaryrefslogtreecommitdiff
path: root/src/core/hle/function_wrappers.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/function_wrappers.h')
-rw-r--r--src/core/hle/function_wrappers.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h
index 18b6e7017..2abdfe1b3 100644
--- a/src/core/hle/function_wrappers.h
+++ b/src/core/hle/function_wrappers.h
@@ -16,9 +16,6 @@ namespace HLE {
16 16
17#define PARAM(n) Core::CPU().GetReg(n) 17#define PARAM(n) Core::CPU().GetReg(n)
18 18
19/// An invalid result code that is meant to be overwritten when a thread resumes from waiting
20static const ResultCode RESULT_INVALID(0xDEADC0DE);
21
22/** 19/**
23 * HLE a function return from the current ARM11 userland process 20 * HLE a function return from the current ARM11 userland process
24 * @param res Result to return 21 * @param res Result to return
@@ -68,10 +65,18 @@ void Wrap() {
68 (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0))) 65 (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0)))
69 .raw; 66 .raw;
70 67
71 if (retval != RESULT_INVALID.raw) { 68 Core::CPU().SetReg(1, (u32)param_1);
72 Core::CPU().SetReg(1, (u32)param_1); 69 FuncReturn(retval);
73 FuncReturn(retval); 70}
74 } 71
72template <ResultCode func(s32*, u32*, s32, u32)>
73void Wrap() {
74 s32 param_1 = 0;
75 u32 retval =
76 func(&param_1, (Kernel::Handle*)Memory::GetPointer(PARAM(1)), (s32)PARAM(2), PARAM(3)).raw;
77
78 Core::CPU().SetReg(1, (u32)param_1);
79 FuncReturn(retval);
75} 80}
76 81
77template <ResultCode func(u32, u32, u32, u32, s64)> 82template <ResultCode func(u32, u32, u32, u32, s64)>
@@ -92,9 +97,7 @@ template <ResultCode func(u32, s64)>
92void Wrap() { 97void Wrap() {
93 s32 retval = func(PARAM(0), (((s64)PARAM(3) << 32) | PARAM(2))).raw; 98 s32 retval = func(PARAM(0), (((s64)PARAM(3) << 32) | PARAM(2))).raw;
94 99
95 if (retval != RESULT_INVALID.raw) { 100 FuncReturn(retval);
96 FuncReturn(retval);
97 }
98} 101}
99 102
100template <ResultCode func(MemoryInfo*, PageInfo*, u32)> 103template <ResultCode func(MemoryInfo*, PageInfo*, u32)>