mirror of
https://github.com/ValveSoftware/Proton.git
synced 2025-05-11 14:19:35 +03:00
vrclient: Generate type-annotated 32bit pointers.
This commit is contained in:
parent
995d3cf28b
commit
c31e612e7f
@ -681,7 +681,8 @@ def declspec(decl, name, prefix, wrapped=False):
|
||||
decl = decl.get_pointee()
|
||||
spec = declspec(decl, f"*{call}{const}{name}", prefix, False)
|
||||
if wrapped:
|
||||
return f'{prefix.upper()}PTR({spec}, {name})'
|
||||
typ = declspec(decl, f"*{call}{const}", prefix, False)
|
||||
return f'{prefix.upper()}PTR({spec}, {name}, {typ})'
|
||||
return spec
|
||||
if decl.kind == TypeKind.CONSTANTARRAY:
|
||||
decl, count = decl.element_type, decl.element_count
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
@ -26,18 +27,47 @@
|
||||
#define U_CDECL __attribute__((sysv_abi))
|
||||
#define U_STDCALL __attribute__((sysv_abi))
|
||||
|
||||
#if defined(__cplusplus)
|
||||
template< typename T >
|
||||
#endif /* __cplusplus */
|
||||
struct ptr32
|
||||
{
|
||||
uint32_t value;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
template< typename U > struct pointee { using type = U; };
|
||||
template< typename U > struct pointee< U** > { using type = struct ptr32< U* >*; };
|
||||
using Type = typename pointee< T >::type;
|
||||
|
||||
struct ptr32& operator=( const Type ptr )
|
||||
{
|
||||
assert( (UINT64)ptr == (UINT_PTR)ptr );
|
||||
this->value = (UINT_PTR)ptr;
|
||||
return *this;
|
||||
}
|
||||
operator Type() const
|
||||
{
|
||||
return (Type)(UINT_PTR)this->value;
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
};
|
||||
|
||||
#ifdef __i386__
|
||||
#define U64_PTR( decl, name ) uint64_t name
|
||||
#define U32_PTR( decl, name ) decl
|
||||
#define W64_PTR( decl, name ) uint64_t name
|
||||
#define W32_PTR( decl, name ) decl
|
||||
#define U64_PTR( decl, name, type ) uint64_t name
|
||||
#define U32_PTR( decl, name, type ) decl
|
||||
#define W64_PTR( decl, name, type ) uint64_t name
|
||||
#define W32_PTR( decl, name, type ) decl
|
||||
#endif
|
||||
|
||||
#ifdef __x86_64__
|
||||
#define U64_PTR( decl, name ) decl
|
||||
#define U32_PTR( decl, name ) uint32_t name
|
||||
#define W64_PTR( decl, name ) decl
|
||||
#define W32_PTR( decl, name ) uint32_t name
|
||||
#define U64_PTR( decl, name, type ) decl
|
||||
#define U32_PTR( decl, name, type ) uint32_t name
|
||||
#define W64_PTR( decl, name, type ) decl
|
||||
#if defined(__cplusplus)
|
||||
#define W32_PTR( decl, name, type ) struct ptr32< type > name
|
||||
#else /* __cplusplus */
|
||||
#define W32_PTR( decl, name, type ) struct ptr32 name
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
typedef struct HmdColor_t HmdColor_t;
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user