SymbolDB: GetSymbolsFromName added
This commit is contained in:
parent
10862cd0e8
commit
d778b8a820
|
@ -48,6 +48,19 @@ Symbol* SymbolDB::GetSymbolFromName(const std::string& name)
|
||||||
return nullptr;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
void SymbolDB::AddCompleteSymbol(const Symbol& symbol)
|
void SymbolDB::AddCompleteSymbol(const Symbol& symbol)
|
||||||
{
|
{
|
||||||
functions.emplace(symbol.address, symbol);
|
functions.emplace(symbol.address, symbol);
|
||||||
|
|
|
@ -71,6 +71,7 @@ public:
|
||||||
void AddCompleteSymbol(const Symbol& symbol);
|
void AddCompleteSymbol(const Symbol& symbol);
|
||||||
|
|
||||||
Symbol* GetSymbolFromName(const std::string& name);
|
Symbol* GetSymbolFromName(const std::string& name);
|
||||||
|
std::vector<Symbol*> GetSymbolsFromName(const std::string& name);
|
||||||
Symbol* GetSymbolFromHash(u32 hash)
|
Symbol* GetSymbolFromHash(u32 hash)
|
||||||
{
|
{
|
||||||
XFuncPtrMap::iterator iter = checksumToFunction.find(hash);
|
XFuncPtrMap::iterator iter = checksumToFunction.find(hash);
|
||||||
|
|
|
@ -109,8 +109,7 @@ void PatchFunctions()
|
||||||
if (OSPatches[i].flags == HLE_TYPE_FIXED)
|
if (OSPatches[i].flags == HLE_TYPE_FIXED)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Symbol* symbol = g_symbolDB.GetSymbolFromName(OSPatches[i].m_szPatchName);
|
for (const auto& symbol : g_symbolDB.GetSymbolsFromName(OSPatches[i].m_szPatchName))
|
||||||
if (symbol)
|
|
||||||
{
|
{
|
||||||
for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4)
|
for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4)
|
||||||
{
|
{
|
||||||
|
@ -125,8 +124,7 @@ void PatchFunctions()
|
||||||
{
|
{
|
||||||
for (size_t i = 1; i < ArraySize(OSBreakPoints); ++i)
|
for (size_t i = 1; i < ArraySize(OSBreakPoints); ++i)
|
||||||
{
|
{
|
||||||
Symbol* symbol = g_symbolDB.GetSymbolFromName(OSBreakPoints[i].m_szPatchName);
|
for (const auto& symbol : g_symbolDB.GetSymbolsFromName(OSBreakPoints[i].m_szPatchName))
|
||||||
if (symbol)
|
|
||||||
{
|
{
|
||||||
PowerPC::breakpoints.Add(symbol->address, false);
|
PowerPC::breakpoints.Add(symbol->address, false);
|
||||||
INFO_LOG(OSHLE, "Adding BP to %s %08x", OSBreakPoints[i].m_szPatchName, symbol->address);
|
INFO_LOG(OSHLE, "Adding BP to %s %08x", OSBreakPoints[i].m_szPatchName, symbol->address);
|
||||||
|
@ -211,7 +209,7 @@ u32 UnPatch(const std::string& patch_name)
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Symbol* symbol = g_symbolDB.GetSymbolFromName(patch_name))
|
for (const auto& symbol : g_symbolDB.GetSymbolsFromName(patch_name))
|
||||||
{
|
{
|
||||||
for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4)
|
for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue