mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-22 12:35:21 +00:00
Partial fix
This commit is contained in:
parent
e6b2be2bc9
commit
18954ee5b8
2 changed files with 17 additions and 44 deletions
|
@ -994,7 +994,7 @@ s32 sceIoGetstat(vm::psv::ptr<const char> name, vm::psv::ptr<SceIoStat> 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", []()
|
||||
{
|
||||
|
|
|
@ -33,11 +33,7 @@ public:
|
|||
|
||||
};
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
typedef void(*psv_func_caller)(ARMv7Context&);
|
||||
#else
|
||||
typedef std::function<void(ARMv7Context&)> 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<g1, f, v>(context, args...) || (t == ARG_STACK);
|
||||
}
|
||||
|
||||
template<void* func, typename RT, typename... T>
|
||||
template<typename RT, typename... T>
|
||||
struct func_binder;
|
||||
|
||||
template<void* func, typename... T>
|
||||
struct func_binder<func, void, T...>
|
||||
template<typename... T>
|
||||
struct func_binder<void, T...>
|
||||
{
|
||||
typedef void(*func_t)(T...);
|
||||
|
||||
|
@ -370,15 +366,10 @@ namespace psv_func_detail
|
|||
{
|
||||
call<void>(_func, get_func_args<0, 0, 0, T...>(context));
|
||||
}
|
||||
|
||||
static void do_call(ARMv7Context& context)
|
||||
{
|
||||
do_call(context, (func_t)func);
|
||||
}
|
||||
};
|
||||
|
||||
template<void* func, typename... T>
|
||||
struct func_binder<func, void, ARMv7Context&, T...>
|
||||
template<typename... T>
|
||||
struct func_binder<void, ARMv7Context&, T...>
|
||||
{
|
||||
typedef void(*func_t)(ARMv7Context&, T...);
|
||||
|
||||
|
@ -386,14 +377,9 @@ namespace psv_func_detail
|
|||
{
|
||||
call<void>(_func, std::tuple_cat(std::tuple<ARMv7Context&>(context), get_func_args<0, 0, 0, T...>(context)));
|
||||
}
|
||||
|
||||
static void do_call(ARMv7Context& context)
|
||||
{
|
||||
do_call(context, (func_t)func);
|
||||
}
|
||||
};
|
||||
|
||||
template<void* func, typename RT, typename... T>
|
||||
template<typename RT, typename... T>
|
||||
struct func_binder
|
||||
{
|
||||
typedef RT(*func_t)(T...);
|
||||
|
@ -402,15 +388,10 @@ namespace psv_func_detail
|
|||
{
|
||||
bind_result<RT, result_type<RT>::value>::put_result(context, call<RT>(_func, get_func_args<0, 0, 0, T...>(context)));
|
||||
}
|
||||
|
||||
static void do_call(ARMv7Context& context)
|
||||
{
|
||||
do_call(context, (func_t)func);
|
||||
}
|
||||
};
|
||||
|
||||
template<void* func, typename RT, typename... T>
|
||||
struct func_binder<func, RT, ARMv7Context&, T...>
|
||||
template<typename RT, typename... T>
|
||||
struct func_binder<RT, ARMv7Context&, T...>
|
||||
{
|
||||
typedef RT(*func_t)(ARMv7Context&, T...);
|
||||
|
||||
|
@ -418,11 +399,6 @@ namespace psv_func_detail
|
|||
{
|
||||
bind_result<RT, result_type<RT>::value>::put_result(context, call<RT>(_func, std::tuple_cat(std::tuple<ARMv7Context&>(context), get_func_args<0, 0, 0, T...>(context))));
|
||||
}
|
||||
|
||||
static void do_call(ARMv7Context& context)
|
||||
{
|
||||
do_call(context, (func_t)func);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename RT, typename... T>
|
||||
|
@ -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<void* func, typename RT, typename... T> 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<func, RT, T...>::do_call;
|
||||
#else
|
||||
f.func = [_func](ARMv7Context& context){ psv_func_detail::func_binder<func, RT, T...>::do_call(context, _func); };
|
||||
#endif
|
||||
f.func = func;
|
||||
f.module = module;
|
||||
|
||||
return add_psv_func(f);
|
||||
}
|
||||
// Do not call directly
|
||||
template<typename RT, typename... T> __forceinline void call_psv_func(ARMv7Context& context, RT(*func)(T...))
|
||||
{
|
||||
psv_func_detail::func_binder<RT, T...>::do_call(context, func);
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define reg_psv_func(nid, module, name, func) add_psv_func<func>(nid, module, name, func)
|
||||
#else
|
||||
#define reg_psv_func(nid, module, name, func) add_psv_func<nullptr>(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);
|
||||
|
|
Loading…
Add table
Reference in a new issue