2023-09-26 23:56:43 +02:00
|
|
|
#include "vrclient_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(vrclient);
|
|
|
|
|
2023-09-27 09:39:03 +02:00
|
|
|
#ifndef __x86_64__
|
2023-09-19 19:59:23 +02:00
|
|
|
static uint32_t ivrinput_get_digital_action_data( uint64_t action_handle, void *action_data, uint32_t action_data_size,
|
2023-12-19 19:18:33 +01:00
|
|
|
uint64_t restrict_to_device, unsigned int version )
|
2023-09-26 23:56:43 +02:00
|
|
|
{
|
|
|
|
/* Digital action state change fixup hack. */
|
2023-09-29 11:28:17 +02:00
|
|
|
w_InputDigitalActionData_t *data = action_data;
|
2023-09-26 23:56:43 +02:00
|
|
|
LARGE_INTEGER qpf;
|
|
|
|
unsigned int i;
|
|
|
|
|
2023-09-27 09:39:03 +02:00
|
|
|
TRACE( "handle %s, data %p, data_size %u, restrict %s, origin %s, state %#x, changed %#x, active %#x.\n",
|
2023-09-26 23:56:43 +02:00
|
|
|
wine_dbgstr_longlong( action_handle ), action_data, action_data_size,
|
|
|
|
wine_dbgstr_longlong( restrict_to_device ), wine_dbgstr_longlong( data->activeOrigin ),
|
2023-09-27 09:39:03 +02:00
|
|
|
data->bState, data->bChanged, data->bActive );
|
2023-09-26 23:56:43 +02:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2023-09-27 09:39:03 +02:00
|
|
|
#endif
|
2023-09-27 08:43:42 +02:00
|
|
|
|
2023-09-19 19:59:23 +02:00
|
|
|
uint32_t __thiscall winIVRInput_IVRInput_004_GetDigitalActionData( struct w_steam_iface *_this, uint64_t action,
|
2023-09-29 11:28:17 +02:00
|
|
|
w_InputDigitalActionData_t *pActionData,
|
2023-12-19 19:18:33 +01:00
|
|
|
uint32_t unActionDataSize, uint64_t ulRestrictToDevice )
|
2023-09-27 08:43:42 +02:00
|
|
|
{
|
2023-12-15 10:20:25 +01:00
|
|
|
w_InputDigitalActionData_t w_pActionData;
|
2023-09-30 13:08:49 +02:00
|
|
|
struct IVRInput_IVRInput_004_GetDigitalActionData_params params =
|
2023-09-27 11:05:52 +02:00
|
|
|
{
|
|
|
|
.linux_side = _this->u_iface,
|
|
|
|
.action = action,
|
2023-12-15 10:20:25 +01:00
|
|
|
.pActionData = pActionData ? &w_pActionData : NULL,
|
2023-09-27 11:05:52 +02:00
|
|
|
.unActionDataSize = unActionDataSize,
|
|
|
|
.ulRestrictToDevice = ulRestrictToDevice,
|
|
|
|
};
|
2023-09-27 09:39:03 +02:00
|
|
|
|
2023-09-27 08:43:42 +02:00
|
|
|
TRACE( "%p\n", _this );
|
2023-09-27 09:39:03 +02:00
|
|
|
|
2023-12-15 10:20:25 +01:00
|
|
|
unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) );
|
|
|
|
if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize );
|
2023-09-30 13:08:49 +02:00
|
|
|
VRCLIENT_CALL( IVRInput_IVRInput_004_GetDigitalActionData, ¶ms );
|
2023-12-15 10:20:25 +01:00
|
|
|
if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize );
|
2023-09-27 09:39:03 +02:00
|
|
|
#ifdef __x86_64__
|
2023-09-27 11:05:52 +02:00
|
|
|
return params._ret;
|
2023-09-27 09:39:03 +02:00
|
|
|
#else
|
2023-09-27 11:05:52 +02:00
|
|
|
if (params._ret) return params._ret;
|
2023-09-27 09:39:03 +02:00
|
|
|
return ivrinput_get_digital_action_data( action, pActionData, unActionDataSize, ulRestrictToDevice, 4 );
|
|
|
|
#endif
|
2023-09-27 08:43:42 +02:00
|
|
|
}
|
|
|
|
|
2023-09-19 19:59:23 +02:00
|
|
|
uint32_t __thiscall winIVRInput_IVRInput_005_GetDigitalActionData( struct w_steam_iface *_this, uint64_t action,
|
2023-09-29 11:28:17 +02:00
|
|
|
w_InputDigitalActionData_t *pActionData,
|
2023-12-19 19:18:33 +01:00
|
|
|
uint32_t unActionDataSize, uint64_t ulRestrictToDevice )
|
2023-09-27 08:43:42 +02:00
|
|
|
{
|
2023-12-15 10:20:25 +01:00
|
|
|
w_InputDigitalActionData_t w_pActionData;
|
2023-09-30 13:08:49 +02:00
|
|
|
struct IVRInput_IVRInput_005_GetDigitalActionData_params params =
|
2023-09-27 11:05:52 +02:00
|
|
|
{
|
|
|
|
.linux_side = _this->u_iface,
|
|
|
|
.action = action,
|
2023-12-15 10:20:25 +01:00
|
|
|
.pActionData = pActionData ? &w_pActionData : NULL,
|
2023-09-27 11:05:52 +02:00
|
|
|
.unActionDataSize = unActionDataSize,
|
|
|
|
.ulRestrictToDevice = ulRestrictToDevice,
|
|
|
|
};
|
2023-09-27 09:39:03 +02:00
|
|
|
|
2023-09-27 08:43:42 +02:00
|
|
|
TRACE( "%p\n", _this );
|
2023-09-27 09:39:03 +02:00
|
|
|
|
2023-12-15 10:20:25 +01:00
|
|
|
unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) );
|
|
|
|
if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize );
|
2023-09-30 13:08:49 +02:00
|
|
|
VRCLIENT_CALL( IVRInput_IVRInput_005_GetDigitalActionData, ¶ms );
|
2023-12-15 10:20:25 +01:00
|
|
|
if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize );
|
2023-09-27 09:39:03 +02:00
|
|
|
#ifdef __x86_64__
|
2023-09-27 11:05:52 +02:00
|
|
|
return params._ret;
|
2023-09-27 09:39:03 +02:00
|
|
|
#else
|
2023-09-27 11:05:52 +02:00
|
|
|
if (params._ret) return params._ret;
|
2023-09-27 09:39:03 +02:00
|
|
|
return ivrinput_get_digital_action_data( action, pActionData, unActionDataSize, ulRestrictToDevice, 5 );
|
|
|
|
#endif
|
2023-09-27 08:43:42 +02:00
|
|
|
}
|
|
|
|
|
2023-09-19 19:59:23 +02:00
|
|
|
uint32_t __thiscall winIVRInput_IVRInput_006_GetDigitalActionData( struct w_steam_iface *_this, uint64_t action,
|
2023-09-29 11:28:17 +02:00
|
|
|
w_InputDigitalActionData_t *pActionData,
|
2023-12-19 19:18:33 +01:00
|
|
|
uint32_t unActionDataSize, uint64_t ulRestrictToDevice )
|
2023-09-27 08:43:42 +02:00
|
|
|
{
|
2023-12-15 10:20:25 +01:00
|
|
|
w_InputDigitalActionData_t w_pActionData;
|
2023-09-30 13:08:49 +02:00
|
|
|
struct IVRInput_IVRInput_006_GetDigitalActionData_params params =
|
2023-09-27 11:05:52 +02:00
|
|
|
{
|
|
|
|
.linux_side = _this->u_iface,
|
|
|
|
.action = action,
|
2023-12-15 10:20:25 +01:00
|
|
|
.pActionData = pActionData ? &w_pActionData : NULL,
|
2023-09-27 11:05:52 +02:00
|
|
|
.unActionDataSize = unActionDataSize,
|
|
|
|
.ulRestrictToDevice = ulRestrictToDevice,
|
|
|
|
};
|
2023-09-27 09:39:03 +02:00
|
|
|
|
2023-09-27 08:43:42 +02:00
|
|
|
TRACE( "%p\n", _this );
|
2023-09-27 09:39:03 +02:00
|
|
|
|
2023-12-15 10:20:25 +01:00
|
|
|
unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) );
|
|
|
|
if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize );
|
2023-09-30 13:08:49 +02:00
|
|
|
VRCLIENT_CALL( IVRInput_IVRInput_006_GetDigitalActionData, ¶ms );
|
2023-12-15 10:20:25 +01:00
|
|
|
if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize );
|
2023-09-27 09:39:03 +02:00
|
|
|
#ifdef __x86_64__
|
2023-09-27 11:05:52 +02:00
|
|
|
return params._ret;
|
2023-09-27 09:39:03 +02:00
|
|
|
#else
|
2023-09-27 11:05:52 +02:00
|
|
|
if (params._ret) return params._ret;
|
2023-09-27 09:39:03 +02:00
|
|
|
return ivrinput_get_digital_action_data( action, pActionData, unActionDataSize, ulRestrictToDevice, 6 );
|
|
|
|
#endif
|
2023-09-27 08:43:42 +02:00
|
|
|
}
|
|
|
|
|
2023-09-19 19:59:23 +02:00
|
|
|
uint32_t __thiscall winIVRInput_IVRInput_007_GetDigitalActionData( struct w_steam_iface *_this, uint64_t action,
|
2023-09-29 11:28:17 +02:00
|
|
|
w_InputDigitalActionData_t *pActionData,
|
2023-12-19 19:18:33 +01:00
|
|
|
uint32_t unActionDataSize, uint64_t ulRestrictToDevice )
|
2023-09-27 08:43:42 +02:00
|
|
|
{
|
2023-12-15 10:20:25 +01:00
|
|
|
w_InputDigitalActionData_t w_pActionData;
|
2023-09-30 13:08:49 +02:00
|
|
|
struct IVRInput_IVRInput_007_GetDigitalActionData_params params =
|
2023-09-27 11:05:52 +02:00
|
|
|
{
|
|
|
|
.linux_side = _this->u_iface,
|
|
|
|
.action = action,
|
2023-12-15 10:20:25 +01:00
|
|
|
.pActionData = pActionData ? &w_pActionData : NULL,
|
2023-09-27 11:05:52 +02:00
|
|
|
.unActionDataSize = unActionDataSize,
|
|
|
|
.ulRestrictToDevice = ulRestrictToDevice,
|
|
|
|
};
|
2023-09-27 09:39:03 +02:00
|
|
|
|
2023-09-27 08:43:42 +02:00
|
|
|
TRACE( "%p\n", _this );
|
2023-09-27 09:39:03 +02:00
|
|
|
|
2023-12-15 10:20:25 +01:00
|
|
|
unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) );
|
|
|
|
if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize );
|
2023-09-30 13:08:49 +02:00
|
|
|
VRCLIENT_CALL( IVRInput_IVRInput_007_GetDigitalActionData, ¶ms );
|
2023-12-15 10:20:25 +01:00
|
|
|
if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize );
|
2023-09-27 09:39:03 +02:00
|
|
|
#ifdef __x86_64__
|
2023-09-27 11:05:52 +02:00
|
|
|
return params._ret;
|
2023-09-27 09:39:03 +02:00
|
|
|
#else
|
2023-09-27 11:05:52 +02:00
|
|
|
if (params._ret) return params._ret;
|
2023-09-27 09:39:03 +02:00
|
|
|
return ivrinput_get_digital_action_data( action, pActionData, unActionDataSize, ulRestrictToDevice, 7 );
|
|
|
|
#endif
|
2023-09-27 08:43:42 +02:00
|
|
|
}
|
|
|
|
|
2023-09-19 19:59:23 +02:00
|
|
|
uint32_t __thiscall winIVRInput_IVRInput_010_GetDigitalActionData( struct w_steam_iface *_this, uint64_t action,
|
2023-09-29 11:28:17 +02:00
|
|
|
w_InputDigitalActionData_t *pActionData,
|
2023-12-19 19:18:33 +01:00
|
|
|
uint32_t unActionDataSize, uint64_t ulRestrictToDevice )
|
2023-09-27 08:43:42 +02:00
|
|
|
{
|
2023-12-15 10:20:25 +01:00
|
|
|
w_InputDigitalActionData_t w_pActionData;
|
2023-09-30 13:08:49 +02:00
|
|
|
struct IVRInput_IVRInput_010_GetDigitalActionData_params params =
|
2023-09-27 11:05:52 +02:00
|
|
|
{
|
|
|
|
.linux_side = _this->u_iface,
|
|
|
|
.action = action,
|
2023-12-15 10:20:25 +01:00
|
|
|
.pActionData = pActionData ? &w_pActionData : NULL,
|
2023-09-27 11:05:52 +02:00
|
|
|
.unActionDataSize = unActionDataSize,
|
|
|
|
.ulRestrictToDevice = ulRestrictToDevice,
|
|
|
|
};
|
2023-09-27 09:39:03 +02:00
|
|
|
|
2023-09-27 08:43:42 +02:00
|
|
|
TRACE( "%p\n", _this );
|
2023-09-27 09:39:03 +02:00
|
|
|
|
2023-12-15 10:20:25 +01:00
|
|
|
unActionDataSize = min( unActionDataSize, sizeof(w_pActionData) );
|
|
|
|
if (pActionData) memcpy( &w_pActionData, pActionData, unActionDataSize );
|
2023-09-30 13:08:49 +02:00
|
|
|
VRCLIENT_CALL( IVRInput_IVRInput_010_GetDigitalActionData, ¶ms );
|
2023-12-15 10:20:25 +01:00
|
|
|
if (pActionData) memcpy( pActionData, &w_pActionData, unActionDataSize );
|
2023-09-27 09:39:03 +02:00
|
|
|
#ifdef __x86_64__
|
2023-09-27 11:05:52 +02:00
|
|
|
return params._ret;
|
2023-09-27 09:39:03 +02:00
|
|
|
#else
|
2023-09-27 11:05:52 +02:00
|
|
|
if (params._ret) return params._ret;
|
2023-09-27 09:39:03 +02:00
|
|
|
return ivrinput_get_digital_action_data( action, pActionData, unActionDataSize, ulRestrictToDevice, 10 );
|
|
|
|
#endif
|
2023-09-27 08:43:42 +02:00
|
|
|
}
|