mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Reverse engineer 'CAppSystemGroup' class
Partially reverse engineered.
This commit is contained in:
parent
5056d8f040
commit
2fdcf2ce2c
@ -12,16 +12,24 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Initialize plugin system
|
// Purpose: Initialize plugin system
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CAppSystemGroup::Destroy(CAppSystemGroup* pModAppSystemGroup)
|
void CAppSystemGroup::S_Destroy(CAppSystemGroup* pModAppSystemGroup)
|
||||||
{
|
{
|
||||||
CAppSystemGroup_Destroy(pModAppSystemGroup);
|
CAppSystemGroup_Destroy(pModAppSystemGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Returns the stage at which the app system group ran into an error
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
CAppSystemGroup::AppSystemGroupStage_t CAppSystemGroup::GetCurrentStage() const
|
||||||
|
{
|
||||||
|
return m_nCurrentStage;
|
||||||
|
}
|
||||||
|
|
||||||
void VAppSystemGroup::Attach(void) const
|
void VAppSystemGroup::Attach(void) const
|
||||||
{
|
{
|
||||||
DetourAttach(&CAppSystemGroup_Destroy, &CAppSystemGroup::Destroy);
|
DetourAttach(&CAppSystemGroup_Destroy, &CAppSystemGroup::S_Destroy);
|
||||||
}
|
}
|
||||||
void VAppSystemGroup::Detach(void) const
|
void VAppSystemGroup::Detach(void) const
|
||||||
{
|
{
|
||||||
DetourDetach(&CAppSystemGroup_Destroy, &CAppSystemGroup::Destroy);
|
DetourDetach(&CAppSystemGroup_Destroy, &CAppSystemGroup::S_Destroy);
|
||||||
}
|
}
|
@ -1,13 +1,96 @@
|
|||||||
#ifndef APPSYSTEMGROUP_H
|
#ifndef APPSYSTEMGROUP_H
|
||||||
#define APPSYSTEMGROUP_H
|
#define APPSYSTEMGROUP_H
|
||||||
|
|
||||||
class CAppSystemGroup
|
#include "public/interface.h"
|
||||||
|
#include "tier1/utlvector.h"
|
||||||
|
#include "filesystem/filesystem.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// NOTE: The following methods must be implemented in your application
|
||||||
|
// although they can be empty implementations if you like...
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
abstract_class IAppSystemGroup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Destroy(CAppSystemGroup* pAppSystemGroup);
|
virtual ~IAppSystemGroup() {}
|
||||||
|
|
||||||
|
// An installed application creation function, you should tell the group
|
||||||
|
// the DLLs and the singleton interfaces you want to instantiate.
|
||||||
|
// Return false if there's any problems and the app will abort
|
||||||
|
virtual bool Create() = 0;
|
||||||
|
|
||||||
|
// Allow the application to do some work after AppSystems are connected but
|
||||||
|
// they are all Initialized.
|
||||||
|
// Return false if there's any problems and the app will abort
|
||||||
|
virtual bool PreInit() = 0;
|
||||||
|
|
||||||
|
// Allow the application to do some work after AppSystems are initialized but
|
||||||
|
// before main is run
|
||||||
|
// Return false if there's any problems and the app will abort
|
||||||
|
virtual bool PostInit() = 0;
|
||||||
|
|
||||||
|
// Main loop implemented by the application
|
||||||
|
virtual int Main() = 0;
|
||||||
|
|
||||||
|
// Allow the application to do some work after all AppSystems are shut down
|
||||||
|
virtual void PreShutdown() = 0;
|
||||||
|
|
||||||
|
// Allow the application to do some work after all AppSystems are shut down
|
||||||
|
virtual void PostShutdown() = 0;
|
||||||
|
|
||||||
|
// Call an installed application destroy function, occurring after all modules
|
||||||
|
// are unloaded
|
||||||
|
virtual void Destroy() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// This class represents a group of app systems that all have the same lifetime
|
||||||
|
// that need to be connected/initialized, etc. in a well-defined order
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class CAppSystemGroup : public IAppSystemGroup
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Used to determine where we exited out from the system
|
||||||
|
enum AppSystemGroupStage_t
|
||||||
|
{
|
||||||
|
CREATION = 0,
|
||||||
|
DEPENDENCIES,
|
||||||
|
CONNECTION,
|
||||||
|
PREINITIALIZATION,
|
||||||
|
INITIALIZATION,
|
||||||
|
POSTINITIALIZATION,
|
||||||
|
RUNNING,
|
||||||
|
PRESHUTDOWN,
|
||||||
|
SHUTDOWN,
|
||||||
|
POSTSHUTDOWN,
|
||||||
|
DISCONNECTION,
|
||||||
|
DESTRUCTION,
|
||||||
|
|
||||||
|
APPSYSTEM_GROUP_STAGE_COUNT,
|
||||||
|
NONE, // This means no error
|
||||||
|
};
|
||||||
|
|
||||||
|
// Detour statics.
|
||||||
|
static void S_Destroy(CAppSystemGroup* pAppSystemGroup);
|
||||||
|
|
||||||
|
// Returns the stage at which the app system group ran into an error
|
||||||
|
AppSystemGroupStage_t GetCurrentStage() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct Module_t
|
||||||
|
{
|
||||||
|
void /*CSysModule*/* m_pModule;
|
||||||
|
CreateInterfaceFn m_Factory;
|
||||||
|
char* m_pModuleName;
|
||||||
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
char pad[0xA8];
|
CUtlVector<Module_t> m_Modules;
|
||||||
|
CUtlVector<IAppSystem*> m_Systems;
|
||||||
|
CUtlVector<CreateInterfaceFn> m_NonAppSystemFactories;
|
||||||
|
char m_Pad[56]; // <-- unknown
|
||||||
|
AppSystemGroupStage_t m_nCurrentStage;
|
||||||
|
CFileSystem_Stdio* m_pFileSystem;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline CMemory p_CAppSystemGroup_Destroy;
|
inline CMemory p_CAppSystemGroup_Destroy;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user