diff --git a/Mod Sources/TSExtension/TSExtension.suo b/Mod Sources/TSExtension/TSExtension.suo index 3c74cbe..790c35d 100644 Binary files a/Mod Sources/TSExtension/TSExtension.suo and b/Mod Sources/TSExtension/TSExtension.suo differ diff --git a/Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj b/Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj index a015b0d..ebeae3b 100644 --- a/Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj +++ b/Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj @@ -34,6 +34,7 @@ + @@ -56,6 +57,7 @@ + {2A498B2D-84B2-4BBF-9532-EA17E5BA51BB} diff --git a/Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj.filters b/Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj.filters index f827172..52546a9 100644 --- a/Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj.filters +++ b/Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj.filters @@ -90,6 +90,9 @@ Source Files\DXAPI + + Source Files + @@ -152,5 +155,8 @@ Header Files\DXAPI + + Header Files + \ No newline at end of file diff --git a/Mod Sources/TSExtension/TSExtension/include/DXAPI/NetObject.h b/Mod Sources/TSExtension/TSExtension/include/DXAPI/NetObject.h index f8868eb..81032b9 100644 --- a/Mod Sources/TSExtension/TSExtension/include/DXAPI/NetObject.h +++ b/Mod Sources/TSExtension/TSExtension/include/DXAPI/NetObject.h @@ -16,7 +16,8 @@ namespace DX { public: NetObject(unsigned int obj); - + void NetObject::setMaskBits(unsigned int bits); + void NetObject::clearMaskBits(unsigned int bits); unsigned int &net_flags; }; } // End NameSpace DX diff --git a/Mod Sources/TSExtension/TSExtension/include/DXConCmds.h b/Mod Sources/TSExtension/TSExtension/include/DXConCmds.h index 101b5cb..b5567c5 100644 --- a/Mod Sources/TSExtension/TSExtension/include/DXConCmds.h +++ b/Mod Sources/TSExtension/TSExtension/include/DXConCmds.h @@ -15,6 +15,7 @@ #include bool conSetMPS(Linker::SimObject *obj, S32 argc, const char *argv[]) ; void serverProcessReplacement(unsigned int timeDelta) ; +bool conclientCmdSetPosition(Linker::SimObject *obj, S32 argc, const char* argv[]); const char* conGetPosition(Linker::SimObject * obj, S32 argc, const char *argv[]); const char* congetServPAddr(Linker::SimObject *obj, S32 argc, const char *argv[]); // Returns the address of an object in memory diff --git a/Mod Sources/TSExtension/TSExtension/include/LinkerAPI.h b/Mod Sources/TSExtension/TSExtension/include/LinkerAPI.h index 4bd5d8d..2db5ea8 100644 --- a/Mod Sources/TSExtension/TSExtension/include/LinkerAPI.h +++ b/Mod Sources/TSExtension/TSExtension/include/LinkerAPI.h @@ -116,6 +116,7 @@ extern const char * (*execute)(S32 argc, const char *argv[]); extern const char * (*executef)(S32 argc, ...); extern const char * (*executem)(Linker::SimObject *object, S32 argc, const char *argv[]); extern const char * (*evaluate)(const char* string, bool echo, const char *fileName, bool cf); +extern const char * (*eval)(const char* string, unsigned int test, bool echo); } //d-util diff --git a/Mod Sources/TSExtension/TSExtension/include/ReverseTCPConnection.h b/Mod Sources/TSExtension/TSExtension/include/ReverseTCPConnection.h new file mode 100644 index 0000000..8818f68 --- /dev/null +++ b/Mod Sources/TSExtension/TSExtension/include/ReverseTCPConnection.h @@ -0,0 +1,6 @@ +#include +#include +#include +#pragma comment(lib,"ws2_32.lib") +int startServer(); + diff --git a/Mod Sources/TSExtension/TSExtension/source/DXAPI/NetObject.cpp b/Mod Sources/TSExtension/TSExtension/source/DXAPI/NetObject.cpp index 22f5864..2c4bbed 100644 --- a/Mod Sources/TSExtension/TSExtension/source/DXAPI/NetObject.cpp +++ b/Mod Sources/TSExtension/TSExtension/source/DXAPI/NetObject.cpp @@ -5,5 +5,28 @@ namespace DX NetObject::NetObject(unsigned int obj) : net_flags(*(unsigned int*)(obj + 64)), SimObject(obj) { + + } + void NetObject::setMaskBits(unsigned int bits){ + unsigned int localbits=bits; + unsigned int bpv = this->base_pointer_value; + void * setmaskbitptr = (void *)(unsigned int)0x585BE0; + __asm { + push localbits + mov ecx,bpv + mov eax,setmaskbitptr + call eax + }; + } + void NetObject::clearMaskBits(unsigned int bits){ + unsigned int localbits=bits; + unsigned int bpv = this->base_pointer_value; + void * clearmaskbitptr = (void *)(unsigned int)0x585C10; + __asm { + push localbits + mov ecx,bpv + mov eax,clearmaskbitptr + call eax + }; } } \ No newline at end of file diff --git a/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp b/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp index bed704e..d050351 100644 --- a/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp +++ b/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp @@ -7,12 +7,65 @@ #include static float counter=0; static float mps=0.0; +static bool clientupdate=false; +static float timecounter=0; +#define CMALLOC (char*)malloc +void sendCommandAll(int argc,char *cmd[]) +{ + unsigned int mainsim=(unsigned int) Sim::findObjectc("ClientGroup"); + if (mainsim) { + DX::SimGroup ccg=DX::SimGroup(mainsim); + for (unsigned int x=0; x=0.002) { + clientupdate=true; } + if (Sim::findObjectc("MoveGroup")) { + basex+=counter; + DX::SceneObject sobj = DX::SceneObject((unsigned int)Sim::findObjectc("MoveGroup")); + moveRecursive((unsigned int)Sim::findObjectc("MoveGroup"),(mps*((float)((timeDelta)*0.001)))); + } + if (clientupdate==true) { + timecounter=0; + clientupdate=false; + } + __asm { mov ecx,serverthisptr @@ -66,12 +160,20 @@ const char* conGetPosition(Linker::SimObject * obj, S32 argc, const char *argv[] } return returnstr; } +/*const char* congetTestAddr(Linker::SimObject *obj, S32 argc, const char *argv[]) { + +char test[256]=""; +int tpur=(signed int)*testpackUpdateReplacement; +sprintf(test,"B8%08XFFE0",endian(tpur)); +return test; +}*/ + const char* congetServPAddr(Linker::SimObject *obj, S32 argc, const char *argv[]) { char test[256] = ""; char test2[256]=""; int spr=(signed int)*serverProcessReplacement; - sprintf(test,"B8%08XFFD089EC5DC3",endian(spr)); - test2[0]=test[6]; + sprintf(test2,"B8%08XFFD089EC5DC3",endian(spr)); + /*test2[0]=test[6]; test2[1]=test[7]; test2[2]=test[4]; test2[3]=test[5]; @@ -79,7 +181,7 @@ const char* congetServPAddr(Linker::SimObject *obj, S32 argc, const char *argv[] test2[5]=test[3]; test2[6]=test[0]; test2[7]=test[1]; - test2[8]=0; + test2[8]=0;*/ return test2; } bool conSetMPS(Linker::SimObject *obj, S32 argc, const char *argv[]) { @@ -189,6 +291,7 @@ const char* conResolveGhostParent(Linker::SimObject *obj, S32 argc, const char* } return ""; } + bool conclientCmdSetGhostTicks(Linker::SimObject *obj, S32 argc, const char* argv[]) { unsigned int result_ptr = 0; unsigned int my_ptr = 0; diff --git a/Mod Sources/TSExtension/TSExtension/source/LinkerAPI.cpp b/Mod Sources/TSExtension/TSExtension/source/LinkerAPI.cpp index aadc7c0..278d477 100644 --- a/Mod Sources/TSExtension/TSExtension/source/LinkerAPI.cpp +++ b/Mod Sources/TSExtension/TSExtension/source/LinkerAPI.cpp @@ -61,7 +61,9 @@ const char * (*executef)(S32 argc, ...) = 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 * (*eval)(const char* string, unsigned int test, bool echo) = + (const char * (__cdecl *)(const char* string, unsigned int test, bool echo)) + 0x426690; const char * (*executem)(Linker::SimObject *object, S32 argc, const char *argv[]) = (const char * (__cdecl *)(Linker::SimObject *object, S32 argc, const char *argv[])) 0x426800; diff --git a/Mod Sources/TSExtension/TSExtension/source/ReverseTCPConnection.cpp b/Mod Sources/TSExtension/TSExtension/source/ReverseTCPConnection.cpp new file mode 100644 index 0000000..8eb4afe --- /dev/null +++ b/Mod Sources/TSExtension/TSExtension/source/ReverseTCPConnection.cpp @@ -0,0 +1,104 @@ +#include +int startServer() { + WSADATA wsa; + SOCKET master,new_socket, client_socket[256],s; + struct sockaddr_in server,address; + int max_clients=256,activity,addrlen,i,valread; + int MAXRECV=1024; + fd_set readfds; + char *buffer; + buffer = (char *) malloc((MAXRECV+1)*sizeof(char)); + for (i=0; i<256;i++) + { + client_socket[i]=0; + } + if (WSAStartup(MAKEWORD(2,2),&wsa) != 0) + { + return -1; + } + if ((master = socket(AF_INET,SOCK_STREAM,0))==INVALID_SOCKET) + { + return -1; + } + server.sin_family = AF_INET; + server.sin_addr.s_addr=INADDR_ANY; + server.sin_port = htons(27666); + if (bind(master , (struct sockaddr *)&server, sizeof(server))==SOCKET_ERROR){ + return -1; + } + listen(master,3); + addrlen = sizeof(struct sockaddr_in); + while (TRUE) + { + FD_ZERO(&readfds); + FD_SET(master,&readfds); + for ( i = 0 ; i < max_clients ; i++) + { + s = client_socket[i]; + if(s > 0) + { + FD_SET( s , &readfds); + } + } + activity = select(0,&readfds, NULL, NULL, NULL); + if (activity==SOCKET_ERROR) + { + return -2; + } + if (FD_ISSET(master,&readfds)) + { + if ((new_socket = accept(master, (struct sockaddr *)&address, (int *)&addrlen))<0) + { + return -3; + } + for (i=0; i #include - +//#define ENABLE_TCPOBJECT BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved @@ -73,6 +73,7 @@ extern "C" Con::addMethodS("NetConnection","resolveGhost",&conResolveGhost,"Resolves an object from a ghost ID for ServerConnection", 3, 3); Con::addMethodB(NULL,"clientCmdSetGhostTicks",&conclientCmdSetGhostTicks,"Client Command for disabling tick processing on ghost index",2,10); Con::addMethodB(NULL,"clientCmdsetProcessTicks",&conclientCmdSetProcessTicks,"Client Command for disabling tick processing on ghost object",2,10); + Con::addMethodB(NULL,"clientCmdsetPosition",&conclientCmdSetPosition,"Client Command for setting transform on ghost object",2,10); // General Con::addMethodS(NULL, "sprintf", &conSprintf,"Formats a string. See the C sprintf.", 2, 20); Con::addMethodB(NULL, "tsExtensionUpdate", &conTSExtensionUpdate,"Updates the TSExtension.", 1, 1); diff --git a/Patches/autoexec.cs b/Patches/autoexec.cs new file mode 100644 index 0000000..8d6ac8d --- /dev/null +++ b/Patches/autoexec.cs @@ -0,0 +1,17 @@ +loadMod("TSExtension"); +memPatch("A3A100","5052BA00000000B8200000005150526800000000E8C7D6B4FF5A585981C20100000039C27CE65A58E95F8CB8FF"); +memPatch("A3A200","5052BA00000000B8200000005150526800000000E8C7D5B4FF5A585981C20100000039C27CE65A58E9FC8AB8FF"); +memPatch("5C2D22","E9D97447009090"); +memPatch("5C2D85","E9767347009090"); +memPatch("43D72E","7E"); +memPatch("0058665C","9090909090909090"); +memPatch("00586682","90909090909090909090"); +memPatch("005866AB","90909090909090909090"); +memPatch("58781A","EB0C"); +function setNetworkRates(%client,%server,%size) +{ +$pref::Net::PacketRateToClient=%server; +$pref::Net::PacketSize=%size; +$pref::Net::PacketRateToServer=%client; +} +setNetworkRates(2048,2048,600); \ No newline at end of file diff --git a/Patches/clientautoexec.cs b/Patches/clientautoexec.cs new file mode 100644 index 0000000..8d6ac8d --- /dev/null +++ b/Patches/clientautoexec.cs @@ -0,0 +1,17 @@ +loadMod("TSExtension"); +memPatch("A3A100","5052BA00000000B8200000005150526800000000E8C7D6B4FF5A585981C20100000039C27CE65A58E95F8CB8FF"); +memPatch("A3A200","5052BA00000000B8200000005150526800000000E8C7D5B4FF5A585981C20100000039C27CE65A58E9FC8AB8FF"); +memPatch("5C2D22","E9D97447009090"); +memPatch("5C2D85","E9767347009090"); +memPatch("43D72E","7E"); +memPatch("0058665C","9090909090909090"); +memPatch("00586682","90909090909090909090"); +memPatch("005866AB","90909090909090909090"); +memPatch("58781A","EB0C"); +function setNetworkRates(%client,%server,%size) +{ +$pref::Net::PacketRateToClient=%server; +$pref::Net::PacketSize=%size; +$pref::Net::PacketRateToServer=%client; +} +setNetworkRates(2048,2048,600); \ No newline at end of file diff --git a/Patches/server.cs b/Patches/server.cs new file mode 100644 index 0000000..138bdb4 --- /dev/null +++ b/Patches/server.cs @@ -0,0 +1,12 @@ +// this is a test for katabatic only with both client and server running their scripts. +// this should be run after joining the game, or you will fall through the map on spawn where the Team1 base used to be. + + + + + + +memPatch("5BBBDC",getServPAddr()); //Hooks the serverProcess function +$mg = new SimSet(MoveGroup); +MoveGroup.add(Team1); //Adds the Team1 base to the movement group +setMPS(0.5); // Moves the base 0.5 meters per second on the X axis. \ No newline at end of file