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
11 KiB

  1. //===== Copyright � 2005-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose: A higher level link library for general use in the game and tools.
  4. //
  5. //===========================================================================//
  6. #ifndef INTERFACES_H
  7. #define INTERFACES_H
  8. #if defined( COMPILER_MSVC )
  9. #pragma once
  10. #endif
  11. //-----------------------------------------------------------------------------
  12. // Interface creation function
  13. //-----------------------------------------------------------------------------
  14. typedef void* (*CreateInterfaceFn)(const char *pName, int *pReturnCode);
  15. //-----------------------------------------------------------------------------
  16. // Macros to declare interfaces appropriate for various tiers
  17. //-----------------------------------------------------------------------------
  18. #if 1 || defined( TIER1_LIBRARY ) || defined( TIER2_LIBRARY ) || defined( TIER3_LIBRARY ) || defined( TIER4_LIBRARY ) || defined( APPLICATION )
  19. #define DECLARE_TIER1_INTERFACE( _Interface, _Global ) extern _Interface * _Global;
  20. #else
  21. #define DECLARE_TIER1_INTERFACE( _Interface, _Global )
  22. #endif
  23. #if 1 || defined( TIER2_LIBRARY ) || defined( TIER3_LIBRARY ) || defined( TIER4_LIBRARY ) || defined( APPLICATION )
  24. #define DECLARE_TIER2_INTERFACE( _Interface, _Global ) extern _Interface * _Global;
  25. #else
  26. #define DECLARE_TIER2_INTERFACE( _Interface, _Global )
  27. #endif
  28. #if 1 || defined( TIER3_LIBRARY ) || defined( TIER4_LIBRARY ) || defined( APPLICATION )
  29. #define DECLARE_TIER3_INTERFACE( _Interface, _Global ) extern _Interface * _Global;
  30. #else
  31. #define DECLARE_TIER3_INTERFACE( _Interface, _Global )
  32. #endif
  33. //-----------------------------------------------------------------------------
  34. // Forward declarations
  35. //-----------------------------------------------------------------------------
  36. class ICvar;
  37. class IProcessUtils;
  38. class ILocalize;
  39. class IPhysics2;
  40. class IPhysics2ActorManager;
  41. class IPhysics2ResourceManager;
  42. class IEventSystem;
  43. class IAsyncFileSystem;
  44. class IColorCorrectionSystem;
  45. class IDebugTextureInfo;
  46. class IFileSystem;
  47. class IRenderHardwareConfig;
  48. class IInputSystem;
  49. class IInputStackSystem;
  50. class IMaterialSystem;
  51. class IMaterialSystem2;
  52. class IMaterialSystemHardwareConfig;
  53. class IMdlLib;
  54. class INetworkSystem;
  55. class IP4;
  56. class IQueuedLoader;
  57. class IResourceAccessControl;
  58. class IPrecacheSystem;
  59. class IRenderDevice;
  60. class IRenderDeviceMgr;
  61. class IResourceSystem;
  62. class IVBAllocTracker;
  63. class IXboxInstaller;
  64. class IMatchFramework;
  65. class ISoundSystem;
  66. class IStudioRender;
  67. class IMatSystemSurface;
  68. class IGameUISystemMgr;
  69. class IDataCache;
  70. class IMDLCache;
  71. class IAvi;
  72. class IBik;
  73. class IDmeMakefileUtils;
  74. class IPhysicsCollision;
  75. class ISoundEmitterSystemBase;
  76. class IMeshSystem;
  77. class IWorldRendererMgr;
  78. class ISceneSystem;
  79. class IVGuiRenderSurface;
  80. class IScaleformUISystemMgr;
  81. class IScaleformUI;
  82. namespace vgui
  83. {
  84. class ISurface;
  85. class IVGui;
  86. class IInput;
  87. class IPanel;
  88. class ILocalize;
  89. class ISchemeManager;
  90. class ISystem;
  91. }
  92. //-----------------------------------------------------------------------------
  93. // Fills out global DLL exported interface pointers
  94. //-----------------------------------------------------------------------------
  95. #define CVAR_INTERFACE_VERSION "VEngineCvar007"
  96. DECLARE_TIER1_INTERFACE( ICvar, cvar );
  97. DECLARE_TIER1_INTERFACE( ICvar, g_pCVar )
  98. #define PROCESS_UTILS_INTERFACE_VERSION "VProcessUtils002"
  99. DECLARE_TIER1_INTERFACE( IProcessUtils, g_pProcessUtils );
  100. #define VPHYSICS2_INTERFACE_VERSION "Physics2 Interface v0.3"
  101. DECLARE_TIER1_INTERFACE( IPhysics2, g_pPhysics2 );
  102. #define VPHYSICS2_ACTOR_MGR_INTERFACE_VERSION "Physics2 Interface ActorMgr v0.1"
  103. DECLARE_TIER1_INTERFACE( IPhysics2ActorManager, g_pPhysics2ActorManager );
  104. #define VPHYSICS2_RESOURCE_MGR_INTERFACE_VERSION "Physics2 Interface ResourceMgr v0.1"
  105. DECLARE_TIER1_INTERFACE( IPhysics2ResourceManager, g_pPhysics2ResourceManager );
  106. #define EVENTSYSTEM_INTERFACE_VERSION "EventSystem001"
  107. DECLARE_TIER1_INTERFACE( IEventSystem, g_pEventSystem );
  108. #define LOCALIZE_INTERFACE_VERSION "Localize_001"
  109. DECLARE_TIER2_INTERFACE( ILocalize, g_pLocalize );
  110. DECLARE_TIER3_INTERFACE( vgui::ILocalize, g_pVGuiLocalize );
  111. #define RENDER_DEVICE_MGR_INTERFACE_VERSION "RenderDeviceMgr001"
  112. DECLARE_TIER2_INTERFACE( IRenderDeviceMgr, g_pRenderDeviceMgr );
  113. #define FILESYSTEM_INTERFACE_VERSION "VFileSystem017"
  114. DECLARE_TIER2_INTERFACE( IFileSystem, g_pFullFileSystem );
  115. #define ASYNCFILESYSTEM_INTERFACE_VERSION "VNewAsyncFileSystem001"
  116. DECLARE_TIER2_INTERFACE( IAsyncFileSystem, g_pAsyncFileSystem );
  117. #define RESOURCESYSTEM_INTERFACE_VERSION "ResourceSystem004"
  118. DECLARE_TIER2_INTERFACE( IResourceSystem, g_pResourceSystem );
  119. #define MATERIAL_SYSTEM_INTERFACE_VERSION "VMaterialSystem080"
  120. DECLARE_TIER2_INTERFACE( IMaterialSystem, materials );
  121. DECLARE_TIER2_INTERFACE( IMaterialSystem, g_pMaterialSystem );
  122. #define MATERIAL_SYSTEM2_INTERFACE_VERSION "VMaterialSystem2_001"
  123. DECLARE_TIER2_INTERFACE( IMaterialSystem2, g_pMaterialSystem2 );
  124. #define INPUTSYSTEM_INTERFACE_VERSION "InputSystemVersion001"
  125. DECLARE_TIER2_INTERFACE( IInputSystem, g_pInputSystem );
  126. #define INPUTSTACKSYSTEM_INTERFACE_VERSION "InputStackSystemVersion001"
  127. DECLARE_TIER2_INTERFACE( IInputStackSystem, g_pInputStackSystem );
  128. #define MATERIALSYSTEM_HARDWARECONFIG_INTERFACE_VERSION "MaterialSystemHardwareConfig013"
  129. DECLARE_TIER2_INTERFACE( IMaterialSystemHardwareConfig, g_pMaterialSystemHardwareConfig );
  130. #define DEBUG_TEXTURE_INFO_VERSION "DebugTextureInfo001"
  131. DECLARE_TIER2_INTERFACE( IDebugTextureInfo, g_pMaterialSystemDebugTextureInfo );
  132. #define VB_ALLOC_TRACKER_INTERFACE_VERSION "VBAllocTracker001"
  133. DECLARE_TIER2_INTERFACE( IVBAllocTracker, g_VBAllocTracker );
  134. #define COLORCORRECTION_INTERFACE_VERSION "COLORCORRECTION_VERSION_1"
  135. DECLARE_TIER2_INTERFACE( IColorCorrectionSystem, colorcorrection );
  136. #define P4_INTERFACE_VERSION "VP4002"
  137. DECLARE_TIER2_INTERFACE( IP4, p4 );
  138. #define MDLLIB_INTERFACE_VERSION "VMDLLIB001"
  139. DECLARE_TIER2_INTERFACE( IMdlLib, mdllib );
  140. #define QUEUEDLOADER_INTERFACE_VERSION "QueuedLoaderVersion001"
  141. DECLARE_TIER2_INTERFACE( IQueuedLoader, g_pQueuedLoader );
  142. #define RESOURCE_ACCESS_CONTROL_INTERFACE_VERSION "VResourceAccessControl001"
  143. DECLARE_TIER2_INTERFACE( IResourceAccessControl, g_pResourceAccessControl );
  144. #define PRECACHE_SYSTEM_INTERFACE_VERSION "VPrecacheSystem001"
  145. DECLARE_TIER2_INTERFACE( IPrecacheSystem, g_pPrecacheSystem );
  146. #if defined( _X360 )
  147. #define XBOXINSTALLER_INTERFACE_VERSION "XboxInstallerVersion001"
  148. DECLARE_TIER2_INTERFACE( IXboxInstaller, g_pXboxInstaller );
  149. #endif
  150. #define MATCHFRAMEWORK_INTERFACE_VERSION "MATCHFRAMEWORK_001"
  151. DECLARE_TIER2_INTERFACE( IMatchFramework, g_pMatchFramework );
  152. #define GAMEUISYSTEMMGR_INTERFACE_VERSION "GameUISystemMgr001"
  153. DECLARE_TIER3_INTERFACE( IGameUISystemMgr, g_pGameUISystemMgr );
  154. #if defined( INCLUDE_SCALEFORM )
  155. #define SCALEFORMUI_INTERFACE_VERSION "ScaleformUI002"
  156. DECLARE_TIER3_INTERFACE( IScaleformUI, g_pScaleformUI );
  157. #endif
  158. //-----------------------------------------------------------------------------
  159. // Not exactly a global, but we're going to keep track of these here anyways
  160. // NOTE: Appframework deals with connecting these bad boys. See materialsystem2app.cpp
  161. //-----------------------------------------------------------------------------
  162. #define RENDER_DEVICE_INTERFACE_VERSION "RenderDevice001"
  163. DECLARE_TIER2_INTERFACE( IRenderDevice, g_pRenderDevice );
  164. #define RENDER_HARDWARECONFIG_INTERFACE_VERSION "RenderHardwareConfig001"
  165. DECLARE_TIER2_INTERFACE( IRenderHardwareConfig, g_pRenderHardwareConfig );
  166. #define SOUNDSYSTEM_INTERFACE_VERSION "SoundSystem001"
  167. DECLARE_TIER2_INTERFACE( ISoundSystem, g_pSoundSystem );
  168. #define MESHSYSTEM_INTERFACE_VERSION "MeshSystem001"
  169. DECLARE_TIER3_INTERFACE( IMeshSystem, g_pMeshSystem );
  170. #define STUDIO_RENDER_INTERFACE_VERSION "VStudioRender026"
  171. DECLARE_TIER3_INTERFACE( IStudioRender, g_pStudioRender );
  172. DECLARE_TIER3_INTERFACE( IStudioRender, studiorender );
  173. #define MAT_SYSTEM_SURFACE_INTERFACE_VERSION "MatSystemSurface006"
  174. DECLARE_TIER3_INTERFACE( IMatSystemSurface, g_pMatSystemSurface );
  175. #define RENDER_SYSTEM_SURFACE_INTERFACE_VERSION "RenderSystemSurface001"
  176. DECLARE_TIER3_INTERFACE( IVGuiRenderSurface, g_pVGuiRenderSurface );
  177. #define SCENESYSTEM_INTERFACE_VERSION "SceneSystem_001"
  178. DECLARE_TIER3_INTERFACE( ISceneSystem, g_pSceneSystem );
  179. #define VGUI_SURFACE_INTERFACE_VERSION "VGUI_Surface031"
  180. DECLARE_TIER3_INTERFACE( vgui::ISurface, g_pVGuiSurface );
  181. #define SCHEME_SURFACE_INTERFACE_VERSION "SchemeSurface001"
  182. #define VGUI_INPUT_INTERFACE_VERSION "VGUI_Input005"
  183. DECLARE_TIER3_INTERFACE( vgui::IInput, g_pVGuiInput );
  184. #define VGUI_IVGUI_INTERFACE_VERSION "VGUI_ivgui008"
  185. DECLARE_TIER3_INTERFACE( vgui::IVGui, g_pVGui );
  186. #define VGUI_PANEL_INTERFACE_VERSION "VGUI_Panel009"
  187. DECLARE_TIER3_INTERFACE( vgui::IPanel, g_pVGuiPanel );
  188. #define VGUI_SCHEME_INTERFACE_VERSION "VGUI_Scheme010"
  189. DECLARE_TIER3_INTERFACE( vgui::ISchemeManager, g_pVGuiSchemeManager );
  190. #define VGUI_SYSTEM_INTERFACE_VERSION "VGUI_System010"
  191. DECLARE_TIER3_INTERFACE( vgui::ISystem, g_pVGuiSystem );
  192. #define DATACACHE_INTERFACE_VERSION "VDataCache003"
  193. DECLARE_TIER3_INTERFACE( IDataCache, g_pDataCache ); // FIXME: Should IDataCache be in tier2?
  194. #define MDLCACHE_INTERFACE_VERSION "MDLCache004"
  195. DECLARE_TIER3_INTERFACE( IMDLCache, g_pMDLCache );
  196. DECLARE_TIER3_INTERFACE( IMDLCache, mdlcache );
  197. #define AVI_INTERFACE_VERSION "VAvi001"
  198. DECLARE_TIER3_INTERFACE( IAvi, g_pAVI );
  199. #define BIK_INTERFACE_VERSION "VBik001"
  200. DECLARE_TIER3_INTERFACE( IBik, g_pBIK );
  201. #define DMEMAKEFILE_UTILS_INTERFACE_VERSION "VDmeMakeFileUtils001"
  202. DECLARE_TIER3_INTERFACE( IDmeMakefileUtils, g_pDmeMakefileUtils );
  203. #define VPHYSICS_COLLISION_INTERFACE_VERSION "VPhysicsCollision007"
  204. DECLARE_TIER3_INTERFACE( IPhysicsCollision, g_pPhysicsCollision );
  205. #define SOUNDEMITTERSYSTEM_INTERFACE_VERSION "VSoundEmitter003"
  206. DECLARE_TIER3_INTERFACE( ISoundEmitterSystemBase, g_pSoundEmitterSystem );
  207. #define WORLD_RENDERER_MGR_INTERFACE_VERSION "WorldRendererMgr001"
  208. DECLARE_TIER3_INTERFACE( IWorldRendererMgr, g_pWorldRendererMgr );
  209. #define NETWORKSYSTEM_INTERFACE_VERSION "NetworkSystemVersion001"
  210. DECLARE_TIER2_INTERFACE( INetworkSystem, g_pNetworkSystem );
  211. //-----------------------------------------------------------------------------
  212. // Fills out global DLL exported interface pointers
  213. //-----------------------------------------------------------------------------
  214. void ConnectInterfaces( CreateInterfaceFn *pFactoryList, int nFactoryCount );
  215. void DisconnectInterfaces();
  216. //-----------------------------------------------------------------------------
  217. // Reconnects an interface
  218. //-----------------------------------------------------------------------------
  219. void ReconnectInterface( CreateInterfaceFn factory, const char *pInterfaceName );
  220. #endif // INTERFACES_H