Skip to content

Commit 473184f

Browse files
committed
Hack in sketchy Linux/OSX ABI
1 parent fc76c45 commit 473184f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
To update, update the submodule then bindgen on wrapper.h
2+
3+
The following structs must be marked `#[cfg_attr(unix, repr(packed))]` to work around OpenVR's broken ABI on Linux/OSX:
4+
- `VRControllerState_t`
5+
- `RenderModel_TextureMap_t`
6+
- `RenderModel_t`
7+
- `VREvent_t`

bindings.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3060,6 +3060,7 @@ impl Clone for VRControllerAxis_t {
30603060
}
30613061
#[repr(C)]
30623062
#[derive(Debug, Copy)]
3063+
#[cfg_attr(unix, repr(packed))]
30633064
pub struct VRControllerState_t {
30643065
pub unPacketNum: u32,
30653066
pub ulButtonPressed: u64,
@@ -3855,6 +3856,7 @@ impl Clone for RenderModel_Vertex_t {
38553856
}
38563857
#[repr(C)]
38573858
#[derive(Debug, Copy)]
3859+
#[cfg_attr(unix, repr(packed))]
38583860
pub struct RenderModel_TextureMap_t {
38593861
pub unWidth: u16,
38603862
pub unHeight: u16,
@@ -3893,6 +3895,7 @@ impl Clone for RenderModel_TextureMap_t {
38933895
}
38943896
#[repr(C)]
38953897
#[derive(Debug, Copy)]
3898+
#[cfg_attr(unix, repr(packed))]
38963899
pub struct RenderModel_t {
38973900
pub rVertexData: *mut RenderModel_Vertex_t,
38983901
pub unVertexCount: u32,
@@ -4196,6 +4199,7 @@ impl Clone for VREvent_Data_t {
41964199
/// An event posted by the server to all running applications
41974200
#[repr(C)]
41984201
#[derive(Copy)]
4202+
#[cfg_attr(unix, repr(packed))]
41994203
pub struct VREvent_t {
42004204
pub eventType: u32,
42014205
pub trackedDeviceIndex: TrackedDeviceIndex_t,

0 commit comments

Comments
 (0)