diff options
| author | 2014-06-14 12:13:16 -0400 | |
|---|---|---|
| committer | 2014-06-14 12:13:16 -0400 | |
| commit | 004df767953a949817da89bddcd5d1379240f769 (patch) | |
| tree | b2d54928dcbf3cb4dde0cd5d3277afe7999b7bd9 /src/core/hle/function_wrappers.h | |
| parent | GPU debugger: Const correctness and build fix. (diff) | |
| parent | Kernel: Removed unnecessary "#pragma once". (diff) | |
| download | yuzu-004df767953a949817da89bddcd5d1379240f769.tar.gz yuzu-004df767953a949817da89bddcd5d1379240f769.tar.xz yuzu-004df767953a949817da89bddcd5d1379240f769.zip | |
Merge branch 'threading' of https://github.com/bunnei/citra
Conflicts:
src/core/hle/function_wrappers.h
src/core/hle/service/gsp.cpp
Diffstat (limited to 'src/core/hle/function_wrappers.h')
| -rw-r--r-- | src/core/hle/function_wrappers.h | 753 |
1 files changed, 61 insertions, 692 deletions
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h index 801865d49..0bed78653 100644 --- a/src/core/hle/function_wrappers.h +++ b/src/core/hle/function_wrappers.h | |||
| @@ -1,19 +1,6 @@ | |||
| 1 | // Copyright (c) 2012- PPSSPP Project. | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | 2 | // Licensed under GPLv2 | |
| 3 | // This program is free software: you can redistribute it and/or modify | 3 | // Refer to the license.txt file included. |
| 4 | // it under the terms of the GNU General Public License as published by | ||
| 5 | // the Free Software Foundation, version 2.0 or later versions. | ||
| 6 | |||
| 7 | // This program is distributed in the hope that it will be useful, | ||
| 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 10 | // GNU General Public License 2.0 for more details. | ||
| 11 | |||
| 12 | // A copy of the GPL 2.0 should have been included with the program. | ||
| 13 | // If not, see http://www.gnu.org/licenses/ | ||
| 14 | |||
| 15 | // Official git repository and contact information can be found at | ||
| 16 | // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. | ||
| 17 | 4 | ||
| 18 | #pragma once | 5 | #pragma once |
| 19 | 6 | ||
| @@ -21,725 +8,107 @@ | |||
| 21 | #include "core/mem_map.h" | 8 | #include "core/mem_map.h" |
| 22 | #include "core/hle/hle.h" | 9 | #include "core/hle/hle.h" |
| 23 | 10 | ||
| 24 | // For easy parameter parsing and return value processing. | 11 | namespace HLE { |
| 25 | |||
| 26 | //32bit wrappers | ||
| 27 | template<void func()> void WrapV_V() { | ||
| 28 | func(); | ||
| 29 | } | ||
| 30 | |||
| 31 | template<u32 func()> void WrapU_V() { | ||
| 32 | RETURN(func()); | ||
| 33 | } | ||
| 34 | |||
| 35 | template<int func(void *, const char *)> void WrapI_VC() { | ||
| 36 | u32 retval = func(Memory::GetPointer(PARAM(0)), Memory::GetCharPointer(PARAM(1))); | ||
| 37 | RETURN(retval); | ||
| 38 | } | ||
| 39 | |||
| 40 | template<u32 func(int, void *, int)> void WrapU_IVI() { | ||
| 41 | u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)), PARAM(2)); | ||
| 42 | RETURN(retval); | ||
| 43 | } | ||
| 44 | |||
| 45 | template<int func(const char *, int, int, u32)> void WrapI_CIIU() { | ||
| 46 | u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3)); | ||
| 47 | RETURN(retval); | ||
| 48 | } | ||
| 49 | |||
| 50 | template<int func(int, const char *, u32, void *, void *, u32, int)> void WrapI_ICUVVUI() { | ||
| 51 | u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), Memory::GetPointer(PARAM(3)),Memory::GetPointer(PARAM(4)), PARAM(5), PARAM(6) ); | ||
| 52 | RETURN(retval); | ||
| 53 | } | ||
| 54 | |||
| 55 | // Hm, do so many params get passed in registers? | ||
| 56 | template<int func(const char *, int, const char *, int, int, int, int, int)> void WrapI_CICIIIII() { | ||
| 57 | u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), Memory::GetCharPointer(PARAM(2)), | ||
| 58 | PARAM(3), PARAM(4), PARAM(5), PARAM(6), PARAM(7)); | ||
| 59 | RETURN(retval); | ||
| 60 | } | ||
| 61 | |||
| 62 | // Hm, do so many params get passed in registers? | ||
| 63 | template<int func(const char *, int, int, int, int, int, int)> void WrapI_CIIIIII() { | ||
| 64 | u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||
| 65 | PARAM(3), PARAM(4), PARAM(5), PARAM(6)); | ||
| 66 | RETURN(retval); | ||
| 67 | } | ||
| 68 | |||
| 69 | // Hm, do so many params get passed in registers? | ||
| 70 | template<int func(int, int, int, int, int, int, u32)> void WrapI_IIIIIIU() { | ||
| 71 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6)); | ||
| 72 | RETURN(retval); | ||
| 73 | } | ||
| 74 | |||
| 75 | // Hm, do so many params get passed in registers? | ||
| 76 | template<int func(int, int, int, int, int, int, int, int, u32)> void WrapI_IIIIIIIIU() { | ||
| 77 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6), PARAM(7), PARAM(8)); | ||
| 78 | RETURN(retval); | ||
| 79 | } | ||
| 80 | |||
| 81 | template<u32 func(int, void *)> void WrapU_IV() { | ||
| 82 | u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1))); | ||
| 83 | RETURN(retval); | ||
| 84 | } | ||
| 85 | |||
| 86 | template<u32 func(u32)> void WrapU_U() { | ||
| 87 | u32 retval = func(PARAM(0)); | ||
| 88 | RETURN(retval); | ||
| 89 | } | ||
| 90 | |||
| 91 | template<u32 func(u32, int)> void WrapU_UI() { | ||
| 92 | u32 retval = func(PARAM(0), PARAM(1)); | ||
| 93 | RETURN(retval); | ||
| 94 | } | ||
| 95 | |||
| 96 | template<int func(u32)> void WrapI_U() { | ||
| 97 | int retval = func(PARAM(0)); | ||
| 98 | RETURN(retval); | ||
| 99 | } | ||
| 100 | |||
| 101 | template<int func(u32, int)> void WrapI_UI() { | ||
| 102 | int retval = func(PARAM(0), PARAM(1)); | ||
| 103 | RETURN(retval); | ||
| 104 | } | ||
| 105 | |||
| 106 | template<int func(u32, int, int, u32)> void WrapI_UIIU() { | ||
| 107 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 108 | RETURN(retval); | ||
| 109 | } | ||
| 110 | |||
| 111 | template<u32 func(int, u32, int)> void WrapU_IUI() { | ||
| 112 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||
| 113 | RETURN(retval); | ||
| 114 | } | ||
| 115 | |||
| 116 | template<int func(u32, u32)> void WrapI_UU() { | ||
| 117 | int retval = func(PARAM(0), PARAM(1)); | ||
| 118 | RETURN(retval); | ||
| 119 | } | ||
| 120 | |||
| 121 | template<int func(u32, u32, u32)> void WrapI_UUU() { | ||
| 122 | int retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||
| 123 | RETURN(retval); | ||
| 124 | } | ||
| 125 | |||
| 126 | template<int func(u32, u32, u32, int)> void WrapI_UUUI() { | ||
| 127 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 128 | RETURN(retval); | ||
| 129 | } | ||
| 130 | |||
| 131 | template<int func(u32, u32, u32, int, int, int,int )> void WrapI_UUUIIII() { | ||
| 132 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6)); | ||
| 133 | RETURN(retval); | ||
| 134 | } | ||
| 135 | |||
| 136 | template<int func(u32, u32, u32, u32)> void WrapI_UUUU() { | ||
| 137 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 138 | RETURN(retval); | ||
| 139 | } | ||
| 140 | |||
| 141 | template<int func(u32, u32, u32, u32, u32)> void WrapI_UUUUU() { | ||
| 142 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||
| 143 | RETURN(retval); | ||
| 144 | } | ||
| 145 | |||
| 146 | template<int func(void*)> void WrapI_V() { | ||
| 147 | u32 retval = func(Memory::GetPointer(PARAM(0))); | ||
| 148 | RETURN(retval); | ||
| 149 | } | ||
| 150 | |||
| 151 | template<u32 func(int)> void WrapU_I() { | ||
| 152 | u32 retval = func(PARAM(0)); | ||
| 153 | RETURN(retval); | ||
| 154 | } | ||
| 155 | |||
| 156 | template<u32 func(int, int, u32)> void WrapU_IIU() { | ||
| 157 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||
| 158 | RETURN(retval); | ||
| 159 | } | ||
| 160 | |||
| 161 | template<int func(int)> void WrapI_I() { | ||
| 162 | int retval = func(PARAM(0)); | ||
| 163 | RETURN(retval); | ||
| 164 | } | ||
| 165 | |||
| 166 | template<void func(u32)> void WrapV_U() { | ||
| 167 | func(PARAM(0)); | ||
| 168 | } | ||
| 169 | |||
| 170 | template<void func(int)> void WrapV_I() { | ||
| 171 | func(PARAM(0)); | ||
| 172 | } | ||
| 173 | |||
| 174 | template<void func(u32, u32)> void WrapV_UU() { | ||
| 175 | func(PARAM(0), PARAM(1)); | ||
| 176 | } | ||
| 177 | |||
| 178 | template<void func(int, int)> void WrapV_II() { | ||
| 179 | func(PARAM(0), PARAM(1)); | ||
| 180 | } | ||
| 181 | |||
| 182 | template<void func(u32, const char *)> void WrapV_UC() { | ||
| 183 | func(PARAM(0), Memory::GetCharPointer(PARAM(1))); | ||
| 184 | } | ||
| 185 | |||
| 186 | template<int func(u32, const char *)> void WrapI_UC() { | ||
| 187 | int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1))); | ||
| 188 | RETURN(retval); | ||
| 189 | } | ||
| 190 | |||
| 191 | template<int func(u32, const char *, int)> void WrapI_UCI() { | ||
| 192 | int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2)); | ||
| 193 | RETURN(retval); | ||
| 194 | } | ||
| 195 | |||
| 196 | template<u32 func(u32, int , int , int, int, int)> void WrapU_UIIIII() { | ||
| 197 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5)); | ||
| 198 | RETURN(retval); | ||
| 199 | } | ||
| 200 | |||
| 201 | template<u32 func(u32, int , int , int, u32)> void WrapU_UIIIU() { | ||
| 202 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||
| 203 | RETURN(retval); | ||
| 204 | } | ||
| 205 | |||
| 206 | template<u32 func(u32, int , int , int, int, int, int)> void WrapU_UIIIIII() { | ||
| 207 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6)); | ||
| 208 | RETURN(retval); | ||
| 209 | } | ||
| 210 | |||
| 211 | template<u32 func(u32, u32)> void WrapU_UU() { | ||
| 212 | u32 retval = func(PARAM(0), PARAM(1)); | ||
| 213 | RETURN(retval); | ||
| 214 | } | ||
| 215 | |||
| 216 | template<u32 func(u32, u32, int)> void WrapU_UUI() { | ||
| 217 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||
| 218 | RETURN(retval); | ||
| 219 | } | ||
| 220 | |||
| 221 | template<u32 func(u32, u32, int, int)> void WrapU_UUII() { | ||
| 222 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 223 | RETURN(retval); | ||
| 224 | } | ||
| 225 | |||
| 226 | template<u32 func(const char *, u32, u32, u32)> void WrapU_CUUU() { | ||
| 227 | u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3)); | ||
| 228 | RETURN(retval); | ||
| 229 | } | ||
| 230 | |||
| 231 | template<void func(u32, int, u32, int, int)> void WrapV_UIUII() { | ||
| 232 | func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||
| 233 | } | ||
| 234 | |||
| 235 | template<u32 func(u32, int, u32, int, int)> void WrapU_UIUII() { | ||
| 236 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||
| 237 | RETURN(retval); | ||
| 238 | } | ||
| 239 | |||
| 240 | template<int func(u32, int, u32, int, int)> void WrapI_UIUII() { | ||
| 241 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||
| 242 | RETURN(retval); | ||
| 243 | } | ||
| 244 | |||
| 245 | template<u32 func(u32, int, u32, int)> void WrapU_UIUI() { | ||
| 246 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 247 | RETURN(retval); | ||
| 248 | } | ||
| 249 | |||
| 250 | template<int func(u32, int, u32, int)> void WrapI_UIUI() { | ||
| 251 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 252 | RETURN(retval); | ||
| 253 | } | ||
| 254 | |||
| 255 | template<u32 func(u32, int, u32)> void WrapU_UIU() { | ||
| 256 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||
| 257 | RETURN(retval); | ||
| 258 | } | ||
| 259 | |||
| 260 | template<u32 func(u32, int, u32, u32)> void WrapU_UIUU() { | ||
| 261 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 262 | RETURN(retval); | ||
| 263 | } | ||
| 264 | |||
| 265 | template<u32 func(u32, int, int)> void WrapU_UII() { | ||
| 266 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||
| 267 | RETURN(retval); | ||
| 268 | } | ||
| 269 | |||
| 270 | template<u32 func(u32, int, int, u32)> void WrapU_UIIU() { | ||
| 271 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 272 | RETURN(retval); | ||
| 273 | } | ||
| 274 | |||
| 275 | template<int func(u32, int, int, u32, u32)> void WrapI_UIIUU() { | ||
| 276 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||
| 277 | RETURN(retval); | ||
| 278 | } | ||
| 279 | |||
| 280 | template<int func(u32, u32, int, int)> void WrapI_UUII() { | ||
| 281 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 282 | RETURN(retval); | ||
| 283 | } | ||
| 284 | |||
| 285 | template<int func(u32, u32, int, int, int)> void WrapI_UUIII() { | ||
| 286 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||
| 287 | RETURN(retval); | ||
| 288 | } | ||
| 289 | |||
| 290 | template<void func(u32, int, int, int)> void WrapV_UIII() { | ||
| 291 | func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 292 | } | ||
| 293 | |||
| 294 | template<void func(u32, int, int, int, int, int)> void WrapV_UIIIII() { | ||
| 295 | func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5)); | ||
| 296 | } | ||
| 297 | |||
| 298 | template<void func(u32, int, int)> void WrapV_UII() { | ||
| 299 | func(PARAM(0), PARAM(1), PARAM(2)); | ||
| 300 | } | ||
| 301 | 12 | ||
| 302 | template<u32 func(int, u32)> void WrapU_IU() { | 13 | #define PARAM(n) Core::g_app_core->GetReg(n) |
| 303 | int retval = func(PARAM(0), PARAM(1)); | 14 | #define RETURN(n) Core::g_app_core->SetReg(0, n) |
| 304 | RETURN(retval); | ||
| 305 | } | ||
| 306 | 15 | ||
| 307 | template<int func(int, u32)> void WrapI_IU() { | 16 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 308 | int retval = func(PARAM(0), PARAM(1)); | 17 | // Function wrappers that return type s32 |
| 309 | RETURN(retval); | ||
| 310 | } | ||
| 311 | 18 | ||
| 312 | template<int func(u32, u32, int)> void WrapI_UUI() { | 19 | template<s32 func(u32, u32, u32, u32)> void Wrap() { |
| 313 | int retval = func(PARAM(0), PARAM(1), PARAM(2)); | 20 | RETURN(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3))); |
| 314 | RETURN(retval); | ||
| 315 | } | 21 | } |
| 316 | 22 | ||
| 317 | template<int func(u32, u32, int, u32)> void WrapI_UUIU() { | 23 | template<s32 func(u32, u32, u32, u32, u32)> void Wrap() { |
| 318 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | 24 | RETURN(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4))); |
| 319 | RETURN(retval); | ||
| 320 | } | 25 | } |
| 321 | 26 | ||
| 322 | template<int func(int, int)> void WrapI_II() { | 27 | template<s32 func(u32*, u32, u32, u32, u32, u32)> void Wrap(){ |
| 323 | int retval = func(PARAM(0), PARAM(1)); | 28 | u32 param_1 = 0; |
| 29 | u32 retval = func(¶m_1, PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||
| 30 | Core::g_app_core->SetReg(1, param_1); | ||
| 324 | RETURN(retval); | 31 | RETURN(retval); |
| 325 | } | 32 | } |
| 326 | 33 | ||
| 327 | template<int func(int, int, int)> void WrapI_III() { | 34 | template<s32 func(s32*, u32*, s32, bool, s64)> void Wrap() { |
| 328 | int retval = func(PARAM(0), PARAM(1), PARAM(2)); | 35 | s32 param_1 = 0; |
| 36 | s32 retval = func(¶m_1, (Handle*)Memory::GetPointer(PARAM(1)), (s32)PARAM(2), | ||
| 37 | (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0))); | ||
| 38 | Core::g_app_core->SetReg(1, (u32)param_1); | ||
| 329 | RETURN(retval); | 39 | RETURN(retval); |
| 330 | } | 40 | } |
| 331 | 41 | ||
| 332 | template<int func(int, u32, int)> void WrapI_IUI() { | 42 | // TODO(bunnei): Is this correct? Probably not |
| 333 | int retval = func(PARAM(0), PARAM(1), PARAM(2)); | 43 | template<s32 func(u32, u32, u32, u32, s64)> void Wrap() { |
| 334 | RETURN(retval); | 44 | RETURN(func(PARAM(5), PARAM(1), PARAM(2), PARAM(3), (((s64)PARAM(4) << 32) | PARAM(0)))); |
| 335 | } | 45 | } |
| 336 | 46 | ||
| 337 | template<int func(int, int, int, int)> void WrapI_IIII() { | 47 | template<s32 func(u32, s64)> void Wrap() { |
| 338 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | 48 | RETURN(func(PARAM(0), (((s64)PARAM(3) << 32) | PARAM(2)))); |
| 339 | RETURN(retval); | ||
| 340 | } | 49 | } |
| 341 | 50 | ||
| 342 | template<int func(u32, int, int, int)> void WrapI_UIII() { | 51 | template<s32 func(void*, void*, u32)> void Wrap(){ |
| 343 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | 52 | RETURN(func(Memory::GetPointer(PARAM(0)), Memory::GetPointer(PARAM(1)), PARAM(2))); |
| 344 | RETURN(retval); | ||
| 345 | } | 53 | } |
| 346 | 54 | ||
| 347 | template<int func(int, int, int, u32, int)> void WrapI_IIIUI() { | 55 | template<s32 func(s32*, u32)> void Wrap(){ |
| 348 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | 56 | s32 param_1 = 0; |
| 57 | u32 retval = func(¶m_1, PARAM(1)); | ||
| 58 | Core::g_app_core->SetReg(1, param_1); | ||
| 349 | RETURN(retval); | 59 | RETURN(retval); |
| 350 | } | 60 | } |
| 351 | 61 | ||
| 352 | template<int func(int, u32, u32, int, int)> void WrapI_IUUII() { | 62 | template<s32 func(u32, s32)> void Wrap() { |
| 353 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | 63 | RETURN(func(PARAM(0), (s32)PARAM(1))); |
| 354 | RETURN(retval); | ||
| 355 | } | 64 | } |
| 356 | 65 | ||
| 357 | template<int func(int, const char *, int, u32, u32)> void WrapI_ICIUU() { | 66 | template<s32 func(u32*, u32)> void Wrap(){ |
| 358 | int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3), PARAM(4)); | 67 | u32 param_1 = 0; |
| 68 | u32 retval = func(¶m_1, PARAM(1)); | ||
| 69 | Core::g_app_core->SetReg(1, param_1); | ||
| 359 | RETURN(retval); | 70 | RETURN(retval); |
| 360 | } | 71 | } |
| 361 | 72 | ||
| 362 | template<int func(int, int, u32)> void WrapI_IIU() { | 73 | template<s32 func(u32)> void Wrap() { |
| 363 | int retval = func(PARAM(0), PARAM(1), PARAM(2)); | 74 | RETURN(func(PARAM(0))); |
| 364 | RETURN(retval); | ||
| 365 | } | 75 | } |
| 366 | 76 | ||
| 367 | template<void func(int, u32)> void WrapV_IU() { | 77 | template<s32 func(void*)> void Wrap() { |
| 368 | func(PARAM(0), PARAM(1)); | 78 | RETURN(func(Memory::GetPointer(PARAM(0)))); |
| 369 | } | 79 | } |
| 370 | 80 | ||
| 371 | template<void func(u32, int)> void WrapV_UI() { | 81 | template<s32 func(s64*, u32, void*, s32)> void Wrap(){ |
| 372 | func(PARAM(0), PARAM(1)); | 82 | RETURN(func((s64*)Memory::GetPointer(PARAM(0)), PARAM(1), Memory::GetPointer(PARAM(2)), |
| 83 | (s32)PARAM(3))); | ||
| 373 | } | 84 | } |
| 374 | 85 | ||
| 375 | template<u32 func(const char *)> void WrapU_C() { | 86 | template<s32 func(u32*, const char*)> void Wrap() { |
| 376 | u32 retval = func(Memory::GetCharPointer(PARAM(0))); | 87 | u32 param_1 = 0; |
| 88 | u32 retval = func(¶m_1, Memory::GetCharPointer(PARAM(1))); | ||
| 89 | Core::g_app_core->SetReg(1, param_1); | ||
| 377 | RETURN(retval); | 90 | RETURN(retval); |
| 378 | } | 91 | } |
| 379 | 92 | ||
| 380 | template<u32 func(const char *, const char *, const char *, u32)> void WrapU_CCCU() { | 93 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 381 | u32 retval = func(Memory::GetCharPointer(PARAM(0)), | 94 | // Function wrappers that return type u32 |
| 382 | Memory::GetCharPointer(PARAM(1)), Memory::GetCharPointer(PARAM(2)), | ||
| 383 | PARAM(3)); | ||
| 384 | RETURN(retval); | ||
| 385 | } | ||
| 386 | |||
| 387 | template<int func(const char *)> void WrapI_C() { | ||
| 388 | int retval = func(Memory::GetCharPointer(PARAM(0))); | ||
| 389 | RETURN(retval); | ||
| 390 | } | ||
| 391 | |||
| 392 | template<int func(const char *, u32)> void WrapI_CU() { | ||
| 393 | int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1)); | ||
| 394 | RETURN(retval); | ||
| 395 | } | ||
| 396 | |||
| 397 | template<int func(const char *, u32, int)> void WrapI_CUI() { | ||
| 398 | int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2)); | ||
| 399 | RETURN(retval); | ||
| 400 | } | ||
| 401 | 95 | ||
| 402 | template<int func(int, const char *, int, u32)> void WrapI_ICIU() { | 96 | template<u32 func()> void Wrap() { |
| 403 | int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3)); | 97 | RETURN(func()); |
| 404 | RETURN(retval); | ||
| 405 | } | ||
| 406 | |||
| 407 | template<int func(const char *, int, u32)> void WrapI_CIU() { | ||
| 408 | int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2)); | ||
| 409 | RETURN(retval); | ||
| 410 | } | ||
| 411 | |||
| 412 | template<int func(const char *, u32, u32)> void WrapI_CUU() { | ||
| 413 | int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2)); | ||
| 414 | RETURN(retval); | ||
| 415 | } | ||
| 416 | |||
| 417 | template<int func(const char *, u32, u32, u32)> void WrapI_CUUU() { | ||
| 418 | int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||
| 419 | PARAM(3)); | ||
| 420 | RETURN(retval); | ||
| 421 | } | ||
| 422 | |||
| 423 | template<int func(const char *, const char*, int, int)> void WrapI_CCII() { | ||
| 424 | int retval = func(Memory::GetCharPointer(PARAM(0)), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3)); | ||
| 425 | RETURN(retval); | ||
| 426 | } | ||
| 427 | |||
| 428 | template<int func(const char *, u32, u32, int, u32, u32)> void WrapI_CUUIUU() { | ||
| 429 | int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||
| 430 | PARAM(3), PARAM(4), PARAM(5)); | ||
| 431 | RETURN(retval); | ||
| 432 | } | ||
| 433 | |||
| 434 | template<int func(const char *, int, int, u32, int, int)> void WrapI_CIIUII() { | ||
| 435 | int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||
| 436 | PARAM(3), PARAM(4), PARAM(5)); | ||
| 437 | RETURN(retval); | ||
| 438 | } | ||
| 439 | |||
| 440 | template<int func(const char *, int, u32, u32, u32)> void WrapI_CIUUU() { | ||
| 441 | int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||
| 442 | PARAM(3), PARAM(4)); | ||
| 443 | RETURN(retval); | ||
| 444 | } | ||
| 445 | |||
| 446 | template<int func(const char *, u32, u32, u32, u32, u32)> void WrapI_CUUUUU() { | ||
| 447 | int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||
| 448 | PARAM(3), PARAM(4), PARAM(5)); | ||
| 449 | RETURN(retval); | ||
| 450 | } | ||
| 451 | |||
| 452 | template<u32 func(const char *, u32)> void WrapU_CU() { | ||
| 453 | u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1)); | ||
| 454 | RETURN((u32) retval); | ||
| 455 | } | ||
| 456 | |||
| 457 | template<u32 func(u32, const char *)> void WrapU_UC() { | ||
| 458 | u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1))); | ||
| 459 | RETURN(retval); | ||
| 460 | } | ||
| 461 | |||
| 462 | template<u32 func(const char *, u32, u32)> void WrapU_CUU() { | ||
| 463 | u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2)); | ||
| 464 | RETURN((u32) retval); | ||
| 465 | } | ||
| 466 | |||
| 467 | template<u32 func(int, int, int)> void WrapU_III() { | ||
| 468 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||
| 469 | RETURN(retval); | ||
| 470 | } | ||
| 471 | |||
| 472 | template<u32 func(int, int)> void WrapU_II() { | ||
| 473 | u32 retval = func(PARAM(0), PARAM(1)); | ||
| 474 | RETURN(retval); | ||
| 475 | } | ||
| 476 | |||
| 477 | template<u32 func(int, int, int, int)> void WrapU_IIII() { | ||
| 478 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 479 | RETURN(retval); | ||
| 480 | } | ||
| 481 | |||
| 482 | template<u32 func(int, u32, u32)> void WrapU_IUU() { | ||
| 483 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||
| 484 | RETURN(retval); | ||
| 485 | } | ||
| 486 | |||
| 487 | template<u32 func(int, u32, u32, u32)> void WrapU_IUUU() { | ||
| 488 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 489 | RETURN(retval); | ||
| 490 | } | ||
| 491 | |||
| 492 | template<u32 func(int, u32, u32, u32, u32)> void WrapU_IUUUU() { | ||
| 493 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||
| 494 | RETURN(retval); | ||
| 495 | } | ||
| 496 | |||
| 497 | template<u32 func(u32, u32, u32)> void WrapU_UUU() { | ||
| 498 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||
| 499 | RETURN(retval); | ||
| 500 | } | ||
| 501 | |||
| 502 | template<void func(int, u32, u32)> void WrapV_IUU() { | ||
| 503 | func(PARAM(0), PARAM(1), PARAM(2)); | ||
| 504 | } | ||
| 505 | |||
| 506 | template<void func(int, int, u32)> void WrapV_IIU() { | ||
| 507 | func(PARAM(0), PARAM(1), PARAM(2)); | ||
| 508 | } | ||
| 509 | |||
| 510 | template<void func(u32, int, u32)> void WrapV_UIU() { | ||
| 511 | func(PARAM(0), PARAM(1), PARAM(2)); | ||
| 512 | } | ||
| 513 | |||
| 514 | template<int func(u32, int, u32)> void WrapI_UIU() { | ||
| 515 | int retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||
| 516 | RETURN(retval); | ||
| 517 | } | ||
| 518 | |||
| 519 | template<void func(int, u32, u32, u32, u32)> void WrapV_IUUUU() { | ||
| 520 | func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||
| 521 | } | ||
| 522 | |||
| 523 | template<void func(u32, u32, u32)> void WrapV_UUU() { | ||
| 524 | func(PARAM(0), PARAM(1), PARAM(2)); | ||
| 525 | } | ||
| 526 | |||
| 527 | template<void func(u32, u32, u32, u32)> void WrapV_UUUU() { | ||
| 528 | func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 529 | } | ||
| 530 | |||
| 531 | template<void func(const char *, u32, int, u32)> void WrapV_CUIU() { | ||
| 532 | func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3)); | ||
| 533 | } | ||
| 534 | |||
| 535 | template<int func(const char *, u32, int, u32)> void WrapI_CUIU() { | ||
| 536 | int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3)); | ||
| 537 | RETURN(retval); | ||
| 538 | } | ||
| 539 | |||
| 540 | template<void func(u32, const char *, u32, int, u32)> void WrapV_UCUIU() { | ||
| 541 | func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3), | ||
| 542 | PARAM(4)); | ||
| 543 | } | ||
| 544 | |||
| 545 | template<int func(u32, const char *, u32, int, u32)> void WrapI_UCUIU() { | ||
| 546 | int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), | ||
| 547 | PARAM(3), PARAM(4)); | ||
| 548 | RETURN(retval); | ||
| 549 | } | ||
| 550 | |||
| 551 | template<void func(const char *, u32, int, int, u32)> void WrapV_CUIIU() { | ||
| 552 | func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3), | ||
| 553 | PARAM(4)); | ||
| 554 | } | ||
| 555 | |||
| 556 | template<int func(const char *, u32, int, int, u32)> void WrapI_CUIIU() { | ||
| 557 | int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||
| 558 | PARAM(3), PARAM(4)); | ||
| 559 | RETURN(retval); | ||
| 560 | } | ||
| 561 | |||
| 562 | template<u32 func(u32, u32, u32, u32)> void WrapU_UUUU() { | ||
| 563 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 564 | RETURN(retval); | ||
| 565 | } | ||
| 566 | |||
| 567 | template<u32 func(u32, const char *, u32, u32)> void WrapU_UCUU() { | ||
| 568 | u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3)); | ||
| 569 | RETURN(retval); | ||
| 570 | } | ||
| 571 | |||
| 572 | template<u32 func(u32, u32, u32, int)> void WrapU_UUUI() { | ||
| 573 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 574 | RETURN(retval); | ||
| 575 | } | ||
| 576 | |||
| 577 | template<u32 func(u32, u32, u32, int, u32)> void WrapU_UUUIU() { | ||
| 578 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||
| 579 | RETURN(retval); | ||
| 580 | } | ||
| 581 | |||
| 582 | template<u32 func(u32, u32, u32, int, u32, int)> void WrapU_UUUIUI() { | ||
| 583 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5)); | ||
| 584 | RETURN(retval); | ||
| 585 | } | ||
| 586 | |||
| 587 | template<u32 func(u32, u32, int, u32)> void WrapU_UUIU() { | ||
| 588 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 589 | RETURN(retval); | ||
| 590 | } | ||
| 591 | |||
| 592 | template<u32 func(u32, int, int, int)> void WrapU_UIII() { | ||
| 593 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 594 | RETURN(retval); | ||
| 595 | } | ||
| 596 | |||
| 597 | template<int func(int, u32, u32, u32, u32)> void WrapI_IUUUU() { | ||
| 598 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||
| 599 | RETURN(retval); | ||
| 600 | } | ||
| 601 | |||
| 602 | template<int func(int, u32, u32, u32, u32, u32)> void WrapI_IUUUUU() { | ||
| 603 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5)); | ||
| 604 | RETURN(retval); | ||
| 605 | } | ||
| 606 | |||
| 607 | template<int func(int, u32, int, int)> void WrapI_IUII() { | ||
| 608 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 609 | RETURN(retval); | ||
| 610 | } | ||
| 611 | template<u32 func(u32, u32, u32, u32, u32)> void WrapU_UUUUU() { | ||
| 612 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||
| 613 | RETURN(retval); | ||
| 614 | } | 98 | } |
| 615 | 99 | ||
| 616 | template<void func(u32, u32, u32, u32, u32)> void WrapV_UUUUU() { | 100 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 617 | func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | 101 | /// Function wrappers that return type void |
| 618 | } | ||
| 619 | 102 | ||
| 620 | template<u32 func(const char *, const char *)> void WrapU_CC() { | 103 | template<void func(s64)> void Wrap() { |
| 621 | int retval = func(Memory::GetCharPointer(PARAM(0)), | 104 | func(((s64)PARAM(1) << 32) | PARAM(0)); |
| 622 | Memory::GetCharPointer(PARAM(1))); | ||
| 623 | RETURN(retval); | ||
| 624 | } | 105 | } |
| 625 | 106 | ||
| 626 | template<void func(const char*)> void WrapV_C() { | 107 | template<void func(const char*)> void Wrap() { |
| 627 | func(Memory::GetCharPointer(PARAM(0))); | 108 | func(Memory::GetCharPointer(PARAM(0))); |
| 628 | } | 109 | } |
| 629 | 110 | ||
| 630 | template<void func(const char *, int)> void WrapV_CI() { | 111 | #undef PARAM |
| 631 | func(Memory::GetCharPointer(PARAM(0)), PARAM(1)); | 112 | #undef RETURN |
| 632 | } | ||
| 633 | |||
| 634 | template<u32 func(const char *, int)> void WrapU_CI() { | ||
| 635 | int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1)); | ||
| 636 | RETURN(retval); | ||
| 637 | } | ||
| 638 | |||
| 639 | template<u32 func(const char *, int, int)> void WrapU_CII() { | ||
| 640 | int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2)); | ||
| 641 | RETURN(retval); | ||
| 642 | } | ||
| 643 | 113 | ||
| 644 | template<int func(const char *, int, u32, int, u32)> void WrapU_CIUIU() { | 114 | } // namespace HLE |
| 645 | int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||
| 646 | PARAM(3), PARAM(4)); | ||
| 647 | RETURN(retval); | ||
| 648 | } | ||
| 649 | |||
| 650 | template<u32 func(const char *, int, u32, int, u32, int)> void WrapU_CIUIUI() { | ||
| 651 | u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||
| 652 | PARAM(3), PARAM(4), PARAM(5)); | ||
| 653 | RETURN(retval); | ||
| 654 | } | ||
| 655 | |||
| 656 | template<u32 func(u32, u32, u32, u32, u32, u32)> void WrapU_UUUUUU() { | ||
| 657 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), | ||
| 658 | PARAM(5)); | ||
| 659 | RETURN(retval); | ||
| 660 | } | ||
| 661 | |||
| 662 | template<int func(int, u32, u32, u32)> void WrapI_IUUU() { | ||
| 663 | int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 664 | RETURN(retval); | ||
| 665 | } | ||
| 666 | |||
| 667 | template<int func(int, u32, u32)> void WrapI_IUU() { | ||
| 668 | int retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||
| 669 | RETURN(retval); | ||
| 670 | } | ||
| 671 | |||
| 672 | template<u32 func(u32, u32, u32, u32, u32, u32, u32)> void WrapU_UUUUUUU() { | ||
| 673 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6)); | ||
| 674 | RETURN(retval); | ||
| 675 | } | ||
| 676 | |||
| 677 | template<int func(u32, int, u32, u32)> void WrapI_UIUU() { | ||
| 678 | u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||
| 679 | RETURN(retval); | ||
| 680 | } | ||
| 681 | |||
| 682 | template<int func(int, const char *)> void WrapI_IC() { | ||
| 683 | int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1))); | ||
| 684 | RETURN(retval); | ||
| 685 | } | ||
| 686 | |||
| 687 | template <int func(int, const char *, const char *, u32, int)> void WrapI_ICCUI() { | ||
| 688 | int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), Memory::GetCharPointer(PARAM(2)), PARAM(3), PARAM(4)); | ||
| 689 | RETURN(retval); | ||
| 690 | } | ||
| 691 | |||
| 692 | template <int func(int, const char *, const char *, int)> void WrapI_ICCI() { | ||
| 693 | int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), Memory::GetCharPointer(PARAM(2)), PARAM(3)); | ||
| 694 | RETURN(retval); | ||
| 695 | } | ||
| 696 | |||
| 697 | template <int func(const char *, int, int)> void WrapI_CII() { | ||
| 698 | int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2)); | ||
| 699 | RETURN(retval); | ||
| 700 | } | ||
| 701 | |||
| 702 | template <int func(int, const char *, int)> void WrapI_ICI() { | ||
| 703 | int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2)); | ||
| 704 | RETURN(retval); | ||
| 705 | } | ||
| 706 | |||
| 707 | template<int func(int, void *, void *, void *, void *, u32, int)> void WrapI_IVVVVUI(){ | ||
| 708 | u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)), Memory::GetPointer(PARAM(2)), Memory::GetPointer(PARAM(3)), Memory::GetPointer(PARAM(4)), PARAM(5), PARAM(6) ); | ||
| 709 | RETURN(retval); | ||
| 710 | } | ||
| 711 | |||
| 712 | template<int func(int, const char *, u32, void *, int, int, int)> void WrapI_ICUVIII(){ | ||
| 713 | u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), Memory::GetPointer(PARAM(3)), PARAM(4), PARAM(5), PARAM(6)); | ||
| 714 | RETURN(retval); | ||
| 715 | } | ||
| 716 | |||
| 717 | template<int func(void*, u32)> void WrapI_VU(){ | ||
| 718 | u32 retval = func(Memory::GetPointer(PARAM(0)), PARAM(1)); | ||
| 719 | RETURN(retval); | ||
| 720 | } | ||
| 721 | |||
| 722 | template<int func(void*, void*, u32)> void WrapI_VVU(){ | ||
| 723 | u32 retval = func(Memory::GetPointer(PARAM(0)), Memory::GetPointer(PARAM(1)), PARAM(2)); | ||
| 724 | RETURN(retval); | ||
| 725 | } | ||
| 726 | |||
| 727 | template<int func(void*, u32, void*, int)> void WrapI_VUVI(){ | ||
| 728 | u32 retval = func(Memory::GetPointer(PARAM(0)), PARAM(1), Memory::GetPointer(PARAM(2)), PARAM(3)); | ||
| 729 | RETURN(retval); | ||
| 730 | } | ||
| 731 | |||
| 732 | template<int func(void*, u32, u32, u32, u32, u32)> void WrapI_VUUUUU(){ | ||
| 733 | u32 retval = func(NULL, PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||
| 734 | RETURN(retval); | ||
| 735 | } | ||
| 736 | |||
| 737 | template<int func(u32, s64)> void WrapI_US64() { | ||
| 738 | int retval = func(PARAM(0), PARAM64(1)); | ||
| 739 | RETURN(retval); | ||
| 740 | } | ||
| 741 | |||
| 742 | template<int func(void*, void*, u32, u32, s64)> void WrapI_VVUUS64() { | ||
| 743 | int retval = func(Memory::GetPointer(PARAM(0)), Memory::GetPointer(PARAM(1)), PARAM(2), PARAM(3), PARAM(4)); | ||
| 744 | RETURN(retval); | ||
| 745 | } | ||