diff --git a/rpcs3/Emu/ARMv7/Modules/sceLibKernel.cpp b/rpcs3/Emu/ARMv7/Modules/sceLibKernel.cpp index 016917d6de..cd17ee6894 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceLibKernel.cpp +++ b/rpcs3/Emu/ARMv7/Modules/sceLibKernel.cpp @@ -994,7 +994,7 @@ s32 sceIoGetstat(vm::psv::ptr name, vm::psv::ptr buf) } -#define REG_FUNC(nid, name) reg_psv_func(nid, &sceLibKernel, #name, &name) +#define REG_FUNC(nid, name) reg_psv_func(nid, &sceLibKernel, #name, name) psv_log_base sceLibKernel("sceLibKernel", []() { diff --git a/rpcs3/Emu/ARMv7/PSVFuncList.h b/rpcs3/Emu/ARMv7/PSVFuncList.h index af64ae5c83..2780e33a7b 100644 --- a/rpcs3/Emu/ARMv7/PSVFuncList.h +++ b/rpcs3/Emu/ARMv7/PSVFuncList.h @@ -33,11 +33,7 @@ public: }; -#if defined(_MSC_VER) typedef void(*psv_func_caller)(ARMv7Context&); -#else -typedef std::function psv_func_caller; -#endif // Utilities for binding ARMv7Context to C++ function arguments received by HLE functions or sent to callbacks namespace psv_func_detail @@ -358,11 +354,11 @@ namespace psv_func_detail return put_func_args(context, args...) || (t == ARG_STACK); } - template + template struct func_binder; - template - struct func_binder + template + struct func_binder { typedef void(*func_t)(T...); @@ -370,15 +366,10 @@ namespace psv_func_detail { call(_func, get_func_args<0, 0, 0, T...>(context)); } - - static void do_call(ARMv7Context& context) - { - do_call(context, (func_t)func); - } }; - template - struct func_binder + template + struct func_binder { typedef void(*func_t)(ARMv7Context&, T...); @@ -386,14 +377,9 @@ namespace psv_func_detail { call(_func, std::tuple_cat(std::tuple(context), get_func_args<0, 0, 0, T...>(context))); } - - static void do_call(ARMv7Context& context) - { - do_call(context, (func_t)func); - } }; - template + template struct func_binder { typedef RT(*func_t)(T...); @@ -402,15 +388,10 @@ namespace psv_func_detail { bind_result::value>::put_result(context, call(_func, get_func_args<0, 0, 0, T...>(context))); } - - static void do_call(ARMv7Context& context) - { - do_call(context, (func_t)func); - } }; - template - struct func_binder + template + struct func_binder { typedef RT(*func_t)(ARMv7Context&, T...); @@ -418,11 +399,6 @@ namespace psv_func_detail { bind_result::value>::put_result(context, call(_func, std::tuple_cat(std::tuple(context), get_func_args<0, 0, 0, T...>(context)))); } - - static void do_call(ARMv7Context& context) - { - do_call(context, (func_t)func); - } }; template @@ -474,26 +450,23 @@ enum psv_special_function_index : u16 // Do not call directly u32 add_psv_func(psv_func data); // Do not call directly -template u32 add_psv_func(u32 nid, psv_log_base* module, const char* name, RT(*_func)(T...)) +__forceinline static u32 add_psv_func(u32 nid, psv_log_base* module, const char* name, psv_func_caller func) { psv_func f; f.nid = nid; f.name = name; -#if defined(_MSC_VER) - f.func = psv_func_detail::func_binder::do_call; -#else - f.func = [_func](ARMv7Context& context){ psv_func_detail::func_binder::do_call(context, _func); }; -#endif + f.func = func; f.module = module; return add_psv_func(f); } +// Do not call directly +template __forceinline void call_psv_func(ARMv7Context& context, RT(*func)(T...)) +{ + psv_func_detail::func_binder::do_call(context, func); +} -#if defined(_MSC_VER) -#define reg_psv_func(nid, module, name, func) add_psv_func(nid, module, name, func) -#else -#define reg_psv_func(nid, module, name, func) add_psv_func(nid, module, name, func) -#endif +#define reg_psv_func(nid, module, name, func) add_psv_func(nid, module, name, [](ARMv7Context& context){ call_psv_func(context, func); }) // Find registered HLE function by NID psv_func* get_psv_func_by_nid(u32 nid, u32* out_index = nullptr);