mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-14 00:09:24 +01:00
Merge pull request #4250 from leoetlino/hle-patch-fix
HLE_OS: Minor fixes (function patching, output encoding)
This commit is contained in:
commit
bd1218a3c4
@ -41,7 +41,7 @@ Symbol* SymbolDB::GetSymbolFromName(const std::string& name)
|
|||||||
{
|
{
|
||||||
for (auto& func : functions)
|
for (auto& func : functions)
|
||||||
{
|
{
|
||||||
if (func.second.name == name)
|
if (func.second.function_name == name)
|
||||||
return &func.second;
|
return &func.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ struct Symbol
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
|
std::string function_name; // stripped function name
|
||||||
std::vector<SCall> callers; // addresses of functions that call this function
|
std::vector<SCall> callers; // addresses of functions that call this function
|
||||||
std::vector<SCall> calls; // addresses of functions that are called by this function
|
std::vector<SCall> calls; // addresses of functions that are called by this function
|
||||||
u32 hash = 0; // use for HLE function finding
|
u32 hash = 0; // use for HLE function finding
|
||||||
|
@ -43,7 +43,7 @@ void HLE_GeneralDebugPrint()
|
|||||||
|
|
||||||
NPC = LR;
|
NPC = LR;
|
||||||
|
|
||||||
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, report_message.c_str());
|
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, SHIFTJISToUTF8(report_message).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// __write_console is slightly abnormal
|
// __write_console is slightly abnormal
|
||||||
@ -53,7 +53,7 @@ void HLE_write_console()
|
|||||||
|
|
||||||
NPC = LR;
|
NPC = LR;
|
||||||
|
|
||||||
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, report_message.c_str());
|
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, SHIFTJISToUTF8(report_message).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetStringVA(u32 strReg)
|
std::string GetStringVA(u32 strReg)
|
||||||
|
@ -16,6 +16,15 @@
|
|||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
#include "Core/PowerPC/SignatureDB.h"
|
#include "Core/PowerPC/SignatureDB.h"
|
||||||
|
|
||||||
|
static std::string GetStrippedFunctionName(const std::string& symbol_name)
|
||||||
|
{
|
||||||
|
std::string name = symbol_name.substr(0, symbol_name.find('('));
|
||||||
|
size_t position = name.find(' ');
|
||||||
|
if (position != std::string::npos)
|
||||||
|
name.erase(position);
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
PPCSymbolDB g_symbolDB;
|
PPCSymbolDB g_symbolDB;
|
||||||
|
|
||||||
PPCSymbolDB::PPCSymbolDB()
|
PPCSymbolDB::PPCSymbolDB()
|
||||||
@ -62,6 +71,7 @@ void PPCSymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const std::string& nam
|
|||||||
// already got it, let's just update name, checksum & size to be sure.
|
// already got it, let's just update name, checksum & size to be sure.
|
||||||
Symbol* tempfunc = &iter->second;
|
Symbol* tempfunc = &iter->second;
|
||||||
tempfunc->name = name;
|
tempfunc->name = name;
|
||||||
|
tempfunc->function_name = GetStrippedFunctionName(name);
|
||||||
tempfunc->hash = SignatureDB::ComputeCodeChecksum(startAddr, startAddr + size - 4);
|
tempfunc->hash = SignatureDB::ComputeCodeChecksum(startAddr, startAddr + size - 4);
|
||||||
tempfunc->type = type;
|
tempfunc->type = type;
|
||||||
tempfunc->size = size;
|
tempfunc->size = size;
|
||||||
@ -77,6 +87,7 @@ void PPCSymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const std::string& nam
|
|||||||
{
|
{
|
||||||
PPCAnalyst::AnalyzeFunction(startAddr, tf, size);
|
PPCAnalyst::AnalyzeFunction(startAddr, tf, size);
|
||||||
checksumToFunction[tf.hash] = &(functions[startAddr]);
|
checksumToFunction[tf.hash] = &(functions[startAddr]);
|
||||||
|
tf.function_name = GetStrippedFunctionName(name);
|
||||||
}
|
}
|
||||||
tf.size = size;
|
tf.size = size;
|
||||||
functions[startAddr] = tf;
|
functions[startAddr] = tf;
|
||||||
@ -101,7 +112,7 @@ Symbol* PPCSymbolDB::GetSymbolFromAddr(u32 addr)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string PPCSymbolDB::GetDescription(u32 addr)
|
std::string PPCSymbolDB::GetDescription(u32 addr)
|
||||||
{
|
{
|
||||||
Symbol* symbol = GetSymbolFromAddr(addr);
|
Symbol* symbol = GetSymbolFromAddr(addr);
|
||||||
if (symbol)
|
if (symbol)
|
||||||
|
@ -31,7 +31,7 @@ public:
|
|||||||
|
|
||||||
Symbol* GetSymbolFromAddr(u32 addr) override;
|
Symbol* GetSymbolFromAddr(u32 addr) override;
|
||||||
|
|
||||||
const std::string GetDescription(u32 addr);
|
std::string GetDescription(u32 addr);
|
||||||
|
|
||||||
void FillInCallers();
|
void FillInCallers();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user