Begin transition to the new ModLoader paradigm. Begin cleaning up code.

This commit is contained in:
Robert MacGregor 2017-07-21 04:30:15 -04:00
parent 015a9f4dc8
commit cb9895a38e
39 changed files with 1429 additions and 967 deletions

View file

@ -7,6 +7,7 @@
#include <stdafx.h>
#include <LinkerAPI.h>
#include <DXAPI\DXAPI.h>
#include <modLoader.h>
#include <unordered_set>
@ -20,8 +21,22 @@ BOOL APIENTRY DllMain( HMODULE hModule,
{
return true;
}
const unsigned char moduroutine[] = {0x8B, 0x3D, 0xEC, 0x82, 0x9E, 0x00, 0x89, 0xF8, 0x8B, 0x14, 0x85, 0xFC, 0xA5, 0x88, 0x00, 0x83, 0xFA, 0x00, 0x74, 0x30, 0x8B, 0x3D, 0xEC, 0x82, 0x9E, 0x00, 0x89, 0xF8, 0x31, 0xD2, 0x89, 0xF8, 0x8B, 0x04, 0x85, 0x00, 0xA6, 0x88, 0x00, 0xF7, 0x34, 0xBD, 0xFC, 0xA5, 0x88, 0x00, 0xFF, 0x0D, 0xEC, 0x82, 0x9E, 0x00, 0x89, 0xF8, 0x89, 0x14, 0x85, 0xFC, 0xA5, 0x88, 0x00, 0xB8, 0xC7, 0xCE, 0x42, 0x00, 0xFF, 0xE0, 0xFF, 0x0D, 0xEC, 0x82, 0x9E, 0x00, 0xC7, 0x04, 0x85, 0xFC, 0xA5, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB8, 0xC7, 0xCE, 0x42, 0x00, 0xFF, 0xE0};
const unsigned char interpreterRoutine[] = {0x8B ,0x56 ,0x18 ,0x89 ,0x15 ,0x10 ,0xB7 ,0xA3 ,0x00 ,0x89 ,0x1D ,0x14 ,0xB7 ,0xA3 ,0x00 ,0x8B ,0x55 ,0x80 ,0x89 ,0xD0 ,0xBF ,0xD9 ,0xCE ,0x42 ,0x00 ,0x3D ,0x55 ,0x00 ,0x00 ,0x00 ,0xFF ,0xE7};
const unsigned char moduroutine[] = {
0x8B, 0x3D, 0xEC, 0x82, 0x9E, 0x00, 0x89, 0xF8, 0x8B, 0x14, 0x85, 0xFC,
0xA5, 0x88, 0x00, 0x83, 0xFA, 0x00, 0x74, 0x30, 0x8B, 0x3D, 0xEC, 0x82,
0x9E, 0x00, 0x89, 0xF8, 0x31, 0xD2, 0x89, 0xF8, 0x8B, 0x04, 0x85, 0x00,
0xA6, 0x88, 0x00, 0xF7, 0x34, 0xBD, 0xFC, 0xA5, 0x88, 0x00, 0xFF, 0x0D,
0xEC, 0x82, 0x9E, 0x00, 0x89, 0xF8, 0x89, 0x14, 0x85, 0xFC, 0xA5, 0x88,
0x00, 0xB8, 0xC7, 0xCE, 0x42, 0x00, 0xFF, 0xE0, 0xFF, 0x0D, 0xEC, 0x82,
0x9E, 0x00, 0xC7, 0x04, 0x85, 0xFC, 0xA5, 0x88, 0x00, 0x00, 0x00, 0x00,
0x00, 0xB8, 0xC7, 0xCE, 0x42, 0x00, 0xFF, 0xE0};
const unsigned char interpreterRoutine[] = {
0x8B, 0x56, 0x18, 0x89, 0x15, 0x10, 0xB7, 0xA3 ,0x00, 0x89, 0x1D, 0x14,
0xB7, 0xA3, 0x00, 0x8B, 0x55, 0x80, 0x89, 0xD0 ,0xBF, 0xD9, 0xCE, 0x42, 0x00,
0x3D, 0x55, 0x00, 0x00, 0x00, 0xFF, 0xE7};
const char* congetServPAddr(Linker::SimObject *obj, S32 argc, const char *argv[])
{
char test[256] = "";
@ -30,6 +45,7 @@ const char* congetServPAddr(Linker::SimObject *obj, S32 argc, const char *argv[]
sprintf(test2,"B8%08XFFD089EC5DC3",endian(spr));
return test2;
}
const char* congetModuAddr(Linker::SimObject *obj, S32 argc, const char *argv[])
{
char test[256] = "";
@ -38,6 +54,7 @@ const char* congetModuAddr(Linker::SimObject *obj, S32 argc, const char *argv[])
sprintf(test2,"B8%08XFFE0",endian(spr));
return test2;
}
const char* congetInterpreterAddr(Linker::SimObject *obj, S32 argc, const char *argv[])
{
char test[256] = "";
@ -63,6 +80,7 @@ class CImmDevice
Con::addVariable("$cpuspeed",TypeS32,reinterpret_cast<void*>(0x8477F8)); //1 - S32, this is so i can set my cpu speed to 31337 or osmething =P
Con::addVariable("$GameBase::showBoundingBox",TypeBool,reinterpret_cast<void*>(0x9ECF24));
DWORD oldprotect=0;
// Mod Loader Function
Con::addMethodB(NULL, "loadMod", &conLoadMod, "Loads a C++ modification.",2,2);
Con::addMethodS(NULL, "getServPAddr",&congetServPAddr,"Gets the memPatch data for ServerProcess",1,1);
@ -87,6 +105,9 @@ class CImmDevice
else
lpinitT2DLL(); // The function was loaded, call TribesNext and move on to postTN Startup
// Initialize all engine hooks
DX::initializeHooks();
return 0;
}