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