steamtypes.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. //========= Copyright © 1996-2008, Valve LLC, All rights reserved. ============
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef STEAMTYPES_H
  7. #define STEAMTYPES_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #define S_CALLTYPE __cdecl
  12. // Steam-specific types. Defined here so this header file can be included in other code bases.
  13. #ifndef WCHARTYPES_H
  14. typedef unsigned char uint8;
  15. #endif
  16. #if defined( __GNUC__ ) && !defined(POSIX)
  17. #if __GNUC__ < 4
  18. #error "Steamworks requires GCC 4.X (4.2 or 4.4 have been tested)"
  19. #endif
  20. #define POSIX 1
  21. #endif
  22. #if defined(__x86_64__) || defined(_WIN64)
  23. #define X64BITS
  24. #endif
  25. // Make sure VALVE_BIG_ENDIAN gets set on PS3, may already be set previously in Valve internal code.
  26. #if !defined(VALVE_BIG_ENDIAN) && defined(_PS3)
  27. #define VALVE_BIG_ENDIAN
  28. #endif
  29. typedef unsigned char uint8;
  30. typedef signed char int8;
  31. #if defined( _WIN32 )
  32. typedef __int16 int16;
  33. typedef unsigned __int16 uint16;
  34. typedef __int32 int32;
  35. typedef unsigned __int32 uint32;
  36. typedef __int64 int64;
  37. typedef unsigned __int64 uint64;
  38. typedef int64 lint64;
  39. typedef uint64 ulint64;
  40. #ifdef X64BITS
  41. typedef __int64 intp; // intp is an integer that can accomodate a pointer
  42. typedef unsigned __int64 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *)
  43. #else
  44. typedef __int32 intp;
  45. typedef unsigned __int32 uintp;
  46. #endif
  47. #else // _WIN32
  48. typedef short int16;
  49. typedef unsigned short uint16;
  50. typedef int int32;
  51. typedef unsigned int uint32;
  52. typedef long long int64;
  53. typedef unsigned long long uint64;
  54. // [u]int64 are actually defined as 'long long' and gcc 64-bit
  55. // doesn't automatically consider them the same as 'long int'.
  56. // Changing the types for [u]int64 is complicated by
  57. // there being many definitions, so we just
  58. // define a 'long int' here and use it in places that would
  59. // otherwise confuse the compiler.
  60. typedef long int lint64;
  61. typedef unsigned long int ulint64;
  62. #ifdef X64BITS
  63. typedef long long intp;
  64. typedef unsigned long long uintp;
  65. #else
  66. typedef int intp;
  67. typedef unsigned int uintp;
  68. #endif
  69. #endif // else _WIN32
  70. #ifdef API_GEN
  71. # define CLANG_ATTR(ATTR) __attribute__((annotate( ATTR )))
  72. #else
  73. # define CLANG_ATTR(ATTR)
  74. #endif
  75. #define METHOD_DESC(DESC) CLANG_ATTR( "desc:" #DESC ";" )
  76. #define IGNOREATTR() CLANG_ATTR( "ignore" )
  77. #define OUT_STRUCT() CLANG_ATTR( "out_struct: ;" )
  78. #define OUT_STRING() CLANG_ATTR( "out_string: ;" )
  79. #define OUT_ARRAY_CALL(COUNTER,FUNCTION,PARAMS) CLANG_ATTR( "out_array_call:" #COUNTER "," #FUNCTION "," #PARAMS ";" )
  80. #define OUT_ARRAY_COUNT(COUNTER, DESC) CLANG_ATTR( "out_array_count:" #COUNTER ";desc:" #DESC )
  81. #define ARRAY_COUNT(COUNTER) CLANG_ATTR( "array_count:" #COUNTER ";" )
  82. #define ARRAY_COUNT_D(COUNTER, DESC) CLANG_ATTR( "array_count:" #COUNTER ";desc:" #DESC )
  83. #define BUFFER_COUNT(COUNTER) CLANG_ATTR( "buffer_count:" #COUNTER ";" )
  84. #define OUT_BUFFER_COUNT(COUNTER) CLANG_ATTR( "out_buffer_count:" #COUNTER ";" )
  85. #define OUT_STRING_COUNT(COUNTER) CLANG_ATTR( "out_string_count:" #COUNTER ";" )
  86. #define DESC(DESC) CLANG_ATTR("desc:" #DESC ";")
  87. #define CALL_RESULT(RESULT_TYPE) CLANG_ATTR("callresult:" #RESULT_TYPE ";")
  88. #define CALL_BACK(RESULT_TYPE) CLANG_ATTR("callback:" #RESULT_TYPE ";")
  89. const int k_cubSaltSize = 8;
  90. typedef uint8 Salt_t[ k_cubSaltSize ];
  91. //-----------------------------------------------------------------------------
  92. // GID (GlobalID) stuff
  93. // This is a globally unique identifier. It's guaranteed to be unique across all
  94. // racks and servers for as long as a given universe persists.
  95. //-----------------------------------------------------------------------------
  96. // NOTE: for GID parsing/rendering and other utils, see gid.h
  97. typedef uint64 GID_t;
  98. const GID_t k_GIDNil = 0xffffffffffffffffull;
  99. // For convenience, we define a number of types that are just new names for GIDs
  100. typedef uint64 JobID_t; // Each Job has a unique ID
  101. typedef GID_t TxnID_t; // Each financial transaction has a unique ID
  102. const GID_t k_TxnIDNil = k_GIDNil;
  103. const GID_t k_TxnIDUnknown = 0;
  104. const JobID_t k_JobIDNil = 0xffffffffffffffffull;
  105. // this is baked into client messages and interfaces as an int,
  106. // make sure we never break this.
  107. typedef uint32 PackageId_t;
  108. const PackageId_t k_uPackageIdFreeSub = 0x0;
  109. const PackageId_t k_uPackageIdInvalid = 0xFFFFFFFF;
  110. typedef uint32 BundleId_t;
  111. const BundleId_t k_uBundleIdInvalid = 0;
  112. // this is baked into client messages and interfaces as an int,
  113. // make sure we never break this.
  114. typedef uint32 AppId_t;
  115. const AppId_t k_uAppIdInvalid = 0x0;
  116. typedef uint64 AssetClassId_t;
  117. const AssetClassId_t k_ulAssetClassIdInvalid = 0x0;
  118. typedef uint32 PhysicalItemId_t;
  119. const PhysicalItemId_t k_uPhysicalItemIdInvalid = 0x0;
  120. // this is baked into client messages and interfaces as an int,
  121. // make sure we never break this. AppIds and DepotIDs also presently
  122. // share the same namespace, but since we'd like to change that in the future
  123. // I've defined it seperately here.
  124. typedef uint32 DepotId_t;
  125. const DepotId_t k_uDepotIdInvalid = 0x0;
  126. // RTime32
  127. // We use this 32 bit time representing real world time.
  128. // It offers 1 second resolution beginning on January 1, 1970 (Unix time)
  129. typedef uint32 RTime32;
  130. typedef uint32 CellID_t;
  131. const CellID_t k_uCellIDInvalid = 0xFFFFFFFF;
  132. // handle to a Steam API call
  133. typedef uint64 SteamAPICall_t;
  134. const SteamAPICall_t k_uAPICallInvalid = 0x0;
  135. typedef uint32 AccountID_t;
  136. typedef uint32 PartnerId_t;
  137. const PartnerId_t k_uPartnerIdInvalid = 0;
  138. // ID for a depot content manifest
  139. typedef uint64 ManifestId_t;
  140. const ManifestId_t k_uManifestIdInvalid = 0;
  141. #endif // STEAMTYPES_H