mirror of
https://github.com/Ragora/T2-CPP.git
synced 2026-02-24 09:03:36 +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
48
CommonAPI/Common/source/DXAPI/SimObject.cpp
Normal file
48
CommonAPI/Common/source/DXAPI/SimObject.cpp
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#include <cstdarg>
|
||||
|
||||
#include <DXAPI/SimObject.h>
|
||||
|
||||
#include <LinkerAPI.h>
|
||||
|
||||
namespace DX
|
||||
{
|
||||
SimObject::SimObject(unsigned int obj) : identifier(*(unsigned int*)(obj + 32)),
|
||||
base_pointer_value(obj)
|
||||
{
|
||||
}
|
||||
|
||||
void SimObject::deleteObject(void)
|
||||
{
|
||||
void *pointer = (void*)this->base_pointer_value;
|
||||
|
||||
typedef void (__cdecl *deleteObjectFunc)(void);
|
||||
static deleteObjectFunc function_call = (deleteObjectFunc)0x4268D0;
|
||||
|
||||
__asm
|
||||
{
|
||||
mov ecx, pointer;
|
||||
lea eax, function_call;
|
||||
mov eax, [eax];
|
||||
call eax;
|
||||
}
|
||||
}
|
||||
|
||||
const char *SimObject::CallMethod(const char *name, unsigned int argc, ...)
|
||||
{
|
||||
char **argv = (char**)malloc(sizeof(char*) * (2 + argc));
|
||||
argv[0]= (char*)name;
|
||||
argv[1] = "";
|
||||
|
||||
va_list vargs;
|
||||
va_start(vargs, argc);
|
||||
|
||||
for (unsigned int iteration = 0; iteration < argc; iteration++)
|
||||
argv[2 + iteration] = va_arg(vargs, char*);
|
||||
va_end(vargs);
|
||||
|
||||
const char *result = Con::executem((Linker::SimObject*)this->base_pointer_value, 2 + argc, (const char**)argv);
|
||||
free(argv);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue