MCPcopy Create free account
hub / github.com/clementgallet/libTAS / sendAddressesFromSymbols

Method sendAddressesFromSymbols

src/program/UnityPatching.cpp:969–1001  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

967};
968
969bool UnityPatching::sendAddressesFromSymbols(std::string debugfile, uintptr_t base_address)
970{
971 bool found_symbols = false;
972
973 /* Sometime games have trouble finding the address of the orginal function
974 * `SDL_DYNAPI_entry()` that we hook, so we send right away the symbol
975 * address if there is one */
976 uint64_t sdl_addr = getSymbolAddress("SDL_DYNAPI_entry", debugfile.c_str());
977 if (sdl_addr != 0) {
978 sdl_addr += base_address;
979
980 sendMessage(MSGN_SDL_DYNAPI_ADDR);
981 sendData(&sdl_addr, sizeof(uint64_t));
982 }
983
984 for (int i=0; UNITY_SYMBOLS[i].id != UNITY_FUNCS_LEN; i++) {
985 if (strlen(UNITY_SYMBOLS[i].symbol) == 0)
986 continue;
987
988 uint64_t func_addr = getSymbolAddress(UNITY_SYMBOLS[i].symbol, debugfile.c_str());
989 if (func_addr != 0) {
990 found_symbols = true;
991 func_addr += base_address;
992
993 sendMessage(MSGN_UNITY_ADDR);
994 sendData(&UNITY_SYMBOLS[i].id, sizeof(int));
995 sendData(&func_addr, sizeof(uint64_t));
996 std::cout << "Found symbol for function " << UNITY_SYMBOLS[i].name << " in address " << std::hex << func_addr << std::endl;
997 }
998 }
999
1000 return found_symbols;
1001}
1002
1003void UnityPatching::sendAddressesFromSignatures(std::pair<uintptr_t,uintptr_t> executablefile_segment, bool is_64bit)
1004{

Callers

nothing calls this directly

Calls 4

getSymbolAddressFunction · 0.85
sendMessageFunction · 0.85
sendDataFunction · 0.85
c_strMethod · 0.45

Tested by

no test coverage detected