InputSystem: fully implement CInputStackSystem in the SDK

The implementation currently only servers as reference, but if we ever have to replace the engine's implementation with the SDK's one, it should now be fully compatible and working.
This commit is contained in:
Kawe Mazidjatari 2024-11-15 15:59:37 +01:00
parent 3dcb058774
commit 68b7c25a10
2 changed files with 35 additions and 33 deletions

View File

@ -216,36 +216,35 @@ void CInputStackSystem::UpdateCursorState()
} }
} }
//-----------------------------------------------------------------------------
// Get dependencies
//-----------------------------------------------------------------------------
//static AppSystemInfo_t s_Dependencies[] =
//{
// { "inputsystem" DLL_EXT_STRING, INPUTSYSTEM_INTERFACE_VERSION },
// { NULL, NULL }
//};
//
//const AppSystemInfo_t* CInputStackSystem::GetDependencies()
//{
// return s_Dependencies;
//}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Shutdown // Shutdown
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//void CInputStackSystem::Shutdown() void CInputStackSystem::Shutdown()
//{ {
// // Delete any leaked contexts // Delete any leaked contexts
// while( m_ContextStack.Count() ) while( m_ContextStack.Count() )
// { {
// InputContext_t *pContext = NULL; InputContext_t *pContext = NULL;
// m_ContextStack.Pop( pContext ); m_ContextStack.Pop( pContext );
// delete pContext; delete pContext;
// } }
//
// BaseClass::Shutdown(); BaseClass::Shutdown();
//} }
//-----------------------------------------------------------------------------
// Get dependencies
//-----------------------------------------------------------------------------
static AppSystemInfo_t s_Dependencies[] =
{
{ "inputsystem" DLL_EXT_STRING, INPUTSYSTEM_INTERFACE_VERSION },
{ NULL, NULL }
};
const AppSystemInfo_t* CInputStackSystem::GetDependencies()
{
return s_Dependencies;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Singleton instance // Singleton instance

View File

@ -30,13 +30,9 @@ class CInputStackSystem : public CTier1AppSystem< IInputStackSystem >
typedef CTier1AppSystem< IInputStackSystem > BaseClass; typedef CTier1AppSystem< IInputStackSystem > BaseClass;
// Methods of IAppSystem // Methods of IAppSystem
// NOTE: currently, the implementation in the game engine is used. If the
// vtable ever gets swapped with the implementation in the SDK, make sure
// to implement BaseClass::Shutdown() and uncomment the functions below !!!
// The implementation in this SDK is identical to that of the engine.
public: public:
//virtual const AppSystemInfo_t* GetDependencies(); virtual void Shutdown();
//virtual void Shutdown(); virtual const AppSystemInfo_t* GetDependencies();
// Methods of IInputStackSystem // Methods of IInputStackSystem
public: public:
@ -56,6 +52,13 @@ private:
CUtlStack< InputContext_t* > m_ContextStack; CUtlStack< InputContext_t* > m_ContextStack;
}; };
// NOTE: we use the engine's implementation of CInputStackSystem, even though
// we have the entire class implemented in the SDK. If, for whatever reason,
// the SDK's implementation is used, make sure all methods are tested properly
// first before fully migrating to the SDK's implementation. The only method
// that appeared to have changed compared to other source game interfaces is
// CInputStackSystem::PopInputContext(), which now actually takes the context
// handle to pop it rather than pushing/popping handles in an explicit order.
extern CInputStackSystem* g_pInputStackSystem; extern CInputStackSystem* g_pInputStackSystem;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////