SymbolDB: GetSymbolsFromHash added
This commit is contained in:
parent
d778b8a820
commit
7e974f1064
|
@ -61,6 +61,26 @@ std::vector<Symbol*> SymbolDB::GetSymbolsFromName(const std::string& name)
|
||||||
return symbols;
|
return symbols;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Symbol* SymbolDB::GetSymbolFromHash(u32 hash)
|
||||||
|
{
|
||||||
|
XFuncPtrMap::iterator iter = checksumToFunction.find(hash);
|
||||||
|
if (iter != checksumToFunction.end())
|
||||||
|
return iter->second;
|
||||||
|
else
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Symbol*> SymbolDB::GetSymbolsFromHash(u32 hash)
|
||||||
|
{
|
||||||
|
std::vector<Symbol*> symbols;
|
||||||
|
|
||||||
|
for (const auto& iter : checksumToFunction)
|
||||||
|
if (iter.first == hash)
|
||||||
|
symbols.push_back(iter.second);
|
||||||
|
|
||||||
|
return symbols;
|
||||||
|
}
|
||||||
|
|
||||||
void SymbolDB::AddCompleteSymbol(const Symbol& symbol)
|
void SymbolDB::AddCompleteSymbol(const Symbol& symbol)
|
||||||
{
|
{
|
||||||
functions.emplace(symbol.address, symbol);
|
functions.emplace(symbol.address, symbol);
|
||||||
|
|
|
@ -72,14 +72,8 @@ public:
|
||||||
|
|
||||||
Symbol* GetSymbolFromName(const std::string& name);
|
Symbol* GetSymbolFromName(const std::string& name);
|
||||||
std::vector<Symbol*> GetSymbolsFromName(const std::string& name);
|
std::vector<Symbol*> GetSymbolsFromName(const std::string& name);
|
||||||
Symbol* GetSymbolFromHash(u32 hash)
|
Symbol* GetSymbolFromHash(u32 hash);
|
||||||
{
|
std::vector<Symbol*> GetSymbolsFromHash(u32 hash);
|
||||||
XFuncPtrMap::iterator iter = checksumToFunction.find(hash);
|
|
||||||
if (iter != checksumToFunction.end())
|
|
||||||
return iter->second;
|
|
||||||
else
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const XFuncMap& Symbols() const { return functions; }
|
const XFuncMap& Symbols() const { return functions; }
|
||||||
XFuncMap& AccessSymbols() { return functions; }
|
XFuncMap& AccessSymbols() { return functions; }
|
||||||
|
|
|
@ -72,12 +72,10 @@ void SignatureDB::Apply(PPCSymbolDB* symbol_db)
|
||||||
{
|
{
|
||||||
for (const auto& entry : m_database)
|
for (const auto& entry : m_database)
|
||||||
{
|
{
|
||||||
u32 hash = entry.first;
|
for (const auto& function : symbol_db->GetSymbolsFromHash(entry.first))
|
||||||
Symbol* function = symbol_db->GetSymbolFromHash(hash);
|
|
||||||
if (function)
|
|
||||||
{
|
{
|
||||||
// Found the function. Let's rename it according to the symbol file.
|
// Found the function. Let's rename it according to the symbol file.
|
||||||
if (entry.second.size == (unsigned int)function->size)
|
if (entry.second.size == static_cast<unsigned int>(function->size))
|
||||||
{
|
{
|
||||||
function->name = entry.second.name;
|
function->name = entry.second.name;
|
||||||
INFO_LOG(OSHLE, "Found %s at %08x (size: %08x)!", entry.second.name.c_str(),
|
INFO_LOG(OSHLE, "Found %s at %08x (size: %08x)!", entry.second.name.c_str(),
|
||||||
|
|
Loading…
Reference in New Issue