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.

182 lines
4.7 KiB

  1. //========= Copyright Valve Corporation, 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. // Path to our running executable
  30. #define XBX_XEX_BASE_FILENAME "default.xex"
  31. #define XBX_XEX_PATH XBX_BOOT_DRIVE XBX_XEX_BASE_FILENAME
  32. #define XBX_CLR_DEFAULT 0xFF000000
  33. #define XBX_CLR_WARNING 0x0000FFFF
  34. #define XBX_CLR_ERROR 0x000000FF
  35. // disk space requirements
  36. #define XBX_SAVEGAME_BYTES ( 1024 * 1024 * 2 )
  37. #define XBX_CONFIGFILE_BYTES ( 1024 * 100 )
  38. #define XBX_USER_STATS_BYTES ( 1024 * 28 )
  39. #define XBX_USER_SETTINGS_BYTES ( XBX_CONFIGFILE_BYTES + XBX_USER_STATS_BYTES )
  40. #define XBX_PERSISTENT_BYTES_NEEDED ( XBX_SAVEGAME_BYTES * 10 ) // 8 save games, 1 autosave, 1 autosavedangerous
  41. #define XMAKECOLOR( r, g, b ) ((unsigned int)(((unsigned char)(r)|((unsigned int)((unsigned char)(g))<<8))|(((unsigned int)(unsigned char)(b))<<16)))
  42. #define MAKE_NON_SRGB_FMT(x) ((D3DFORMAT)( ((unsigned int)(x)) & ~(D3DFORMAT_SIGNX_MASK | D3DFORMAT_SIGNY_MASK | D3DFORMAT_SIGNZ_MASK)))
  43. #define IS_D3DFORMAT_SRGB( x ) ( MAKESRGBFMT(x) == (x) )
  44. typedef enum
  45. {
  46. XEV_NULL,
  47. XEV_REMOTECMD,
  48. XEV_QUIT,
  49. XEV_LISTENER_NOTIFICATION,
  50. } xevent_e;
  51. typedef struct xevent_s
  52. {
  53. xevent_e event;
  54. int arg1;
  55. int arg2;
  56. int arg3;
  57. } xevent_t;
  58. typedef enum
  59. {
  60. XK_NULL,
  61. XK_BUTTON_UP,
  62. XK_BUTTON_DOWN,
  63. XK_BUTTON_LEFT,
  64. XK_BUTTON_RIGHT,
  65. XK_BUTTON_START,
  66. XK_BUTTON_BACK,
  67. XK_BUTTON_STICK1,
  68. XK_BUTTON_STICK2,
  69. XK_BUTTON_A,
  70. XK_BUTTON_B,
  71. XK_BUTTON_X,
  72. XK_BUTTON_Y,
  73. XK_BUTTON_LEFT_SHOULDER,
  74. XK_BUTTON_RIGHT_SHOULDER,
  75. XK_BUTTON_LTRIGGER,
  76. XK_BUTTON_RTRIGGER,
  77. XK_STICK1_UP,
  78. XK_STICK1_DOWN,
  79. XK_STICK1_LEFT,
  80. XK_STICK1_RIGHT,
  81. XK_STICK2_UP,
  82. XK_STICK2_DOWN,
  83. XK_STICK2_LEFT,
  84. XK_STICK2_RIGHT,
  85. XK_MAX_KEYS,
  86. } xKey_t;
  87. typedef struct
  88. {
  89. const char *pName;
  90. const char *pGroupName;
  91. const char *pFormatName;
  92. int size;
  93. int width;
  94. int height;
  95. int depth;
  96. int numLevels;
  97. int binds;
  98. int refCount;
  99. int sRGB;
  100. int edram;
  101. int procedural;
  102. int fallback;
  103. int final;
  104. int failed;
  105. } xTextureList_t;
  106. typedef struct
  107. {
  108. const char *pName;
  109. const char *pShaderName;
  110. int refCount;
  111. } xMaterialList_t;
  112. typedef struct
  113. {
  114. char name[MAX_PATH];
  115. char formatName[32];
  116. int rate;
  117. int bits;
  118. int channels;
  119. int looped;
  120. int dataSize;
  121. int numSamples;
  122. int streamed;
  123. } xSoundList_t;
  124. typedef struct
  125. {
  126. float position[3];
  127. float angle[3];
  128. char mapPath[256];
  129. char savePath[256];
  130. int build;
  131. int skill;
  132. } xMapInfo_t;
  133. /******************************************************************************
  134. XBOX_SYSTEM.CPP
  135. ******************************************************************************/
  136. #if defined( PLATFORM_H )
  137. // redirect debugging output through xbox debug channel
  138. #define OutputDebugStringA XBX_OutputDebugStringA
  139. // Messages
  140. PLATFORM_INTERFACE void XBX_Error( const char* format, ... );
  141. PLATFORM_INTERFACE void XBX_OutputDebugStringA( LPCSTR lpOutputString );
  142. // Event handling
  143. PLATFORM_INTERFACE bool XBX_NotifyCreateListener( ULONG64 categories );
  144. PLATFORM_INTERFACE void XBX_QueueEvent( xevent_e event, int arg1, int arg2, int arg3 );
  145. PLATFORM_INTERFACE void XBX_ProcessEvents( void );
  146. // Accessors
  147. PLATFORM_INTERFACE const char* XBX_GetLanguageString( void );
  148. PLATFORM_INTERFACE bool XBX_IsLocalized( void );
  149. PLATFORM_INTERFACE DWORD XBX_GetStorageDeviceId( void );
  150. PLATFORM_INTERFACE void XBX_SetStorageDeviceId( DWORD id );
  151. PLATFORM_INTERFACE DWORD XBX_GetPrimaryUserId( void );
  152. PLATFORM_INTERFACE void XBX_SetPrimaryUserId( DWORD id );
  153. PLATFORM_INTERFACE XNKID XBX_GetInviteSessionId( void );
  154. PLATFORM_INTERFACE void XBX_SetInviteSessionId( XNKID nSessionId );
  155. PLATFORM_INTERFACE DWORD XBX_GetInvitedUserId( void );
  156. PLATFORM_INTERFACE void XBX_SetInvitedUserId( DWORD nUserId );
  157. #endif