diff --git a/main.cpp b/main.cpp index 19b35ea..bf646ad 100644 --- a/main.cpp +++ b/main.cpp @@ -10,7 +10,7 @@ using namespace std; void (*DedicatedMain)(int argc, const char** argv); // engine -void (*CModelLoader_GetModelForName)(void*, const char* name, int referencetype); +void (*CModelLoader_ReferenceModel)(void*, const char* name, int referencetype); void** p_modelloader; template void ptr(T*& f, void* so, uint32_t offset) { @@ -26,7 +26,6 @@ char *mappath; void startpoint() { fprintf(stderr, "startpoint()\n"); - void* modelloader = *p_modelloader; cout << "modelloader @ " << modelloader << endl; @@ -36,10 +35,10 @@ void startpoint() { cerr << "Press enter to continue" << endl; getchar(); } - + void *buf = alloca(0x10000); - CModelLoader_GetModelForName(modelloader, mappath, 2); + CModelLoader_ReferenceModel(modelloader, mappath, 2); cout << "Done" << endl; _exit(0); @@ -57,11 +56,20 @@ int main(int argc, char** argv) { } struct link_map *lm = (struct link_map*)dlopen("dedicated.so", RTLD_NOW); + if(lm == NULL) + { + fprintf(stderr, dlerror()); + } void* dedicated = (void*)lm->l_addr; assert(dedicated); lm = (struct link_map*)dlopen("engine.so", RTLD_NOW); + if (lm == NULL) + { + fprintf(stderr, dlerror()); + } void* engine = (void*)lm->l_addr; assert(engine); + cout << "dedicated.so loaded at " << dedicated << endl; cout << "engine.so loaded at " << engine << endl; @@ -77,11 +85,11 @@ int main(int argc, char** argv) { cout << "Reading from " << mappath << endl; // dedicated - ptr(DedicatedMain, dedicated, 0x1beb0); + ptr(DedicatedMain, dedicated, 0x1d000); // engine - ptr(CModelLoader_GetModelForName, engine, 0x180460); - ptr(p_modelloader, engine, 0x6E3C80); + ptr(CModelLoader_ReferenceModel, engine, 0x18A400); + ptr(p_modelloader, engine, 0x70E2E0); const char* args[] = {"x", "-game", "csgo", "-nominidumps", "-nobreakpad"}; DedicatedMain(sizeof args / sizeof *args, args); diff --git a/patch.py b/patch.py index 6e312cd..1c13344 100644 --- a/patch.py +++ b/patch.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 import shutil import struct import os @@ -14,35 +14,35 @@ def patch(d, offset, s): d[offset:offset+len(s)] = s ######### engine.so -dat = bytearray(open("bin/engine.orig.so").read()) +dat = bytearray(open("bin/engine.orig.so", "rb").read()) # Jump to forkserver entry point after initialization. # 0x286d20 is the NET_CloseAllSockets function. -patch(dat, 0x286D20, - ( - '\xb8' + struct.pack('