Counter Strike : Global Offensive Source Code
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.

296 lines
7.6 KiB

  1. //========= Copyright � 1996-2004, Valve LLC, All rights reserved. ============
  2. //
  3. // Purpose: XBox Core definitions
  4. //
  5. //=============================================================================
  6. #pragma once
  7. #define XBOX_DONTCARE 0 // for functions with don't care params
  8. #define XBX_MAX_DPORTS 4
  9. #define XBX_MAX_BUTTONSAMPLE 32768
  10. #define XBX_MAX_ANALOGSAMPLE 255
  11. #define XBX_MAX_MESSAGE 2048
  12. #define XBX_MAX_PATH MAX_PATH
  13. #define XBX_MAX_RCMDLENGTH 256
  14. #define XBX_MAX_RCMDNAMELEN 32
  15. #define XBX_HDD_CLUSTERSIZE 16384
  16. // could be dvd or hdd, actual device depends on source of xex launch
  17. #define XBX_DVD_DRIVE "D:\\"
  18. #define XBX_BOOT_DRIVE "D:\\"
  19. #define XBX_IOTHREAD_STACKSIZE 32768
  20. #define XBX_IOTHREAD_PRIORITY THREAD_PRIORITY_HIGHEST
  21. // scale by screen dimension to get an inset
  22. #define XBOX_MINBORDERSAFE 0.05f
  23. #define XBOX_MAXBORDERSAFE 0.075f
  24. #define XBX_CALCSIG_TYPE XCALCSIG_FLAG_NON_ROAMABLE
  25. #define XBX_INVALID_STORAGE_ID ((DWORD)-1)
  26. #define XBX_STORAGE_DECLINED ((DWORD)-2)
  27. #define XBX_INVALID_USER_ID ((DWORD)-1)
  28. #define XBX_USER_SETTINGS_CONTAINER_DRIVE "CFG"
  29. #define XBX_USER_SAVES_CONTAINER_DRIVE "SAV"
  30. // Path to our running executable
  31. #define XBX_XEX_BASE_FILENAME "default.xex"
  32. #define XBX_XEX_PATH XBX_BOOT_DRIVE XBX_XEX_BASE_FILENAME
  33. #define XBX_CLR_DEFAULT 0xFF000000
  34. #define XBX_CLR_WARNING 0x0000FFFF
  35. #define XBX_CLR_ERROR 0x000000FF
  36. // disk space requirements
  37. #define XBX_SAVEGAME_BYTES ( 1024 * 1024 * 2 )
  38. #define XBX_CONFIGFILE_BYTES ( 1024 * 100 )
  39. #define XBX_USER_STATS_BYTES ( 1024 * 28 )
  40. #define XBX_USER_SETTINGS_BYTES ( XBX_CONFIGFILE_BYTES + XBX_USER_STATS_BYTES )
  41. #define XBX_PERSISTENT_BYTES_NEEDED ( XBX_SAVEGAME_BYTES * 10 ) // 8 save games, 1 autosave, 1 autosavedangerous
  42. #define XMAKECOLOR( r, g, b ) ((unsigned int)(((unsigned char)(r)|((unsigned int)((unsigned char)(g))<<8))|(((unsigned int)(unsigned char)(b))<<16)))
  43. #define MAKE_NON_SRGB_FMT(x) ((D3DFORMAT)( ((unsigned int)(x)) & ~(D3DFORMAT_SIGNX_MASK | D3DFORMAT_SIGNY_MASK | D3DFORMAT_SIGNZ_MASK)))
  44. #define IS_D3DFORMAT_SRGB( x ) ( MAKESRGBFMT(x) == (x) )
  45. typedef enum
  46. {
  47. XEV_NULL,
  48. XEV_REMOTECMD,
  49. XEV_QUIT,
  50. XEV_LISTENER_NOTIFICATION,
  51. } xevent_e;
  52. typedef struct xevent_s
  53. {
  54. xevent_e event;
  55. int arg1;
  56. int arg2;
  57. int arg3;
  58. } xevent_t;
  59. typedef struct xevent_SYS_SIGNINCHANGED_s
  60. {
  61. XUID xuid[ XUSER_MAX_COUNT ];
  62. XUSER_SIGNIN_STATE state[ XUSER_MAX_COUNT ];
  63. DWORD dwParam;
  64. } xevent_SYS_SIGNINCHANGED_t;
  65. typedef enum
  66. {
  67. XK_NULL,
  68. XK_BUTTON_UP,
  69. XK_BUTTON_DOWN,
  70. XK_BUTTON_LEFT,
  71. XK_BUTTON_RIGHT,
  72. XK_BUTTON_START,
  73. XK_BUTTON_BACK,
  74. XK_BUTTON_STICK1,
  75. XK_BUTTON_STICK2,
  76. XK_BUTTON_A,
  77. XK_BUTTON_B,
  78. XK_BUTTON_X,
  79. XK_BUTTON_Y,
  80. XK_BUTTON_LEFT_SHOULDER,
  81. XK_BUTTON_RIGHT_SHOULDER,
  82. XK_BUTTON_LTRIGGER,
  83. XK_BUTTON_RTRIGGER,
  84. XK_STICK1_UP,
  85. XK_STICK1_DOWN,
  86. XK_STICK1_LEFT,
  87. XK_STICK1_RIGHT,
  88. XK_STICK2_UP,
  89. XK_STICK2_DOWN,
  90. XK_STICK2_LEFT,
  91. XK_STICK2_RIGHT,
  92. XK_BUTTON_INACTIVE_START, // Special key that is passed through on disabled controllers
  93. XK_BUTTON_FIREMODE_SELECTOR_1,
  94. XK_BUTTON_FIREMODE_SELECTOR_2,
  95. XK_BUTTON_FIREMODE_SELECTOR_3,
  96. XK_BUTTON_RELOAD,
  97. XK_BUTTON_TRIGGER,
  98. XK_BUTTON_PUMP_ACTION,
  99. XK_XBUTTON_ROLL_RIGHT,
  100. XK_XBUTTON_ROLL_LEFT,
  101. XK_MAX_KEYS,
  102. } xKey_t;
  103. typedef struct
  104. {
  105. const char *pName;
  106. const char *pGroupName;
  107. const char *pFormatName;
  108. int size;
  109. int width;
  110. int height;
  111. int depth;
  112. int numLevels;
  113. int binds;
  114. int refCount;
  115. int sRGB;
  116. int edram;
  117. int procedural;
  118. int cacheableState;
  119. int cacheableSize;
  120. int final;
  121. int failed;
  122. int pwl;
  123. int reduced;
  124. } xTextureList_t;
  125. typedef struct
  126. {
  127. const char *pName;
  128. const char *pShaderName;
  129. int refCount;
  130. } xMaterialList_t;
  131. typedef struct
  132. {
  133. char name[MAX_PATH];
  134. char formatName[32];
  135. int rate;
  136. int bits;
  137. int channels;
  138. int looped;
  139. int dataSize;
  140. int numSamples;
  141. int streamed;
  142. int quality;
  143. } xSoundList_t;
  144. typedef struct
  145. {
  146. float position[3];
  147. float angle[3];
  148. char mapPath[256];
  149. char savePath[256];
  150. int build;
  151. int skill;
  152. char details[1024];
  153. } xMapInfo_t;
  154. typedef struct
  155. {
  156. int BSPSize;
  157. } xBudgetInfo_t;
  158. struct xModelList_t
  159. {
  160. char name[MAX_PATH];
  161. int dataSize;
  162. int numVertices;
  163. int triCount;
  164. int dataSizeLod0;
  165. int numVerticesLod0;
  166. int triCountLod0;
  167. int numBones;
  168. int numParts;
  169. int numLODs;
  170. int numMeshes;
  171. };
  172. struct xDataCacheItem_t
  173. {
  174. char name[MAX_PATH];
  175. char section[64];
  176. int size;
  177. int lockCount;
  178. unsigned int clientId;
  179. unsigned int itemData;
  180. unsigned int handle;
  181. };
  182. struct xVProfNodeItem_t
  183. {
  184. const char *pName;
  185. const char *pBudgetGroupName;
  186. unsigned int budgetGroupColor;
  187. unsigned int totalCalls;
  188. double inclusiveTime;
  189. double exclusiveTime;
  190. };
  191. /******************************************************************************
  192. XBOX_SYSTEM.CPP
  193. ******************************************************************************/
  194. #if defined( PLATFORM_H )
  195. // redirect debugging output through xbox debug channel
  196. #define OutputDebugStringA XBX_OutputDebugStringA
  197. // Messages
  198. PLATFORM_INTERFACE void XBX_Error( const char* format, ... );
  199. PLATFORM_INTERFACE void XBX_OutputDebugStringA( LPCSTR lpOutputString );
  200. // Event handling
  201. PLATFORM_INTERFACE bool XBX_NotifyCreateListener( ULONG64 categories );
  202. PLATFORM_INTERFACE void XBX_QueueEvent( xevent_e event, int arg1, int arg2, int arg3 );
  203. PLATFORM_INTERFACE void XBX_ProcessEvents( void );
  204. PLATFORM_INTERFACE void XBX_DispatchEventsQueue( void );
  205. // Accessors
  206. PLATFORM_INTERFACE const char* XBX_GetLanguageString( void );
  207. PLATFORM_INTERFACE bool XBX_IsLocalized( void );
  208. PLATFORM_INTERFACE bool XBX_IsAudioLocalized( void );
  209. PLATFORM_INTERFACE const char *XBX_GetNextSupportedLanguage( const char *pLanguage, bool *pbHasAudio );
  210. PLATFORM_INTERFACE bool XBX_IsRestrictiveLanguage( void );
  211. //
  212. // Storage devices management
  213. //
  214. PLATFORM_INTERFACE void XBX_ResetStorageDeviceInfo();
  215. PLATFORM_INTERFACE DWORD XBX_DescribeStorageDevice( DWORD nStorageID );
  216. PLATFORM_INTERFACE char const *XBX_MakeStorageContainerRoot( int iController, char const *szRootName, char *pBuffer, int numBufferBytes );
  217. PLATFORM_INTERFACE DWORD XBX_GetStorageDeviceId( int iController );
  218. PLATFORM_INTERFACE void XBX_SetStorageDeviceId( int iController, DWORD id );
  219. //
  220. // Information about game primary user
  221. //
  222. PLATFORM_INTERFACE DWORD XBX_GetPrimaryUserId( void );
  223. PLATFORM_INTERFACE void XBX_SetPrimaryUserId( DWORD id );
  224. PLATFORM_INTERFACE DWORD XBX_GetPrimaryUserIsGuest( void );
  225. PLATFORM_INTERFACE void XBX_SetPrimaryUserIsGuest( DWORD bPrimaryUserIsGuest );
  226. //
  227. // Disabling and enabling input from controllers
  228. //
  229. PLATFORM_INTERFACE void XBX_ResetUserIdSlots();
  230. PLATFORM_INTERFACE void XBX_ClearUserIdSlots();
  231. //
  232. // Mapping between game slots and controllers
  233. //
  234. PLATFORM_INTERFACE int XBX_GetUserId( int nSlot );
  235. PLATFORM_INTERFACE int XBX_GetSlotByUserId( int idx );
  236. PLATFORM_INTERFACE void XBX_SetUserId( int nSlot, int idx );
  237. PLATFORM_INTERFACE void XBX_ClearSlot( int nSlot );
  238. PLATFORM_INTERFACE void XBX_ClearUserId( int idx );
  239. PLATFORM_INTERFACE DWORD XBX_GetUserIsGuest( int nSlot );
  240. PLATFORM_INTERFACE void XBX_SetUserIsGuest( int nSlot, DWORD dwUserIsGuest );
  241. //
  242. // Number of game users
  243. //
  244. PLATFORM_INTERFACE DWORD XBX_GetNumGameUsers( void );
  245. PLATFORM_INTERFACE void XBX_SetNumGameUsers( DWORD numGameUsers );
  246. //
  247. // Invite related functions
  248. //
  249. PLATFORM_INTERFACE XNKID XBX_GetInviteSessionId( void );
  250. PLATFORM_INTERFACE void XBX_SetInviteSessionId( XNKID nSessionId );
  251. PLATFORM_INTERFACE XUID XBX_GetInvitedUserXuid( void );
  252. PLATFORM_INTERFACE void XBX_SetInvitedUserXuid( XUID xuid );
  253. PLATFORM_INTERFACE DWORD XBX_GetInvitedUserId( void );
  254. PLATFORM_INTERFACE void XBX_SetInvitedUserId( DWORD nUserId );
  255. #endif