From a50dbef090cf50e3a0208f369c49e90a46da1f3e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 5 Nov 2024 19:33:31 -0600 Subject: [PATCH] vrclient: Revert "vrclient: HACK: Fixup digital action 'bChange' parameter on 32 bit." By removing manual handling of IVRInput::GetDigitalActionData(). CW-Bug-Id: #19067 CW-Bug-Id: #24440 --- vrclient_x64/Makefile.in | 1 - vrclient_x64/gen_wrapper.py | 1 - vrclient_x64/vrinput_manual.c | 206 ---------------------------------- vrclient_x64/winIVRInput.c | 95 +++++++++++++++- 4 files changed, 90 insertions(+), 213 deletions(-) delete mode 100644 vrclient_x64/vrinput_manual.c diff --git a/vrclient_x64/Makefile.in b/vrclient_x64/Makefile.in index 0846427c..3be1b3ee 100644 --- a/vrclient_x64/Makefile.in +++ b/vrclient_x64/Makefile.in @@ -11,7 +11,6 @@ SOURCES = \ vrclient_generated.c \ vrclient_main.c \ vrcompositor_manual.c \ - vrinput_manual.c \ vroverlay_manual.c \ vrsystem_manual.c \ vrrendermodels_manual.c \ diff --git a/vrclient_x64/gen_wrapper.py b/vrclient_x64/gen_wrapper.py index dbdc048f..e03ba697 100755 --- a/vrclient_x64/gen_wrapper.py +++ b/vrclient_x64/gen_wrapper.py @@ -251,7 +251,6 @@ MANUAL_METHODS = { "IVRRenderModels_FreeRenderModel": lambda ver, abi: ver > 1, "IVRMailbox_undoc3": lambda ver, abi: abi == 'u', "IVROverlay_SetOverlayTexture": True, - "IVRInput_GetDigitalActionData": lambda ver, abi: abi == 'w' and ver > 3, "IVRTrackedCamera_GetVideoStreamFrame": True, } diff --git a/vrclient_x64/vrinput_manual.c b/vrclient_x64/vrinput_manual.c deleted file mode 100644 index 0a4cf568..00000000 --- a/vrclient_x64/vrinput_manual.c +++ /dev/null @@ -1,206 +0,0 @@ -#include "vrclient_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(vrclient); - -#ifndef __x86_64__ -static uint32_t ivrinput_get_digital_action_data( uint64_t action_handle, void *action_data, uint32_t action_data_size, - uint64_t restrict_to_device, unsigned int version ) -{ - /* Digital action state change fixup hack. */ - w_InputDigitalActionData_t *data = action_data; - LARGE_INTEGER qpf; - unsigned int i; - - TRACE( "handle %s, data %p, data_size %u, restrict %s, origin %s, state %#x, changed %#x, active %#x.\n", - wine_dbgstr_longlong( action_handle ), action_data, action_data_size, - wine_dbgstr_longlong( restrict_to_device ), wine_dbgstr_longlong( data->activeOrigin ), - data->bState, data->bChanged, data->bActive ); - - if (action_data_size != sizeof(*data)) - { - WARN( "Unexpected action_data_size %u.\n", action_data_size ); - return 0; - } - - if (!data->bActive) return 0; - - if (!compositor_data.qpf_freq.QuadPart) QueryPerformanceFrequency( &compositor_data.qpf_freq ); - QueryPerformanceCounter( &qpf ); - - for (i = 0; i < compositor_data.digital_action_count; ++i) - { - if (compositor_data.digital_actions_state[i].action == action_handle && - compositor_data.digital_actions_state[i].origin == data->activeOrigin) - { - if ((data->bChanged = (!compositor_data.digital_actions_state[i].previous_state != !data->bState))) - { - TRACE( "action %s (%s) changed to %#x, data->fUpdateTime %f.\n", - wine_dbgstr_longlong( action_handle ), - wine_dbgstr_longlong( restrict_to_device ), data->bState, data->fUpdateTime ); - - compositor_data.digital_actions_state[i].update_qpf_time = qpf; - compositor_data.digital_actions_state[i].previous_state = data->bState; - } - if (compositor_data.digital_actions_state[i].update_qpf_time.QuadPart) - data->fUpdateTime = -(float)(qpf.QuadPart - compositor_data.digital_actions_state[i].update_qpf_time.QuadPart) / compositor_data.qpf_freq.QuadPart; - - return 0; - } - } - - if (i == ARRAY_SIZE(compositor_data.digital_actions_state)) - { - static unsigned int once; - if (!once++) WARN( "Too many actions.\n" ); - return 0; - } - - compositor_data.digital_actions_state[i].action = action_handle; - compositor_data.digital_actions_state[i].origin = data->activeOrigin; - compositor_data.digital_actions_state[i].previous_state = data->bState; - compositor_data.digital_actions_state[i].update_qpf_time = qpf; - ++compositor_data.digital_action_count; - - return 0; -} -#endif - -uint32_t __thiscall winIVRInput_IVRInput_004_GetDigitalActionData( struct w_steam_iface *_this, uint64_t action, - w_InputDigitalActionData_t *pActionData, - uint32_t unActionDataSize, uint64_t ulRestrictToDevice ) -{ - w_InputDigitalActionData_t w_pActionData; - struct IVRInput_IVRInput_004_GetDigitalActionData_params params = - { - .linux_side = _this->u_iface, - .action = action, - .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 - if (params._ret) return params._ret; - return ivrinput_get_digital_action_data( action, pActionData, unActionDataSize, ulRestrictToDevice, 4 ); -#endif -} - -uint32_t __thiscall winIVRInput_IVRInput_005_GetDigitalActionData( struct w_steam_iface *_this, uint64_t action, - w_InputDigitalActionData_t *pActionData, - uint32_t unActionDataSize, uint64_t ulRestrictToDevice ) -{ - w_InputDigitalActionData_t w_pActionData; - struct IVRInput_IVRInput_005_GetDigitalActionData_params params = - { - .linux_side = _this->u_iface, - .action = action, - .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 - if (params._ret) return params._ret; - return ivrinput_get_digital_action_data( action, pActionData, unActionDataSize, ulRestrictToDevice, 5 ); -#endif -} - -uint32_t __thiscall winIVRInput_IVRInput_006_GetDigitalActionData( struct w_steam_iface *_this, uint64_t action, - w_InputDigitalActionData_t *pActionData, - uint32_t unActionDataSize, uint64_t ulRestrictToDevice ) -{ - w_InputDigitalActionData_t w_pActionData; - struct IVRInput_IVRInput_006_GetDigitalActionData_params params = - { - .linux_side = _this->u_iface, - .action = action, - .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 - if (params._ret) return params._ret; - return ivrinput_get_digital_action_data( action, pActionData, unActionDataSize, ulRestrictToDevice, 6 ); -#endif -} - -uint32_t __thiscall winIVRInput_IVRInput_007_GetDigitalActionData( struct w_steam_iface *_this, uint64_t action, - w_InputDigitalActionData_t *pActionData, - uint32_t unActionDataSize, uint64_t ulRestrictToDevice ) -{ - w_InputDigitalActionData_t w_pActionData; - struct IVRInput_IVRInput_007_GetDigitalActionData_params params = - { - .linux_side = _this->u_iface, - .action = action, - .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 - if (params._ret) return params._ret; - return ivrinput_get_digital_action_data( action, pActionData, unActionDataSize, ulRestrictToDevice, 7 ); -#endif -} - -uint32_t __thiscall winIVRInput_IVRInput_010_GetDigitalActionData( struct w_steam_iface *_this, uint64_t action, - w_InputDigitalActionData_t *pActionData, - uint32_t unActionDataSize, uint64_t ulRestrictToDevice ) -{ - w_InputDigitalActionData_t w_pActionData; - struct IVRInput_IVRInput_010_GetDigitalActionData_params params = - { - .linux_side = _this->u_iface, - .action = action, - .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 - if (params._ret) return params._ret; - return ivrinput_get_digital_action_data( action, pActionData, unActionDataSize, ulRestrictToDevice, 10 ); -#endif -} diff --git a/vrclient_x64/winIVRInput.c b/vrclient_x64/winIVRInput.c index a0992a6e..bacccc82 100644 --- a/vrclient_x64/winIVRInput.c +++ b/vrclient_x64/winIVRInput.c @@ -454,7 +454,24 @@ uint32_t __thiscall winIVRInput_IVRInput_004_UpdateActionState(struct w_steam_if return params._ret; } -extern uint32_t __thiscall winIVRInput_IVRInput_004_GetDigitalActionData(struct w_steam_iface *_this, uint64_t action, w_InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice); +uint32_t __thiscall winIVRInput_IVRInput_004_GetDigitalActionData(struct w_steam_iface *_this, uint64_t action, w_InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) +{ + w_InputDigitalActionData_t w_pActionData; + struct IVRInput_IVRInput_004_GetDigitalActionData_params params = + { + .linux_side = _this->u_iface, + .action = action, + .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 ); + return params._ret; +} 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) { @@ -832,7 +849,24 @@ uint32_t __thiscall winIVRInput_IVRInput_005_UpdateActionState(struct w_steam_if return params._ret; } -extern uint32_t __thiscall winIVRInput_IVRInput_005_GetDigitalActionData(struct w_steam_iface *_this, uint64_t action, w_InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice); +uint32_t __thiscall winIVRInput_IVRInput_005_GetDigitalActionData(struct w_steam_iface *_this, uint64_t action, w_InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) +{ + w_InputDigitalActionData_t w_pActionData; + struct IVRInput_IVRInput_005_GetDigitalActionData_params params = + { + .linux_side = _this->u_iface, + .action = action, + .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 ); + return params._ret; +} 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) { @@ -1317,7 +1351,24 @@ uint32_t __thiscall winIVRInput_IVRInput_006_UpdateActionState(struct w_steam_if return params._ret; } -extern uint32_t __thiscall winIVRInput_IVRInput_006_GetDigitalActionData(struct w_steam_iface *_this, uint64_t action, w_InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice); +uint32_t __thiscall winIVRInput_IVRInput_006_GetDigitalActionData(struct w_steam_iface *_this, uint64_t action, w_InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) +{ + w_InputDigitalActionData_t w_pActionData; + struct IVRInput_IVRInput_006_GetDigitalActionData_params params = + { + .linux_side = _this->u_iface, + .action = action, + .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 ); + return params._ret; +} 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) { @@ -1827,7 +1878,24 @@ uint32_t __thiscall winIVRInput_IVRInput_007_UpdateActionState(struct w_steam_if return params._ret; } -extern uint32_t __thiscall winIVRInput_IVRInput_007_GetDigitalActionData(struct w_steam_iface *_this, uint64_t action, w_InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice); +uint32_t __thiscall winIVRInput_IVRInput_007_GetDigitalActionData(struct w_steam_iface *_this, uint64_t action, w_InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) +{ + w_InputDigitalActionData_t w_pActionData; + struct IVRInput_IVRInput_007_GetDigitalActionData_params params = + { + .linux_side = _this->u_iface, + .action = action, + .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 ); + return params._ret; +} 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) { @@ -2376,7 +2444,24 @@ uint32_t __thiscall winIVRInput_IVRInput_010_UpdateActionState(struct w_steam_if return params._ret; } -extern uint32_t __thiscall winIVRInput_IVRInput_010_GetDigitalActionData(struct w_steam_iface *_this, uint64_t action, w_InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice); +uint32_t __thiscall winIVRInput_IVRInput_010_GetDigitalActionData(struct w_steam_iface *_this, uint64_t action, w_InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, uint64_t ulRestrictToDevice) +{ + w_InputDigitalActionData_t w_pActionData; + struct IVRInput_IVRInput_010_GetDigitalActionData_params params = + { + .linux_side = _this->u_iface, + .action = action, + .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 ); + return params._ret; +} 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) {