Merge Bahke's latest changes in

This commit is contained in:
Robert MacGregor 2016-02-23 02:07:23 -05:00
parent 752155db59
commit bdca76020c
10 changed files with 351 additions and 53 deletions

View file

@ -19,6 +19,20 @@
namespace DX
{
const char * StringTableInsert(const char * str,bool casesensitive) {
const char* retval;
unsigned int * StringTablePtr=(unsigned int *)0x9e618c;
unsigned int StrTableAddr=*StringTablePtr;
__asm {
mov ecx,StrTableAddr
push casesensitive
push str
mov eax,0x441A00
call eax
mov retval,eax
}
return retval;
}
bool memPatch(unsigned int addr, unsigned char * data, unsigned int size){
DWORD oldprotect=0;
DWORD oldnewprotect=0;

View file

@ -4,6 +4,7 @@ namespace DX
{
GameBase::GameBase(unsigned int obj) : SceneObject(obj)
{
}

View file

@ -24,18 +24,24 @@ namespace DX
}
return ghostid;
}
NetObject NetConnection::resolveGhostParent(S32 id) {
unsigned int NetConnection::resolveGhostParent(S32 id) {
if (this->getGhostFrom()) {
if (this->mGhostRefs[id].obj)
{
return NetObject((unsigned int)(this->mGhostRefs[id].obj));
return (unsigned int)(this->mGhostRefs[id].obj);
}
}
return NULL;
}
NetObject NetConnection::resolveGhost(S32 id) {
unsigned int NetConnection::resolveGhost(S32 id) {
if (id == NULL) {
return NULL;
}
if (this->getGhostTo()) {
return NetObject((unsigned int)this->mLocalGhosts[id]);
if ((unsigned int)this->mLocalGhosts[id] == NULL) {
return NULL;
}
return (unsigned int)this->mLocalGhosts[id];
}
return NULL;
}

View file

@ -6,7 +6,7 @@
namespace DX
{
SimObject::SimObject(unsigned int obj) : identifier(*(unsigned int*)(obj + 32)),
SimObject::SimObject(unsigned int obj) : identifier(*(unsigned int*)(obj + 32)), fieldDictionary(*(unsigned int*)(obj + 0x2C)), dataBlock(*(unsigned int*)(obj + 0x248)),
base_pointer_value(obj)
{
}
@ -45,4 +45,39 @@ namespace DX
return result;
}
const char *SimObject::getFieldValue(const char *slotname)
{
void * getfieldvalueptr=(void *)0x435210;
const char* retptr;
void * thisptr=(void *)this->base_pointer_value;
void * fieldDictPtr=(void*)this->fieldDictionary;
if (this->base_pointer_value!=0 && this->fieldDictionary!=0) {
__asm {
push slotname
mov ecx,fieldDictPtr
call getfieldvalueptr
mov retptr,eax
};
if (retptr != NULL) {
return retptr;
} else {
return "";
}
}
return "";
}
void SimObject::setDataField(const char *slotname, const char *array, const char *value)
{
void * setfieldptr=(void *)0x4364E0;
void * retptr;
void * thisptr=(void *)this->base_pointer_value;
__asm {
push value
push array
push slotname
mov ecx,thisptr
call setfieldptr
};
return;
}
}