mirror of
https://github.com/Ragora/T2-CPP.git
synced 2026-02-28 11:03:39 +00:00
Restructured project structure to use a singular SLN; made the T2API common to all projects; adjusted watchdog timer to 8 seconds
This commit is contained in:
parent
e1c5d1dead
commit
527474ff24
79 changed files with 469 additions and 626 deletions
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <t2api.h>
|
||||
#include <LinkerAPI.h>
|
||||
|
||||
static std::tr1::unordered_set<ServerProcessPointer> sServerProcessResponders;
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ void serverProcessReplacement(unsigned int timeDelta)
|
|||
}
|
||||
|
||||
// Mod Loader Implementation
|
||||
bool conLoadMod(SimObject *obj,S32 argc, const char* argv[])
|
||||
bool conLoadMod(Linker::SimObject *obj,S32 argc, const char* argv[])
|
||||
{
|
||||
typedef void (*LPMODINIT)(void);
|
||||
HINSTANCE hDLL = NULL;
|
||||
|
|
@ -42,7 +42,7 @@ bool conLoadMod(SimObject *obj,S32 argc, const char* argv[])
|
|||
hDLL = LoadLibrary(modification.c_str());
|
||||
if (hDLL == NULL)
|
||||
{
|
||||
Con::errorf(0, "loadMod(): Failed to load DLL '%s'. Does it exist in GameData\mods? (%u)", raw.c_str(), GetLastError());
|
||||
Con::errorf(0, "loadMod(): Failed to load DLL '%s'. Does it exist in GameData\\mods? (%u)", raw.c_str(), GetLastError());
|
||||
return false; // The DLL doesn't exist
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,89 +0,0 @@
|
|||
#include <t2api.h>
|
||||
|
||||
SimIdDictionary* gIdDictionary = reinterpret_cast<SimIdDictionary*>(0x009E9194);
|
||||
|
||||
//439550
|
||||
namespace Sim {
|
||||
SimObject* (*findObject)(U32 id) =
|
||||
(SimObject* (_cdecl *)(U32 id) )
|
||||
0x439550;
|
||||
}
|
||||
|
||||
//hackey way to do member functions, ....
|
||||
void GuiTSCtrl_project(GuiTSCtrl *obj, const Point3F &pt, Point3F *dest) {
|
||||
typedef void (__cdecl *projFunc)(const Point3F &pt, Point3F *dest);
|
||||
static projFunc p = (projFunc)0x4d0b40;
|
||||
|
||||
__asm {
|
||||
push dest;
|
||||
push pt;
|
||||
mov ecx,obj;
|
||||
lea eax, p;
|
||||
mov eax, [eax];
|
||||
call eax;
|
||||
}
|
||||
}
|
||||
|
||||
void (*someTest)(void) =
|
||||
(void (__cdecl *)(void))
|
||||
0x4FD9B3;
|
||||
|
||||
namespace Con {
|
||||
|
||||
char* (*getReturnBuffer)(U32 bufferSize) =
|
||||
(char *(__cdecl *)(U32))
|
||||
0x42caa0;
|
||||
|
||||
void (*addMethodB)(const char *nsName, const char *name, BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs) =
|
||||
(void (__cdecl *)(const char *, const char *,BoolCallback,const char *,S32,S32))
|
||||
0x426510;
|
||||
|
||||
void (*addMethodS)(const char *, const char *,StringCallback, const char *, S32, S32) =
|
||||
(void (__cdecl *)(const char *,const char *,StringCallback,const char *,S32,S32))
|
||||
0x426410;
|
||||
|
||||
bool (*addVariable)(const char *name, S32 t, void *dp) =
|
||||
(bool (__cdecl *)(const char *name, S32 t, void *dp))
|
||||
0x4263B0;
|
||||
|
||||
const char * (*execute)(S32 argc, const char *argv[]) =
|
||||
(const char * (__cdecl *)(S32 argc, const char *argv[]))
|
||||
0x4267A0;
|
||||
|
||||
const char * (*executef)(S32 argc, ...) =
|
||||
(const char * (__cdecl *)(S32 argc, ...))
|
||||
0x4269E0;
|
||||
|
||||
const char * (*evaluate)(const char* string, bool echo, const char *fileName, bool cf) =
|
||||
(const char * (__cdecl *)(const char* string, bool echo, const char *fileName, bool cf))
|
||||
0x426690;
|
||||
|
||||
const char * (*executem)(SimObject *object, S32 argc, const char *argv[]) =
|
||||
(const char * (__cdecl *)(SimObject *object, S32 argc, const char *argv[]))
|
||||
0x426800;
|
||||
|
||||
const char * (*getVariable)(const char *name) =
|
||||
(const char * (__cdecl *)(const char *name))
|
||||
0x4261F0;
|
||||
|
||||
void (*printf)(const char* fmt,...) =
|
||||
(void (__cdecl *)(const char* fmt,...))
|
||||
0x425F30;
|
||||
|
||||
void (*errorf)(U32 type, const char* fmt,...)=
|
||||
(void (__cdecl *)(U32, const char*,...))
|
||||
0x425FB0;
|
||||
|
||||
}
|
||||
|
||||
int (*dSscanf)(const char *buffer, const char *format, ...) =
|
||||
(int (__cdecl *)(const char *,const char *,...))
|
||||
0x55b640;
|
||||
|
||||
int (*dSprintf)(char *buffer, dsize_t bufferSize, const char *format, ...) =
|
||||
(int (__cdecl *)(char *,dsize_t,const char *,...))
|
||||
0x55b5e0;
|
||||
|
||||
bool (*dAtob)(const char *str) =
|
||||
(bool (__cdecl *)(const char *str))
|
||||
0x55B490;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <stdafx.h>
|
||||
|
||||
#include <t2api.h>
|
||||
#include <LinkerAPI.h>
|
||||
#include <modLoader.h>
|
||||
|
||||
#include <unordered_set>
|
||||
|
|
@ -21,7 +21,7 @@ BOOL APIENTRY DllMain( HMODULE hModule,
|
|||
return true;
|
||||
}
|
||||
|
||||
const char* congetServPAddr(SimObject *obj, S32 argc, const char *argv[])
|
||||
const char* congetServPAddr(Linker::SimObject *obj, S32 argc, const char *argv[])
|
||||
{
|
||||
char test[256] = "";
|
||||
char test2[256]="";
|
||||
|
|
@ -38,33 +38,63 @@ const char* congetServPAddr(SimObject *obj, S32 argc, const char *argv[])
|
|||
test2[8]=0;*/
|
||||
return test2;
|
||||
}
|
||||
|
||||
__declspec(dllexport) void initT2Dll(void)
|
||||
{
|
||||
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));
|
||||
|
||||
// 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);
|
||||
|
||||
// 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.
|
||||
|
||||
if (hDLL == NULL)
|
||||
return; // The DLL doesn't exist
|
||||
else
|
||||
lpinitT2DLL = (LPINITT2DLL)GetProcAddress(hDLL, "_Z9initT2Dllv"); // Attempt to load our entry point
|
||||
|
||||
if (lpinitT2DLL == NULL)
|
||||
return; // Unable to load entry point
|
||||
else
|
||||
lpinitT2DLL(); // The function was loaded, call TribesNext and move on to postTN Startup
|
||||
}
|
||||
|
||||
|
||||
class CImmCompoundEffect
|
||||
{
|
||||
public:
|
||||
_declspec(dllexport) int Start(unsigned long x, unsigned long y) { return 8; }
|
||||
_declspec(dllexport) int Stop() { return 1; }
|
||||
};
|
||||
|
||||
class CImmDevice
|
||||
{
|
||||
public:
|
||||
_declspec(dllexport) static CImmDevice * CreateDevice(HINSTANCE__ *, HWND__ *)
|
||||
{
|
||||
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));
|
||||
|
||||
// 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);
|
||||
|
||||
// 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.
|
||||
|
||||
if (hDLL == NULL)
|
||||
return 0; // The DLL doesn't exist
|
||||
else
|
||||
lpinitT2DLL = (LPINITT2DLL)GetProcAddress(hDLL, "_Z9initT2Dllv"); // Attempt to load our entry point
|
||||
|
||||
if (lpinitT2DLL == NULL)
|
||||
return 0; // Unable to load entry point
|
||||
else
|
||||
lpinitT2DLL(); // The function was loaded, call TribesNext and move on to postTN Startup
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
_declspec(dllexport) int UsesWin32MouseServices(int) { return 4; }
|
||||
};
|
||||
|
||||
class CImmProject
|
||||
{
|
||||
public:
|
||||
_declspec(dllexport) CImmProject() {}
|
||||
_declspec(dllexport) ~CImmProject() {}
|
||||
|
||||
_declspec(dllexport) CImmCompoundEffect *GetCreatedEffect(int) { return 0; }
|
||||
_declspec(dllexport) CImmCompoundEffect *GetCreatedEffect(const char *) { return 0; }
|
||||
_declspec(dllexport) CImmCompoundEffect *CreateEffect(char const *, CImmDevice *, unsigned long) { return 0; }
|
||||
_declspec(dllexport) int Start(char const *, unsigned long, unsigned long, class CImmDevice *) { return 1; }
|
||||
_declspec(dllexport) int Stop(const char *) { return 1; }
|
||||
_declspec(dllexport) int LoadProjectFromMemory(void *, CImmDevice *) { return 1; }
|
||||
};
|
||||
|
||||
#ifdef _MANAGED
|
||||
#pragma managed(pop)
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue