From ce735357d61dcd446b7d219c56d365e3a35edeaf Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 10 Oct 2024 14:57:26 +0200 Subject: [BOX32] More 32bits wrapped functions --- src/wrapped32/generated/functions_list.txt | 6 +++ src/wrapped32/generated/wrappedlibgltypes32.h | 3 ++ src/wrapped32/generated/wrapper32.c | 6 +++ src/wrapped32/generated/wrapper32.h | 3 ++ src/wrapped32/wrappedlibgl.c | 54 ++++++++++++++++++++++++++- src/wrapped32/wrappedlibgl_private.h | 11 +++++- src/wrapped32/wrappedsdl2_private.h | 12 +++--- 7 files changed, 86 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index 4722335f..a7d10174 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -450,6 +450,7 @@ #() iFXup -> iFXup #() iFXLi -> iFXLi #() iFXLu -> iFXLu +#() iFXLf -> iFXLf #() iFXLl -> iFXLl #() iFXLL -> iFXLL #() iFXLp -> iFXLp @@ -825,6 +826,7 @@ #() pFpupp -> pFpupp #() pFpLiS -> pFpLiS #() pFppLL -> pFppLL +#() pFpppL -> pFpppL #() pFpppp -> pFpppp #() pFXiii -> pFXiii #() pFXiip -> pFXiip @@ -1324,6 +1326,7 @@ #() vFXLiiiLii -> vFXLiiiLii #() vFXLLLiipi -> vFXLLLiipi #() vFXLppiipi -> vFXLppiipi +#() vFXppuulll -> vFXppuulll #() iFEpippppp -> iFEpippppp #() iFEpLiLppp -> iFEpLiLppp #() iFuiiiiuup -> iFuiiiiuup @@ -1761,6 +1764,9 @@ wrappedlibgl: - glGetVkProcAddrNV - glXGetProcAddress - glXGetProcAddressARB +- vFip: + - glVDPAUMapSurfacesNV + - glVDPAUUnmapSurfacesNV - vFpp: - glDebugMessageCallback - glDebugMessageCallbackAMD diff --git a/src/wrapped32/generated/wrappedlibgltypes32.h b/src/wrapped32/generated/wrappedlibgltypes32.h index d4918664..14b082ee 100644 --- a/src/wrapped32/generated/wrappedlibgltypes32.h +++ b/src/wrapped32/generated/wrappedlibgltypes32.h @@ -13,6 +13,7 @@ typedef int32_t (*iFi_t)(int32_t); typedef void* (*pFp_t)(void*); +typedef void (*vFip_t)(int32_t, void*); typedef void (*vFpp_t)(void*, void*); typedef int32_t (*iFpp_t)(void*, void*); typedef void* (*pFXp_t)(void*, void*); @@ -35,6 +36,8 @@ typedef void (*vFupupip_t)(uint32_t, void*, uint32_t, void*, int32_t, void*); GO(glGetVkProcAddrNV, pFp_t) \ GO(glXGetProcAddress, pFp_t) \ GO(glXGetProcAddressARB, pFp_t) \ + GO(glVDPAUMapSurfacesNV, vFip_t) \ + GO(glVDPAUUnmapSurfacesNV, vFip_t) \ GO(glDebugMessageCallback, vFpp_t) \ GO(glDebugMessageCallbackAMD, vFpp_t) \ GO(glDebugMessageCallbackARB, vFpp_t) \ diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index 1be6a3bc..8b252ced 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -540,6 +540,7 @@ typedef int32_t (*iFXuu_t)(void*, uint32_t, uint32_t); typedef int32_t (*iFXup_t)(void*, uint32_t, void*); typedef int32_t (*iFXLi_t)(void*, uintptr_t, int32_t); typedef int32_t (*iFXLu_t)(void*, uintptr_t, uint32_t); +typedef int32_t (*iFXLf_t)(void*, uintptr_t, float); typedef int32_t (*iFXLl_t)(void*, uintptr_t, intptr_t); typedef int32_t (*iFXLL_t)(void*, uintptr_t, uintptr_t); typedef int32_t (*iFXLp_t)(void*, uintptr_t, void*); @@ -915,6 +916,7 @@ typedef void* (*pFpuii_t)(void*, uint32_t, int32_t, int32_t); typedef void* (*pFpupp_t)(void*, uint32_t, void*, void*); typedef void* (*pFpLiS_t)(void*, uintptr_t, int32_t, void*); typedef void* (*pFppLL_t)(void*, void*, uintptr_t, uintptr_t); +typedef void* (*pFpppL_t)(void*, void*, void*, uintptr_t); typedef void* (*pFpppp_t)(void*, void*, void*, void*); typedef void* (*pFXiii_t)(void*, int32_t, int32_t, int32_t); typedef void* (*pFXiip_t)(void*, int32_t, int32_t, void*); @@ -1414,6 +1416,7 @@ typedef void (*vFXiLpiiuu_t)(void*, int32_t, uintptr_t, void*, int32_t, int32_t, typedef void (*vFXLiiiLii_t)(void*, uintptr_t, int32_t, int32_t, int32_t, uintptr_t, int32_t, int32_t); typedef void (*vFXLLLiipi_t)(void*, uintptr_t, uintptr_t, uintptr_t, int32_t, int32_t, void*, int32_t); typedef void (*vFXLppiipi_t)(void*, uintptr_t, void*, void*, int32_t, int32_t, void*, int32_t); +typedef void (*vFXppuulll_t)(void*, void*, void*, uint32_t, uint32_t, intptr_t, intptr_t, intptr_t); typedef int32_t (*iFEpippppp_t)(x64emu_t*, void*, int32_t, void*, void*, void*, void*, void*); typedef int32_t (*iFEpLiLppp_t)(x64emu_t*, void*, uintptr_t, int32_t, uintptr_t, void*, void*, void*); typedef int32_t (*iFuiiiiuup_t)(uint32_t, int32_t, int32_t, int32_t, int32_t, uint32_t, uint32_t, void*); @@ -2028,6 +2031,7 @@ void iFXuu_32(x64emu_t *emu, uintptr_t fcn) { iFXuu_t fn = (iFXuu_t)fcn; R_EAX = void iFXup_32(x64emu_t *emu, uintptr_t fcn) { iFXup_t fn = (iFXup_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptri(uint32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); } void iFXLi_32(x64emu_t *emu, uintptr_t fcn) { iFXLi_t fn = (iFXLi_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12)); } void iFXLu_32(x64emu_t *emu, uintptr_t fcn) { iFXLu_t fn = (iFXLu_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(uint32_t, R_ESP + 12)); } +void iFXLf_32(x64emu_t *emu, uintptr_t fcn) { iFXLf_t fn = (iFXLf_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(float, R_ESP + 12)); } void iFXLl_32(x64emu_t *emu, uintptr_t fcn) { iFXLl_t fn = (iFXLl_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_long(from_ptri(long_t, R_ESP + 12))); } void iFXLL_32(x64emu_t *emu, uintptr_t fcn) { iFXLL_t fn = (iFXLL_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ulong(from_ptri(ulong_t, R_ESP + 12))); } void iFXLp_32(x64emu_t *emu, uintptr_t fcn) { iFXLp_t fn = (iFXLp_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12)); } @@ -2403,6 +2407,7 @@ void pFpuii_32(x64emu_t *emu, uintptr_t fcn) { pFpuii_t fn = (pFpuii_t)fcn; R_EA void pFpupp_32(x64emu_t *emu, uintptr_t fcn) { pFpupp_t fn = (pFpupp_t)fcn; R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16))); } void pFpLiS_32(x64emu_t *emu, uintptr_t fcn) { pFpLiS_t fn = (pFpLiS_t)fcn; R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), io_convert32(from_ptriv(R_ESP + 16)))); } void pFppLL_32(x64emu_t *emu, uintptr_t fcn) { pFppLL_t fn = (pFppLL_t)fcn; R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ulong(from_ptri(ulong_t, R_ESP + 16)))); } +void pFpppL_32(x64emu_t *emu, uintptr_t fcn) { pFpppL_t fn = (pFpppL_t)fcn; R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ulong(from_ptri(ulong_t, R_ESP + 16)))); } void pFpppp_32(x64emu_t *emu, uintptr_t fcn) { pFpppp_t fn = (pFpppp_t)fcn; R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16))); } void pFXiii_32(x64emu_t *emu, uintptr_t fcn) { pFXiii_t fn = (pFXiii_t)fcn; R_EAX = to_ptrv(fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16))); } void pFXiip_32(x64emu_t *emu, uintptr_t fcn) { pFXiip_t fn = (pFXiip_t)fcn; R_EAX = to_ptrv(fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16))); } @@ -2902,6 +2907,7 @@ void vFXiLpiiuu_32(x64emu_t *emu, uintptr_t fcn) { vFXiLpiiuu_t fn = (vFXiLpiiuu void vFXLiiiLii_32(x64emu_t *emu, uintptr_t fcn) { vFXLiiiLii_t fn = (vFXLiiiLii_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptri(int32_t, R_ESP + 20), from_ulong(from_ptri(ulong_t, R_ESP + 24)), from_ptri(int32_t, R_ESP + 28), from_ptri(int32_t, R_ESP + 32)); } void vFXLLLiipi_32(x64emu_t *emu, uintptr_t fcn) { vFXLLLiipi_t fn = (vFXLLLiipi_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ptri(int32_t, R_ESP + 20), from_ptri(int32_t, R_ESP + 24), from_ptriv(R_ESP + 28), from_ptri(int32_t, R_ESP + 32)); } void vFXLppiipi_32(x64emu_t *emu, uintptr_t fcn) { vFXLppiipi_t fn = (vFXLppiipi_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_ptri(int32_t, R_ESP + 20), from_ptri(int32_t, R_ESP + 24), from_ptriv(R_ESP + 28), from_ptri(int32_t, R_ESP + 32)); } +void vFXppuulll_32(x64emu_t *emu, uintptr_t fcn) { vFXppuulll_t fn = (vFXppuulll_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20), from_long(from_ptri(long_t, R_ESP + 24)), from_long(from_ptri(long_t, R_ESP + 28)), from_long(from_ptri(long_t, R_ESP + 32))); } void iFEpippppp_32(x64emu_t *emu, uintptr_t fcn) { iFEpippppp_t fn = (iFEpippppp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20), from_ptriv(R_ESP + 24), from_ptriv(R_ESP + 28)); } void iFEpLiLppp_32(x64emu_t *emu, uintptr_t fcn) { iFEpLiLppp_t fn = (iFEpLiLppp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), from_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ptriv(R_ESP + 20), from_ptriv(R_ESP + 24), from_ptriv(R_ESP + 28)); } void iFuiiiiuup_32(x64emu_t *emu, uintptr_t fcn) { iFuiiiiuup_t fn = (iFuiiiiuup_t)fcn; R_EAX = fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptri(int32_t, R_ESP + 20), from_ptri(uint32_t, R_ESP + 24), from_ptri(uint32_t, R_ESP + 28), from_ptriv(R_ESP + 32)); } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index f76816c0..63d94afa 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -491,6 +491,7 @@ void iFXuu_32(x64emu_t *emu, uintptr_t fnc); void iFXup_32(x64emu_t *emu, uintptr_t fnc); void iFXLi_32(x64emu_t *emu, uintptr_t fnc); void iFXLu_32(x64emu_t *emu, uintptr_t fnc); +void iFXLf_32(x64emu_t *emu, uintptr_t fnc); void iFXLl_32(x64emu_t *emu, uintptr_t fnc); void iFXLL_32(x64emu_t *emu, uintptr_t fnc); void iFXLp_32(x64emu_t *emu, uintptr_t fnc); @@ -866,6 +867,7 @@ void pFpuii_32(x64emu_t *emu, uintptr_t fnc); void pFpupp_32(x64emu_t *emu, uintptr_t fnc); void pFpLiS_32(x64emu_t *emu, uintptr_t fnc); void pFppLL_32(x64emu_t *emu, uintptr_t fnc); +void pFpppL_32(x64emu_t *emu, uintptr_t fnc); void pFpppp_32(x64emu_t *emu, uintptr_t fnc); void pFXiii_32(x64emu_t *emu, uintptr_t fnc); void pFXiip_32(x64emu_t *emu, uintptr_t fnc); @@ -1365,6 +1367,7 @@ void vFXiLpiiuu_32(x64emu_t *emu, uintptr_t fnc); void vFXLiiiLii_32(x64emu_t *emu, uintptr_t fnc); void vFXLLLiipi_32(x64emu_t *emu, uintptr_t fnc); void vFXLppiipi_32(x64emu_t *emu, uintptr_t fnc); +void vFXppuulll_32(x64emu_t *emu, uintptr_t fnc); void iFEpippppp_32(x64emu_t *emu, uintptr_t fnc); void iFEpLiLppp_32(x64emu_t *emu, uintptr_t fnc); void iFuiiiiuup_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedlibgl.c b/src/wrapped32/wrappedlibgl.c index e23f1d36..8a45afe2 100644 --- a/src/wrapped32/wrappedlibgl.c +++ b/src/wrapped32/wrappedlibgl.c @@ -43,6 +43,7 @@ EXPORT void* my32_glXGetProcAddressARB(x64emu_t* emu, void* name) __attribute__( typedef int (*iFi_t)(int); typedef void (*vFpp_t)(void*, void*); typedef void*(*pFpp_t)(void*, void*); +typedef void (*vFip_t)(int, void*); typedef void (*vFppp_t)(void*, void*, void*); typedef void (*vFppi_t)(void*, void*, int); typedef void*(*pFpip_t)(void*, int, void*); @@ -838,6 +839,56 @@ static void* find_glGetUniformIndices_Fct(void* fct) printf_log(LOG_NONE, "Warning, no more slot for libGL glGetUniformIndices callback\n"); return NULL; } +// glVDPAUMapSurfacesNV ... +#define GO(A) \ +static vFip_t my32_glVDPAUMapSurfacesNV_fct_##A = NULL; \ +static void my32_glVDPAUMapSurfacesNV_##A(x64emu_t* emu, int count, long_t* surfaces) \ +{ \ + if(!my32_glVDPAUMapSurfacesNV_fct_##A) \ + return; \ + long surfaces_l[count]; \ + if(surfaces) for(int i=0; i