mirror of
https://github.com/Ragora/T2-CPP.git
synced 2026-01-20 02:24:46 +00:00
* Minor cleanup removing unnecessary code.
* Minor experimentation with unloadMod.
This commit is contained in:
parent
7dd6907521
commit
eee62bbf31
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
//! A vector of mod callables.
|
//! A vector of mod callables.
|
||||||
static std::vector<ModLoader::ModLoaderCallables*> sModCallables;
|
static std::vector<ModLoader::ModLoaderCallables*> sModCallables;
|
||||||
|
//! A vector of mod DLL handles.
|
||||||
|
static std::vector<HMODULE> sModHandles;
|
||||||
|
|
||||||
void serverProcessReplacement(unsigned int timeDelta)
|
void serverProcessReplacement(unsigned int timeDelta)
|
||||||
{
|
{
|
||||||
|
|
@ -38,6 +40,7 @@ bool conUnloadLoadMod(Linker::SimObject *obj,S32 argc, const char* argv[])
|
||||||
{
|
{
|
||||||
const char* targetName = argv[1];
|
const char* targetName = argv[1];
|
||||||
|
|
||||||
|
unsigned int modIndex = 0;
|
||||||
for (auto it = sModCallables.begin(); it != sModCallables.end(); it++)
|
for (auto it = sModCallables.begin(); it != sModCallables.end(); it++)
|
||||||
{
|
{
|
||||||
ModLoader::ModLoaderCallables* currentMod = *it;
|
ModLoader::ModLoaderCallables* currentMod = *it;
|
||||||
|
|
@ -46,9 +49,16 @@ bool conUnloadLoadMod(Linker::SimObject *obj,S32 argc, const char* argv[])
|
||||||
// Deinitialize the mod and remove it from the list.
|
// Deinitialize the mod and remove it from the list.
|
||||||
if (currentMod->mDeinitializeModPointer != NULL)
|
if (currentMod->mDeinitializeModPointer != NULL)
|
||||||
currentMod->mDeinitializeModPointer();
|
currentMod->mDeinitializeModPointer();
|
||||||
|
|
||||||
|
// FIXME: Create a structure to track mod data runtime
|
||||||
sModCallables.erase(it);
|
sModCallables.erase(it);
|
||||||
|
// FIXME: This will cause crashes because mods currently don't actually fully unload.
|
||||||
|
// FreeLibrary(sModHandles[modIndex]);
|
||||||
|
sModHandles.erase(sModHandles.begin() + modIndex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
++modIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Something weird happened.
|
// Something weird happened.
|
||||||
|
|
@ -118,5 +128,6 @@ bool conLoadMod(Linker::SimObject *obj,S32 argc, const char* argv[])
|
||||||
callables->mInitializeModPointer();
|
callables->mInitializeModPointer();
|
||||||
|
|
||||||
sModCallables.push_back(callables);
|
sModCallables.push_back(callables);
|
||||||
|
sModHandles.push_back(hDLL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -126,12 +126,6 @@ class CImmDevice
|
||||||
Con::addMethodS(NULL, "getModuAddr",&congetModuAddr,"Gets the memPatch data for the MODULO operator routine",1,1); // memPatch("42D89D",getModuAddr());
|
Con::addMethodS(NULL, "getModuAddr",&congetModuAddr,"Gets the memPatch data for the MODULO operator routine",1,1); // memPatch("42D89D",getModuAddr());
|
||||||
Con::addMethodS(NULL, "getInterAddr", &congetInterpreterAddr, "Gets the memPatch data for the interpreter switchtable",1,1); // memPatch("42CED1",getInterAddr());
|
Con::addMethodS(NULL, "getInterAddr", &congetInterpreterAddr, "Gets the memPatch data for the interpreter switchtable",1,1); // memPatch("42CED1",getInterAddr());
|
||||||
|
|
||||||
// Load the original TribesNext DLL if available
|
|
||||||
typedef void (*LPINITT2DLL)(void);
|
|
||||||
HINSTANCE hDLL = NULL;
|
|
||||||
LPINITT2DLL lpinitT2DLL = NULL;
|
|
||||||
hDLL = LoadLibrary(L"tribesnext.dll"); // AfxLoadLibrary is probably better.
|
|
||||||
|
|
||||||
// Initialize all engine hooks
|
// Initialize all engine hooks
|
||||||
initializeHooks();
|
initializeHooks();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue