1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-19 20:16:10 +08:00

ConnectInterfaces() actually works now.

This commit is contained in:
Scott Ehlert
2012-06-02 22:33:10 -05:00
parent bf0a12e642
commit 5744b3b0ee
5 changed files with 68 additions and 107 deletions

View File

@ -74,60 +74,60 @@ struct ConnectionRegistration_t
static const InterfaceGlobals_t g_pInterfaceGlobals[] = static const InterfaceGlobals_t g_pInterfaceGlobals[] =
{ {
{ CVAR_INTERFACE_VERSION, cvar }, { CVAR_INTERFACE_VERSION, &cvar },
{ CVAR_INTERFACE_VERSION, g_pCVar }, { CVAR_INTERFACE_VERSION, &g_pCVar },
{ EVENTSYSTEM_INTERFACE_VERSION, g_pEventSystem }, { EVENTSYSTEM_INTERFACE_VERSION, &g_pEventSystem },
{ PROCESS_UTILS_INTERFACE_VERSION, g_pProcessUtils }, { PROCESS_UTILS_INTERFACE_VERSION, &g_pProcessUtils },
{ VPHYSICS2_INTERFACE_VERSION, g_pPhysics2 }, { VPHYSICS2_INTERFACE_VERSION, &g_pPhysics2 },
{ VPHYSICS2_ACTOR_MGR_INTERFACE_VERSION, g_pPhysics2ActorManager }, { VPHYSICS2_ACTOR_MGR_INTERFACE_VERSION, &g_pPhysics2ActorManager },
{ VPHYSICS2_RESOURCE_MGR_INTERFACE_VERSION, g_pPhysics2ResourceManager }, { VPHYSICS2_RESOURCE_MGR_INTERFACE_VERSION, &g_pPhysics2ResourceManager },
{ FILESYSTEM_INTERFACE_VERSION, g_pFullFileSystem }, { FILESYSTEM_INTERFACE_VERSION, &g_pFullFileSystem },
{ ASYNCFILESYSTEM_INTERFACE_VERSION, g_pAsyncFileSystem }, { ASYNCFILESYSTEM_INTERFACE_VERSION, &g_pAsyncFileSystem },
{ RESOURCESYSTEM_INTERFACE_VERSION, g_pResourceSystem }, { RESOURCESYSTEM_INTERFACE_VERSION, &g_pResourceSystem },
{ MATERIAL_SYSTEM_INTERFACE_VERSION, materials }, { MATERIAL_SYSTEM_INTERFACE_VERSION, &materials },
{ MATERIAL_SYSTEM_INTERFACE_VERSION, g_pMaterialSystem }, { MATERIAL_SYSTEM_INTERFACE_VERSION, &g_pMaterialSystem },
{ MATERIAL_SYSTEM2_INTERFACE_VERSION, g_pMaterialSystem2 }, { MATERIAL_SYSTEM2_INTERFACE_VERSION, &g_pMaterialSystem2 },
{ INPUTSYSTEM_INTERFACE_VERSION, g_pInputSystem }, { INPUTSYSTEM_INTERFACE_VERSION, &g_pInputSystem },
{ INPUTSTACKSYSTEM_INTERFACE_VERSION, g_pInputStackSystem }, { INPUTSTACKSYSTEM_INTERFACE_VERSION, &g_pInputStackSystem },
{ NETWORKSYSTEM_INTERFACE_VERSION, g_pNetworkSystem }, { NETWORKSYSTEM_INTERFACE_VERSION, &g_pNetworkSystem },
{ RENDER_DEVICE_MGR_INTERFACE_VERSION, g_pRenderDeviceMgr }, { RENDER_DEVICE_MGR_INTERFACE_VERSION, &g_pRenderDeviceMgr },
{ MATERIALSYSTEM_HARDWARECONFIG_INTERFACE_VERSION, g_pMaterialSystemHardwareConfig }, { MATERIALSYSTEM_HARDWARECONFIG_INTERFACE_VERSION, &g_pMaterialSystemHardwareConfig },
{ SOUNDSYSTEM_INTERFACE_VERSION, g_pSoundSystem }, { SOUNDSYSTEM_INTERFACE_VERSION, &g_pSoundSystem },
{ DEBUG_TEXTURE_INFO_VERSION, g_pMaterialSystemDebugTextureInfo }, { DEBUG_TEXTURE_INFO_VERSION, &g_pMaterialSystemDebugTextureInfo },
{ VB_ALLOC_TRACKER_INTERFACE_VERSION, g_VBAllocTracker }, { VB_ALLOC_TRACKER_INTERFACE_VERSION, &g_VBAllocTracker },
{ COLORCORRECTION_INTERFACE_VERSION, colorcorrection }, { COLORCORRECTION_INTERFACE_VERSION, &colorcorrection },
{ P4_INTERFACE_VERSION, p4 }, { P4_INTERFACE_VERSION, &p4 },
{ MDLLIB_INTERFACE_VERSION, mdllib }, { MDLLIB_INTERFACE_VERSION, &mdllib },
{ QUEUEDLOADER_INTERFACE_VERSION, g_pQueuedLoader }, { QUEUEDLOADER_INTERFACE_VERSION, &g_pQueuedLoader },
{ RESOURCE_ACCESS_CONTROL_INTERFACE_VERSION, g_pResourceAccessControl }, { RESOURCE_ACCESS_CONTROL_INTERFACE_VERSION, &g_pResourceAccessControl },
{ PRECACHE_SYSTEM_INTERFACE_VERSION, g_pPrecacheSystem }, { PRECACHE_SYSTEM_INTERFACE_VERSION, &g_pPrecacheSystem },
{ STUDIO_RENDER_INTERFACE_VERSION, g_pStudioRender }, { STUDIO_RENDER_INTERFACE_VERSION, &g_pStudioRender },
{ STUDIO_RENDER_INTERFACE_VERSION, studiorender }, { STUDIO_RENDER_INTERFACE_VERSION, &studiorender },
{ VGUI_IVGUI_INTERFACE_VERSION, g_pVGui }, { VGUI_IVGUI_INTERFACE_VERSION, &g_pVGui },
{ VGUI_INPUT_INTERFACE_VERSION, g_pVGuiInput }, { VGUI_INPUT_INTERFACE_VERSION, &g_pVGuiInput },
{ VGUI_PANEL_INTERFACE_VERSION, g_pVGuiPanel }, { VGUI_PANEL_INTERFACE_VERSION, &g_pVGuiPanel },
{ VGUI_SURFACE_INTERFACE_VERSION, g_pVGuiSurface }, { VGUI_SURFACE_INTERFACE_VERSION, &g_pVGuiSurface },
{ VGUI_SCHEME_INTERFACE_VERSION, g_pVGuiSchemeManager }, { VGUI_SCHEME_INTERFACE_VERSION, &g_pVGuiSchemeManager },
{ VGUI_SYSTEM_INTERFACE_VERSION, g_pVGuiSystem }, { VGUI_SYSTEM_INTERFACE_VERSION, &g_pVGuiSystem },
{ LOCALIZE_INTERFACE_VERSION, g_pLocalize }, { LOCALIZE_INTERFACE_VERSION, &g_pLocalize },
{ LOCALIZE_INTERFACE_VERSION, g_pVGuiLocalize }, { LOCALIZE_INTERFACE_VERSION, &g_pVGuiLocalize },
{ MAT_SYSTEM_SURFACE_INTERFACE_VERSION, g_pMatSystemSurface }, { MAT_SYSTEM_SURFACE_INTERFACE_VERSION, &g_pMatSystemSurface },
{ DATACACHE_INTERFACE_VERSION, g_pDataCache }, { DATACACHE_INTERFACE_VERSION, &g_pDataCache },
{ MDLCACHE_INTERFACE_VERSION, g_pMDLCache }, { MDLCACHE_INTERFACE_VERSION, &g_pMDLCache },
{ MDLCACHE_INTERFACE_VERSION, mdlcache }, { MDLCACHE_INTERFACE_VERSION, &mdlcache },
{ AVI_INTERFACE_VERSION, g_pAVI }, { AVI_INTERFACE_VERSION, &g_pAVI },
{ BIK_INTERFACE_VERSION, g_pBIK }, { BIK_INTERFACE_VERSION, &g_pBIK },
{ DMEMAKEFILE_UTILS_INTERFACE_VERSION, g_pDmeMakefileUtils }, { DMEMAKEFILE_UTILS_INTERFACE_VERSION, &g_pDmeMakefileUtils },
{ VPHYSICS_COLLISION_INTERFACE_VERSION, g_pPhysicsCollision }, { VPHYSICS_COLLISION_INTERFACE_VERSION, &g_pPhysicsCollision },
{ SOUNDEMITTERSYSTEM_INTERFACE_VERSION, g_pSoundEmitterSystem }, { SOUNDEMITTERSYSTEM_INTERFACE_VERSION, &g_pSoundEmitterSystem },
{ MESHSYSTEM_INTERFACE_VERSION, g_pMeshSystem }, { MESHSYSTEM_INTERFACE_VERSION, &g_pMeshSystem },
{ RENDER_DEVICE_INTERFACE_VERSION, g_pRenderDevice }, { RENDER_DEVICE_INTERFACE_VERSION, &g_pRenderDevice },
{ RENDER_HARDWARECONFIG_INTERFACE_VERSION, g_pRenderHardwareConfig }, { RENDER_HARDWARECONFIG_INTERFACE_VERSION, &g_pRenderHardwareConfig },
{ SCENESYSTEM_INTERFACE_VERSION, g_pSceneSystem }, { SCENESYSTEM_INTERFACE_VERSION, &g_pSceneSystem },
{ WORLD_RENDERER_MGR_INTERFACE_VERSION, g_pWorldRendererMgr }, { WORLD_RENDERER_MGR_INTERFACE_VERSION, &g_pWorldRendererMgr },
{ RENDER_SYSTEM_SURFACE_INTERFACE_VERSION, g_pVGuiRenderSurface }, { RENDER_SYSTEM_SURFACE_INTERFACE_VERSION, &g_pVGuiRenderSurface },
{ MATCHFRAMEWORK_INTERFACE_VERSION, g_pMatchFramework }, { MATCHFRAMEWORK_INTERFACE_VERSION, &g_pMatchFramework },
{ GAMEUISYSTEMMGR_INTERFACE_VERSION, g_pGameUISystemMgr } { GAMEUISYSTEMMGR_INTERFACE_VERSION, &g_pGameUISystemMgr }
}; };
static const int NUM_INTERFACES = sizeof(g_pInterfaceGlobals) / sizeof(InterfaceGlobals_t); static const int NUM_INTERFACES = sizeof(g_pInterfaceGlobals) / sizeof(InterfaceGlobals_t);
@ -137,7 +137,7 @@ static int s_nRegistrationCount;
static ConnectionRegistration_t s_pConnectionRegistration[NUM_INTERFACES + 1]; static ConnectionRegistration_t s_pConnectionRegistration[NUM_INTERFACES + 1];
void ReconnectInterface(CreateInterfaceFn factory, char const *pInterfaceName, void **w); void ReconnectInterface(CreateInterfaceFn factory, char const *pInterfaceName, void **ppGlobal);
void ConnectInterfaces(CreateInterfaceFn *pFactoryList, int nFactoryCount) void ConnectInterfaces(CreateInterfaceFn *pFactoryList, int nFactoryCount)
{ {
@ -207,7 +207,10 @@ void ReconnectInterface(CreateInterfaceFn factory, char const *pInterfaceName, v
for (int i = 0; i < s_nRegistrationCount; i++) for (int i = 0; i < s_nRegistrationCount; i++)
{ {
if (s_pConnectionRegistration[i].m_ppGlobalStorage == ppGlobal) if (s_pConnectionRegistration[i].m_ppGlobalStorage == ppGlobal)
{
got = true; got = true;
break;
}
} }
if ((s_nRegistrationCount <= 0 || !got) && *ppGlobal) if ((s_nRegistrationCount <= 0 || !got) && *ppGlobal)

View File

@ -35,13 +35,7 @@
<PropertyGroup> <PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion> <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\lib\public\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\lib\public\</OutDir>
<PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PostBuildEventUseInBuild>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\lib\public\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\lib\public\</OutDir>
<PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</PostBuildEventUseInBuild>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
@ -57,7 +51,7 @@
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\public;..\public\tier0;..\public\tier1;..\public\interfaces;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\public;..\public\tier0;..\public\tier1;..\public\interfaces;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;COMPILER_MSVC;COMPILER_MSVC32;_DEBUG;DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TIER1_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_WIN32;COMPILER_MSVC;COMPILER_MSVC32;_DEBUG;DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild> <MinimalRebuild>true</MinimalRebuild>
<ExceptionHandling> <ExceptionHandling>
@ -66,25 +60,12 @@
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck> <BufferSecurityCheck>false</BufferSecurityCheck>
<FloatingPointModel>Fast</FloatingPointModel> <FloatingPointModel>Fast</FloatingPointModel>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<ExpandAttributedSource>false</ExpandAttributedSource>
<AssemblerOutput> <AssemblerOutput>
</AssemblerOutput> </AssemblerOutput>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<BrowseInformation> <BrowseInformation>
</BrowseInformation> </BrowseInformation>
<BrowseInformationFile>$(IntDir)</BrowseInformationFile>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<ErrorReporting>Prompt</ErrorReporting>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
</ClCompile> </ClCompile>
<PreLinkEvent> <PreLinkEvent>
@ -92,17 +73,12 @@
</Command> </Command>
</PreLinkEvent> </PreLinkEvent>
<Lib> <Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<AdditionalDependencies>Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib> </Lib>
<Xdcmake> <Xdcmake>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
</Xdcmake> </Xdcmake>
<Bscmake> <Bscmake />
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>$(OutDir)tier1.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent> <PreBuildEvent>
@ -110,56 +86,38 @@
</Command> </Command>
</PreBuildEvent> </PreBuildEvent>
<ClCompile> <ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\public;..\public\tier0;..\public\tier1;..\public\interfaces;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\public;..\public\tier0;..\public\tier1;..\public\interfaces;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;COMPILER_MSVC;COMPILER_MSVC32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TIER1_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_WIN32;COMPILER_MSVC;COMPILER_MSVC32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<ExceptionHandling> <ExceptionHandling>
</ExceptionHandling> </ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck> <BufferSecurityCheck>false</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<FloatingPointModel>Fast</FloatingPointModel>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<ExpandAttributedSource>false</ExpandAttributedSource>
<AssemblerOutput> <AssemblerOutput>
</AssemblerOutput> </AssemblerOutput>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<BrowseInformation> <BrowseInformation>
</BrowseInformation> </BrowseInformation>
<BrowseInformationFile>$(IntDir)</BrowseInformationFile>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<ErrorReporting>Prompt</ErrorReporting>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<FloatingPointModel>Fast</FloatingPointModel>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile> </ClCompile>
<PreLinkEvent> <PreLinkEvent>
<Command> <Command>
</Command> </Command>
</PreLinkEvent> </PreLinkEvent>
<Lib> <Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles> <AdditionalDependencies>
<AdditionalDependencies>Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies> </AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib> </Lib>
<Xdcmake> <Xdcmake>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
</Xdcmake> </Xdcmake>
<Bscmake> <Bscmake />
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>$(OutDir)tier1.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\public\tier1\bitbuf.h" /> <ClInclude Include="..\public\tier1\bitbuf.h" />

Binary file not shown.

Binary file not shown.

Binary file not shown.