From f24531b1a279e48cb119353132cee6642cb76fb4 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 31 Dec 2017 15:46:30 -0500 Subject: function_wrappers: Cleanup, fix warnings, remove unused code. --- src/core/hle/function_wrappers.h | 222 ++++++--------------------------------- 1 file changed, 35 insertions(+), 187 deletions(-) diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h index 5d6d0eb56..df2c3e843 100644 --- a/src/core/hle/function_wrappers.h +++ b/src/core/hle/function_wrappers.h @@ -1,4 +1,4 @@ -// Copyright 2014 Citra Emulator Project +// Copyright 2017 Citra Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. @@ -7,7 +7,6 @@ #include "common/common_types.h" #include "core/arm/arm_interface.h" #include "core/core.h" -#include "core/hle/kernel/kernel.h" #include "core/hle/result.h" #include "core/hle/svc.h" #include "core/memory.h" @@ -17,7 +16,7 @@ namespace HLE { #define PARAM(n) Core::CPU().GetReg(n) /** - * HLE a function return from the current ARM11 userland process + * HLE a function return from the current ARM userland process * @param res Result to return */ static inline void FuncReturn(u64 res) { @@ -32,112 +31,78 @@ void Wrap() { FuncReturn(func(PARAM(0)).raw); } -template -void Wrap() { - FuncReturn(func(PARAM(0), PARAM(1), PARAM(2)).raw); -} - -template -void Wrap() { - FuncReturn(func(PARAM(0), PARAM(1)).raw); -} - -template +template void Wrap() { - FuncReturn(func(PARAM(0), PARAM(1), PARAM(2)).raw); + FuncReturn(func((u32)PARAM(0)).raw); } -template +template void Wrap() { - FuncReturn(func(PARAM(1), PARAM(2), (s64)PARAM(3)).raw); + FuncReturn(func((u32)PARAM(0), (u32)PARAM(1)).raw); } -template +template void Wrap() { - u64 param_1 = 0; - u32 retval = func(¶m_1, PARAM(1)).raw; + u32 param_1 = 0; + u32 retval = func(¶m_1, (u32)PARAM(1)).raw; Core::CPU().SetReg(1, param_1); FuncReturn(retval); } -template +template void Wrap() { - u64 param_1 = 0; - u32 retval = func(¶m_1, PARAM(1), PARAM(2), PARAM(3)).raw; + u32 param_1 = 0; + u32 retval = func(¶m_1, PARAM(1)).raw; Core::CPU().SetReg(1, param_1); FuncReturn(retval); } -template -void Wrap() { - FuncReturn(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)).raw); -} - -template +template void Wrap() { - u32 param_1 = 0; - u32 retval = func(¶m_1, PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)).raw; - Core::CPU().SetReg(1, param_1); - FuncReturn(retval); + FuncReturn(func(PARAM(0), (u32)PARAM(1)).raw); } -template +template void Wrap() { - u32 param_1 = 0; - u32 retval = func(¶m_1, PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)).raw; + u64 param_1 = 0; + u32 retval = func(¶m_1, PARAM(1)).raw; Core::CPU().SetReg(1, param_1); FuncReturn(retval); } -template +template void Wrap() { - s32 param_1 = 0; - s32 retval = - func(¶m_1, PARAM(1), (s32)PARAM(2), (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0))) - .raw; - - Core::CPU().SetReg(1, (u32)param_1); - FuncReturn(retval); + FuncReturn(func((u32)PARAM(0), PARAM(1), (u32)PARAM(2)).raw); } -template +template void Wrap() { - s32 param_1 = 0; - u32 retval = func(¶m_1, PARAM(1), (s32)PARAM(2), PARAM(3)).raw; - - Core::CPU().SetReg(1, (u32)param_1); - FuncReturn(retval); + FuncReturn(func(PARAM(0), PARAM(1), PARAM(2)).raw); } -template +template void Wrap() { - FuncReturn( - func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), (((s64)PARAM(5) << 32) | PARAM(4))).raw); + FuncReturn(func(PARAM(1), PARAM(2), (s64)PARAM(3)).raw); } -template +template void Wrap() { u64 param_1 = 0; - u32 retval = func(PARAM(0), ¶m_1).raw; + u32 retval = func(¶m_1, PARAM(1), PARAM(2), PARAM(3)).raw; Core::CPU().SetReg(1, param_1); FuncReturn(retval); } -template +template void Wrap() { u32 param_1 = 0; - u32 retval = func(¶m_1).raw; + u32 retval = + func(¶m_1, PARAM(1), PARAM(2), PARAM(3), (u32)PARAM(4), (s32)(PARAM(5) & 0xFFFFFFFF)) + .raw; Core::CPU().SetReg(1, param_1); FuncReturn(retval); } -template -void Wrap() { - s32 retval = func(PARAM(0), (((s64)PARAM(3) << 32) | PARAM(2))).raw; - - FuncReturn(retval); -} - template void Wrap() { MemoryInfo memory_info = {}; @@ -153,120 +118,6 @@ void Wrap() { FuncReturn(retval); } -template -void Wrap() { - s32 param_1 = 0; - u32 retval = func(¶m_1, PARAM(1)).raw; - Core::CPU().SetReg(1, param_1); - FuncReturn(retval); -} - -template -void Wrap() { - FuncReturn(func(PARAM(0), (s32)PARAM(1)).raw); -} - -template -void Wrap() { - u32 param_1 = 0; - u32 retval = func(¶m_1, PARAM(1)).raw; - Core::CPU().SetReg(1, param_1); - FuncReturn(retval); -} - -template -void Wrap() { - u32 param_1 = 0; - u32 retval = func(¶m_1, PARAM(1)).raw; - Core::CPU().SetReg(1, param_1); - FuncReturn(retval); -} - -template -void Wrap() { - FuncReturn(func(PARAM(0)).raw); -} - -template -void Wrap() { - u32 param_1 = 0; - u32 retval = func(¶m_1, PARAM(1), PARAM(2)).raw; - Core::CPU().SetReg(1, param_1); - FuncReturn(retval); -} - -template -void Wrap() { - s32 param_1 = 0; - u32 retval = func(¶m_1, PARAM(1), PARAM(2)).raw; - Core::CPU().SetReg(1, param_1); - FuncReturn(retval); -} - -template -void Wrap() { - s64 param_1 = 0; - u32 retval = func(¶m_1, PARAM(1), PARAM(2)).raw; - Core::CPU().SetReg(1, (u32)param_1); - Core::CPU().SetReg(2, (u32)(param_1 >> 32)); - FuncReturn(retval); -} - -template -void Wrap() { - u32 param_1 = 0; - // The last parameter is passed in R0 instead of R4 - u32 retval = func(¶m_1, PARAM(1), PARAM(2), PARAM(3), PARAM(0)).raw; - Core::CPU().SetReg(1, param_1); - FuncReturn(retval); -} - -template -void Wrap() { - s64 param1 = ((u64)PARAM(3) << 32) | PARAM(2); - s64 param2 = ((u64)PARAM(4) << 32) | PARAM(1); - FuncReturn(func(PARAM(0), param1, param2).raw); -} - -template -void Wrap() { - s64 param_1 = 0; - u32 retval = func(¶m_1, PARAM(1), PARAM(2)).raw; - Core::CPU().SetReg(1, (u32)param_1); - Core::CPU().SetReg(2, (u32)(param_1 >> 32)); - FuncReturn(retval); -} - -template -void Wrap() { - FuncReturn(func(PARAM(0), PARAM(1)).raw); -} - -template -void Wrap() { - Kernel::Handle param_1 = 0; - Kernel::Handle param_2 = 0; - u32 retval = func(¶m_1, ¶m_2, PARAM(2), PARAM(3)).raw; - Core::CPU().SetReg(1, param_1); - Core::CPU().SetReg(2, param_2); - FuncReturn(retval); -} - -template -void Wrap() { - Kernel::Handle param_1 = 0; - Kernel::Handle param_2 = 0; - u32 retval = func(¶m_1, ¶m_2).raw; - Core::CPU().SetReg(1, param_1); - Core::CPU().SetReg(2, param_2); - FuncReturn(retval); -} - -template -void Wrap() { - FuncReturn(func(PARAM(0), PARAM(1), PARAM(2)).raw); -} - //////////////////////////////////////////////////////////////////////////////////////////////////// // Function wrappers that return type u32 @@ -276,24 +127,21 @@ void Wrap() { } //////////////////////////////////////////////////////////////////////////////////////////////////// -// Function wrappers that return type s64 +/// Function wrappers that return type void -template +template void Wrap() { - FuncReturn64(func()); + func(); } -//////////////////////////////////////////////////////////////////////////////////////////////////// -/// Function wrappers that return type void - template void Wrap() { - func(((s64)PARAM(1) << 32) | PARAM(0)); + func((s64)PARAM(0)); } -template +template void Wrap() { - func(PARAM(0), PARAM(1)); + func(PARAM(0), (s32)(PARAM(1) & 0xFFFFFFFF)); } template -- cgit v1.2.3