More consistent lookup for sounds
CI / Build (AMD64, Client) (push) Has started running Details
CI / Build (ARM64, Client) (push) Has been cancelled Details
CI / Build (ARM64, Server) (push) Has been cancelled Details
CI / Build (ARMHF, Client) (push) Has been cancelled Details
CI / Build (ARMHF, Server) (push) Has been cancelled Details
CI / Test (Client) (push) Has been cancelled Details
CI / Test (Server) (push) Has been cancelled Details
CI / Build Example Mods (push) Has been cancelled Details
CI / Release (push) Has been cancelled Details
CI / Build (AMD64, Server) (push) Has been cancelled Details

This commit is contained in:
Bigjango13 2024-02-06 20:42:42 -05:00 committed by TheBrokenRail
parent 93498ce9c0
commit c62d5264a8
1 changed files with 4 additions and 4 deletions

View File

@ -14,11 +14,11 @@
// Load Symbol From ELF File
static void load_symbol(const char *source, const char *name, std::function<void(const unsigned char *, uint32_t)> callback) {
static std::unordered_map<std::string, std::unique_ptr<LIEF::ELF::Binary>> sources = {};
auto pos = sources.find(std::string(source));
if (pos == sources.end()) {
sources[std::string(source)] = LIEF::ELF::Parser::parse(source);
std::string cpp_source = source;
if (sources.count(cpp_source) == 0) {
sources[cpp_source] = LIEF::ELF::Parser::parse(source);
}
std::unique_ptr<LIEF::ELF::Binary> &binary = sources[std::string(source)];
std::unique_ptr<LIEF::ELF::Binary> &binary = sources[cpp_source];
const LIEF::ELF::Symbol *symbol = binary->get_dynamic_symbol(name);
if (symbol != NULL) {
LIEF::span<const uint8_t> data = binary->get_content_from_virtual_address(symbol->value(), symbol->size(), LIEF::Binary::VA_TYPES::VA);