mirror of
https://github.com/ValveSoftware/Proton.git
synced 2025-07-21 20:56:22 +03:00
vrclient: Use templates for some unix side thunks.
This commit is contained in:
parent
4d4acd55cc
commit
427e71fee8
@ -36,6 +36,14 @@ extern char *vrclient_dos_to_unix_path( const char *src );
|
|||||||
extern void vrclient_free_path( char *path );
|
extern void vrclient_free_path( char *path );
|
||||||
extern unsigned int vrclient_unix_path_to_dos_path( bool api_result, const char *src, char *dst, uint32_t dst_bytes );
|
extern unsigned int vrclient_unix_path_to_dos_path( bool api_result, const char *src, char *dst, uint32_t dst_bytes );
|
||||||
|
|
||||||
|
#define VRCLIENT_UNIX_IMPL( iface, version, method, ... ) \
|
||||||
|
NTSTATUS iface ## _ ## iface ## _ ## version ## _ ## method( void *args ) \
|
||||||
|
{ \
|
||||||
|
auto params = (struct iface ## _ ## iface ## _ ## version ## _ ## method ## _params *)args; \
|
||||||
|
auto u_iface = (struct u_ ## iface ## _ ## iface ## _ ## version *)params->u_iface; \
|
||||||
|
return iface ## _ ## method( u_iface, params, false, ## __VA_ARGS__ ); \
|
||||||
|
} \
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
@ -5,18 +5,16 @@
|
|||||||
#pragma makedep unix
|
#pragma makedep unix
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NTSTATUS IVRClientCore_IVRClientCore_002_Init( void *args )
|
template< typename Params >
|
||||||
|
static NTSTATUS IVRClientCore_Init( u_IVRClientCore_IVRClientCore_002 *iface, Params *params, bool wow64 )
|
||||||
{
|
{
|
||||||
struct IVRClientCore_IVRClientCore_002_Init_params *params = (struct IVRClientCore_IVRClientCore_002_Init_params *)args;
|
|
||||||
struct u_IVRClientCore_IVRClientCore_002 *iface = (struct u_IVRClientCore_IVRClientCore_002 *)params->u_iface;
|
|
||||||
params->_ret = (uint32_t)iface->Init( params->eApplicationType );
|
params->_ret = (uint32_t)iface->Init( params->eApplicationType );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS IVRClientCore_IVRClientCore_003_Init( void *args )
|
template< typename Iface, typename Params >
|
||||||
|
static NTSTATUS IVRClientCore_Init( Iface *iface, Params *params, bool wow64 )
|
||||||
{
|
{
|
||||||
struct IVRClientCore_IVRClientCore_003_Init_params *params = (struct IVRClientCore_IVRClientCore_003_Init_params *)args;
|
|
||||||
struct u_IVRClientCore_IVRClientCore_003 *iface = (struct u_IVRClientCore_IVRClientCore_003 *)params->u_iface;
|
|
||||||
const char *startup_info = json_convert_startup_info( params->pStartupInfo );
|
const char *startup_info = json_convert_startup_info( params->pStartupInfo );
|
||||||
if (!startup_info) startup_info = params->pStartupInfo;
|
if (!startup_info) startup_info = params->pStartupInfo;
|
||||||
|
|
||||||
@ -26,12 +24,15 @@ NTSTATUS IVRClientCore_IVRClientCore_003_Init( void *args )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS IVRMailbox_IVRMailbox_001_undoc3( void *args )
|
template< typename Iface, typename Params >
|
||||||
|
static NTSTATUS IVRMailbox_undoc3( Iface *iface, Params *params, bool wow64 )
|
||||||
{
|
{
|
||||||
struct IVRMailbox_IVRMailbox_001_undoc3_params *params = (struct IVRMailbox_IVRMailbox_001_undoc3_params *)args;
|
|
||||||
struct u_IVRMailbox_IVRMailbox_001 *iface = (struct u_IVRMailbox_IVRMailbox_001 *)params->u_iface;
|
|
||||||
char *c = json_convert_paths( params->c );
|
char *c = json_convert_paths( params->c );
|
||||||
params->_ret = (uint32_t)iface->undoc3( params->a, params->b, c );
|
params->_ret = (uint32_t)iface->undoc3( params->a, params->b, c );
|
||||||
free( c );
|
free( c );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VRCLIENT_UNIX_IMPL( IVRClientCore, 002, Init );
|
||||||
|
VRCLIENT_UNIX_IMPL( IVRClientCore, 003, Init );
|
||||||
|
VRCLIENT_UNIX_IMPL( IVRMailbox, 001, undoc3 );
|
||||||
|
@ -23,10 +23,9 @@ static uint64_t wrap_device( uint32_t type, VkInstance_T *instance, uint64_t dev
|
|||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS IVRSystem_IVRSystem_017_GetOutputDevice( void *args )
|
template< typename Iface, typename Params >
|
||||||
|
static NTSTATUS IVRSystem_GetOutputDevice( Iface *iface, Params *params, bool wow64 )
|
||||||
{
|
{
|
||||||
struct IVRSystem_IVRSystem_017_GetOutputDevice_params *params = (struct IVRSystem_IVRSystem_017_GetOutputDevice_params *)args;
|
|
||||||
struct u_IVRSystem_IVRSystem_017 *iface = (struct u_IVRSystem_IVRSystem_017 *)params->u_iface;
|
|
||||||
VkInstance_T *host_instance = unwrap_instance( params->textureType, params->pInstance );
|
VkInstance_T *host_instance = unwrap_instance( params->textureType, params->pInstance );
|
||||||
uint64_t host_device;
|
uint64_t host_device;
|
||||||
|
|
||||||
@ -35,50 +34,8 @@ NTSTATUS IVRSystem_IVRSystem_017_GetOutputDevice( void *args )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS IVRSystem_IVRSystem_019_GetOutputDevice( void *args )
|
VRCLIENT_UNIX_IMPL( IVRSystem, 017, GetOutputDevice );
|
||||||
{
|
VRCLIENT_UNIX_IMPL( IVRSystem, 019, GetOutputDevice );
|
||||||
struct IVRSystem_IVRSystem_019_GetOutputDevice_params *params = (struct IVRSystem_IVRSystem_019_GetOutputDevice_params *)args;
|
VRCLIENT_UNIX_IMPL( IVRSystem, 020, GetOutputDevice );
|
||||||
struct u_IVRSystem_IVRSystem_019 *iface = (struct u_IVRSystem_IVRSystem_019 *)params->u_iface;
|
VRCLIENT_UNIX_IMPL( IVRSystem, 021, GetOutputDevice );
|
||||||
VkInstance_T *host_instance = unwrap_instance( params->textureType, params->pInstance );
|
VRCLIENT_UNIX_IMPL( IVRSystem, 022, GetOutputDevice );
|
||||||
uint64_t host_device;
|
|
||||||
|
|
||||||
iface->GetOutputDevice( &host_device, params->textureType, host_instance );
|
|
||||||
*params->pnDevice = wrap_device( params->textureType, params->pInstance, host_device );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
NTSTATUS IVRSystem_IVRSystem_020_GetOutputDevice( void *args )
|
|
||||||
{
|
|
||||||
struct IVRSystem_IVRSystem_020_GetOutputDevice_params *params = (struct IVRSystem_IVRSystem_020_GetOutputDevice_params *)args;
|
|
||||||
struct u_IVRSystem_IVRSystem_020 *iface = (struct u_IVRSystem_IVRSystem_020 *)params->u_iface;
|
|
||||||
VkInstance_T *host_instance = unwrap_instance( params->textureType, params->pInstance );
|
|
||||||
uint64_t host_device;
|
|
||||||
|
|
||||||
iface->GetOutputDevice( &host_device, params->textureType, host_instance );
|
|
||||||
*params->pnDevice = wrap_device( params->textureType, params->pInstance, host_device );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
NTSTATUS IVRSystem_IVRSystem_021_GetOutputDevice( void *args )
|
|
||||||
{
|
|
||||||
struct IVRSystem_IVRSystem_021_GetOutputDevice_params *params = (struct IVRSystem_IVRSystem_021_GetOutputDevice_params *)args;
|
|
||||||
struct u_IVRSystem_IVRSystem_021 *iface = (struct u_IVRSystem_IVRSystem_021 *)params->u_iface;
|
|
||||||
VkInstance_T *host_instance = unwrap_instance( params->textureType, params->pInstance );
|
|
||||||
uint64_t host_device;
|
|
||||||
|
|
||||||
iface->GetOutputDevice( &host_device, params->textureType, host_instance );
|
|
||||||
*params->pnDevice = wrap_device( params->textureType, params->pInstance, host_device );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
NTSTATUS IVRSystem_IVRSystem_022_GetOutputDevice( void *args )
|
|
||||||
{
|
|
||||||
struct IVRSystem_IVRSystem_022_GetOutputDevice_params *params = (struct IVRSystem_IVRSystem_022_GetOutputDevice_params *)args;
|
|
||||||
struct u_IVRSystem_IVRSystem_022 *iface = (struct u_IVRSystem_IVRSystem_022 *)params->u_iface;
|
|
||||||
VkInstance_T *host_instance = unwrap_instance( params->textureType, params->pInstance );
|
|
||||||
uint64_t host_device;
|
|
||||||
|
|
||||||
iface->GetOutputDevice( &host_device, params->textureType, host_instance );
|
|
||||||
*params->pnDevice = wrap_device( params->textureType, params->pInstance, host_device );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
@ -164,9 +164,9 @@ static int parse_extensions( const char *extensions, char ***list )
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS vrclient_init_registry( void *args )
|
template< typename Params >
|
||||||
|
static NTSTATUS vrclient_init_registry( Params *params, bool wow64 )
|
||||||
{
|
{
|
||||||
struct vrclient_init_registry_params *params = (struct vrclient_init_registry_params *)args;
|
|
||||||
VkApplicationInfo app_info =
|
VkApplicationInfo app_info =
|
||||||
{
|
{
|
||||||
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
|
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
|
||||||
@ -305,9 +305,9 @@ failed:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS vrclient_init( void *args )
|
template< typename Params >
|
||||||
|
static NTSTATUS vrclient_init( Params *params, bool wow64 )
|
||||||
{
|
{
|
||||||
struct vrclient_init_params *params = (struct vrclient_init_params *)args;
|
|
||||||
|
|
||||||
params->_ret = false;
|
params->_ret = false;
|
||||||
|
|
||||||
@ -341,9 +341,9 @@ NTSTATUS vrclient_init( void *args )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS vrclient_unload( void *args )
|
template< typename Params >
|
||||||
|
static NTSTATUS vrclient_unload( Params *params, bool wow64 )
|
||||||
{
|
{
|
||||||
if (!vrclient) return 0;
|
|
||||||
dlclose( vrclient );
|
dlclose( vrclient );
|
||||||
vrclient = NULL;
|
vrclient = NULL;
|
||||||
p_HmdSystemFactory = NULL;
|
p_HmdSystemFactory = NULL;
|
||||||
@ -351,24 +351,23 @@ NTSTATUS vrclient_unload( void *args )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS vrclient_HmdSystemFactory( void *args )
|
template< typename Params >
|
||||||
|
static NTSTATUS vrclient_HmdSystemFactory( Params *params, bool wow64 )
|
||||||
{
|
{
|
||||||
struct vrclient_HmdSystemFactory_params *params = (struct vrclient_HmdSystemFactory_params *)args;
|
|
||||||
params->_ret = p_HmdSystemFactory( params->name, params->return_code );
|
params->_ret = p_HmdSystemFactory( params->name, params->return_code );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS vrclient_VRClientCoreFactory( void *args )
|
template< typename Params >
|
||||||
|
static NTSTATUS vrclient_VRClientCoreFactory( Params *params, bool wow64 )
|
||||||
{
|
{
|
||||||
struct vrclient_VRClientCoreFactory_params *params = (struct vrclient_VRClientCoreFactory_params *)args;
|
|
||||||
params->_ret = p_VRClientCoreFactory( params->name, params->return_code );
|
params->_ret = p_VRClientCoreFactory( params->name, params->return_code );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS IVRTrackedCamera_IVRTrackedCamera_001_GetVideoStreamFrame( void *args )
|
template< typename Iface, typename Params >
|
||||||
|
static NTSTATUS IVRTrackedCamera_GetVideoStreamFrame( Iface *iface, Params *params, bool wow64 )
|
||||||
{
|
{
|
||||||
struct IVRTrackedCamera_IVRTrackedCamera_001_GetVideoStreamFrame_params *params = (struct IVRTrackedCamera_IVRTrackedCamera_001_GetVideoStreamFrame_params *)args;
|
|
||||||
struct u_IVRTrackedCamera_IVRTrackedCamera_001 *iface = (struct u_IVRTrackedCamera_IVRTrackedCamera_001 *)params->u_iface;
|
|
||||||
*(w_CameraVideoStreamFrame_t_0914 *)params->_ret = *iface->GetVideoStreamFrame( params->nDeviceIndex );
|
*(w_CameraVideoStreamFrame_t_0914 *)params->_ret = *iface->GetVideoStreamFrame( params->nDeviceIndex );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -386,9 +385,9 @@ template<> struct hash< struct u_buffer >
|
|||||||
static pthread_mutex_t buffer_cache_lock = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t buffer_cache_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
static std::unordered_map< struct u_buffer, void * > buffer_cache;
|
static std::unordered_map< struct u_buffer, void * > buffer_cache;
|
||||||
|
|
||||||
NTSTATUS vrclient_get_unix_buffer( void *args )
|
template< typename Params >
|
||||||
|
static NTSTATUS vrclient_get_unix_buffer( Params *params, bool wow64 )
|
||||||
{
|
{
|
||||||
struct vrclient_get_unix_buffer_params *params = (struct vrclient_get_unix_buffer_params *)args;
|
|
||||||
struct cache_entry *entry;
|
struct cache_entry *entry;
|
||||||
struct rb_entry *ptr;
|
struct rb_entry *ptr;
|
||||||
|
|
||||||
@ -404,3 +403,15 @@ NTSTATUS vrclient_get_unix_buffer( void *args )
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define VRCLIENT_UNIX_FUNC( name ) \
|
||||||
|
NTSTATUS name( void *args ) { return name( (struct name ## _params *)args, false ); } \
|
||||||
|
|
||||||
|
VRCLIENT_UNIX_FUNC( vrclient_init );
|
||||||
|
VRCLIENT_UNIX_FUNC( vrclient_init_registry );
|
||||||
|
VRCLIENT_UNIX_FUNC( vrclient_unload );
|
||||||
|
VRCLIENT_UNIX_FUNC( vrclient_HmdSystemFactory );
|
||||||
|
VRCLIENT_UNIX_FUNC( vrclient_VRClientCoreFactory );
|
||||||
|
VRCLIENT_UNIX_FUNC( vrclient_get_unix_buffer );
|
||||||
|
|
||||||
|
VRCLIENT_UNIX_IMPL( IVRTrackedCamera, 001, GetVideoStreamFrame );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user