From 1e7bfcde2e0dd37a153bbb3f0ec5bea4ce963d9e Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:58:57 +0100 Subject: [PATCH] AppFrameWork: adjust IAppSystem interface In this engine, GetTier() doesn't exist, GetDependencies() however does exist (confirmed by the vftable for CInputStackSystem) and therefore we should adjust all interfaces to make it use this instead. --- src/engine/sys_dll2.h | 2 +- src/filesystem/filesystem_std.h | 11 ----------- src/public/appframework/IAppSystem.h | 22 ++++++++-------------- src/public/tier1/tier1.h | 15 ++++++++------- 4 files changed, 17 insertions(+), 33 deletions(-) diff --git a/src/engine/sys_dll2.h b/src/engine/sys_dll2.h index 8f484e7a..343f4994 100644 --- a/src/engine/sys_dll2.h +++ b/src/engine/sys_dll2.h @@ -10,7 +10,7 @@ public: virtual void* QueryInterface(const char* const pInterfaceName) = 0; virtual InitReturnVal_t Init() = 0; virtual void Shutdown() = 0; - virtual AppSystemTier_t GetTier() = 0; + virtual AppSystemInfo_t* GetDependencies() = 0; virtual void Reconnect(const CreateInterfaceFn factory, const char* const pInterfaceName) = 0; // This function must be called before init diff --git a/src/filesystem/filesystem_std.h b/src/filesystem/filesystem_std.h index 37262d01..9908de12 100644 --- a/src/filesystem/filesystem_std.h +++ b/src/filesystem/filesystem_std.h @@ -6,17 +6,6 @@ class CBaseFileSystem : public CTier1AppSystem { public: - // Stub implementation of IAppSystem. - //virtual ~CBaseFileSystem() {}; - virtual bool Connect(const CreateInterfaceFn factory) { return false; }; - virtual void Disconnect() {}; - virtual void* QueryInterface(const char* const pInterfaceName) { return nullptr; }; - virtual InitReturnVal_t Init() { return InitReturnVal_t::INIT_FAILED; }; - virtual void Shutdown() {}; - virtual AppSystemTier_t GetTier() { return AppSystemTier_t::APP_SYSTEM_TIER_OTHER; }; - virtual void Reconnect(const CreateInterfaceFn factory, const char* const pInterfaceName) {}; - - //-------------------------------------------------------- virtual bool IsSteam() const { return false; }; virtual FilesystemMountRetval_t MountSteamContent(int nExtraAppId = -1) { return FilesystemMountRetval_t::FILESYSTEM_MOUNT_FAILED; }; diff --git a/src/public/appframework/IAppSystem.h b/src/public/appframework/IAppSystem.h index 4267abc1..7b068cd2 100644 --- a/src/public/appframework/IAppSystem.h +++ b/src/public/appframework/IAppSystem.h @@ -69,10 +69,7 @@ public: virtual void Shutdown() = 0; // Returns all dependent libraries - //virtual const AppSystemInfo_t* GetDependencies() { return NULL; } - - // Returns the tier - virtual AppSystemTier_t GetTier() = 0; + virtual const AppSystemInfo_t* GetDependencies() { return NULL; } // Reconnect to a particular interface virtual void Reconnect(const CreateInterfaceFn factory, const char* const pInterfaceName) = 0; @@ -88,25 +85,22 @@ public: virtual ~CBaseAppSystem() {}; // Prepended on each class derived class in assembly. // Here's where the app systems get to learn about each other - virtual bool Connect(const CreateInterfaceFn factory) = 0; - virtual void Disconnect() = 0; + virtual bool Connect(const CreateInterfaceFn factory) { return true; }; + virtual void Disconnect() {}; // Here's where systems can access other interfaces implemented by this object // Returns NULL if it doesn't implement the requested interface - virtual void* QueryInterface(const char* const pInterfaceName) = 0; + virtual void* QueryInterface(const char* const pInterfaceName) { return NULL; }; // Init, shutdown - virtual InitReturnVal_t Init() = 0; - virtual void Shutdown() = 0; + virtual InitReturnVal_t Init() { return INIT_OK; }; + virtual void Shutdown() {}; // Returns all dependent libraries - //virtual const AppSystemInfo_t* GetDependencies() { return NULL; } - - // Returns the tier - virtual AppSystemTier_t GetTier() = 0; + virtual const AppSystemInfo_t* GetDependencies() { return NULL; } // Reconnect to a particular interface - virtual void Reconnect(const CreateInterfaceFn factory, const char* const pInterfaceName) = 0; + virtual void Reconnect(const CreateInterfaceFn factory, const char* const pInterfaceName) {}; }; //----------------------------------------------------------------------------- diff --git a/src/public/tier1/tier1.h b/src/public/tier1/tier1.h index bc6f6d51..79390786 100644 --- a/src/public/tier1/tier1.h +++ b/src/public/tier1/tier1.h @@ -13,14 +13,15 @@ template< class IInterface, int ConVarFlag = 0 > class CTier1AppSystem : public CTier0AppSystem< IInterface > { + typedef CTier0AppSystem< IInterface > BaseClass; + public: - virtual bool Connect( const CreateInterfaceFn factory ) = 0; - virtual void Disconnect( ) = 0; - virtual void* QueryInterface( const char* const pInterfaceName ) = 0; - virtual InitReturnVal_t Init( ) = 0; - virtual void Shutdown( ) = 0; - virtual AppSystemTier_t GetTier( ) = 0; - virtual void Reconnect( const CreateInterfaceFn factory, const char* const pInterfaceName ) = 0; + virtual bool Connect( const CreateInterfaceFn factory ) { return true; }; + virtual void Disconnect() {}; + virtual void* QueryInterface(const char* const pInterfaceName) { return NULL; }; + virtual InitReturnVal_t Init() { return INIT_OK; }; + virtual void Shutdown() {}; + virtual const AppSystemInfo_t* GetDependencies() { return NULL; } }; #endif // TIER1_H