mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-31 21:28:51 +00:00
Merge pull request #4299 from sepalani/hle_symbols
SymbolDB: Multiple symbols detection allowed
This commit is contained in:
commit
5790f15be8
5 changed files with 46 additions and 20 deletions
|
@ -48,6 +48,40 @@ Symbol* SymbolDB::GetSymbolFromName(const std::string& name)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<Symbol*> SymbolDB::GetSymbolsFromName(const std::string& name)
|
||||
{
|
||||
std::vector<Symbol*> symbols;
|
||||
|
||||
for (auto& func : functions)
|
||||
{
|
||||
if (func.second.function_name == name)
|
||||
symbols.push_back(&func.second);
|
||||
}
|
||||
|
||||
return symbols;
|
||||
}
|
||||
|
||||
Symbol* SymbolDB::GetSymbolFromHash(u32 hash)
|
||||
{
|
||||
XFuncPtrMap::iterator iter = checksumToFunction.find(hash);
|
||||
if (iter != checksumToFunction.end())
|
||||
return *iter->second.begin();
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<Symbol*> SymbolDB::GetSymbolsFromHash(u32 hash)
|
||||
{
|
||||
std::vector<Symbol*> symbols;
|
||||
|
||||
for (const auto& iter : checksumToFunction)
|
||||
if (iter.first == hash)
|
||||
for (const auto& symbol : iter.second)
|
||||
symbols.push_back(symbol);
|
||||
|
||||
return symbols;
|
||||
}
|
||||
|
||||
void SymbolDB::AddCompleteSymbol(const Symbol& symbol)
|
||||
{
|
||||
functions.emplace(symbol.address, symbol);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
@ -57,7 +58,7 @@ class SymbolDB
|
|||
{
|
||||
public:
|
||||
typedef std::map<u32, Symbol> XFuncMap;
|
||||
typedef std::map<u32, Symbol*> XFuncPtrMap;
|
||||
typedef std::map<u32, std::set<Symbol*>> XFuncPtrMap;
|
||||
|
||||
protected:
|
||||
XFuncMap functions;
|
||||
|
@ -71,14 +72,9 @@ public:
|
|||
void AddCompleteSymbol(const Symbol& symbol);
|
||||
|
||||
Symbol* GetSymbolFromName(const std::string& name);
|
||||
Symbol* GetSymbolFromHash(u32 hash)
|
||||
{
|
||||
XFuncPtrMap::iterator iter = checksumToFunction.find(hash);
|
||||
if (iter != checksumToFunction.end())
|
||||
return iter->second;
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
std::vector<Symbol*> GetSymbolsFromName(const std::string& name);
|
||||
Symbol* GetSymbolFromHash(u32 hash);
|
||||
std::vector<Symbol*> GetSymbolsFromHash(u32 hash);
|
||||
|
||||
const XFuncMap& Symbols() const { return functions; }
|
||||
XFuncMap& AccessSymbols() { return functions; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue