diff --git a/vrclient_x64/gen_wrapper.py b/vrclient_x64/gen_wrapper.py index c82b818d..95d46983 100755 --- a/vrclient_x64/gen_wrapper.py +++ b/vrclient_x64/gen_wrapper.py @@ -120,6 +120,17 @@ print_sizes = [] class_versions = {} +def ivrsystem_get_dxgi_output_info(cppname, method): + param_count = len([p for p in method.get_children() if p.kind == clang.cindex.CursorKind.PARM_DECL]) + return { + 1: "get_dxgi_output_info", + 2: "get_dxgi_output_info2" + }.get(param_count, "unhandled_get_dxgi_output_info_method") + +method_overrides = [ + ("IVRSystem", "GetDXGIOutputInfo", ivrsystem_get_dxgi_output_info) +] + def display_sdkver(s): if s.startswith("v"): s = s[1:] @@ -239,7 +250,14 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e if should_gen_wrapper: cfile.write("create_win_interface(pchNameAndVersion,\n ") - cfile.write("%s_%s(_this->linux_side" % (cppname, used_name)) + for classname_pattern, methodname, override_generator in method_overrides: + if used_name == methodname and classname_pattern in classname: + cfile.write(override_generator(cppname, method)) + cfile.write("(%s_%s, _this->linux_side" % (cppname, used_name)) + break + else: + cfile.write("%s_%s(_this->linux_side" % (cppname, used_name)) + cpp.write("((%s*)linux_side)->%s(" % (classname, method.spelling)) unnamed = 'a' first = True diff --git a/vrclient_x64/vrclient_main.c b/vrclient_x64/vrclient_main.c index d8bbf39b..eb58fb61 100644 --- a/vrclient_x64/vrclient_main.c +++ b/vrclient_x64/vrclient_main.c @@ -133,3 +133,16 @@ void *CDECL VRClientCoreFactory(const char *name, int *return_code) return create_win_interface(name, vrclient_VRClientCoreFactory(name, return_code)); } + +void get_dxgi_output_info(void *cpp_func, void *linux_side, int32_t *adapter_idx) +{ + TRACE("%p\n", adapter_idx); + *adapter_idx = 0; +} + +void get_dxgi_output_info2(void *cpp_func, void *linux_side, int32_t *adapter_idx, int32_t *output_idx) +{ + TRACE("%p, %p\n", adapter_idx, output_idx); + *adapter_idx = 0; + *output_idx = 0; +} diff --git a/vrclient_x64/vrclient_private.h b/vrclient_x64/vrclient_private.h index f77a5e51..985f2282 100644 --- a/vrclient_x64/vrclient_private.h +++ b/vrclient_x64/vrclient_private.h @@ -1,3 +1,5 @@ +#include + /* TODO these should be generated */ typedef struct __winISteamClient winISteamClient; typedef struct __winISteamUser winISteamUser; @@ -32,6 +34,9 @@ void *create_win_interface(const char *name, void *linux_side); unsigned int steamclient_unix_path_to_dos_path(unsigned int api_result, char *inout, unsigned int inout_bytes); void *create_LinuxMatchmakingServerListResponse(void *win); +void get_dxgi_output_info(void *cpp_func, void *linux_side, int32_t *adapter_idx); +void get_dxgi_output_info2(void *cpp_func, void *linux_side, int32_t *adapter_idx, int32_t *output_idx); + #define TRACE WINE_TRACE #define ERR WINE_ERR #define WARN WINE_WARN diff --git a/vrclient_x64/winIVRSystem.c b/vrclient_x64/winIVRSystem.c index f6c7c83c..97c22cd7 100644 --- a/vrclient_x64/winIVRSystem.c +++ b/vrclient_x64/winIVRSystem.c @@ -78,7 +78,7 @@ DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_019_GetDXGIOutputInfo, 12) void __thiscall winIVRSystem_IVRSystem_019_GetDXGIOutputInfo(winIVRSystem_IVRSystem_019 *_this, int32_t * pnAdapterIndex) { TRACE("%p\n", _this); - cppIVRSystem_IVRSystem_019_GetDXGIOutputInfo(_this->linux_side, pnAdapterIndex); + get_dxgi_output_info(cppIVRSystem_IVRSystem_019_GetDXGIOutputInfo, _this->linux_side, pnAdapterIndex); } DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_019_GetOutputDevice, 24) @@ -487,7 +487,7 @@ DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_017_GetDXGIOutputInfo, 12) void __thiscall winIVRSystem_IVRSystem_017_GetDXGIOutputInfo(winIVRSystem_IVRSystem_017 *_this, int32_t * pnAdapterIndex) { TRACE("%p\n", _this); - cppIVRSystem_IVRSystem_017_GetDXGIOutputInfo(_this->linux_side, pnAdapterIndex); + get_dxgi_output_info(cppIVRSystem_IVRSystem_017_GetDXGIOutputInfo, _this->linux_side, pnAdapterIndex); } DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_017_GetOutputDevice, 24) @@ -880,7 +880,7 @@ DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_016_GetDXGIOutputInfo, 12) void __thiscall winIVRSystem_IVRSystem_016_GetDXGIOutputInfo(winIVRSystem_IVRSystem_016 *_this, int32_t * pnAdapterIndex) { TRACE("%p\n", _this); - cppIVRSystem_IVRSystem_016_GetDXGIOutputInfo(_this->linux_side, pnAdapterIndex); + get_dxgi_output_info(cppIVRSystem_IVRSystem_016_GetDXGIOutputInfo, _this->linux_side, pnAdapterIndex); } DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_016_GetOutputDevice, 16) @@ -1273,7 +1273,7 @@ DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_015_GetDXGIOutputInfo, 12) void __thiscall winIVRSystem_IVRSystem_015_GetDXGIOutputInfo(winIVRSystem_IVRSystem_015 *_this, int32_t * pnAdapterIndex) { TRACE("%p\n", _this); - cppIVRSystem_IVRSystem_015_GetDXGIOutputInfo(_this->linux_side, pnAdapterIndex); + get_dxgi_output_info(cppIVRSystem_IVRSystem_015_GetDXGIOutputInfo, _this->linux_side, pnAdapterIndex); } DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_015_IsDisplayOnDesktop, 4) @@ -1658,7 +1658,7 @@ DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_014_GetDXGIOutputInfo, 12) void __thiscall winIVRSystem_IVRSystem_014_GetDXGIOutputInfo(winIVRSystem_IVRSystem_014 *_this, int32_t * pnAdapterIndex) { TRACE("%p\n", _this); - cppIVRSystem_IVRSystem_014_GetDXGIOutputInfo(_this->linux_side, pnAdapterIndex); + get_dxgi_output_info(cppIVRSystem_IVRSystem_014_GetDXGIOutputInfo, _this->linux_side, pnAdapterIndex); } DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_014_IsDisplayOnDesktop, 4) @@ -2044,7 +2044,7 @@ DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_012_GetDXGIOutputInfo, 12) void __thiscall winIVRSystem_IVRSystem_012_GetDXGIOutputInfo(winIVRSystem_IVRSystem_012 *_this, int32_t * pnAdapterIndex) { TRACE("%p\n", _this); - cppIVRSystem_IVRSystem_012_GetDXGIOutputInfo(_this->linux_side, pnAdapterIndex); + get_dxgi_output_info(cppIVRSystem_IVRSystem_012_GetDXGIOutputInfo, _this->linux_side, pnAdapterIndex); } DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_012_IsDisplayOnDesktop, 4) @@ -2430,7 +2430,7 @@ DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_011_GetDXGIOutputInfo, 12) void __thiscall winIVRSystem_IVRSystem_011_GetDXGIOutputInfo(winIVRSystem_IVRSystem_011 *_this, int32_t * pnAdapterIndex) { TRACE("%p\n", _this); - cppIVRSystem_IVRSystem_011_GetDXGIOutputInfo(_this->linux_side, pnAdapterIndex); + get_dxgi_output_info(cppIVRSystem_IVRSystem_011_GetDXGIOutputInfo, _this->linux_side, pnAdapterIndex); } DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_011_IsDisplayOnDesktop, 4) @@ -2832,7 +2832,7 @@ DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_010_GetDXGIOutputInfo, 12) void __thiscall winIVRSystem_IVRSystem_010_GetDXGIOutputInfo(winIVRSystem_IVRSystem_010 *_this, int32_t * pnAdapterIndex) { TRACE("%p\n", _this); - cppIVRSystem_IVRSystem_010_GetDXGIOutputInfo(_this->linux_side, pnAdapterIndex); + get_dxgi_output_info(cppIVRSystem_IVRSystem_010_GetDXGIOutputInfo, _this->linux_side, pnAdapterIndex); } DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_010_IsDisplayOnDesktop, 4) @@ -3234,7 +3234,7 @@ DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_009_GetDXGIOutputInfo, 12) void __thiscall winIVRSystem_IVRSystem_009_GetDXGIOutputInfo(winIVRSystem_IVRSystem_009 *_this, int32_t * pnAdapterIndex) { TRACE("%p\n", _this); - cppIVRSystem_IVRSystem_009_GetDXGIOutputInfo(_this->linux_side, pnAdapterIndex); + get_dxgi_output_info(cppIVRSystem_IVRSystem_009_GetDXGIOutputInfo, _this->linux_side, pnAdapterIndex); } DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_009_IsDisplayOnDesktop, 4) @@ -3618,7 +3618,7 @@ DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_006_GetDXGIOutputInfo, 20) void __thiscall winIVRSystem_IVRSystem_006_GetDXGIOutputInfo(winIVRSystem_IVRSystem_006 *_this, int32_t * pnAdapterIndex, int32_t * pnAdapterOutputIndex) { TRACE("%p\n", _this); - cppIVRSystem_IVRSystem_006_GetDXGIOutputInfo(_this->linux_side, pnAdapterIndex, pnAdapterOutputIndex); + get_dxgi_output_info2(cppIVRSystem_IVRSystem_006_GetDXGIOutputInfo, _this->linux_side, pnAdapterIndex, pnAdapterOutputIndex); } DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_006_AttachToWindow, 12) @@ -3988,7 +3988,7 @@ DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_005_GetDXGIOutputInfo, 20) void __thiscall winIVRSystem_IVRSystem_005_GetDXGIOutputInfo(winIVRSystem_IVRSystem_005 *_this, int32_t * pnAdapterIndex, int32_t * pnAdapterOutputIndex) { TRACE("%p\n", _this); - cppIVRSystem_IVRSystem_005_GetDXGIOutputInfo(_this->linux_side, pnAdapterIndex, pnAdapterOutputIndex); + get_dxgi_output_info2(cppIVRSystem_IVRSystem_005_GetDXGIOutputInfo, _this->linux_side, pnAdapterIndex, pnAdapterOutputIndex); } DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_005_AttachToWindow, 12) @@ -4317,7 +4317,7 @@ DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_004_GetDXGIOutputInfo, 20) void __thiscall winIVRSystem_IVRSystem_004_GetDXGIOutputInfo(winIVRSystem_IVRSystem_004 *_this, int32_t * pnAdapterIndex, int32_t * pnAdapterOutputIndex) { TRACE("%p\n", _this); - cppIVRSystem_IVRSystem_004_GetDXGIOutputInfo(_this->linux_side, pnAdapterIndex, pnAdapterOutputIndex); + get_dxgi_output_info2(cppIVRSystem_IVRSystem_004_GetDXGIOutputInfo, _this->linux_side, pnAdapterIndex, pnAdapterOutputIndex); } DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_004_AttachToWindow, 12) @@ -4638,7 +4638,7 @@ DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_003_GetDXGIOutputInfo, 20) void __thiscall winIVRSystem_IVRSystem_003_GetDXGIOutputInfo(winIVRSystem_IVRSystem_003 *_this, int32_t * pnAdapterIndex, int32_t * pnAdapterOutputIndex) { TRACE("%p\n", _this); - cppIVRSystem_IVRSystem_003_GetDXGIOutputInfo(_this->linux_side, pnAdapterIndex, pnAdapterOutputIndex); + get_dxgi_output_info2(cppIVRSystem_IVRSystem_003_GetDXGIOutputInfo, _this->linux_side, pnAdapterIndex, pnAdapterOutputIndex); } DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_003_AttachToWindow, 12)