From 77c53456321ded9e66a540e3f5db5b963d28619d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 15 Dec 2023 10:20:25 +0100 Subject: [PATCH] vrclient: Respect provided struct sizes when returning structures. CW-Bug-Id: #22729 CW-Bug-Id: #23147 --- vrclient_x64/gen_wrapper.py | 40 +++++- vrclient_x64/vrinput_manual.c | 30 +++- vrclient_x64/winIVRInput.c | 162 ++++++++++++++++++---- vrclient_x64/winIVROverlay.c | 96 ++++++++++--- vrclient_x64/winIVRSystem.c | 216 ++++++++++++++++++++++++----- vrclient_x64/winIVRTrackedCamera.c | 54 ++++++-- 6 files changed, 503 insertions(+), 95 deletions(-) diff --git a/vrclient_x64/gen_wrapper.py b/vrclient_x64/gen_wrapper.py index cc2efa70..85883985 100755 --- a/vrclient_x64/gen_wrapper.py +++ b/vrclient_x64/gen_wrapper.py @@ -158,6 +158,10 @@ STRUCTS_NEXT_IS_SIZE = [ "InputBindingInfo_t", ] +STRUCTS_IS_INPUT_ARRAY = [ + "VRActiveActionSet_t", +] + STRUCTS_NEXT_IS_SIZE_UNHANDLED = [ "VROverlayIntersectionMaskPrimitive_t" # not next, but next-next uint32 is the size ] @@ -839,6 +843,9 @@ def handle_method_c(klass, method, winclassname, out): for i, p in enumerate(method.get_arguments())] params = [declspec(p, names[i], "w_") for i, p in enumerate(method.get_arguments())] + need_convert = {n: p for n, p in zip(names, method.get_arguments()) + if param_needs_conversion(p)} + if returns_record: params = [f'{declspec(method.result_type, "*_ret", "w_")}'] + params names = ['_ret'] + names @@ -853,11 +860,35 @@ def handle_method_c(klass, method, winclassname, out): out(f'{ret}__thiscall {winclassname}_{method.name}({", ".join(params)})\n') out(u'{\n') + names = names[2:] if returns_record else names[1:] + params = list(zip(names, method.get_arguments())) + params += [(None, None)] + param_sizes = {} + + for i, (name, param) in enumerate(params[:-1]): + if name not in need_convert: + continue + real_type = underlying_type(param) + if strip_ns(real_type.spelling) not in STRUCTS_NEXT_IS_SIZE: + continue + assert name not in STRUCTS_IS_INPUT_ARRAY + assert name not in STRUCTS_NEXT_IS_SIZE_UNHANDLED + + next_name, next_param = params[i + 1] + if next_param and next_param.type.spelling == "uint32_t": + out(f' {declspec(param.type.get_pointee(), f"w_{name}", "w_")};\n') + param_sizes[name] = next_name + out(f' struct {method.full_name}_params params =\n') out(u' {\n') out(u' .linux_side = _this->u_iface,\n') - for name in names[1:]: - out(f' .{name} = {name},\n') + if returns_record: + out(u' ._ret = _ret,\n') + for name, param in params[:-1]: + if name in param_sizes: + out(f' .{name} = {name} ? &w_{name} : NULL,\n') + else: + out(f' .{name} = {name},\n') out(u' };\n') out(u' TRACE("%p\\n", _this);\n') @@ -865,7 +896,12 @@ def handle_method_c(klass, method, winclassname, out): if 'eTextureType' in names: out(u' if (eTextureType == TextureType_DirectX) FIXME( "Not implemented Direct3D API!\\n" );\n') + for name, size in param_sizes.items(): + out(f' {size} = min( {size}, sizeof(w_{name}) );\n') + out(f' if ({name}) memcpy( &w_{name}, {name}, {size} );\n') out(f' VRCLIENT_CALL( {method.full_name}, ¶ms );\n') + for name, size in param_sizes.items(): + out(f' if ({name}) memcpy( {name}, &w_{name}, {size} );\n') if not returns_void: out(u' return params._ret;\n') diff --git a/vrclient_x64/vrinput_manual.c b/vrclient_x64/vrinput_manual.c index 52c55793..b7852b90 100644 --- a/vrclient_x64/vrinput_manual.c +++ b/vrclient_x64/vrinput_manual.c @@ -69,18 +69,22 @@ uint32_t __thiscall winIVRInput_IVRInput_004_GetDigitalActionData( struct w_stea w_InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, uint32_t ulRestrictToDevice ) { + w_InputDigitalActionData_t w_pActionData; struct IVRInput_IVRInput_004_GetDigitalActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE( "%p\n", _this ); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_004_GetDigitalActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); #ifdef __x86_64__ return params._ret; #else @@ -93,18 +97,22 @@ uint32_t __thiscall winIVRInput_IVRInput_005_GetDigitalActionData( struct w_stea w_InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, uint32_t ulRestrictToDevice ) { + w_InputDigitalActionData_t w_pActionData; struct IVRInput_IVRInput_005_GetDigitalActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE( "%p\n", _this ); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_005_GetDigitalActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); #ifdef __x86_64__ return params._ret; #else @@ -117,18 +125,22 @@ uint32_t __thiscall winIVRInput_IVRInput_006_GetDigitalActionData( struct w_stea w_InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, uint32_t ulRestrictToDevice ) { + w_InputDigitalActionData_t w_pActionData; struct IVRInput_IVRInput_006_GetDigitalActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE( "%p\n", _this ); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_006_GetDigitalActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); #ifdef __x86_64__ return params._ret; #else @@ -141,18 +153,22 @@ uint32_t __thiscall winIVRInput_IVRInput_007_GetDigitalActionData( struct w_stea w_InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, uint32_t ulRestrictToDevice ) { + w_InputDigitalActionData_t w_pActionData; struct IVRInput_IVRInput_007_GetDigitalActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE( "%p\n", _this ); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_007_GetDigitalActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); #ifdef __x86_64__ return params._ret; #else @@ -165,18 +181,22 @@ uint32_t __thiscall winIVRInput_IVRInput_010_GetDigitalActionData( struct w_stea w_InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, uint32_t ulRestrictToDevice ) { + w_InputDigitalActionData_t w_pActionData; struct IVRInput_IVRInput_010_GetDigitalActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE( "%p\n", _this ); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_010_GetDigitalActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); #ifdef __x86_64__ return params._ret; #else diff --git a/vrclient_x64/winIVRInput.c b/vrclient_x64/winIVRInput.c index e2892b9a..a0992a6e 100644 --- a/vrclient_x64/winIVRInput.c +++ b/vrclient_x64/winIVRInput.c @@ -93,45 +93,57 @@ uint32_t __thiscall winIVRInput_IVRInput_003_UpdateActionState(struct w_steam_if uint32_t __thiscall winIVRInput_IVRInput_003_GetDigitalActionData(struct w_steam_iface *_this, uint64_t action, w_InputDigitalActionData_t *pActionData, uint32_t unActionDataSize) { + w_InputDigitalActionData_t w_pActionData; struct IVRInput_IVRInput_003_GetDigitalActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_003_GetDigitalActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } uint32_t __thiscall winIVRInput_IVRInput_003_GetAnalogActionData(struct w_steam_iface *_this, uint64_t action, w_InputAnalogActionData_t *pActionData, uint32_t unActionDataSize) { + w_InputAnalogActionData_t w_pActionData; struct IVRInput_IVRInput_003_GetAnalogActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_003_GetAnalogActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } uint32_t __thiscall winIVRInput_IVRInput_003_GetPoseActionData(struct w_steam_iface *_this, uint64_t action, uint32_t eOrigin, float fPredictedSecondsFromNow, w_InputPoseActionData_t *pActionData, uint32_t unActionDataSize) { + w_InputPoseActionData_t w_pActionData; struct IVRInput_IVRInput_003_GetPoseActionData_params params = { .linux_side = _this->u_iface, .action = action, .eOrigin = eOrigin, .fPredictedSecondsFromNow = fPredictedSecondsFromNow, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_003_GetPoseActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } @@ -233,15 +245,19 @@ uint32_t __thiscall winIVRInput_IVRInput_003_GetOriginLocalizedName(struct w_ste uint32_t __thiscall winIVRInput_IVRInput_003_GetOriginTrackedDeviceInfo(struct w_steam_iface *_this, uint64_t origin, w_InputOriginInfo_t *pOriginInfo, uint32_t unOriginInfoSize) { + w_InputOriginInfo_t w_pOriginInfo; struct IVRInput_IVRInput_003_GetOriginTrackedDeviceInfo_params params = { .linux_side = _this->u_iface, .origin = origin, - .pOriginInfo = pOriginInfo, + .pOriginInfo = pOriginInfo ? &w_pOriginInfo : NULL, .unOriginInfoSize = unOriginInfoSize, }; TRACE("%p\n", _this); + unOriginInfoSize = min( unOriginInfoSize, sizeof(w_pOriginInfo) ); + if (pOriginInfo) memcpy( &w_pOriginInfo, pOriginInfo, unOriginInfoSize ); VRCLIENT_CALL( IVRInput_IVRInput_003_GetOriginTrackedDeviceInfo, ¶ms ); + if (pOriginInfo) memcpy( pOriginInfo, &w_pOriginInfo, unOriginInfoSize ); return params._ret; } @@ -442,48 +458,60 @@ extern uint32_t __thiscall winIVRInput_IVRInput_004_GetDigitalActionData(struct uint32_t __thiscall winIVRInput_IVRInput_004_GetAnalogActionData(struct w_steam_iface *_this, uint64_t action, w_InputAnalogActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) { + w_InputAnalogActionData_t w_pActionData; struct IVRInput_IVRInput_004_GetAnalogActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_004_GetAnalogActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } uint32_t __thiscall winIVRInput_IVRInput_004_GetPoseActionData(struct w_steam_iface *_this, uint64_t action, uint32_t eOrigin, float fPredictedSecondsFromNow, w_InputPoseActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) { + w_InputPoseActionData_t w_pActionData; struct IVRInput_IVRInput_004_GetPoseActionData_params params = { .linux_side = _this->u_iface, .action = action, .eOrigin = eOrigin, .fPredictedSecondsFromNow = fPredictedSecondsFromNow, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_004_GetPoseActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } uint32_t __thiscall winIVRInput_IVRInput_004_GetSkeletalActionData(struct w_steam_iface *_this, uint64_t action, w_InputSkeletalActionData_t_1016 *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) { + w_InputSkeletalActionData_t_1016 w_pActionData; struct IVRInput_IVRInput_004_GetSkeletalActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_004_GetSkeletalActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } @@ -586,15 +614,19 @@ uint32_t __thiscall winIVRInput_IVRInput_004_GetOriginLocalizedName(struct w_ste uint32_t __thiscall winIVRInput_IVRInput_004_GetOriginTrackedDeviceInfo(struct w_steam_iface *_this, uint64_t origin, w_InputOriginInfo_t *pOriginInfo, uint32_t unOriginInfoSize) { + w_InputOriginInfo_t w_pOriginInfo; struct IVRInput_IVRInput_004_GetOriginTrackedDeviceInfo_params params = { .linux_side = _this->u_iface, .origin = origin, - .pOriginInfo = pOriginInfo, + .pOriginInfo = pOriginInfo ? &w_pOriginInfo : NULL, .unOriginInfoSize = unOriginInfoSize, }; TRACE("%p\n", _this); + unOriginInfoSize = min( unOriginInfoSize, sizeof(w_pOriginInfo) ); + if (pOriginInfo) memcpy( &w_pOriginInfo, pOriginInfo, unOriginInfoSize ); VRCLIENT_CALL( IVRInput_IVRInput_004_GetOriginTrackedDeviceInfo, ¶ms ); + if (pOriginInfo) memcpy( pOriginInfo, &w_pOriginInfo, unOriginInfoSize ); return params._ret; } @@ -804,47 +836,59 @@ extern uint32_t __thiscall winIVRInput_IVRInput_005_GetDigitalActionData(struct uint32_t __thiscall winIVRInput_IVRInput_005_GetAnalogActionData(struct w_steam_iface *_this, uint64_t action, w_InputAnalogActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) { + w_InputAnalogActionData_t w_pActionData; struct IVRInput_IVRInput_005_GetAnalogActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_005_GetAnalogActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } uint32_t __thiscall winIVRInput_IVRInput_005_GetPoseActionData(struct w_steam_iface *_this, uint64_t action, uint32_t eOrigin, float fPredictedSecondsFromNow, w_InputPoseActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) { + w_InputPoseActionData_t w_pActionData; struct IVRInput_IVRInput_005_GetPoseActionData_params params = { .linux_side = _this->u_iface, .action = action, .eOrigin = eOrigin, .fPredictedSecondsFromNow = fPredictedSecondsFromNow, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_005_GetPoseActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } uint32_t __thiscall winIVRInput_IVRInput_005_GetSkeletalActionData(struct w_steam_iface *_this, uint64_t action, w_InputSkeletalActionData_t_113b *pActionData, uint32_t unActionDataSize) { + w_InputSkeletalActionData_t_113b w_pActionData; struct IVRInput_IVRInput_005_GetSkeletalActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_005_GetSkeletalActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } @@ -1029,15 +1073,19 @@ uint32_t __thiscall winIVRInput_IVRInput_005_GetOriginLocalizedName(struct w_ste uint32_t __thiscall winIVRInput_IVRInput_005_GetOriginTrackedDeviceInfo(struct w_steam_iface *_this, uint64_t origin, w_InputOriginInfo_t *pOriginInfo, uint32_t unOriginInfoSize) { + w_InputOriginInfo_t w_pOriginInfo; struct IVRInput_IVRInput_005_GetOriginTrackedDeviceInfo_params params = { .linux_side = _this->u_iface, .origin = origin, - .pOriginInfo = pOriginInfo, + .pOriginInfo = pOriginInfo ? &w_pOriginInfo : NULL, .unOriginInfoSize = unOriginInfoSize, }; TRACE("%p\n", _this); + unOriginInfoSize = min( unOriginInfoSize, sizeof(w_pOriginInfo) ); + if (pOriginInfo) memcpy( &w_pOriginInfo, pOriginInfo, unOriginInfoSize ); VRCLIENT_CALL( IVRInput_IVRInput_005_GetOriginTrackedDeviceInfo, ¶ms ); + if (pOriginInfo) memcpy( pOriginInfo, &w_pOriginInfo, unOriginInfoSize ); return params._ret; } @@ -1273,63 +1321,79 @@ extern uint32_t __thiscall winIVRInput_IVRInput_006_GetDigitalActionData(struct uint32_t __thiscall winIVRInput_IVRInput_006_GetAnalogActionData(struct w_steam_iface *_this, uint64_t action, w_InputAnalogActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) { + w_InputAnalogActionData_t w_pActionData; struct IVRInput_IVRInput_006_GetAnalogActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_006_GetAnalogActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } uint32_t __thiscall winIVRInput_IVRInput_006_GetPoseActionDataRelativeToNow(struct w_steam_iface *_this, uint64_t action, uint32_t eOrigin, float fPredictedSecondsFromNow, w_InputPoseActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) { + w_InputPoseActionData_t w_pActionData; struct IVRInput_IVRInput_006_GetPoseActionDataRelativeToNow_params params = { .linux_side = _this->u_iface, .action = action, .eOrigin = eOrigin, .fPredictedSecondsFromNow = fPredictedSecondsFromNow, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_006_GetPoseActionDataRelativeToNow, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } uint32_t __thiscall winIVRInput_IVRInput_006_GetPoseActionDataForNextFrame(struct w_steam_iface *_this, uint64_t action, uint32_t eOrigin, w_InputPoseActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) { + w_InputPoseActionData_t w_pActionData; struct IVRInput_IVRInput_006_GetPoseActionDataForNextFrame_params params = { .linux_side = _this->u_iface, .action = action, .eOrigin = eOrigin, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_006_GetPoseActionDataForNextFrame, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } uint32_t __thiscall winIVRInput_IVRInput_006_GetSkeletalActionData(struct w_steam_iface *_this, uint64_t action, w_InputSkeletalActionData_t_113b *pActionData, uint32_t unActionDataSize) { + w_InputSkeletalActionData_t_113b w_pActionData; struct IVRInput_IVRInput_006_GetSkeletalActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_006_GetSkeletalActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } @@ -1515,15 +1579,19 @@ uint32_t __thiscall winIVRInput_IVRInput_006_GetOriginLocalizedName(struct w_ste uint32_t __thiscall winIVRInput_IVRInput_006_GetOriginTrackedDeviceInfo(struct w_steam_iface *_this, uint64_t origin, w_InputOriginInfo_t *pOriginInfo, uint32_t unOriginInfoSize) { + w_InputOriginInfo_t w_pOriginInfo; struct IVRInput_IVRInput_006_GetOriginTrackedDeviceInfo_params params = { .linux_side = _this->u_iface, .origin = origin, - .pOriginInfo = pOriginInfo, + .pOriginInfo = pOriginInfo ? &w_pOriginInfo : NULL, .unOriginInfoSize = unOriginInfoSize, }; TRACE("%p\n", _this); + unOriginInfoSize = min( unOriginInfoSize, sizeof(w_pOriginInfo) ); + if (pOriginInfo) memcpy( &w_pOriginInfo, pOriginInfo, unOriginInfoSize ); VRCLIENT_CALL( IVRInput_IVRInput_006_GetOriginTrackedDeviceInfo, ¶ms ); + if (pOriginInfo) memcpy( pOriginInfo, &w_pOriginInfo, unOriginInfoSize ); return params._ret; } @@ -1763,63 +1831,79 @@ extern uint32_t __thiscall winIVRInput_IVRInput_007_GetDigitalActionData(struct uint32_t __thiscall winIVRInput_IVRInput_007_GetAnalogActionData(struct w_steam_iface *_this, uint64_t action, w_InputAnalogActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) { + w_InputAnalogActionData_t w_pActionData; struct IVRInput_IVRInput_007_GetAnalogActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_007_GetAnalogActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } uint32_t __thiscall winIVRInput_IVRInput_007_GetPoseActionDataRelativeToNow(struct w_steam_iface *_this, uint64_t action, uint32_t eOrigin, float fPredictedSecondsFromNow, w_InputPoseActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) { + w_InputPoseActionData_t w_pActionData; struct IVRInput_IVRInput_007_GetPoseActionDataRelativeToNow_params params = { .linux_side = _this->u_iface, .action = action, .eOrigin = eOrigin, .fPredictedSecondsFromNow = fPredictedSecondsFromNow, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_007_GetPoseActionDataRelativeToNow, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } uint32_t __thiscall winIVRInput_IVRInput_007_GetPoseActionDataForNextFrame(struct w_steam_iface *_this, uint64_t action, uint32_t eOrigin, w_InputPoseActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) { + w_InputPoseActionData_t w_pActionData; struct IVRInput_IVRInput_007_GetPoseActionDataForNextFrame_params params = { .linux_side = _this->u_iface, .action = action, .eOrigin = eOrigin, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_007_GetPoseActionDataForNextFrame, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } uint32_t __thiscall winIVRInput_IVRInput_007_GetSkeletalActionData(struct w_steam_iface *_this, uint64_t action, w_InputSkeletalActionData_t_113b *pActionData, uint32_t unActionDataSize) { + w_InputSkeletalActionData_t_113b w_pActionData; struct IVRInput_IVRInput_007_GetSkeletalActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_007_GetSkeletalActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } @@ -2005,15 +2089,19 @@ uint32_t __thiscall winIVRInput_IVRInput_007_GetOriginLocalizedName(struct w_ste uint32_t __thiscall winIVRInput_IVRInput_007_GetOriginTrackedDeviceInfo(struct w_steam_iface *_this, uint64_t origin, w_InputOriginInfo_t *pOriginInfo, uint32_t unOriginInfoSize) { + w_InputOriginInfo_t w_pOriginInfo; struct IVRInput_IVRInput_007_GetOriginTrackedDeviceInfo_params params = { .linux_side = _this->u_iface, .origin = origin, - .pOriginInfo = pOriginInfo, + .pOriginInfo = pOriginInfo ? &w_pOriginInfo : NULL, .unOriginInfoSize = unOriginInfoSize, }; TRACE("%p\n", _this); + unOriginInfoSize = min( unOriginInfoSize, sizeof(w_pOriginInfo) ); + if (pOriginInfo) memcpy( &w_pOriginInfo, pOriginInfo, unOriginInfoSize ); VRCLIENT_CALL( IVRInput_IVRInput_007_GetOriginTrackedDeviceInfo, ¶ms ); + if (pOriginInfo) memcpy( pOriginInfo, &w_pOriginInfo, unOriginInfoSize ); return params._ret; } @@ -2292,63 +2380,79 @@ extern uint32_t __thiscall winIVRInput_IVRInput_010_GetDigitalActionData(struct uint32_t __thiscall winIVRInput_IVRInput_010_GetAnalogActionData(struct w_steam_iface *_this, uint64_t action, w_InputAnalogActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) { + w_InputAnalogActionData_t w_pActionData; struct IVRInput_IVRInput_010_GetAnalogActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_010_GetAnalogActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } uint32_t __thiscall winIVRInput_IVRInput_010_GetPoseActionDataRelativeToNow(struct w_steam_iface *_this, uint64_t action, uint32_t eOrigin, float fPredictedSecondsFromNow, w_InputPoseActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) { + w_InputPoseActionData_t w_pActionData; struct IVRInput_IVRInput_010_GetPoseActionDataRelativeToNow_params params = { .linux_side = _this->u_iface, .action = action, .eOrigin = eOrigin, .fPredictedSecondsFromNow = fPredictedSecondsFromNow, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_010_GetPoseActionDataRelativeToNow, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } uint32_t __thiscall winIVRInput_IVRInput_010_GetPoseActionDataForNextFrame(struct w_steam_iface *_this, uint64_t action, uint32_t eOrigin, w_InputPoseActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) { + w_InputPoseActionData_t w_pActionData; struct IVRInput_IVRInput_010_GetPoseActionDataForNextFrame_params params = { .linux_side = _this->u_iface, .action = action, .eOrigin = eOrigin, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, .ulRestrictToDevice = ulRestrictToDevice, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_010_GetPoseActionDataForNextFrame, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } uint32_t __thiscall winIVRInput_IVRInput_010_GetSkeletalActionData(struct w_steam_iface *_this, uint64_t action, w_InputSkeletalActionData_t_113b *pActionData, uint32_t unActionDataSize) { + w_InputSkeletalActionData_t_113b w_pActionData; struct IVRInput_IVRInput_010_GetSkeletalActionData_params params = { .linux_side = _this->u_iface, .action = action, - .pActionData = pActionData, + .pActionData = pActionData ? &w_pActionData : NULL, .unActionDataSize = unActionDataSize, }; TRACE("%p\n", _this); + unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) ); + if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize ); VRCLIENT_CALL( IVRInput_IVRInput_010_GetSkeletalActionData, ¶ms ); + if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize ); return params._ret; } @@ -2558,15 +2662,19 @@ uint32_t __thiscall winIVRInput_IVRInput_010_GetOriginLocalizedName(struct w_ste uint32_t __thiscall winIVRInput_IVRInput_010_GetOriginTrackedDeviceInfo(struct w_steam_iface *_this, uint64_t origin, w_InputOriginInfo_t *pOriginInfo, uint32_t unOriginInfoSize) { + w_InputOriginInfo_t w_pOriginInfo; struct IVRInput_IVRInput_010_GetOriginTrackedDeviceInfo_params params = { .linux_side = _this->u_iface, .origin = origin, - .pOriginInfo = pOriginInfo, + .pOriginInfo = pOriginInfo ? &w_pOriginInfo : NULL, .unOriginInfoSize = unOriginInfoSize, }; TRACE("%p\n", _this); + unOriginInfoSize = min( unOriginInfoSize, sizeof(w_pOriginInfo) ); + if (pOriginInfo) memcpy( &w_pOriginInfo, pOriginInfo, unOriginInfoSize ); VRCLIENT_CALL( IVRInput_IVRInput_010_GetOriginTrackedDeviceInfo, ¶ms ); + if (pOriginInfo) memcpy( pOriginInfo, &w_pOriginInfo, unOriginInfoSize ); return params._ret; } diff --git a/vrclient_x64/winIVROverlay.c b/vrclient_x64/winIVROverlay.c index 6709c2cd..aa47e52c 100644 --- a/vrclient_x64/winIVROverlay.c +++ b/vrclient_x64/winIVROverlay.c @@ -6385,15 +6385,19 @@ uint32_t __thiscall winIVROverlay_IVROverlay_010_GetTransformForOverlayCoordinat int8_t __thiscall winIVROverlay_IVROverlay_010_PollNextOverlayEvent(struct w_steam_iface *_this, uint64_t ulOverlayHandle, w_VREvent_t_0918 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_0918 w_pEvent; struct IVROverlay_IVROverlay_010_PollNextOverlayEvent_params params = { .linux_side = _this->u_iface, .ulOverlayHandle = ulOverlayHandle, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVROverlay_IVROverlay_010_PollNextOverlayEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -7478,15 +7482,19 @@ uint32_t __thiscall winIVROverlay_IVROverlay_011_GetTransformForOverlayCoordinat int8_t __thiscall winIVROverlay_IVROverlay_011_PollNextOverlayEvent(struct w_steam_iface *_this, uint64_t ulOverlayHandle, w_VREvent_t_0918 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_0918 w_pEvent; struct IVROverlay_IVROverlay_011_PollNextOverlayEvent_params params = { .linux_side = _this->u_iface, .ulOverlayHandle = ulOverlayHandle, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVROverlay_IVROverlay_011_PollNextOverlayEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -8612,15 +8620,19 @@ uint32_t __thiscall winIVROverlay_IVROverlay_012_GetTransformForOverlayCoordinat int8_t __thiscall winIVROverlay_IVROverlay_012_PollNextOverlayEvent(struct w_steam_iface *_this, uint64_t ulOverlayHandle, w_VREvent_t_101 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_101 w_pEvent; struct IVROverlay_IVROverlay_012_PollNextOverlayEvent_params params = { .linux_side = _this->u_iface, .ulOverlayHandle = ulOverlayHandle, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVROverlay_IVROverlay_012_PollNextOverlayEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -9819,15 +9831,19 @@ uint32_t __thiscall winIVROverlay_IVROverlay_013_GetTransformForOverlayCoordinat int8_t __thiscall winIVROverlay_IVROverlay_013_PollNextOverlayEvent(struct w_steam_iface *_this, uint64_t ulOverlayHandle, w_VREvent_t_103 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_103 w_pEvent; struct IVROverlay_IVROverlay_013_PollNextOverlayEvent_params params = { .linux_side = _this->u_iface, .ulOverlayHandle = ulOverlayHandle, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVROverlay_IVROverlay_013_PollNextOverlayEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -11053,15 +11069,19 @@ uint32_t __thiscall winIVROverlay_IVROverlay_014_GetTransformForOverlayCoordinat int8_t __thiscall winIVROverlay_IVROverlay_014_PollNextOverlayEvent(struct w_steam_iface *_this, uint64_t ulOverlayHandle, w_VREvent_t_106 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_106 w_pEvent; struct IVROverlay_IVROverlay_014_PollNextOverlayEvent_params params = { .linux_side = _this->u_iface, .ulOverlayHandle = ulOverlayHandle, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVROverlay_IVROverlay_014_PollNextOverlayEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -12399,15 +12419,19 @@ uint32_t __thiscall winIVROverlay_IVROverlay_016_GetTransformForOverlayCoordinat int8_t __thiscall winIVROverlay_IVROverlay_016_PollNextOverlayEvent(struct w_steam_iface *_this, uint64_t ulOverlayHandle, w_VREvent_t_106 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_106 w_pEvent; struct IVROverlay_IVROverlay_016_PollNextOverlayEvent_params params = { .linux_side = _this->u_iface, .ulOverlayHandle = ulOverlayHandle, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVROverlay_IVROverlay_016_PollNextOverlayEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -13769,15 +13793,19 @@ uint32_t __thiscall winIVROverlay_IVROverlay_017_GetTransformForOverlayCoordinat int8_t __thiscall winIVROverlay_IVROverlay_017_PollNextOverlayEvent(struct w_steam_iface *_this, uint64_t ulOverlayHandle, w_VREvent_t_1011 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_1011 w_pEvent; struct IVROverlay_IVROverlay_017_PollNextOverlayEvent_params params = { .linux_side = _this->u_iface, .ulOverlayHandle = ulOverlayHandle, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVROverlay_IVROverlay_017_PollNextOverlayEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -15172,15 +15200,19 @@ uint32_t __thiscall winIVROverlay_IVROverlay_018_GetTransformForOverlayCoordinat int8_t __thiscall winIVROverlay_IVROverlay_018_PollNextOverlayEvent(struct w_steam_iface *_this, uint64_t ulOverlayHandle, w_VREvent_t_1016 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_1016 w_pEvent; struct IVROverlay_IVROverlay_018_PollNextOverlayEvent_params params = { .linux_side = _this->u_iface, .ulOverlayHandle = ulOverlayHandle, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVROverlay_IVROverlay_018_PollNextOverlayEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -16560,15 +16592,19 @@ uint32_t __thiscall winIVROverlay_IVROverlay_019_GetTransformForOverlayCoordinat int8_t __thiscall winIVROverlay_IVROverlay_019_PollNextOverlayEvent(struct w_steam_iface *_this, uint64_t ulOverlayHandle, w_VREvent_t_1322 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_1322 w_pEvent; struct IVROverlay_IVROverlay_019_PollNextOverlayEvent_params params = { .linux_side = _this->u_iface, .ulOverlayHandle = ulOverlayHandle, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVROverlay_IVROverlay_019_PollNextOverlayEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -17923,15 +17959,19 @@ uint32_t __thiscall winIVROverlay_IVROverlay_020_GetTransformForOverlayCoordinat int8_t __thiscall winIVROverlay_IVROverlay_020_PollNextOverlayEvent(struct w_steam_iface *_this, uint64_t ulOverlayHandle, w_VREvent_t_1322 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_1322 w_pEvent; struct IVROverlay_IVROverlay_020_PollNextOverlayEvent_params params = { .linux_side = _this->u_iface, .ulOverlayHandle = ulOverlayHandle, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVROverlay_IVROverlay_020_PollNextOverlayEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -19276,15 +19316,19 @@ uint32_t __thiscall winIVROverlay_IVROverlay_021_GetTransformForOverlayCoordinat int8_t __thiscall winIVROverlay_IVROverlay_021_PollNextOverlayEvent(struct w_steam_iface *_this, uint64_t ulOverlayHandle, w_VREvent_t_1322 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_1322 w_pEvent; struct IVROverlay_IVROverlay_021_PollNextOverlayEvent_params params = { .linux_side = _this->u_iface, .ulOverlayHandle = ulOverlayHandle, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVROverlay_IVROverlay_021_PollNextOverlayEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -20616,15 +20660,19 @@ uint32_t __thiscall winIVROverlay_IVROverlay_022_GetTransformForOverlayCoordinat int8_t __thiscall winIVROverlay_IVROverlay_022_PollNextOverlayEvent(struct w_steam_iface *_this, uint64_t ulOverlayHandle, w_VREvent_t_1322 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_1322 w_pEvent; struct IVROverlay_IVROverlay_022_PollNextOverlayEvent_params params = { .linux_side = _this->u_iface, .ulOverlayHandle = ulOverlayHandle, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVROverlay_IVROverlay_022_PollNextOverlayEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -21974,15 +22022,19 @@ uint32_t __thiscall winIVROverlay_IVROverlay_024_GetTransformForOverlayCoordinat int8_t __thiscall winIVROverlay_IVROverlay_024_PollNextOverlayEvent(struct w_steam_iface *_this, uint64_t ulOverlayHandle, w_VREvent_t_11030 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_11030 w_pEvent; struct IVROverlay_IVROverlay_024_PollNextOverlayEvent_params params = { .linux_side = _this->u_iface, .ulOverlayHandle = ulOverlayHandle, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVROverlay_IVROverlay_024_PollNextOverlayEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -23311,15 +23363,19 @@ uint32_t __thiscall winIVROverlay_IVROverlay_025_GetTransformForOverlayCoordinat int8_t __thiscall winIVROverlay_IVROverlay_025_PollNextOverlayEvent(struct w_steam_iface *_this, uint64_t ulOverlayHandle, w_VREvent_t_1168 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_1168 w_pEvent; struct IVROverlay_IVROverlay_025_PollNextOverlayEvent_params params = { .linux_side = _this->u_iface, .ulOverlayHandle = ulOverlayHandle, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVROverlay_IVROverlay_025_PollNextOverlayEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -24691,15 +24747,19 @@ uint32_t __thiscall winIVROverlay_IVROverlay_026_WaitFrameSync(struct w_steam_if int8_t __thiscall winIVROverlay_IVROverlay_026_PollNextOverlayEvent(struct w_steam_iface *_this, uint64_t ulOverlayHandle, w_VREvent_t_1168 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_1168 w_pEvent; struct IVROverlay_IVROverlay_026_PollNextOverlayEvent_params params = { .linux_side = _this->u_iface, .ulOverlayHandle = ulOverlayHandle, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVROverlay_IVROverlay_026_PollNextOverlayEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -26047,15 +26107,19 @@ uint32_t __thiscall winIVROverlay_IVROverlay_027_WaitFrameSync(struct w_steam_if int8_t __thiscall winIVROverlay_IVROverlay_027_PollNextOverlayEvent(struct w_steam_iface *_this, uint64_t ulOverlayHandle, w_VREvent_t_1168 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_1168 w_pEvent; struct IVROverlay_IVROverlay_027_PollNextOverlayEvent_params params = { .linux_side = _this->u_iface, .ulOverlayHandle = ulOverlayHandle, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVROverlay_IVROverlay_027_PollNextOverlayEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } diff --git a/vrclient_x64/winIVRSystem.c b/vrclient_x64/winIVRSystem.c index b9c298a4..ed1ecb75 100644 --- a/vrclient_x64/winIVRSystem.c +++ b/vrclient_x64/winIVRSystem.c @@ -4475,29 +4475,37 @@ const char * __thiscall winIVRSystem_IVRSystem_011_GetPropErrorNameFromEnum(stru int8_t __thiscall winIVRSystem_IVRSystem_011_PollNextEvent(struct w_steam_iface *_this, w_VREvent_t_0918 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_0918 w_pEvent; struct IVRSystem_IVRSystem_011_PollNextEvent_params params = { .linux_side = _this->u_iface, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_011_PollNextEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_011_PollNextEventWithPose(struct w_steam_iface *_this, uint32_t eOrigin, w_VREvent_t_0918 *pEvent, uint32_t uncbVREvent, TrackedDevicePose_t *pTrackedDevicePose) { + w_VREvent_t_0918 w_pEvent; struct IVRSystem_IVRSystem_011_PollNextEventWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_011_PollNextEventWithPose, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -5233,29 +5241,37 @@ const char * __thiscall winIVRSystem_IVRSystem_012_GetPropErrorNameFromEnum(stru int8_t __thiscall winIVRSystem_IVRSystem_012_PollNextEvent(struct w_steam_iface *_this, w_VREvent_t_103 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_103 w_pEvent; struct IVRSystem_IVRSystem_012_PollNextEvent_params params = { .linux_side = _this->u_iface, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_012_PollNextEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_012_PollNextEventWithPose(struct w_steam_iface *_this, uint32_t eOrigin, w_VREvent_t_103 *pEvent, uint32_t uncbVREvent, TrackedDevicePose_t *pTrackedDevicePose) { + w_VREvent_t_103 w_pEvent; struct IVRSystem_IVRSystem_012_PollNextEventWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_012_PollNextEventWithPose, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -5965,29 +5981,37 @@ const char * __thiscall winIVRSystem_IVRSystem_014_GetPropErrorNameFromEnum(stru int8_t __thiscall winIVRSystem_IVRSystem_014_PollNextEvent(struct w_steam_iface *_this, w_VREvent_t_103 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_103 w_pEvent; struct IVRSystem_IVRSystem_014_PollNextEvent_params params = { .linux_side = _this->u_iface, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_014_PollNextEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_014_PollNextEventWithPose(struct w_steam_iface *_this, uint32_t eOrigin, w_VREvent_t_103 *pEvent, uint32_t uncbVREvent, TrackedDevicePose_t *pTrackedDevicePose) { + w_VREvent_t_103 w_pEvent; struct IVRSystem_IVRSystem_014_PollNextEventWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_014_PollNextEventWithPose, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -6019,31 +6043,39 @@ w_HiddenAreaMesh_t * __thiscall winIVRSystem_IVRSystem_014_GetHiddenAreaMesh(str int8_t __thiscall winIVRSystem_IVRSystem_014_GetControllerState(struct w_steam_iface *_this, uint32_t unControllerDeviceIndex, w_VRControllerState001_t *pControllerState, uint32_t unControllerStateSize) { + w_VRControllerState001_t w_pControllerState; struct IVRSystem_IVRSystem_014_GetControllerState_params params = { .linux_side = _this->u_iface, .unControllerDeviceIndex = unControllerDeviceIndex, - .pControllerState = pControllerState, + .pControllerState = pControllerState ? &w_pControllerState : NULL, .unControllerStateSize = unControllerStateSize, }; TRACE("%p\n", _this); + unControllerStateSize = min( unControllerStateSize, sizeof(w_pControllerState) ); + if (pControllerState) memcpy( &w_pControllerState, pControllerState, unControllerStateSize ); VRCLIENT_CALL( IVRSystem_IVRSystem_014_GetControllerState, ¶ms ); + if (pControllerState) memcpy( pControllerState, &w_pControllerState, unControllerStateSize ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_014_GetControllerStateWithPose(struct w_steam_iface *_this, uint32_t eOrigin, uint32_t unControllerDeviceIndex, w_VRControllerState001_t *pControllerState, uint32_t unControllerStateSize, TrackedDevicePose_t *pTrackedDevicePose) { + w_VRControllerState001_t w_pControllerState; struct IVRSystem_IVRSystem_014_GetControllerStateWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, .unControllerDeviceIndex = unControllerDeviceIndex, - .pControllerState = pControllerState, + .pControllerState = pControllerState ? &w_pControllerState : NULL, .unControllerStateSize = unControllerStateSize, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + unControllerStateSize = min( unControllerStateSize, sizeof(w_pControllerState) ); + if (pControllerState) memcpy( &w_pControllerState, pControllerState, unControllerStateSize ); VRCLIENT_CALL( IVRSystem_IVRSystem_014_GetControllerStateWithPose, ¶ms ); + if (pControllerState) memcpy( pControllerState, &w_pControllerState, unControllerStateSize ); return params._ret; } @@ -6699,29 +6731,37 @@ const char * __thiscall winIVRSystem_IVRSystem_015_GetPropErrorNameFromEnum(stru int8_t __thiscall winIVRSystem_IVRSystem_015_PollNextEvent(struct w_steam_iface *_this, w_VREvent_t_106 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_106 w_pEvent; struct IVRSystem_IVRSystem_015_PollNextEvent_params params = { .linux_side = _this->u_iface, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_015_PollNextEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_015_PollNextEventWithPose(struct w_steam_iface *_this, uint32_t eOrigin, w_VREvent_t_106 *pEvent, uint32_t uncbVREvent, TrackedDevicePose_t *pTrackedDevicePose) { + w_VREvent_t_106 w_pEvent; struct IVRSystem_IVRSystem_015_PollNextEventWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_015_PollNextEventWithPose, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -6753,31 +6793,39 @@ w_HiddenAreaMesh_t * __thiscall winIVRSystem_IVRSystem_015_GetHiddenAreaMesh(str int8_t __thiscall winIVRSystem_IVRSystem_015_GetControllerState(struct w_steam_iface *_this, uint32_t unControllerDeviceIndex, w_VRControllerState001_t *pControllerState, uint32_t unControllerStateSize) { + w_VRControllerState001_t w_pControllerState; struct IVRSystem_IVRSystem_015_GetControllerState_params params = { .linux_side = _this->u_iface, .unControllerDeviceIndex = unControllerDeviceIndex, - .pControllerState = pControllerState, + .pControllerState = pControllerState ? &w_pControllerState : NULL, .unControllerStateSize = unControllerStateSize, }; TRACE("%p\n", _this); + unControllerStateSize = min( unControllerStateSize, sizeof(w_pControllerState) ); + if (pControllerState) memcpy( &w_pControllerState, pControllerState, unControllerStateSize ); VRCLIENT_CALL( IVRSystem_IVRSystem_015_GetControllerState, ¶ms ); + if (pControllerState) memcpy( pControllerState, &w_pControllerState, unControllerStateSize ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_015_GetControllerStateWithPose(struct w_steam_iface *_this, uint32_t eOrigin, uint32_t unControllerDeviceIndex, w_VRControllerState001_t *pControllerState, uint32_t unControllerStateSize, TrackedDevicePose_t *pTrackedDevicePose) { + w_VRControllerState001_t w_pControllerState; struct IVRSystem_IVRSystem_015_GetControllerStateWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, .unControllerDeviceIndex = unControllerDeviceIndex, - .pControllerState = pControllerState, + .pControllerState = pControllerState ? &w_pControllerState : NULL, .unControllerStateSize = unControllerStateSize, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + unControllerStateSize = min( unControllerStateSize, sizeof(w_pControllerState) ); + if (pControllerState) memcpy( &w_pControllerState, pControllerState, unControllerStateSize ); VRCLIENT_CALL( IVRSystem_IVRSystem_015_GetControllerStateWithPose, ¶ms ); + if (pControllerState) memcpy( pControllerState, &w_pControllerState, unControllerStateSize ); return params._ret; } @@ -7446,29 +7494,37 @@ const char * __thiscall winIVRSystem_IVRSystem_016_GetPropErrorNameFromEnum(stru int8_t __thiscall winIVRSystem_IVRSystem_016_PollNextEvent(struct w_steam_iface *_this, w_VREvent_t_106 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_106 w_pEvent; struct IVRSystem_IVRSystem_016_PollNextEvent_params params = { .linux_side = _this->u_iface, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_016_PollNextEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_016_PollNextEventWithPose(struct w_steam_iface *_this, uint32_t eOrigin, w_VREvent_t_106 *pEvent, uint32_t uncbVREvent, TrackedDevicePose_t *pTrackedDevicePose) { + w_VREvent_t_106 w_pEvent; struct IVRSystem_IVRSystem_016_PollNextEventWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_016_PollNextEventWithPose, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -7500,31 +7556,39 @@ w_HiddenAreaMesh_t * __thiscall winIVRSystem_IVRSystem_016_GetHiddenAreaMesh(str int8_t __thiscall winIVRSystem_IVRSystem_016_GetControllerState(struct w_steam_iface *_this, uint32_t unControllerDeviceIndex, w_VRControllerState001_t *pControllerState, uint32_t unControllerStateSize) { + w_VRControllerState001_t w_pControllerState; struct IVRSystem_IVRSystem_016_GetControllerState_params params = { .linux_side = _this->u_iface, .unControllerDeviceIndex = unControllerDeviceIndex, - .pControllerState = pControllerState, + .pControllerState = pControllerState ? &w_pControllerState : NULL, .unControllerStateSize = unControllerStateSize, }; TRACE("%p\n", _this); + unControllerStateSize = min( unControllerStateSize, sizeof(w_pControllerState) ); + if (pControllerState) memcpy( &w_pControllerState, pControllerState, unControllerStateSize ); VRCLIENT_CALL( IVRSystem_IVRSystem_016_GetControllerState, ¶ms ); + if (pControllerState) memcpy( pControllerState, &w_pControllerState, unControllerStateSize ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_016_GetControllerStateWithPose(struct w_steam_iface *_this, uint32_t eOrigin, uint32_t unControllerDeviceIndex, w_VRControllerState001_t *pControllerState, uint32_t unControllerStateSize, TrackedDevicePose_t *pTrackedDevicePose) { + w_VRControllerState001_t w_pControllerState; struct IVRSystem_IVRSystem_016_GetControllerStateWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, .unControllerDeviceIndex = unControllerDeviceIndex, - .pControllerState = pControllerState, + .pControllerState = pControllerState ? &w_pControllerState : NULL, .unControllerStateSize = unControllerStateSize, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + unControllerStateSize = min( unControllerStateSize, sizeof(w_pControllerState) ); + if (pControllerState) memcpy( &w_pControllerState, pControllerState, unControllerStateSize ); VRCLIENT_CALL( IVRSystem_IVRSystem_016_GetControllerStateWithPose, ¶ms ); + if (pControllerState) memcpy( pControllerState, &w_pControllerState, unControllerStateSize ); return params._ret; } @@ -8196,29 +8260,37 @@ const char * __thiscall winIVRSystem_IVRSystem_017_GetPropErrorNameFromEnum(stru int8_t __thiscall winIVRSystem_IVRSystem_017_PollNextEvent(struct w_steam_iface *_this, w_VREvent_t_1011 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_1011 w_pEvent; struct IVRSystem_IVRSystem_017_PollNextEvent_params params = { .linux_side = _this->u_iface, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_017_PollNextEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_017_PollNextEventWithPose(struct w_steam_iface *_this, uint32_t eOrigin, w_VREvent_t_1011 *pEvent, uint32_t uncbVREvent, TrackedDevicePose_t *pTrackedDevicePose) { + w_VREvent_t_1011 w_pEvent; struct IVRSystem_IVRSystem_017_PollNextEventWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_017_PollNextEventWithPose, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -8250,31 +8322,39 @@ w_HiddenAreaMesh_t * __thiscall winIVRSystem_IVRSystem_017_GetHiddenAreaMesh(str int8_t __thiscall winIVRSystem_IVRSystem_017_GetControllerState(struct w_steam_iface *_this, uint32_t unControllerDeviceIndex, w_VRControllerState001_t *pControllerState, uint32_t unControllerStateSize) { + w_VRControllerState001_t w_pControllerState; struct IVRSystem_IVRSystem_017_GetControllerState_params params = { .linux_side = _this->u_iface, .unControllerDeviceIndex = unControllerDeviceIndex, - .pControllerState = pControllerState, + .pControllerState = pControllerState ? &w_pControllerState : NULL, .unControllerStateSize = unControllerStateSize, }; TRACE("%p\n", _this); + unControllerStateSize = min( unControllerStateSize, sizeof(w_pControllerState) ); + if (pControllerState) memcpy( &w_pControllerState, pControllerState, unControllerStateSize ); VRCLIENT_CALL( IVRSystem_IVRSystem_017_GetControllerState, ¶ms ); + if (pControllerState) memcpy( pControllerState, &w_pControllerState, unControllerStateSize ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_017_GetControllerStateWithPose(struct w_steam_iface *_this, uint32_t eOrigin, uint32_t unControllerDeviceIndex, w_VRControllerState001_t *pControllerState, uint32_t unControllerStateSize, TrackedDevicePose_t *pTrackedDevicePose) { + w_VRControllerState001_t w_pControllerState; struct IVRSystem_IVRSystem_017_GetControllerStateWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, .unControllerDeviceIndex = unControllerDeviceIndex, - .pControllerState = pControllerState, + .pControllerState = pControllerState ? &w_pControllerState : NULL, .unControllerStateSize = unControllerStateSize, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + unControllerStateSize = min( unControllerStateSize, sizeof(w_pControllerState) ); + if (pControllerState) memcpy( &w_pControllerState, pControllerState, unControllerStateSize ); VRCLIENT_CALL( IVRSystem_IVRSystem_017_GetControllerStateWithPose, ¶ms ); + if (pControllerState) memcpy( pControllerState, &w_pControllerState, unControllerStateSize ); return params._ret; } @@ -8965,29 +9045,37 @@ const char * __thiscall winIVRSystem_IVRSystem_019_GetPropErrorNameFromEnum(stru int8_t __thiscall winIVRSystem_IVRSystem_019_PollNextEvent(struct w_steam_iface *_this, w_VREvent_t_1322 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_1322 w_pEvent; struct IVRSystem_IVRSystem_019_PollNextEvent_params params = { .linux_side = _this->u_iface, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_019_PollNextEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_019_PollNextEventWithPose(struct w_steam_iface *_this, uint32_t eOrigin, w_VREvent_t_1322 *pEvent, uint32_t uncbVREvent, TrackedDevicePose_t *pTrackedDevicePose) { + w_VREvent_t_1322 w_pEvent; struct IVRSystem_IVRSystem_019_PollNextEventWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_019_PollNextEventWithPose, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -9019,31 +9107,39 @@ w_HiddenAreaMesh_t * __thiscall winIVRSystem_IVRSystem_019_GetHiddenAreaMesh(str int8_t __thiscall winIVRSystem_IVRSystem_019_GetControllerState(struct w_steam_iface *_this, uint32_t unControllerDeviceIndex, w_VRControllerState001_t *pControllerState, uint32_t unControllerStateSize) { + w_VRControllerState001_t w_pControllerState; struct IVRSystem_IVRSystem_019_GetControllerState_params params = { .linux_side = _this->u_iface, .unControllerDeviceIndex = unControllerDeviceIndex, - .pControllerState = pControllerState, + .pControllerState = pControllerState ? &w_pControllerState : NULL, .unControllerStateSize = unControllerStateSize, }; TRACE("%p\n", _this); + unControllerStateSize = min( unControllerStateSize, sizeof(w_pControllerState) ); + if (pControllerState) memcpy( &w_pControllerState, pControllerState, unControllerStateSize ); VRCLIENT_CALL( IVRSystem_IVRSystem_019_GetControllerState, ¶ms ); + if (pControllerState) memcpy( pControllerState, &w_pControllerState, unControllerStateSize ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_019_GetControllerStateWithPose(struct w_steam_iface *_this, uint32_t eOrigin, uint32_t unControllerDeviceIndex, w_VRControllerState001_t *pControllerState, uint32_t unControllerStateSize, TrackedDevicePose_t *pTrackedDevicePose) { + w_VRControllerState001_t w_pControllerState; struct IVRSystem_IVRSystem_019_GetControllerStateWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, .unControllerDeviceIndex = unControllerDeviceIndex, - .pControllerState = pControllerState, + .pControllerState = pControllerState ? &w_pControllerState : NULL, .unControllerStateSize = unControllerStateSize, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + unControllerStateSize = min( unControllerStateSize, sizeof(w_pControllerState) ); + if (pControllerState) memcpy( &w_pControllerState, pControllerState, unControllerStateSize ); VRCLIENT_CALL( IVRSystem_IVRSystem_019_GetControllerStateWithPose, ¶ms ); + if (pControllerState) memcpy( pControllerState, &w_pControllerState, unControllerStateSize ); return params._ret; } @@ -9751,29 +9847,37 @@ const char * __thiscall winIVRSystem_IVRSystem_020_GetPropErrorNameFromEnum(stru int8_t __thiscall winIVRSystem_IVRSystem_020_PollNextEvent(struct w_steam_iface *_this, w_VREvent_t_1322 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_1322 w_pEvent; struct IVRSystem_IVRSystem_020_PollNextEvent_params params = { .linux_side = _this->u_iface, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_020_PollNextEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_020_PollNextEventWithPose(struct w_steam_iface *_this, uint32_t eOrigin, w_VREvent_t_1322 *pEvent, uint32_t uncbVREvent, TrackedDevicePose_t *pTrackedDevicePose) { + w_VREvent_t_1322 w_pEvent; struct IVRSystem_IVRSystem_020_PollNextEventWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_020_PollNextEventWithPose, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -9805,31 +9909,39 @@ w_HiddenAreaMesh_t * __thiscall winIVRSystem_IVRSystem_020_GetHiddenAreaMesh(str int8_t __thiscall winIVRSystem_IVRSystem_020_GetControllerState(struct w_steam_iface *_this, uint32_t unControllerDeviceIndex, w_VRControllerState001_t *pControllerState, uint32_t unControllerStateSize) { + w_VRControllerState001_t w_pControllerState; struct IVRSystem_IVRSystem_020_GetControllerState_params params = { .linux_side = _this->u_iface, .unControllerDeviceIndex = unControllerDeviceIndex, - .pControllerState = pControllerState, + .pControllerState = pControllerState ? &w_pControllerState : NULL, .unControllerStateSize = unControllerStateSize, }; TRACE("%p\n", _this); + unControllerStateSize = min( unControllerStateSize, sizeof(w_pControllerState) ); + if (pControllerState) memcpy( &w_pControllerState, pControllerState, unControllerStateSize ); VRCLIENT_CALL( IVRSystem_IVRSystem_020_GetControllerState, ¶ms ); + if (pControllerState) memcpy( pControllerState, &w_pControllerState, unControllerStateSize ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_020_GetControllerStateWithPose(struct w_steam_iface *_this, uint32_t eOrigin, uint32_t unControllerDeviceIndex, w_VRControllerState001_t *pControllerState, uint32_t unControllerStateSize, TrackedDevicePose_t *pTrackedDevicePose) { + w_VRControllerState001_t w_pControllerState; struct IVRSystem_IVRSystem_020_GetControllerStateWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, .unControllerDeviceIndex = unControllerDeviceIndex, - .pControllerState = pControllerState, + .pControllerState = pControllerState ? &w_pControllerState : NULL, .unControllerStateSize = unControllerStateSize, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + unControllerStateSize = min( unControllerStateSize, sizeof(w_pControllerState) ); + if (pControllerState) memcpy( &w_pControllerState, pControllerState, unControllerStateSize ); VRCLIENT_CALL( IVRSystem_IVRSystem_020_GetControllerStateWithPose, ¶ms ); + if (pControllerState) memcpy( pControllerState, &w_pControllerState, unControllerStateSize ); return params._ret; } @@ -10547,29 +10659,37 @@ const char * __thiscall winIVRSystem_IVRSystem_021_GetPropErrorNameFromEnum(stru int8_t __thiscall winIVRSystem_IVRSystem_021_PollNextEvent(struct w_steam_iface *_this, w_VREvent_t_11030 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_11030 w_pEvent; struct IVRSystem_IVRSystem_021_PollNextEvent_params params = { .linux_side = _this->u_iface, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_021_PollNextEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_021_PollNextEventWithPose(struct w_steam_iface *_this, uint32_t eOrigin, w_VREvent_t_11030 *pEvent, uint32_t uncbVREvent, TrackedDevicePose_t *pTrackedDevicePose) { + w_VREvent_t_11030 w_pEvent; struct IVRSystem_IVRSystem_021_PollNextEventWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_021_PollNextEventWithPose, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -10601,31 +10721,39 @@ w_HiddenAreaMesh_t * __thiscall winIVRSystem_IVRSystem_021_GetHiddenAreaMesh(str int8_t __thiscall winIVRSystem_IVRSystem_021_GetControllerState(struct w_steam_iface *_this, uint32_t unControllerDeviceIndex, w_VRControllerState001_t *pControllerState, uint32_t unControllerStateSize) { + w_VRControllerState001_t w_pControllerState; struct IVRSystem_IVRSystem_021_GetControllerState_params params = { .linux_side = _this->u_iface, .unControllerDeviceIndex = unControllerDeviceIndex, - .pControllerState = pControllerState, + .pControllerState = pControllerState ? &w_pControllerState : NULL, .unControllerStateSize = unControllerStateSize, }; TRACE("%p\n", _this); + unControllerStateSize = min( unControllerStateSize, sizeof(w_pControllerState) ); + if (pControllerState) memcpy( &w_pControllerState, pControllerState, unControllerStateSize ); VRCLIENT_CALL( IVRSystem_IVRSystem_021_GetControllerState, ¶ms ); + if (pControllerState) memcpy( pControllerState, &w_pControllerState, unControllerStateSize ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_021_GetControllerStateWithPose(struct w_steam_iface *_this, uint32_t eOrigin, uint32_t unControllerDeviceIndex, w_VRControllerState001_t *pControllerState, uint32_t unControllerStateSize, TrackedDevicePose_t *pTrackedDevicePose) { + w_VRControllerState001_t w_pControllerState; struct IVRSystem_IVRSystem_021_GetControllerStateWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, .unControllerDeviceIndex = unControllerDeviceIndex, - .pControllerState = pControllerState, + .pControllerState = pControllerState ? &w_pControllerState : NULL, .unControllerStateSize = unControllerStateSize, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + unControllerStateSize = min( unControllerStateSize, sizeof(w_pControllerState) ); + if (pControllerState) memcpy( &w_pControllerState, pControllerState, unControllerStateSize ); VRCLIENT_CALL( IVRSystem_IVRSystem_021_GetControllerStateWithPose, ¶ms ); + if (pControllerState) memcpy( pControllerState, &w_pControllerState, unControllerStateSize ); return params._ret; } @@ -11320,29 +11448,37 @@ const char * __thiscall winIVRSystem_IVRSystem_022_GetPropErrorNameFromEnum(stru int8_t __thiscall winIVRSystem_IVRSystem_022_PollNextEvent(struct w_steam_iface *_this, w_VREvent_t_1168 *pEvent, uint32_t uncbVREvent) { + w_VREvent_t_1168 w_pEvent; struct IVRSystem_IVRSystem_022_PollNextEvent_params params = { .linux_side = _this->u_iface, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_022_PollNextEvent, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_022_PollNextEventWithPose(struct w_steam_iface *_this, uint32_t eOrigin, w_VREvent_t_1168 *pEvent, uint32_t uncbVREvent, TrackedDevicePose_t *pTrackedDevicePose) { + w_VREvent_t_1168 w_pEvent; struct IVRSystem_IVRSystem_022_PollNextEventWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, - .pEvent = pEvent, + .pEvent = pEvent ? &w_pEvent : NULL, .uncbVREvent = uncbVREvent, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + uncbVREvent = min( uncbVREvent, sizeof(w_pEvent) ); + if (pEvent) memcpy( &w_pEvent, pEvent, uncbVREvent ); VRCLIENT_CALL( IVRSystem_IVRSystem_022_PollNextEventWithPose, ¶ms ); + if (pEvent) memcpy( pEvent, &w_pEvent, uncbVREvent ); return params._ret; } @@ -11374,31 +11510,39 @@ w_HiddenAreaMesh_t * __thiscall winIVRSystem_IVRSystem_022_GetHiddenAreaMesh(str int8_t __thiscall winIVRSystem_IVRSystem_022_GetControllerState(struct w_steam_iface *_this, uint32_t unControllerDeviceIndex, w_VRControllerState001_t *pControllerState, uint32_t unControllerStateSize) { + w_VRControllerState001_t w_pControllerState; struct IVRSystem_IVRSystem_022_GetControllerState_params params = { .linux_side = _this->u_iface, .unControllerDeviceIndex = unControllerDeviceIndex, - .pControllerState = pControllerState, + .pControllerState = pControllerState ? &w_pControllerState : NULL, .unControllerStateSize = unControllerStateSize, }; TRACE("%p\n", _this); + unControllerStateSize = min( unControllerStateSize, sizeof(w_pControllerState) ); + if (pControllerState) memcpy( &w_pControllerState, pControllerState, unControllerStateSize ); VRCLIENT_CALL( IVRSystem_IVRSystem_022_GetControllerState, ¶ms ); + if (pControllerState) memcpy( pControllerState, &w_pControllerState, unControllerStateSize ); return params._ret; } int8_t __thiscall winIVRSystem_IVRSystem_022_GetControllerStateWithPose(struct w_steam_iface *_this, uint32_t eOrigin, uint32_t unControllerDeviceIndex, w_VRControllerState001_t *pControllerState, uint32_t unControllerStateSize, TrackedDevicePose_t *pTrackedDevicePose) { + w_VRControllerState001_t w_pControllerState; struct IVRSystem_IVRSystem_022_GetControllerStateWithPose_params params = { .linux_side = _this->u_iface, .eOrigin = eOrigin, .unControllerDeviceIndex = unControllerDeviceIndex, - .pControllerState = pControllerState, + .pControllerState = pControllerState ? &w_pControllerState : NULL, .unControllerStateSize = unControllerStateSize, .pTrackedDevicePose = pTrackedDevicePose, }; TRACE("%p\n", _this); + unControllerStateSize = min( unControllerStateSize, sizeof(w_pControllerState) ); + if (pControllerState) memcpy( &w_pControllerState, pControllerState, unControllerStateSize ); VRCLIENT_CALL( IVRSystem_IVRSystem_022_GetControllerStateWithPose, ¶ms ); + if (pControllerState) memcpy( pControllerState, &w_pControllerState, unControllerStateSize ); return params._ret; } diff --git a/vrclient_x64/winIVRTrackedCamera.c b/vrclient_x64/winIVRTrackedCamera.c index 9c279304..e8eb0116 100644 --- a/vrclient_x64/winIVRTrackedCamera.c +++ b/vrclient_x64/winIVRTrackedCamera.c @@ -892,6 +892,7 @@ uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_004_ReleaseVideoStreami uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_004_GetVideoStreamFrameBuffer(struct w_steam_iface *_this, uint64_t hTrackedCamera, uint32_t eFrameType, void *pFrameBuffer, uint32_t nFrameBufferSize, w_CameraVideoStreamFrameHeader_t_1017 *pFrameHeader, uint32_t nFrameHeaderSize) { + w_CameraVideoStreamFrameHeader_t_1017 w_pFrameHeader; struct IVRTrackedCamera_IVRTrackedCamera_004_GetVideoStreamFrameBuffer_params params = { .linux_side = _this->u_iface, @@ -899,11 +900,14 @@ uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_004_GetVideoStreamFrame .eFrameType = eFrameType, .pFrameBuffer = pFrameBuffer, .nFrameBufferSize = nFrameBufferSize, - .pFrameHeader = pFrameHeader, + .pFrameHeader = pFrameHeader ? &w_pFrameHeader : NULL, .nFrameHeaderSize = nFrameHeaderSize, }; TRACE("%p\n", _this); + nFrameHeaderSize = min( nFrameHeaderSize, sizeof(w_pFrameHeader) ); + if (pFrameHeader) memcpy( &w_pFrameHeader, pFrameHeader, nFrameHeaderSize ); VRCLIENT_CALL( IVRTrackedCamera_IVRTrackedCamera_004_GetVideoStreamFrameBuffer, ¶ms ); + if (pFrameHeader) memcpy( pFrameHeader, &w_pFrameHeader, nFrameHeaderSize ); return params._ret; } @@ -925,6 +929,7 @@ uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_004_GetVideoStreamTextu uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_004_GetVideoStreamTextureD3D11(struct w_steam_iface *_this, uint64_t hTrackedCamera, uint32_t eFrameType, void *pD3D11DeviceOrResource, void **ppD3D11ShaderResourceView, w_CameraVideoStreamFrameHeader_t_1017 *pFrameHeader, uint32_t nFrameHeaderSize) { + w_CameraVideoStreamFrameHeader_t_1017 w_pFrameHeader; struct IVRTrackedCamera_IVRTrackedCamera_004_GetVideoStreamTextureD3D11_params params = { .linux_side = _this->u_iface, @@ -932,27 +937,34 @@ uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_004_GetVideoStreamTextu .eFrameType = eFrameType, .pD3D11DeviceOrResource = pD3D11DeviceOrResource, .ppD3D11ShaderResourceView = ppD3D11ShaderResourceView, - .pFrameHeader = pFrameHeader, + .pFrameHeader = pFrameHeader ? &w_pFrameHeader : NULL, .nFrameHeaderSize = nFrameHeaderSize, }; TRACE("%p\n", _this); + nFrameHeaderSize = min( nFrameHeaderSize, sizeof(w_pFrameHeader) ); + if (pFrameHeader) memcpy( &w_pFrameHeader, pFrameHeader, nFrameHeaderSize ); VRCLIENT_CALL( IVRTrackedCamera_IVRTrackedCamera_004_GetVideoStreamTextureD3D11, ¶ms ); + if (pFrameHeader) memcpy( pFrameHeader, &w_pFrameHeader, nFrameHeaderSize ); return params._ret; } uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_004_GetVideoStreamTextureGL(struct w_steam_iface *_this, uint64_t hTrackedCamera, uint32_t eFrameType, uint32_t *pglTextureId, w_CameraVideoStreamFrameHeader_t_1017 *pFrameHeader, uint32_t nFrameHeaderSize) { + w_CameraVideoStreamFrameHeader_t_1017 w_pFrameHeader; struct IVRTrackedCamera_IVRTrackedCamera_004_GetVideoStreamTextureGL_params params = { .linux_side = _this->u_iface, .hTrackedCamera = hTrackedCamera, .eFrameType = eFrameType, .pglTextureId = pglTextureId, - .pFrameHeader = pFrameHeader, + .pFrameHeader = pFrameHeader ? &w_pFrameHeader : NULL, .nFrameHeaderSize = nFrameHeaderSize, }; TRACE("%p\n", _this); + nFrameHeaderSize = min( nFrameHeaderSize, sizeof(w_pFrameHeader) ); + if (pFrameHeader) memcpy( &w_pFrameHeader, pFrameHeader, nFrameHeaderSize ); VRCLIENT_CALL( IVRTrackedCamera_IVRTrackedCamera_004_GetVideoStreamTextureGL, ¶ms ); + if (pFrameHeader) memcpy( pFrameHeader, &w_pFrameHeader, nFrameHeaderSize ); return params._ret; } @@ -1154,6 +1166,7 @@ uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_005_ReleaseVideoStreami uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_005_GetVideoStreamFrameBuffer(struct w_steam_iface *_this, uint64_t hTrackedCamera, uint32_t eFrameType, void *pFrameBuffer, uint32_t nFrameBufferSize, w_CameraVideoStreamFrameHeader_t_1017 *pFrameHeader, uint32_t nFrameHeaderSize) { + w_CameraVideoStreamFrameHeader_t_1017 w_pFrameHeader; struct IVRTrackedCamera_IVRTrackedCamera_005_GetVideoStreamFrameBuffer_params params = { .linux_side = _this->u_iface, @@ -1161,11 +1174,14 @@ uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_005_GetVideoStreamFrame .eFrameType = eFrameType, .pFrameBuffer = pFrameBuffer, .nFrameBufferSize = nFrameBufferSize, - .pFrameHeader = pFrameHeader, + .pFrameHeader = pFrameHeader ? &w_pFrameHeader : NULL, .nFrameHeaderSize = nFrameHeaderSize, }; TRACE("%p\n", _this); + nFrameHeaderSize = min( nFrameHeaderSize, sizeof(w_pFrameHeader) ); + if (pFrameHeader) memcpy( &w_pFrameHeader, pFrameHeader, nFrameHeaderSize ); VRCLIENT_CALL( IVRTrackedCamera_IVRTrackedCamera_005_GetVideoStreamFrameBuffer, ¶ms ); + if (pFrameHeader) memcpy( pFrameHeader, &w_pFrameHeader, nFrameHeaderSize ); return params._ret; } @@ -1187,6 +1203,7 @@ uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_005_GetVideoStreamTextu uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_005_GetVideoStreamTextureD3D11(struct w_steam_iface *_this, uint64_t hTrackedCamera, uint32_t eFrameType, void *pD3D11DeviceOrResource, void **ppD3D11ShaderResourceView, w_CameraVideoStreamFrameHeader_t_1017 *pFrameHeader, uint32_t nFrameHeaderSize) { + w_CameraVideoStreamFrameHeader_t_1017 w_pFrameHeader; struct IVRTrackedCamera_IVRTrackedCamera_005_GetVideoStreamTextureD3D11_params params = { .linux_side = _this->u_iface, @@ -1194,27 +1211,34 @@ uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_005_GetVideoStreamTextu .eFrameType = eFrameType, .pD3D11DeviceOrResource = pD3D11DeviceOrResource, .ppD3D11ShaderResourceView = ppD3D11ShaderResourceView, - .pFrameHeader = pFrameHeader, + .pFrameHeader = pFrameHeader ? &w_pFrameHeader : NULL, .nFrameHeaderSize = nFrameHeaderSize, }; TRACE("%p\n", _this); + nFrameHeaderSize = min( nFrameHeaderSize, sizeof(w_pFrameHeader) ); + if (pFrameHeader) memcpy( &w_pFrameHeader, pFrameHeader, nFrameHeaderSize ); VRCLIENT_CALL( IVRTrackedCamera_IVRTrackedCamera_005_GetVideoStreamTextureD3D11, ¶ms ); + if (pFrameHeader) memcpy( pFrameHeader, &w_pFrameHeader, nFrameHeaderSize ); return params._ret; } uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_005_GetVideoStreamTextureGL(struct w_steam_iface *_this, uint64_t hTrackedCamera, uint32_t eFrameType, uint32_t *pglTextureId, w_CameraVideoStreamFrameHeader_t_1017 *pFrameHeader, uint32_t nFrameHeaderSize) { + w_CameraVideoStreamFrameHeader_t_1017 w_pFrameHeader; struct IVRTrackedCamera_IVRTrackedCamera_005_GetVideoStreamTextureGL_params params = { .linux_side = _this->u_iface, .hTrackedCamera = hTrackedCamera, .eFrameType = eFrameType, .pglTextureId = pglTextureId, - .pFrameHeader = pFrameHeader, + .pFrameHeader = pFrameHeader ? &w_pFrameHeader : NULL, .nFrameHeaderSize = nFrameHeaderSize, }; TRACE("%p\n", _this); + nFrameHeaderSize = min( nFrameHeaderSize, sizeof(w_pFrameHeader) ); + if (pFrameHeader) memcpy( &w_pFrameHeader, pFrameHeader, nFrameHeaderSize ); VRCLIENT_CALL( IVRTrackedCamera_IVRTrackedCamera_005_GetVideoStreamTextureGL, ¶ms ); + if (pFrameHeader) memcpy( pFrameHeader, &w_pFrameHeader, nFrameHeaderSize ); return params._ret; } @@ -1418,6 +1442,7 @@ uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_006_ReleaseVideoStreami uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_006_GetVideoStreamFrameBuffer(struct w_steam_iface *_this, uint64_t hTrackedCamera, uint32_t eFrameType, void *pFrameBuffer, uint32_t nFrameBufferSize, w_CameraVideoStreamFrameHeader_t_1017 *pFrameHeader, uint32_t nFrameHeaderSize) { + w_CameraVideoStreamFrameHeader_t_1017 w_pFrameHeader; struct IVRTrackedCamera_IVRTrackedCamera_006_GetVideoStreamFrameBuffer_params params = { .linux_side = _this->u_iface, @@ -1425,11 +1450,14 @@ uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_006_GetVideoStreamFrame .eFrameType = eFrameType, .pFrameBuffer = pFrameBuffer, .nFrameBufferSize = nFrameBufferSize, - .pFrameHeader = pFrameHeader, + .pFrameHeader = pFrameHeader ? &w_pFrameHeader : NULL, .nFrameHeaderSize = nFrameHeaderSize, }; TRACE("%p\n", _this); + nFrameHeaderSize = min( nFrameHeaderSize, sizeof(w_pFrameHeader) ); + if (pFrameHeader) memcpy( &w_pFrameHeader, pFrameHeader, nFrameHeaderSize ); VRCLIENT_CALL( IVRTrackedCamera_IVRTrackedCamera_006_GetVideoStreamFrameBuffer, ¶ms ); + if (pFrameHeader) memcpy( pFrameHeader, &w_pFrameHeader, nFrameHeaderSize ); return params._ret; } @@ -1451,6 +1479,7 @@ uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_006_GetVideoStreamTextu uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_006_GetVideoStreamTextureD3D11(struct w_steam_iface *_this, uint64_t hTrackedCamera, uint32_t eFrameType, void *pD3D11DeviceOrResource, void **ppD3D11ShaderResourceView, w_CameraVideoStreamFrameHeader_t_1017 *pFrameHeader, uint32_t nFrameHeaderSize) { + w_CameraVideoStreamFrameHeader_t_1017 w_pFrameHeader; struct IVRTrackedCamera_IVRTrackedCamera_006_GetVideoStreamTextureD3D11_params params = { .linux_side = _this->u_iface, @@ -1458,27 +1487,34 @@ uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_006_GetVideoStreamTextu .eFrameType = eFrameType, .pD3D11DeviceOrResource = pD3D11DeviceOrResource, .ppD3D11ShaderResourceView = ppD3D11ShaderResourceView, - .pFrameHeader = pFrameHeader, + .pFrameHeader = pFrameHeader ? &w_pFrameHeader : NULL, .nFrameHeaderSize = nFrameHeaderSize, }; TRACE("%p\n", _this); + nFrameHeaderSize = min( nFrameHeaderSize, sizeof(w_pFrameHeader) ); + if (pFrameHeader) memcpy( &w_pFrameHeader, pFrameHeader, nFrameHeaderSize ); VRCLIENT_CALL( IVRTrackedCamera_IVRTrackedCamera_006_GetVideoStreamTextureD3D11, ¶ms ); + if (pFrameHeader) memcpy( pFrameHeader, &w_pFrameHeader, nFrameHeaderSize ); return params._ret; } uint32_t __thiscall winIVRTrackedCamera_IVRTrackedCamera_006_GetVideoStreamTextureGL(struct w_steam_iface *_this, uint64_t hTrackedCamera, uint32_t eFrameType, uint32_t *pglTextureId, w_CameraVideoStreamFrameHeader_t_1017 *pFrameHeader, uint32_t nFrameHeaderSize) { + w_CameraVideoStreamFrameHeader_t_1017 w_pFrameHeader; struct IVRTrackedCamera_IVRTrackedCamera_006_GetVideoStreamTextureGL_params params = { .linux_side = _this->u_iface, .hTrackedCamera = hTrackedCamera, .eFrameType = eFrameType, .pglTextureId = pglTextureId, - .pFrameHeader = pFrameHeader, + .pFrameHeader = pFrameHeader ? &w_pFrameHeader : NULL, .nFrameHeaderSize = nFrameHeaderSize, }; TRACE("%p\n", _this); + nFrameHeaderSize = min( nFrameHeaderSize, sizeof(w_pFrameHeader) ); + if (pFrameHeader) memcpy( &w_pFrameHeader, pFrameHeader, nFrameHeaderSize ); VRCLIENT_CALL( IVRTrackedCamera_IVRTrackedCamera_006_GetVideoStreamTextureGL, ¶ms ); + if (pFrameHeader) memcpy( pFrameHeader, &w_pFrameHeader, nFrameHeaderSize ); return params._ret; }