mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-21 10:55:03 +00:00
resolving relocate function and patching them (successfully done one :D)
This commit is contained in:
parent
42dc535638
commit
81906c271a
4 changed files with 137 additions and 59 deletions
|
@ -5,9 +5,26 @@
|
|||
void SymbolsResolver::AddSymbol(const SymbolRes& s, u64 virtual_addr)
|
||||
{
|
||||
SymbolRecord r{};
|
||||
char str[256];
|
||||
sprintf(str, "%s (%s)[%s_v%d][%s_v%d.%d]", s.name.c_str(),s.nidName.c_str(), s.library.c_str(), s.library_version, s.module.c_str(),s.module_version_major, s.module_version_minor);
|
||||
r.name = std::string(str);
|
||||
r.name = GenerateName(s);
|
||||
r.virtual_address = virtual_addr;
|
||||
m_symbols.push_back(r);
|
||||
}
|
||||
|
||||
std::string SymbolsResolver::GenerateName(const SymbolRes& s) {
|
||||
char str[256];
|
||||
sprintf(str, "%s lib[%s_v%d]mod[%s_v%d.%d]", s.name.c_str(),s.library.c_str(), s.library_version, s.module.c_str(),
|
||||
s.module_version_major, s.module_version_minor);
|
||||
return std::string(str);
|
||||
}
|
||||
|
||||
const SymbolRecord* SymbolsResolver::FindSymbol(const SymbolRes& s) const {
|
||||
std::string name = GenerateName(s);
|
||||
int index = 0;
|
||||
for (auto symbol : m_symbols) {
|
||||
if (symbol.name.compare(name) == 0) {
|
||||
return &m_symbols.at(index);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue