rendered paste bodyvoid *eth32_dlopen(const char *filename, int flag) { if (!filename) return dlopen(filename, flag); if (strstr(filename, "cgame.mp.i386.so")) {#ifdef ETH32_DEBUG Debug.Log("Loading %s [crc32: 0x%x]", filename, Tools.crc32FromFile(filename));#endif // this automatically gets the offset for cgame console commands#ifdef ETH32_PRELIM_OFFSETS GElf_Shdr *tshdr; GElf_Shdr rodata_shdr; GElf_Shdr data_shdr; tshdr = Detour.getSectionHeader((char *)filename, ".rodata"); memcpy(&rodata_shdr, tshdr, sizeof(rodata_shdr)); tshdr = Detour.getSectionHeader((char *)filename, ".data"); memcpy(&data_shdr, tshdr, sizeof(data_shdr)); FILE *fp = fopen(filename, "r"); if (!fp) Debug.Log("couldnt open cgame :("); else { char *rodata = (char *)malloc((uint32)rodata_shdr.sh_size); char *data = (char *)malloc((uint32)data_shdr.sh_size); fseek (fp, rodata_shdr.sh_offset, SEEK_SET); fread(rodata, 1, (uint32)rodata_shdr.sh_size, fp); fseek (fp, data_shdr.sh_offset, SEEK_SET); fread(data, 1, (uint32)data_shdr.sh_size, fp); fclose(fp); char str[] = "testgun"; void *cmdstart = memmem(rodata, (uint32)rodata_shdr.sh_size, str, 8); if (!cmdstart) { Debug.Log("couldn't find 'testgun' in .rodata"); } else { uint32 p = (uint32)cmdstart - (uint32)rodata; p += (uint32)rodata_shdr.sh_offset; void *command = memmem(data, (uint32)data_shdr.sh_size, &p, 4); if (!command) Debug.Log("'testgun' found in rodata, but not command..."); else { p = (uint32)command - (uint32)data; p += (uint32)data_shdr.sh_offset; Debug.Log("commands found at 0x%x", p); } } free(rodata); free(data); } FATAL_ERROR("done")#endif