Skip to content

Commit

Permalink
vrclient: Fix up windows-side struct packing
Browse files Browse the repository at this point in the history
  • Loading branch information
aeikum committed Mar 21, 2019
1 parent cb4490f commit 520d675
Show file tree
Hide file tree
Showing 40 changed files with 315 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vrclient_x64/gen_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ def handle_struct(sdkver, struct, which):

hfile.write("typedef struct win%s win%s;\n" % (handler_name, handler_name))

cppfile.write("#pragma pack(push, 8)\n")
cppfile.write("struct win%s {\n" % handler_name)
for m in struct.get_children():
if m.kind == clang.cindex.CursorKind.FIELD_DECL:
Expand All @@ -740,7 +741,8 @@ def handle_struct(sdkver, struct, which):
cppfile.write(" %s %s;\n" % (m.type.spelling, m.displayname))
if which == WRAPPERS:
cppfile.write("\n %s *linux_side;\n" % struct.displayname)
cppfile.write("} __attribute__ ((ms_struct));\n\n")
cppfile.write("} __attribute__ ((ms_struct));\n")
cppfile.write("#pragma pack(pop)\n\n")

if which == LIN_TO_WIN:
hfile.write("extern void struct_%s_lin_to_win(void *l, void *w);\n" % handler_name)
Expand Down
8 changes: 8 additions & 0 deletions vrclient_x64/vrclient_x64/struct_converters_090.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
using namespace vr;
extern "C" {
#include "struct_converters.h"
#pragma pack(push, 8)
struct winRenderModel_TextureMap_t_090 {
uint16_t unWidth;
uint16_t unHeight;
const uint8_t * rubTextureMapData;

RenderModel_TextureMap_t *linux_side;
} __attribute__ ((ms_struct));
#pragma pack(pop)

struct winRenderModel_TextureMap_t_090 *struct_RenderModel_TextureMap_t_090_wrap(void *l)
{
Expand All @@ -32,6 +34,7 @@ struct RenderModel_TextureMap_t *struct_RenderModel_TextureMap_t_090_unwrap(winR
return ret;
}

#pragma pack(push, 8)
struct winRenderModel_t_090 {
uint64_t ulInternalHandle;
const vr::RenderModel_Vertex_t * rVertexData;
Expand All @@ -42,6 +45,7 @@ struct winRenderModel_t_090 {

RenderModel_t *linux_side;
} __attribute__ ((ms_struct));
#pragma pack(pop)

struct winRenderModel_t_090 *struct_RenderModel_t_090_wrap(void *l)
{
Expand All @@ -64,12 +68,14 @@ struct RenderModel_t *struct_RenderModel_t_090_unwrap(winRenderModel_t_090 *w)
return ret;
}

#pragma pack(push, 8)
struct winVREvent_t_090 {
vr::EVREventType eventType;
vr::TrackedDeviceIndex_t trackedDeviceIndex;
vr::VREvent_Data_t data;
float eventAgeSeconds;
} __attribute__ ((ms_struct));
#pragma pack(pop)

void struct_VREvent_t_090_lin_to_win(void *l, void *w)
{
Expand All @@ -81,12 +87,14 @@ void struct_VREvent_t_090_lin_to_win(void *l, void *w)
win->eventAgeSeconds = lin->eventAgeSeconds;
}

#pragma pack(push, 8)
struct winVRControllerState001_t_090 {
uint32_t unPacketNum;
uint64_t ulButtonPressed;
uint64_t ulButtonTouched;
vr::VRControllerAxis_t rAxis[5];
} __attribute__ ((ms_struct));
#pragma pack(pop)

void struct_VRControllerState001_t_090_lin_to_win(void *l, void *w)
{
Expand Down
8 changes: 8 additions & 0 deletions vrclient_x64/vrclient_x64/struct_converters_091.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
using namespace vr;
extern "C" {
#include "struct_converters.h"
#pragma pack(push, 8)
struct winRenderModel_TextureMap_t_091 {
uint16_t unWidth;
uint16_t unHeight;
const uint8_t * rubTextureMapData;

RenderModel_TextureMap_t *linux_side;
} __attribute__ ((ms_struct));
#pragma pack(pop)

struct winRenderModel_TextureMap_t_091 *struct_RenderModel_TextureMap_t_091_wrap(void *l)
{
Expand All @@ -32,6 +34,7 @@ struct RenderModel_TextureMap_t *struct_RenderModel_TextureMap_t_091_unwrap(winR
return ret;
}

#pragma pack(push, 8)
struct winRenderModel_t_091 {
uint64_t ulInternalHandle;
const vr::RenderModel_Vertex_t * rVertexData;
Expand All @@ -42,6 +45,7 @@ struct winRenderModel_t_091 {

RenderModel_t *linux_side;
} __attribute__ ((ms_struct));
#pragma pack(pop)

struct winRenderModel_t_091 *struct_RenderModel_t_091_wrap(void *l)
{
Expand All @@ -64,12 +68,14 @@ struct RenderModel_t *struct_RenderModel_t_091_unwrap(winRenderModel_t_091 *w)
return ret;
}

#pragma pack(push, 8)
struct winVREvent_t_091 {
vr::EVREventType eventType;
vr::TrackedDeviceIndex_t trackedDeviceIndex;
vr::VREvent_Data_t data;
float eventAgeSeconds;
} __attribute__ ((ms_struct));
#pragma pack(pop)

void struct_VREvent_t_091_lin_to_win(void *l, void *w)
{
Expand All @@ -81,12 +87,14 @@ void struct_VREvent_t_091_lin_to_win(void *l, void *w)
win->eventAgeSeconds = lin->eventAgeSeconds;
}

#pragma pack(push, 8)
struct winVRControllerState001_t_091 {
uint32_t unPacketNum;
uint64_t ulButtonPressed;
uint64_t ulButtonTouched;
vr::VRControllerAxis_t rAxis[5];
} __attribute__ ((ms_struct));
#pragma pack(pop)

void struct_VRControllerState001_t_091_lin_to_win(void *l, void *w)
{
Expand Down
8 changes: 8 additions & 0 deletions vrclient_x64/vrclient_x64/struct_converters_0910.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
using namespace vr;
extern "C" {
#include "struct_converters.h"
#pragma pack(push, 8)
struct winRenderModel_TextureMap_t_0910 {
uint16_t unWidth;
uint16_t unHeight;
const uint8_t * rubTextureMapData;

RenderModel_TextureMap_t *linux_side;
} __attribute__ ((ms_struct));
#pragma pack(pop)

struct winRenderModel_TextureMap_t_0910 *struct_RenderModel_TextureMap_t_0910_wrap(void *l)
{
Expand All @@ -32,6 +34,7 @@ struct RenderModel_TextureMap_t *struct_RenderModel_TextureMap_t_0910_unwrap(win
return ret;
}

#pragma pack(push, 8)
struct winRenderModel_t_0910 {
uint64_t ulInternalHandle;
const vr::RenderModel_Vertex_t * rVertexData;
Expand All @@ -42,6 +45,7 @@ struct winRenderModel_t_0910 {

RenderModel_t *linux_side;
} __attribute__ ((ms_struct));
#pragma pack(pop)

struct winRenderModel_t_0910 *struct_RenderModel_t_0910_wrap(void *l)
{
Expand All @@ -64,12 +68,14 @@ struct RenderModel_t *struct_RenderModel_t_0910_unwrap(winRenderModel_t_0910 *w)
return ret;
}

#pragma pack(push, 8)
struct winVREvent_t_0910 {
vr::EVREventType eventType;
vr::TrackedDeviceIndex_t trackedDeviceIndex;
vr::VREvent_Data_t data;
float eventAgeSeconds;
} __attribute__ ((ms_struct));
#pragma pack(pop)

void struct_VREvent_t_0910_lin_to_win(void *l, void *w)
{
Expand All @@ -81,12 +87,14 @@ void struct_VREvent_t_0910_lin_to_win(void *l, void *w)
win->eventAgeSeconds = lin->eventAgeSeconds;
}

#pragma pack(push, 8)
struct winVRControllerState001_t_0910 {
uint32_t unPacketNum;
uint64_t ulButtonPressed;
uint64_t ulButtonTouched;
vr::VRControllerAxis_t rAxis[5];
} __attribute__ ((ms_struct));
#pragma pack(pop)

void struct_VRControllerState001_t_0910_lin_to_win(void *l, void *w)
{
Expand Down
8 changes: 8 additions & 0 deletions vrclient_x64/vrclient_x64/struct_converters_0912.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
using namespace vr;
extern "C" {
#include "struct_converters.h"
#pragma pack(push, 8)
struct winVREvent_t_0912 {
vr::EVREventType eventType;
vr::TrackedDeviceIndex_t trackedDeviceIndex;
vr::VREvent_Data_t data;
float eventAgeSeconds;
} __attribute__ ((ms_struct));
#pragma pack(pop)

void struct_VREvent_t_0912_lin_to_win(void *l, void *w)
{
Expand All @@ -23,12 +25,14 @@ void struct_VREvent_t_0912_lin_to_win(void *l, void *w)
win->eventAgeSeconds = lin->eventAgeSeconds;
}

#pragma pack(push, 8)
struct winVRControllerState001_t_0912 {
uint32_t unPacketNum;
uint64_t ulButtonPressed;
uint64_t ulButtonTouched;
vr::VRControllerAxis_t rAxis[5];
} __attribute__ ((ms_struct));
#pragma pack(pop)

void struct_VRControllerState001_t_0912_lin_to_win(void *l, void *w)
{
Expand All @@ -40,13 +44,15 @@ void struct_VRControllerState001_t_0912_lin_to_win(void *l, void *w)
memcpy(win->rAxis, lin->rAxis, sizeof(win->rAxis));
}

#pragma pack(push, 8)
struct winRenderModel_TextureMap_t_0912 {
uint16_t unWidth;
uint16_t unHeight;
const uint8_t * rubTextureMapData;

RenderModel_TextureMap_t *linux_side;
} __attribute__ ((ms_struct));
#pragma pack(pop)

struct winRenderModel_TextureMap_t_0912 *struct_RenderModel_TextureMap_t_0912_wrap(void *l)
{
Expand All @@ -66,6 +72,7 @@ struct RenderModel_TextureMap_t *struct_RenderModel_TextureMap_t_0912_unwrap(win
return ret;
}

#pragma pack(push, 8)
struct winRenderModel_t_0912 {
const vr::RenderModel_Vertex_t * rVertexData;
uint32_t unVertexCount;
Expand All @@ -75,6 +82,7 @@ struct winRenderModel_t_0912 {

RenderModel_t *linux_side;
} __attribute__ ((ms_struct));
#pragma pack(pop)

struct winRenderModel_t_0912 *struct_RenderModel_t_0912_wrap(void *l)
{
Expand Down
8 changes: 8 additions & 0 deletions vrclient_x64/vrclient_x64/struct_converters_0913.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
using namespace vr;
extern "C" {
#include "struct_converters.h"
#pragma pack(push, 8)
struct winVREvent_t_0913 {
vr::EVREventType eventType;
vr::TrackedDeviceIndex_t trackedDeviceIndex;
vr::VREvent_Data_t data;
float eventAgeSeconds;
} __attribute__ ((ms_struct));
#pragma pack(pop)

void struct_VREvent_t_0913_lin_to_win(void *l, void *w)
{
Expand All @@ -23,12 +25,14 @@ void struct_VREvent_t_0913_lin_to_win(void *l, void *w)
win->eventAgeSeconds = lin->eventAgeSeconds;
}

#pragma pack(push, 8)
struct winVRControllerState001_t_0913 {
uint32_t unPacketNum;
uint64_t ulButtonPressed;
uint64_t ulButtonTouched;
vr::VRControllerAxis_t rAxis[5];
} __attribute__ ((ms_struct));
#pragma pack(pop)

void struct_VRControllerState001_t_0913_lin_to_win(void *l, void *w)
{
Expand All @@ -40,13 +44,15 @@ void struct_VRControllerState001_t_0913_lin_to_win(void *l, void *w)
memcpy(win->rAxis, lin->rAxis, sizeof(win->rAxis));
}

#pragma pack(push, 8)
struct winRenderModel_TextureMap_t_0913 {
uint16_t unWidth;
uint16_t unHeight;
const uint8_t * rubTextureMapData;

RenderModel_TextureMap_t *linux_side;
} __attribute__ ((ms_struct));
#pragma pack(pop)

struct winRenderModel_TextureMap_t_0913 *struct_RenderModel_TextureMap_t_0913_wrap(void *l)
{
Expand All @@ -66,6 +72,7 @@ struct RenderModel_TextureMap_t *struct_RenderModel_TextureMap_t_0913_unwrap(win
return ret;
}

#pragma pack(push, 8)
struct winRenderModel_t_0913 {
const vr::RenderModel_Vertex_t * rVertexData;
uint32_t unVertexCount;
Expand All @@ -75,6 +82,7 @@ struct winRenderModel_t_0913 {

RenderModel_t *linux_side;
} __attribute__ ((ms_struct));
#pragma pack(pop)

struct winRenderModel_t_0913 *struct_RenderModel_t_0913_wrap(void *l)
{
Expand Down
8 changes: 8 additions & 0 deletions vrclient_x64/vrclient_x64/struct_converters_0914.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
using namespace vr;
extern "C" {
#include "struct_converters.h"
#pragma pack(push, 8)
struct winVREvent_t_0914 {
vr::EVREventType eventType;
vr::TrackedDeviceIndex_t trackedDeviceIndex;
vr::VREvent_Data_t data;
float eventAgeSeconds;
} __attribute__ ((ms_struct));
#pragma pack(pop)

void struct_VREvent_t_0914_lin_to_win(void *l, void *w)
{
Expand All @@ -23,12 +25,14 @@ void struct_VREvent_t_0914_lin_to_win(void *l, void *w)
win->eventAgeSeconds = lin->eventAgeSeconds;
}

#pragma pack(push, 8)
struct winVRControllerState001_t_0914 {
uint32_t unPacketNum;
uint64_t ulButtonPressed;
uint64_t ulButtonTouched;
vr::VRControllerAxis_t rAxis[5];
} __attribute__ ((ms_struct));
#pragma pack(pop)

void struct_VRControllerState001_t_0914_lin_to_win(void *l, void *w)
{
Expand All @@ -40,13 +44,15 @@ void struct_VRControllerState001_t_0914_lin_to_win(void *l, void *w)
memcpy(win->rAxis, lin->rAxis, sizeof(win->rAxis));
}

#pragma pack(push, 8)
struct winRenderModel_TextureMap_t_0914 {
uint16_t unWidth;
uint16_t unHeight;
const uint8_t * rubTextureMapData;

RenderModel_TextureMap_t *linux_side;
} __attribute__ ((ms_struct));
#pragma pack(pop)

struct winRenderModel_TextureMap_t_0914 *struct_RenderModel_TextureMap_t_0914_wrap(void *l)
{
Expand All @@ -66,6 +72,7 @@ struct RenderModel_TextureMap_t *struct_RenderModel_TextureMap_t_0914_unwrap(win
return ret;
}

#pragma pack(push, 8)
struct winRenderModel_t_0914 {
const vr::RenderModel_Vertex_t * rVertexData;
uint32_t unVertexCount;
Expand All @@ -75,6 +82,7 @@ struct winRenderModel_t_0914 {

RenderModel_t *linux_side;
} __attribute__ ((ms_struct));
#pragma pack(pop)

struct winRenderModel_t_0914 *struct_RenderModel_t_0914_wrap(void *l)
{
Expand Down
Loading

0 comments on commit 520d675

Please sign in to comment.