mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-06-02 21:05:13 -06:00
core: simplify sysv_abi wrappers for MinGW-w64 GCC (#4402)
Use template <auto f> for HostCallWrapperImpl and OrbisWrapperImpl instead of passing the function type and value separately. This keeps the wrapper behavior the same while matching the form MinGW-w64 GCC accepts.
This commit is contained in:
parent
622cfffaf2
commit
9559468c2e
@ -21,11 +21,11 @@ const char* PS4_SYSV_ABI sceKernelGetFsSandboxRandomWord();
|
||||
|
||||
extern Core::EntryParams entry_params;
|
||||
|
||||
template <class F, F f>
|
||||
template <auto f>
|
||||
struct OrbisWrapperImpl;
|
||||
|
||||
template <class R, class... Args, PS4_SYSV_ABI R (*f)(Args...)>
|
||||
struct OrbisWrapperImpl<PS4_SYSV_ABI R (*)(Args...), f> {
|
||||
struct OrbisWrapperImpl<f> {
|
||||
static R PS4_SYSV_ABI wrap(Args... args) {
|
||||
u32 ret = f(args...);
|
||||
if (ret != 0) {
|
||||
@ -35,7 +35,7 @@ struct OrbisWrapperImpl<PS4_SYSV_ABI R (*)(Args...), f> {
|
||||
}
|
||||
};
|
||||
|
||||
#define ORBIS(func) (Libraries::Kernel::OrbisWrapperImpl<decltype(&(func)), func>::wrap)
|
||||
#define ORBIS(func) (Libraries::Kernel::OrbisWrapperImpl<func>::wrap)
|
||||
|
||||
#define CURRENT_FIRMWARE_VERSION 0x13500011
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
#include <functional>
|
||||
#include "common/polyfill_thread.h"
|
||||
#include "core/libraries/kernel/threads/pthread.h"
|
||||
#include "core/tls.h"
|
||||
|
||||
namespace Core::Loader {
|
||||
class SymbolsResolver;
|
||||
|
||||
@ -45,16 +45,16 @@ Tcb* GetTcbBase();
|
||||
/// Makes sure TLS is initialized for the thread before entering guest.
|
||||
void InitializeTLS();
|
||||
|
||||
template <class F, F f>
|
||||
template <auto f>
|
||||
struct HostCallWrapperImpl;
|
||||
|
||||
template <class ReturnType, class... Args, PS4_SYSV_ABI ReturnType (*func)(Args...)>
|
||||
struct HostCallWrapperImpl<PS4_SYSV_ABI ReturnType (*)(Args...), func> {
|
||||
struct HostCallWrapperImpl<func> {
|
||||
static ReturnType PS4_SYSV_ABI wrap(Args... args) {
|
||||
return func(args...);
|
||||
}
|
||||
};
|
||||
|
||||
#define HOST_CALL(func) (Core::HostCallWrapperImpl<decltype(&(func)), func>::wrap)
|
||||
#define HOST_CALL(func) (Core::HostCallWrapperImpl<func>::wrap)
|
||||
|
||||
} // namespace Core
|
||||
|
||||
Loading…
Reference in New Issue
Block a user