Packsize.cs (2497B)
1 // This file is provided under The MIT License as part of Steamworks.NET. 2 // Copyright (c) 2013-2019 Riley Labrecque 3 // Please see the included LICENSE.txt for additional information. 4 5 // This file is automatically generated. 6 // Changes to this file will be reverted when you update Steamworks.NET 7 8 #if UNITY_ANDROID || UNITY_IOS || UNITY_TIZEN || UNITY_TVOS || UNITY_WEBGL || UNITY_WSA || UNITY_PS4 || UNITY_WII || UNITY_XBOXONE || UNITY_SWITCH 9 #define DISABLESTEAMWORKS 10 #endif 11 12 #if !DISABLESTEAMWORKS 13 14 // If we're running in the Unity Editor we need the editors platform. 15 #if UNITY_EDITOR_WIN 16 #define VALVE_CALLBACK_PACK_LARGE 17 #elif UNITY_EDITOR_OSX 18 #define VALVE_CALLBACK_PACK_SMALL 19 20 // Otherwise we want the target platform. 21 #elif UNITY_STANDALONE_WIN || STEAMWORKS_WIN 22 #define VALVE_CALLBACK_PACK_LARGE 23 #elif UNITY_STANDALONE_LINUX || UNITY_STANDALONE_OSX || STEAMWORKS_LIN_OSX 24 #define VALVE_CALLBACK_PACK_SMALL 25 26 // We do not want to throw a warning when we're building in Unity but for an unsupported platform. So we'll silently let this slip by. 27 // It would be nice if Unity itself would define 'UNITY' or something like that... 28 #elif UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_5 || UNITY_2017_1_OR_NEWER 29 #define VALVE_CALLBACK_PACK_SMALL 30 31 // But we do want to be explicit on the Standalone build for XNA/Monogame. 32 #else 33 #define VALVE_CALLBACK_PACK_LARGE 34 #warning You need to define STEAMWORKS_WIN, or STEAMWORKS_LIN_OSX. Refer to the readme for more details. 35 #endif 36 37 using System.Runtime.InteropServices; 38 using IntPtr = System.IntPtr; 39 40 namespace Steamworks { 41 public static class Packsize { 42 #if VALVE_CALLBACK_PACK_LARGE 43 public const int value = 8; 44 #elif VALVE_CALLBACK_PACK_SMALL 45 public const int value = 4; 46 #endif 47 48 public static bool Test() { 49 int sentinelSize = Marshal.SizeOf(typeof(ValvePackingSentinel_t)); 50 int subscribedFilesSize = Marshal.SizeOf(typeof(RemoteStorageEnumerateUserSubscribedFilesResult_t)); 51 #if VALVE_CALLBACK_PACK_LARGE 52 if (sentinelSize != 32 || subscribedFilesSize != (1 + 1 + 1 + 50 + 100) * 4 + 4) 53 return false; 54 #elif VALVE_CALLBACK_PACK_SMALL 55 if (sentinelSize != 24 || subscribedFilesSize != (1 + 1 + 1 + 50 + 100) * 4) 56 return false; 57 #endif 58 return true; 59 } 60 61 [StructLayout(LayoutKind.Sequential, Pack = Packsize.value)] 62 struct ValvePackingSentinel_t { 63 uint m_u32; 64 ulong m_u64; 65 ushort m_u16; 66 double m_d; 67 }; 68 } 69 } 70 71 #endif // !DISABLESTEAMWORKS