Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

237 lines
6.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Win32 replacements for XBox.
  4. //
  5. //=============================================================================
  6. #if !defined( XBOXSTUBS_H ) && !defined( _X360 )
  7. #define XBOXSTUBS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tier0/platform.h"
  12. // Content creation/open flags
  13. #define XCONTENTFLAG_NONE 0x00
  14. #define XCONTENTFLAG_CREATENEW 0x00
  15. #define XCONTENTFLAG_CREATEALWAYS 0x00
  16. #define XCONTENTFLAG_OPENEXISTING 0x00
  17. #define XCONTENTFLAG_OPENALWAYS 0x00
  18. #define XCONTENTFLAG_TRUNCATEEXISTING 0x00
  19. // Content attributes
  20. #define XCONTENTFLAG_NOPROFILE_TRANSFER 0x00
  21. #define XCONTENTFLAG_NODEVICE_TRANSFER 0x00
  22. #define XCONTENTFLAG_STRONG_SIGNED 0x00
  23. #define XCONTENTFLAG_ALLOWPROFILE_TRANSFER 0x00
  24. #define XCONTENTFLAG_MOVEONLY_TRANSFER 0x00
  25. // Console device ports
  26. #define XDEVICE_PORT0 0
  27. #define XDEVICE_PORT1 1
  28. #define XDEVICE_PORT2 2
  29. #define XDEVICE_PORT3 3
  30. #define XUSER_MAX_COUNT 4
  31. #define XUSER_INDEX_NONE 0x000000FE
  32. #define XBX_CLR_DEFAULT 0xFF000000
  33. #define XBX_CLR_WARNING 0x0000FFFF
  34. #define XBX_CLR_ERROR 0x000000FF
  35. #define XBOX_MINBORDERSAFE 0
  36. #define XBOX_MAXBORDERSAFE 0
  37. typedef enum
  38. {
  39. XK_NULL,
  40. XK_BUTTON_UP,
  41. XK_BUTTON_DOWN,
  42. XK_BUTTON_LEFT,
  43. XK_BUTTON_RIGHT,
  44. XK_BUTTON_START,
  45. XK_BUTTON_BACK,
  46. XK_BUTTON_STICK1,
  47. XK_BUTTON_STICK2,
  48. XK_BUTTON_A,
  49. XK_BUTTON_B,
  50. XK_BUTTON_X,
  51. XK_BUTTON_Y,
  52. XK_BUTTON_LEFT_SHOULDER,
  53. XK_BUTTON_RIGHT_SHOULDER,
  54. XK_BUTTON_LTRIGGER,
  55. XK_BUTTON_RTRIGGER,
  56. XK_STICK1_UP,
  57. XK_STICK1_DOWN,
  58. XK_STICK1_LEFT,
  59. XK_STICK1_RIGHT,
  60. XK_STICK2_UP,
  61. XK_STICK2_DOWN,
  62. XK_STICK2_LEFT,
  63. XK_STICK2_RIGHT,
  64. XK_MAX_KEYS,
  65. } xKey_t;
  66. //typedef enum
  67. //{
  68. // XVRB_NONE, // off
  69. // XVRB_ERROR, // fatal error
  70. // XVRB_ALWAYS, // no matter what
  71. // XVRB_WARNING, // non-fatal warnings
  72. // XVRB_STATUS, // status reports
  73. // XVRB_ALL,
  74. //} xverbose_e;
  75. typedef unsigned short WORD;
  76. #ifndef POSIX
  77. typedef unsigned long DWORD;
  78. typedef void* HANDLE;
  79. typedef unsigned __int64 ULONGLONG;
  80. #endif
  81. #ifdef POSIX
  82. typedef DWORD COLORREF;
  83. #endif
  84. #ifndef INVALID_HANDLE_VALUE
  85. #define INVALID_HANDLE_VALUE ((HANDLE)-1)
  86. #endif
  87. // typedef struct {
  88. // IN_ADDR ina; // IP address (zero if not static/DHCP)
  89. // IN_ADDR inaOnline; // Online IP address (zero if not online)
  90. // WORD wPortOnline; // Online port
  91. // BYTE abEnet[6]; // Ethernet MAC address
  92. // BYTE abOnline[20]; // Online identification
  93. // } XNADDR;
  94. typedef int XNADDR;
  95. typedef uint64 XUID;
  96. typedef struct {
  97. BYTE ab[8]; // xbox to xbox key identifier
  98. } XNKID;
  99. typedef struct {
  100. BYTE ab[16]; // xbox to xbox key exchange key
  101. } XNKEY;
  102. typedef struct _XSESSION_INFO
  103. {
  104. XNKID sessionID; // 8 bytes
  105. XNADDR hostAddress; // 36 bytes
  106. XNKEY keyExchangeKey; // 16 bytes
  107. } XSESSION_INFO, *PXSESSION_INFO;
  108. typedef struct _XUSER_DATA
  109. {
  110. BYTE type;
  111. union
  112. {
  113. int nData; // XUSER_DATA_TYPE_INT32
  114. int64 i64Data; // XUSER_DATA_TYPE_INT64
  115. double dblData; // XUSER_DATA_TYPE_DOUBLE
  116. struct // XUSER_DATA_TYPE_UNICODE
  117. {
  118. uint cbData; // Includes null-terminator
  119. char * pwszData;
  120. } string;
  121. float fData; // XUSER_DATA_TYPE_FLOAT
  122. struct // XUSER_DATA_TYPE_BINARY
  123. {
  124. uint cbData;
  125. char * pbData;
  126. } binary;
  127. };
  128. } XUSER_DATA, *PXUSER_DATA;
  129. typedef struct _XUSER_PROPERTY
  130. {
  131. DWORD dwPropertyId;
  132. XUSER_DATA value;
  133. } XUSER_PROPERTY, *PXUSER_PROPERTY;
  134. typedef struct _XUSER_CONTEXT
  135. {
  136. DWORD dwContextId;
  137. DWORD dwValue;
  138. } XUSER_CONTEXT, *PXUSER_CONTEXT;
  139. typedef struct _XSESSION_SEARCHRESULT
  140. {
  141. XSESSION_INFO info;
  142. DWORD dwOpenPublicSlots;
  143. DWORD dwOpenPrivateSlots;
  144. DWORD dwFilledPublicSlots;
  145. DWORD dwFilledPrivateSlots;
  146. DWORD cProperties;
  147. DWORD cContexts;
  148. PXUSER_PROPERTY pProperties;
  149. PXUSER_CONTEXT pContexts;
  150. } XSESSION_SEARCHRESULT, *PXSESSION_SEARCHRESULT;
  151. typedef struct _XSESSION_SEARCHRESULT_HEADER
  152. {
  153. DWORD dwSearchResults;
  154. XSESSION_SEARCHRESULT *pResults;
  155. } XSESSION_SEARCHRESULT_HEADER, *PXSESSION_SEARCHRESULT_HEADER;
  156. typedef struct _XSESSION_REGISTRANT
  157. {
  158. uint64 qwMachineID;
  159. DWORD bTrustworthiness;
  160. DWORD bNumUsers;
  161. XUID *rgUsers;
  162. } XSESSION_REGISTRANT;
  163. typedef struct _XSESSION_REGISTRATION_RESULTS
  164. {
  165. DWORD wNumRegistrants;
  166. XSESSION_REGISTRANT *rgRegistrants;
  167. } XSESSION_REGISTRATION_RESULTS, *PXSESSION_REGISTRATION_RESULTS;
  168. typedef struct {
  169. BYTE bFlags;
  170. BYTE bReserved;
  171. WORD cProbesXmit;
  172. WORD cProbesRecv;
  173. WORD cbData;
  174. BYTE * pbData;
  175. WORD wRttMinInMsecs;
  176. WORD wRttMedInMsecs;
  177. DWORD dwUpBitsPerSec;
  178. DWORD dwDnBitsPerSec;
  179. } XNQOSINFO;
  180. typedef struct {
  181. uint cxnqos;
  182. uint cxnqosPending;
  183. XNQOSINFO axnqosinfo[1];
  184. } XNQOS;
  185. #define XSESSION_CREATE_HOST 0
  186. #define XUSER_DATA_TYPE_INT32 0
  187. #define XSESSION_CREATE_USES_ARBITRATION 0
  188. #define XNET_QOS_LISTEN_ENABLE 0
  189. #define XNET_QOS_LISTEN_DISABLE 0
  190. #define XNET_QOS_LISTEN_SET_DATA 0
  191. FORCEINLINE void XBX_ProcessEvents() {}
  192. FORCEINLINE unsigned int XBX_GetSystemTime() { return 0; }
  193. FORCEINLINE int XBX_GetPrimaryUserId() { return 0; }
  194. FORCEINLINE void XBX_SetPrimaryUserId( DWORD idx ) {}
  195. FORCEINLINE int XBX_GetStorageDeviceId() { return 0; }
  196. FORCEINLINE void XBX_SetStorageDeviceId( DWORD idx ) {}
  197. FORCEINLINE const char *XBX_GetLanguageString() { return ""; }
  198. FORCEINLINE bool XBX_IsLocalized() { return false; }
  199. #define XCONTENT_MAX_DISPLAYNAME_LENGTH 128
  200. #define XCONTENT_MAX_FILENAME_LENGTH 42
  201. #define XBX_INVALID_STORAGE_ID ((DWORD) -1)
  202. #define XBX_STORAGE_DECLINED ((DWORD) -2)
  203. #endif // XBOXSTUBS_H