| 2471 | public _GetControllerStatePacked pGetControllerStatePacked; |
| 2472 | } |
| 2473 | public bool GetControllerState(uint unControllerDeviceIndex,ref VRControllerState_t pControllerState,uint unControllerStateSize) |
| 2474 | { |
| 2475 | #if !UNITY_METRO |
| 2476 | if ((System.Environment.OSVersion.Platform == System.PlatformID.MacOSX) || |
| 2477 | (System.Environment.OSVersion.Platform == System.PlatformID.Unix)) |
| 2478 | { |
| 2479 | GetControllerStateUnion u; |
| 2480 | VRControllerState_t_Packed state_packed = new VRControllerState_t_Packed(pControllerState); |
| 2481 | u.pGetControllerStatePacked = null; |
| 2482 | u.pGetControllerState = FnTable.GetControllerState; |
| 2483 | bool packed_result = u.pGetControllerStatePacked(unControllerDeviceIndex,ref state_packed,(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(VRControllerState_t_Packed))); |
| 2484 | |
| 2485 | state_packed.Unpack(ref pControllerState); |
| 2486 | return packed_result; |
| 2487 | } |
| 2488 | #endif |
| 2489 | bool result = FnTable.GetControllerState(unControllerDeviceIndex,ref pControllerState,unControllerStateSize); |
| 2490 | return result; |
| 2491 | } |
| 2492 | // This is a terrible hack to workaround the fact that VRControllerState_t and VREvent_t were |
| 2493 | // originally mis-compiled with the wrong packing for Linux and OSX. |
| 2494 | [UnmanagedFunctionPointer(CallingConvention.StdCall)] |