summaryrefslogtreecommitdiff
path: root/src/core/hle/function_wrappers.h
diff options
context:
space:
mode:
authorGravatar bunnei2014-06-09 22:30:39 -0400
committerGravatar bunnei2014-06-13 09:51:17 -0400
commit8957622d10784d5f04571e9ae01dbae13ed64c3e (patch)
treebfa07530da08a88cb1f60b8251cec48cc9cec787 /src/core/hle/function_wrappers.h
parentThread: Renamed occurrences of "t" to "thread" to improve readability. (diff)
downloadyuzu-8957622d10784d5f04571e9ae01dbae13ed64c3e.tar.gz
yuzu-8957622d10784d5f04571e9ae01dbae13ed64c3e.tar.xz
yuzu-8957622d10784d5f04571e9ae01dbae13ed64c3e.zip
SVC: Renamed all function wrapper templates to Wrap, moved to HLE namespace.
Diffstat (limited to 'src/core/hle/function_wrappers.h')
-rw-r--r--src/core/hle/function_wrappers.h50
1 files changed, 19 insertions, 31 deletions
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h
index e8afa90d6..aa5278c8a 100644
--- a/src/core/hle/function_wrappers.h
+++ b/src/core/hle/function_wrappers.h
@@ -8,29 +8,27 @@
8#include "core/mem_map.h" 8#include "core/mem_map.h"
9#include "core/hle/hle.h" 9#include "core/hle/hle.h"
10 10
11namespace Wrap { 11namespace HLE {
12 12
13//////////////////////////////////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////////////////////////////////
14// Function wrappers that return type s32 14// Function wrappers that return type s32
15 15
16namespace S32 { 16template<s32 func(u32, u32, u32, u32)> void Wrap() {
17
18template<s32 func(u32, u32, u32, u32)> void U32_U32_U32_U32() {
19 RETURN(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3))); 17 RETURN(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)));
20} 18}
21 19
22template<s32 func(u32, u32, u32, u32, u32)> void U32_U32_U32_U32_U32() { 20template<s32 func(u32, u32, u32, u32, u32)> void Wrap() {
23 RETURN(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4))); 21 RETURN(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)));
24} 22}
25 23
26template<s32 func(u32*, u32, u32, u32, u32, u32)> void U32P_U32_U32_U32_U32_U32(){ 24template<s32 func(u32*, u32, u32, u32, u32, u32)> void Wrap(){
27 u32 param_1 = 0; 25 u32 param_1 = 0;
28 u32 retval = func(&param_1, PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); 26 u32 retval = func(&param_1, PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
29 Core::g_app_core->SetReg(1, param_1); 27 Core::g_app_core->SetReg(1, param_1);
30 RETURN(retval); 28 RETURN(retval);
31} 29}
32 30
33template<s32 func(s32*, u32*, s32, bool, s64)> void S32P_U32P_S32_Bool_S64() { 31template<s32 func(s32*, u32*, s32, bool, s64)> void Wrap() {
34 s32 param_1 = 0; 32 s32 param_1 = 0;
35 s32 retval = func(&param_1, (Handle*)Memory::GetPointer(PARAM(1)), (s32)PARAM(2), 33 s32 retval = func(&param_1, (Handle*)Memory::GetPointer(PARAM(1)), (s32)PARAM(2),
36 (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0))); 34 (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0)));
@@ -39,82 +37,72 @@ template<s32 func(s32*, u32*, s32, bool, s64)> void S32P_U32P_S32_Bool_S64() {
39} 37}
40 38
41// TODO(bunnei): Is this correct? Probably not 39// TODO(bunnei): Is this correct? Probably not
42template<s32 func(u32, u32, u32, u32, s64)> void U32_U32_U32_U32_S64() { 40template<s32 func(u32, u32, u32, u32, s64)> void Wrap() {
43 RETURN(func(PARAM(5), PARAM(1), PARAM(2), PARAM(3), (((s64)PARAM(4) << 32) | PARAM(0)))); 41 RETURN(func(PARAM(5), PARAM(1), PARAM(2), PARAM(3), (((s64)PARAM(4) << 32) | PARAM(0))));
44} 42}
45 43
46template<s32 func(u32, s64)> void U32_S64() { 44template<s32 func(u32, s64)> void Wrap() {
47 RETURN(func(PARAM(0), (((s64)PARAM(3) << 32) | PARAM(2)))); 45 RETURN(func(PARAM(0), (((s64)PARAM(3) << 32) | PARAM(2))));
48} 46}
49 47
50template<s32 func(void*, void*, u32)> void VoidP_VoidP_U32(){ 48template<s32 func(void*, void*, u32)> void Wrap(){
51 RETURN(func(Memory::GetPointer(PARAM(0)), Memory::GetPointer(PARAM(1)), PARAM(2))); 49 RETURN(func(Memory::GetPointer(PARAM(0)), Memory::GetPointer(PARAM(1)), PARAM(2)));
52} 50}
53 51
54template<s32 func(s32*, u32)> void S32P_U32(){ 52template<s32 func(s32*, u32)> void Wrap(){
55 s32 param_1 = 0; 53 s32 param_1 = 0;
56 u32 retval = func(&param_1, PARAM(1)); 54 u32 retval = func(&param_1, PARAM(1));
57 Core::g_app_core->SetReg(1, param_1); 55 Core::g_app_core->SetReg(1, param_1);
58 RETURN(retval); 56 RETURN(retval);
59} 57}
60 58
61template<s32 func(u32, s32)> void U32_S32() { 59template<s32 func(u32, s32)> void Wrap() {
62 RETURN(func(PARAM(0), (s32)PARAM(1))); 60 RETURN(func(PARAM(0), (s32)PARAM(1)));
63} 61}
64 62
65template<s32 func(u32*, u32)> void U32P_U32(){ 63template<s32 func(u32*, u32)> void Wrap(){
66 u32 param_1 = 0; 64 u32 param_1 = 0;
67 u32 retval = func(&param_1, PARAM(1)); 65 u32 retval = func(&param_1, PARAM(1));
68 Core::g_app_core->SetReg(1, param_1); 66 Core::g_app_core->SetReg(1, param_1);
69 RETURN(retval); 67 RETURN(retval);
70} 68}
71 69
72template<s32 func(u32)> void U32() { 70template<s32 func(u32)> void Wrap() {
73 RETURN(func(PARAM(0))); 71 RETURN(func(PARAM(0)));
74} 72}
75 73
76template<s32 func(void*)> void U32P() { 74template<s32 func(void*)> void Wrap() {
77 RETURN(func(Memory::GetPointer(PARAM(0)))); 75 RETURN(func(Memory::GetPointer(PARAM(0))));
78} 76}
79 77
80template<s32 func(s64*, u32, void*, s32)> void S64P_U32_VoidP_S32(){ 78template<s32 func(s64*, u32, void*, s32)> void Wrap(){
81 RETURN(func((s64*)Memory::GetPointer(PARAM(0)), PARAM(1), Memory::GetPointer(PARAM(2)), 79 RETURN(func((s64*)Memory::GetPointer(PARAM(0)), PARAM(1), Memory::GetPointer(PARAM(2)),
82 (s32)PARAM(3))); 80 (s32)PARAM(3)));
83} 81}
84 82
85template<s32 func(u32*, const char*)> void U32P_CharP() { 83template<s32 func(u32*, const char*)> void Wrap() {
86 u32 param_1 = 0; 84 u32 param_1 = 0;
87 u32 retval = func(&param_1, Memory::GetCharPointer(PARAM(1))); 85 u32 retval = func(&param_1, Memory::GetCharPointer(PARAM(1)));
88 Core::g_app_core->SetReg(1, param_1); 86 Core::g_app_core->SetReg(1, param_1);
89 RETURN(retval); 87 RETURN(retval);
90} 88}
91 89
92} // namespace S32
93
94//////////////////////////////////////////////////////////////////////////////////////////////////// 90////////////////////////////////////////////////////////////////////////////////////////////////////
95// Function wrappers that return type u32 91// Function wrappers that return type u32
96 92
97namespace U32 { 93template<u32 func()> void Wrap() {
98
99template<u32 func()> void Void() {
100 RETURN(func()); 94 RETURN(func());
101} 95}
102 96
103} // namespace U32
104
105//////////////////////////////////////////////////////////////////////////////////////////////////// 97////////////////////////////////////////////////////////////////////////////////////////////////////
106/// Function wrappers that return type void 98/// Function wrappers that return type void
107 99
108namespace Void { 100template<void func(s64)> void Wrap() {
109
110template<void func(s64)> void S64() {
111 func(((s64)PARAM(1) << 32) | PARAM(0)); 101 func(((s64)PARAM(1) << 32) | PARAM(0));
112} 102}
113 103
114template<void func(const char*)> void CharP() { 104template<void func(const char*)> void Wrap() {
115 func(Memory::GetCharPointer(PARAM(0))); 105 func(Memory::GetCharPointer(PARAM(0)));
116} 106}
117 107
118} // namespace Void 108} // namespace HLE
119
120} // namespace Wrap