mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Map CAppSystemGroup out more
Added members: - CUtlDict<int, unsigned short> m_SystemDict; - CAppSystemGroup* m_pParentAppSystem; Added functions: - FindSystem (untested and unused at the moment!)
This commit is contained in:
parent
20cc4b1439
commit
ee6e1a6cf0
@ -25,6 +25,47 @@ CAppSystemGroup::AppSystemGroupStage_t CAppSystemGroup::GetCurrentStage() const
|
||||
return m_nCurrentStage;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Methods to find various global singleton systems
|
||||
//-----------------------------------------------------------------------------
|
||||
void* CAppSystemGroup::FindSystem(const char* pSystemName)
|
||||
{
|
||||
unsigned short i = m_SystemDict.Find(pSystemName);
|
||||
if (i != m_SystemDict.InvalidIndex())
|
||||
return m_Systems[m_SystemDict[i]];
|
||||
|
||||
// If it's not an interface we know about, it could be an older
|
||||
// version of an interface, or maybe something implemented by
|
||||
// one of the instantiated interfaces...
|
||||
|
||||
// QUESTION: What order should we iterate this in?
|
||||
// It controls who wins if multiple ones implement the same interface
|
||||
for (i = 0; i < m_Systems.Count(); ++i)
|
||||
{
|
||||
void* pInterface = m_Systems[i]->QueryInterface(pSystemName);
|
||||
if (pInterface)
|
||||
return pInterface;
|
||||
}
|
||||
|
||||
int nExternalCount = m_NonAppSystemFactories.Count();
|
||||
for (i = 0; i < nExternalCount; ++i)
|
||||
{
|
||||
void* pInterface = m_NonAppSystemFactories[i](pSystemName, NULL);
|
||||
if (pInterface)
|
||||
return pInterface;
|
||||
}
|
||||
|
||||
if (m_pParentAppSystem)
|
||||
{
|
||||
void* pInterface = m_pParentAppSystem->FindSystem(pSystemName);
|
||||
if (pInterface)
|
||||
return pInterface;
|
||||
}
|
||||
|
||||
// No dice..
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void VAppSystemGroup::Attach(void) const
|
||||
{
|
||||
DetourAttach(&CAppSystemGroup_Destroy, &CAppSystemGroup::StaticDestroy);
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "tier1/interface.h"
|
||||
#include "tier1/utlvector.h"
|
||||
#include "tier1/utldict.h"
|
||||
#include "filesystem/filesystem.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -76,10 +77,13 @@ public:
|
||||
// Returns the stage at which the app system group ran into an error
|
||||
AppSystemGroupStage_t GetCurrentStage() const;
|
||||
|
||||
// Method to look up a particular named system...
|
||||
void* FindSystem(const char* pInterfaceName);
|
||||
|
||||
private:
|
||||
struct Module_t
|
||||
{
|
||||
void /*CSysModule*/* m_pModule;
|
||||
CSysModule* m_pModule;
|
||||
CreateInterfaceFn m_Factory;
|
||||
char* m_pModuleName;
|
||||
};
|
||||
@ -88,7 +92,8 @@ protected:
|
||||
CUtlVector<Module_t> m_Modules;
|
||||
CUtlVector<IAppSystem*> m_Systems;
|
||||
CUtlVector<CreateInterfaceFn> m_NonAppSystemFactories;
|
||||
char m_Pad[56]; // <-- unknown
|
||||
CUtlDict<int, unsigned short> m_SystemDict;
|
||||
CAppSystemGroup* m_pParentAppSystem;
|
||||
AppSystemGroupStage_t m_nCurrentStage;
|
||||
};
|
||||
static_assert(sizeof(CAppSystemGroup) == 0xA8);
|
||||
|
Loading…
x
Reference in New Issue
Block a user