diff options
Diffstat (limited to 'src/wrapped/wrappedvulkan.c')
| -rw-r--r-- | src/wrapped/wrappedvulkan.c | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/src/wrapped/wrappedvulkan.c b/src/wrapped/wrappedvulkan.c index b90747c4..8cba5772 100644 --- a/src/wrapped/wrappedvulkan.c +++ b/src/wrapped/wrappedvulkan.c @@ -53,7 +53,7 @@ static void* resolveSymbol(x64emu_t* emu, void* symbol, const char* rname) printf_dlsym(LOG_DEBUG, "%p\n", (void*)ret); return (void*)ret; // already bridged } - // get wrapper + // get wrapper khint_t k = kh_get(symbolmap, emu->context->vkwrappers, rname); if(k==kh_end(emu->context->vkwrappers) && strstr(rname, "KHR")==NULL) { // try again, adding KHR at the end if not present @@ -74,7 +74,7 @@ static void* resolveSymbol(x64emu_t* emu, void* symbol, const char* rname) return (void*)ret; } -EXPORT void* my_vkGetDeviceProcAddr(x64emu_t* emu, void* device, void* name) +EXPORT void* my_vkGetDeviceProcAddr(x64emu_t* emu, void* device, void* name) { khint_t k; const char* rname = (const char*)name; @@ -84,8 +84,8 @@ EXPORT void* my_vkGetDeviceProcAddr(x64emu_t* emu, void* device, void* name) fillVulkanProcWrapper(emu->context); k = kh_get(symbolmap, emu->context->vkmymap, rname); int is_my = (k==kh_end(emu->context->vkmymap))?0:1; - void* symbol; - if(is_my) { + void* symbol = my->vkGetDeviceProcAddr(device, name); + if(symbol && is_my) { // only wrap if symbol exist // try again, by using custom "my_" now... char tmp[200]; strcpy(tmp, "my_"); @@ -95,8 +95,7 @@ EXPORT void* my_vkGetDeviceProcAddr(x64emu_t* emu, void* device, void* name) #define GO(A, W) if(!strcmp(rname, #A)) my->A = (W)my->vkGetDeviceProcAddr(device, name); SUPER() #undef GO - } else - symbol = my->vkGetDeviceProcAddr(device, name); + } if(!symbol) { printf_dlsym(LOG_DEBUG, "%p\n", NULL); return NULL; // easy @@ -104,7 +103,7 @@ EXPORT void* my_vkGetDeviceProcAddr(x64emu_t* emu, void* device, void* name) return resolveSymbol(emu, symbol, rname); } -EXPORT void* my_vkGetInstanceProcAddr(x64emu_t* emu, void* instance, void* name) +EXPORT void* my_vkGetInstanceProcAddr(x64emu_t* emu, void* instance, void* name) { khint_t k; const char* rname = (const char*)name; @@ -192,10 +191,10 @@ GO(4) // Allocation ... #define GO(A) \ -static uintptr_t my_Allocation_fct_##A = 0; \ -static void* my_Allocation_##A(void* a, size_t b, size_t c, int d) \ -{ \ - return (void*)RunFunction(my_context, my_Allocation_fct_##A, 4, a, b, c, d); \ +static uintptr_t my_Allocation_fct_##A = 0; \ +static void* my_Allocation_##A(void* a, size_t b, size_t c, int d) \ +{ \ + return (void*)RunFunctionFmt(my_Allocation_fct_##A, "pLLi", a, b, c, d); \ } SUPER() #undef GO @@ -214,10 +213,10 @@ static void* find_Allocation_Fct(void* fct) } // Reallocation ... #define GO(A) \ -static uintptr_t my_Reallocation_fct_##A = 0; \ -static void* my_Reallocation_##A(void* a, void* b, size_t c, size_t d, int e) \ -{ \ - return (void*)RunFunction(my_context, my_Reallocation_fct_##A, 5, a, b, c, d, e); \ +static uintptr_t my_Reallocation_fct_##A = 0; \ +static void* my_Reallocation_##A(void* a, void* b, size_t c, size_t d, int e) \ +{ \ + return (void*)RunFunctionFmt(my_Reallocation_fct_##A, "ppLLi", a, b, c, d, e); \ } SUPER() #undef GO @@ -239,7 +238,7 @@ static void* find_Reallocation_Fct(void* fct) static uintptr_t my_Free_fct_##A = 0; \ static void my_Free_##A(void* a, void* b) \ { \ - RunFunction(my_context, my_Free_fct_##A, 2, a, b); \ + RunFunctionFmt(my_Free_fct_##A, "pp", a, b); \ } SUPER() #undef GO @@ -258,10 +257,10 @@ static void* find_Free_Fct(void* fct) } // InternalAllocNotification ... #define GO(A) \ -static uintptr_t my_InternalAllocNotification_fct_##A = 0; \ -static void my_InternalAllocNotification_##A(void* a, size_t b, int c, int d) \ -{ \ - RunFunction(my_context, my_InternalAllocNotification_fct_##A, 4, a, b, c, d); \ +static uintptr_t my_InternalAllocNotification_fct_##A = 0; \ +static void my_InternalAllocNotification_##A(void* a, size_t b, int c, int d) \ +{ \ + RunFunctionFmt(my_InternalAllocNotification_fct_##A, "pLii", a, b, c, d); \ } SUPER() #undef GO @@ -280,10 +279,10 @@ static void* find_InternalAllocNotification_Fct(void* fct) } // InternalFreeNotification ... #define GO(A) \ -static uintptr_t my_InternalFreeNotification_fct_##A = 0; \ -static void my_InternalFreeNotification_##A(void* a, size_t b, int c, int d) \ -{ \ - RunFunction(my_context, my_InternalFreeNotification_fct_##A, 4, a, b, c, d); \ +static uintptr_t my_InternalFreeNotification_fct_##A = 0; \ +static void my_InternalFreeNotification_##A(void* a, size_t b, int c, int d) \ +{ \ + RunFunctionFmt(my_InternalFreeNotification_fct_##A, "pLii", a, b, c, d); \ } SUPER() #undef GO @@ -302,10 +301,10 @@ static void* find_InternalFreeNotification_Fct(void* fct) } // DebugReportCallbackEXT ... #define GO(A) \ -static uintptr_t my_DebugReportCallbackEXT_fct_##A = 0; \ -static int my_DebugReportCallbackEXT_##A(int a, int b, uint64_t c, size_t d, int e, void* f, void* g, void* h) \ -{ \ - return RunFunction(my_context, my_DebugReportCallbackEXT_fct_##A, 8, a, b, c, d, e, f, g, h); \ +static uintptr_t my_DebugReportCallbackEXT_fct_##A = 0; \ +static int my_DebugReportCallbackEXT_##A(int a, int b, uint64_t c, size_t d, int e, void* f, void* g, void* h) \ +{ \ + return RunFunctionFmt(my_DebugReportCallbackEXT_fct_##A, "iiULippp", a, b, c, d, e, f, g, h); \ } SUPER() #undef GO @@ -618,7 +617,7 @@ EXPORT void my_vkGetPhysicalDeviceMemoryProperties(x64emu_t* emu, void* device, my->vkGetPhysicalDeviceMemoryProperties(device, pProps); } -EXPORT void my_vkCmdPipelineBarrier(x64emu_t* emu, void* device, int src, int dst, int dep, +EXPORT void my_vkCmdPipelineBarrier(x64emu_t* emu, void* device, int src, int dst, int dep, uint32_t barrierCount, void* pBarriers, uint32_t bufferCount, void* pBuffers, uint32_t imageCount, void* pImages) { my->vkCmdPipelineBarrier(device, src, dst, dep, barrierCount, pBarriers, bufferCount, pBuffers, imageCount, pImages); @@ -632,12 +631,12 @@ typedef struct my_VkDebugReportCallbackCreateInfoEXT_s { void* pUserData; } my_VkDebugReportCallbackCreateInfoEXT_t; -EXPORT int my_vkCreateDebugReportCallbackEXT(x64emu_t* emu, void* instance, - my_VkDebugReportCallbackCreateInfoEXT_t* create, +EXPORT int my_vkCreateDebugReportCallbackEXT(x64emu_t* emu, void* instance, + my_VkDebugReportCallbackCreateInfoEXT_t* create, my_VkAllocationCallbacks_t* alloc, void* callback) { my_VkDebugReportCallbackCreateInfoEXT_t dbg = *create; - my_VkAllocationCallbacks_t my_alloc; + my_VkAllocationCallbacks_t my_alloc; dbg.pfnCallback = find_DebugReportCallbackEXT_Fct(dbg.pfnCallback); return my->vkCreateDebugReportCallbackEXT(instance, &dbg, find_VkAllocationCallbacks(&my_alloc, alloc), callback); } @@ -648,4 +647,4 @@ EXPORT int my_vkDestroyDebugReportCallbackEXT(x64emu_t* emu, void* instance, voi return my->vkDestroyDebugReportCallbackEXT(instance, callback, find_VkAllocationCallbacks(&my_alloc, alloc)); } -CREATE(vkCreateHeadlessSurfaceEXT) \ No newline at end of file +CREATE(vkCreateHeadlessSurfaceEXT) |