diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2023-06-24 17:34:57 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2023-06-24 17:34:57 +0200 |
| commit | 8aa98d3f53600ce978a2a4a41d51f394ef312fd8 (patch) | |
| tree | baf8fa384c3afd39504242575c3915bcad6cf589 /src | |
| parent | 4219af78f45fd1a2ba54e0ea2019a70de2b73684 (diff) | |
| download | box64-8aa98d3f53600ce978a2a4a41d51f394ef312fd8.tar.gz box64-8aa98d3f53600ce978a2a4a41d51f394ef312fd8.zip | |
Faked libvdpau and added 2 wrapped symbols to libva and steam can stream games again
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 5 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedlibvatypes.h | 5 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedlibvdpautypes.h | 4 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibva.c | 69 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibva_private.h | 4 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibvdpau.c | 24 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibvdpau_private.h | 2 |
7 files changed, 108 insertions, 5 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index 0218874d..f7097031 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -4291,10 +4291,15 @@ wrappedlibusb1: - libusb_hotplug_register_callback wrappedlibuuid: wrappedlibva: +- pFppp: + - vaSetErrorCallback + - vaSetInfoCallback wrappedlibvadrm: wrappedlibvawayland: wrappedlibvax11: wrappedlibvdpau: +- iFpipp: + - vdp_device_create_x11 wrappedlibvorbis: wrappedlibx11: - iFp: diff --git a/src/wrapped/generated/wrappedlibvatypes.h b/src/wrapped/generated/wrappedlibvatypes.h index ac5d152b..5fc6424d 100644 --- a/src/wrapped/generated/wrappedlibvatypes.h +++ b/src/wrapped/generated/wrappedlibvatypes.h @@ -11,7 +11,10 @@ #define ADDED_FUNCTIONS() #endif +typedef void* (*pFppp_t)(void*, void*, void*); -#define SUPER() ADDED_FUNCTIONS() +#define SUPER() ADDED_FUNCTIONS() \ + GO(vaSetErrorCallback, pFppp_t) \ + GO(vaSetInfoCallback, pFppp_t) #endif // __wrappedlibvaTYPES_H_ diff --git a/src/wrapped/generated/wrappedlibvdpautypes.h b/src/wrapped/generated/wrappedlibvdpautypes.h index c2569c3f..f6fe3146 100644 --- a/src/wrapped/generated/wrappedlibvdpautypes.h +++ b/src/wrapped/generated/wrappedlibvdpautypes.h @@ -11,7 +11,9 @@ #define ADDED_FUNCTIONS() #endif +typedef int32_t (*iFpipp_t)(void*, int32_t, void*, void*); -#define SUPER() ADDED_FUNCTIONS() +#define SUPER() ADDED_FUNCTIONS() \ + GO(vdp_device_create_x11, iFpipp_t) #endif // __wrappedlibvdpauTYPES_H_ diff --git a/src/wrapped/wrappedlibva.c b/src/wrapped/wrappedlibva.c index 2900057b..ecfa33ca 100644 --- a/src/wrapped/wrappedlibva.c +++ b/src/wrapped/wrappedlibva.c @@ -6,13 +6,82 @@ #include "wrappedlibs.h" +#include "debug.h" #include "wrapper.h" #include "bridge.h" #include "librarian/library_private.h" #include "x64emu.h" +#include "callback.h" +#include "librarian.h" +#include "box64context.h" +#include "emu/x64emu_private.h" +#include "myalign.h" const char* libvaName = "libva.so.2"; #define LIBNAME libva +#define ADDED_FUNCTIONS() \ + +#include "generated/wrappedlibvatypes.h" + +#include "wrappercallback.h" + +#define SUPER() \ +GO(0) \ +GO(1) \ +GO(2) \ +GO(3) + +// VAMessageCallback +#define GO(A) \ +static uintptr_t my_VAMessageCallback_fct_##A = 0; \ +static void my_VAMessageCallback_##A(void* a, void* b) \ +{ \ + RunFunctionFmt(my_context, my_VAMessageCallback_fct_##A, "pp", a, b); \ +} +SUPER() +#undef GO +static void* findVAMessageCallbackFct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_VAMessageCallback_fct_##A == (uintptr_t)fct) return my_VAMessageCallback_##A; + SUPER() + #undef GO + #define GO(A) if(my_VAMessageCallback_fct_##A == 0) {my_VAMessageCallback_fct_##A = (uintptr_t)fct; return my_VAMessageCallback_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libxa VAMessageCallback callback\n"); + return NULL; +} +static void* reverse_VAMessageCallbackFct(void* fct) +{ + if(!fct) return fct; + if(CheckBridged(my_lib->w.bridge, fct)) + return (void*)CheckBridged(my_lib->w.bridge, fct); + #define GO(A) if(my_VAMessageCallback_##A == fct) return (void*)my_VAMessageCallback_fct_##A; + SUPER() + #undef GO + return (void*)AddBridge(my_lib->w.bridge, vFpp, fct, 0, NULL); +} + +#undef SUPER + +EXPORT void* my_vaSetErrorCallback(x64emu_t* emu, void* dpy, void* f, void* ctx) +{ + return reverse_VAMessageCallbackFct(my->vaSetErrorCallback(dpy, findVAMessageCallbackFct(f), ctx)); +} + +EXPORT void* my_vaSetInfoCallback(x64emu_t* emu, void* dpy, void* f, void* ctx) +{ + return reverse_VAMessageCallbackFct(my->vaSetInfoCallback(dpy, findVAMessageCallbackFct(f), ctx)); +} + +#define CUSTOM_INIT \ + getMy(lib); + +#define CUSTOM_FINI \ + freeMy(); + #include "wrappedlib_init.h" diff --git a/src/wrapped/wrappedlibva_private.h b/src/wrapped/wrappedlibva_private.h index dd83be25..cba8dc0e 100644 --- a/src/wrapped/wrappedlibva_private.h +++ b/src/wrapped/wrappedlibva_private.h @@ -78,9 +78,9 @@ GO(vaQueryVideoProcPipelineCaps, iFpupup) GO(vaRenderPicture, iFpupi) //GO(vaSetDisplayAttributes, //GO(vaSetDriverName, -//GO(vaSetErrorCallback, +GOM(vaSetErrorCallback, pFEppp) //GO(vaSetImagePalette, -//GO(vaSetInfoCallback, +GOM(vaSetInfoCallback, pFEppp) //GO(vaSetSubpictureChromakey, //GO(vaSetSubpictureGlobalAlpha, //GO(vaSetSubpictureImage, diff --git a/src/wrapped/wrappedlibvdpau.c b/src/wrapped/wrappedlibvdpau.c index 146ef72e..16eef5ae 100644 --- a/src/wrapped/wrappedlibvdpau.c +++ b/src/wrapped/wrappedlibvdpau.c @@ -6,13 +6,37 @@ #include "wrappedlibs.h" +#include "debug.h" #include "wrapper.h" #include "bridge.h" #include "librarian/library_private.h" #include "x64emu.h" +#include "callback.h" +#include "librarian.h" +#include "box64context.h" +#include "emu/x64emu_private.h" +#include "myalign.h" const char* libvdpauName = "libvdpau.so.1"; #define LIBNAME libvdpau + +#define ADDED_FUNCTIONS() \ + +#include "generated/wrappedlibvdpautypes.h" + +#include "wrappercallback.h" + +EXPORT uint32_t my_vdp_device_create_x11(x64emu_t* emu, void* display, int screen, void* device, void** get_proc_address) +{ + return 1; // VDP_STATUS_NO_IMPLEMENTATION +} + +#define CUSTOM_INIT \ + getMy(lib); + +#define CUSTOM_FINI \ + freeMy(); + #include "wrappedlib_init.h" diff --git a/src/wrapped/wrappedlibvdpau_private.h b/src/wrapped/wrappedlibvdpau_private.h index 3a06a036..99a0b336 100644 --- a/src/wrapped/wrappedlibvdpau_private.h +++ b/src/wrapped/wrappedlibvdpau_private.h @@ -2,4 +2,4 @@ #error meh! #endif -//GO(vdp_device_create_x11, iFpipp) // last is a pointer to a VdpGetProcAddress function \ No newline at end of file +GOM(vdp_device_create_x11, iFpipp) // last is a pointer to a VdpGetProcAddress function \ No newline at end of file |