mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Use CUtlString
This commit is contained in:
parent
e8bffae822
commit
ee3e2b8f2a
@ -149,9 +149,9 @@ void CModAppSystemGroup::InitPluginSystem(CModAppSystemGroup* pModAppSystemGroup
|
||||
for (auto& it : g_pPluginSystem->GetPluginInstances())
|
||||
{
|
||||
if (g_pPluginSystem->LoadPluginInstance(it))
|
||||
Msg(eDLL_T::ENGINE, "Loaded plugin: '%s'\n", it.m_svPluginName.c_str());
|
||||
Msg(eDLL_T::ENGINE, "Loaded plugin: '%s'\n", it.m_Name.String());
|
||||
else
|
||||
Warning(eDLL_T::ENGINE, "Failed loading plugin: '%s'\n", it.m_svPluginName.c_str());
|
||||
Warning(eDLL_T::ENGINE, "Failed loading plugin: '%s'\n", it.m_Name.String());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,14 +29,15 @@ void CPluginSystem::PluginSystem_Init()
|
||||
bool addInstance = true;
|
||||
for (auto& inst : pluginInstances)
|
||||
{
|
||||
if (inst.m_svPluginFullPath.compare(path.Get()) == 0)
|
||||
if (inst.m_Path.IsEqual_CaseInsensitive(path.String()) == 0)
|
||||
addInstance = false;
|
||||
}
|
||||
|
||||
const char* baseFileName = V_UnqualifiedFileName(path.Get());
|
||||
|
||||
if (addInstance)
|
||||
pluginInstances.push_back(PluginInstance_t(baseFileName, path.Get()));
|
||||
{
|
||||
const char* baseFileName = V_UnqualifiedFileName(path.String());
|
||||
pluginInstances.push_back(PluginInstance_t(baseFileName, path.String()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,11 +51,11 @@ bool CPluginSystem::LoadPluginInstance(PluginInstance_t& pluginInst)
|
||||
if (pluginInst.m_bIsLoaded)
|
||||
return false;
|
||||
|
||||
HMODULE loadedPlugin = LoadLibraryA(pluginInst.m_svPluginFullPath.c_str());
|
||||
HMODULE loadedPlugin = LoadLibraryA(pluginInst.m_Path.String());
|
||||
if (loadedPlugin == INVALID_HANDLE_VALUE || loadedPlugin == 0)
|
||||
return false;
|
||||
|
||||
CModule pluginModule(pluginInst.m_svPluginName.c_str());
|
||||
CModule pluginModule(pluginInst.m_Name.String());
|
||||
|
||||
// Pass selfModule here on load function, we have to do
|
||||
// this because local listen/dedi/client dll's are called
|
||||
@ -64,7 +65,7 @@ bool CPluginSystem::LoadPluginInstance(PluginInstance_t& pluginInst)
|
||||
|
||||
Assert(onLoadFn);
|
||||
|
||||
if (!onLoadFn(pluginInst.m_svPluginName.c_str(), g_SDKDll.GetModuleName().c_str()))
|
||||
if (!onLoadFn(pluginInst.m_Name.String(), g_SDKDll.GetModuleName().c_str()))
|
||||
{
|
||||
FreeLibrary(loadedPlugin);
|
||||
return false;
|
||||
|
@ -80,16 +80,22 @@ class CPluginSystem : IPluginSystem
|
||||
public:
|
||||
struct PluginInstance_t
|
||||
{
|
||||
PluginInstance_t(string svPluginName, string svPluginFullPath) : m_svPluginName(svPluginName), m_svPluginFullPath(svPluginFullPath), m_svDescription(std::string()), m_bIsLoaded(false) {};
|
||||
PluginInstance_t(const char* pName, const char* pPath, const char* pDescription = "")
|
||||
: m_Name(pName)
|
||||
, m_Path(pPath)
|
||||
, m_Description(pDescription)
|
||||
, m_bIsLoaded(false)
|
||||
{
|
||||
};
|
||||
|
||||
// Might wanna make a status code system.
|
||||
typedef bool(*OnLoad)(const char*, const char*);
|
||||
typedef void(*OnUnload)();
|
||||
|
||||
CModule m_hModule;
|
||||
string m_svPluginName;
|
||||
string m_svPluginFullPath;
|
||||
string m_svDescription;
|
||||
CUtlString m_Name;
|
||||
CUtlString m_Path;
|
||||
CUtlString m_Description;
|
||||
bool m_bIsLoaded; // [ PIXIE ]: I don't like this and it's bad.
|
||||
// I will make a module manager later which will grab all modules from the process and adds each module / removes module that passes through DLLMain.
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user