From f2f04142b05ad447f2d917ffc09224199415e143 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Mon, 25 Mar 2024 09:46:36 +0200 Subject: [PATCH] improved symbols_resolver and output --- src/core/loader/symbols_resolver.cpp | 7 +++---- src/main.cpp | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/loader/symbols_resolver.cpp b/src/core/loader/symbols_resolver.cpp index 085e061c..03329207 100644 --- a/src/core/loader/symbols_resolver.cpp +++ b/src/core/loader/symbols_resolver.cpp @@ -11,10 +11,9 @@ namespace Core::Loader { void SymbolsResolver::AddSymbol(const SymbolResolver& s, u64 virtual_addr) { - SymbolRecord r{}; + SymbolRecord& r = m_symbols.emplace_back(); r.name = GenerateName(s); r.virtual_address = virtual_addr; - m_symbols.push_back(r); } std::string SymbolsResolver::GenerateName(const SymbolResolver& s) { @@ -25,7 +24,7 @@ std::string SymbolsResolver::GenerateName(const SymbolResolver& s) { const SymbolRecord* SymbolsResolver::FindSymbol(const SymbolResolver& s) const { const std::string name = GenerateName(s); for (u32 i = 0; i < m_symbols.size(); i++) { - if (m_symbols[i].name.compare(name) == 0) { + if (m_symbols[i].name == name) { return &m_symbols[i]; } } @@ -46,7 +45,7 @@ void SymbolsResolver::DebugDump(const std::filesystem::path& file_name) { } else { nidName = "UNK"; } - f.WriteString(fmt::format("{:<20} {:<16} {:<60} {:<30} {:<2} {:<30} {:<2} {:<2} {:<10}\n", + f.WriteString(fmt::format("0x{:<20x} {:<16} {:<60} {:<30} {:<2} {:<30} {:<2} {:<2} {:<10}\n", symbol.virtual_address, ids.at(0), nidName, ids.at(1), ids.at(2), ids.at(3), ids.at(4), ids.at(5), ids.at(6))); } diff --git a/src/main.cpp b/src/main.cpp index b43252bb..8d45f7a6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -58,8 +58,9 @@ int main(int argc, char* argv[]) { if (std::filesystem::exists(sce_module_folder)) { for (const auto& entry : std::filesystem::directory_iterator(sce_module_folder)) { if (entry.path().filename() == "libc.prx") { - // found = true; + found = true; printf("%s\n", entry.path().string().c_str()); + linker->LoadModule(entry.path().string().c_str()); } } }