HLE: Log (v)dprintf messages
This commit is contained in:
parent
9f6d6e6921
commit
2989c0cb61
|
@ -62,6 +62,8 @@ static const SPatch OSPatches[] = {
|
|||
{"WUD_DEBUGPrint", HLE_OS::HLE_GeneralDebugPrint, HLE_HOOK_START, HLE_TYPE_DEBUG},
|
||||
{"vprintf", HLE_OS::HLE_GeneralDebugVPrint, HLE_HOOK_START, HLE_TYPE_DEBUG},
|
||||
{"printf", HLE_OS::HLE_GeneralDebugPrint, HLE_HOOK_START, HLE_TYPE_DEBUG},
|
||||
{"vdprintf", HLE_OS::HLE_LogVDPrint, HLE_HOOK_START, HLE_TYPE_DEBUG},
|
||||
{"dprintf", HLE_OS::HLE_LogDPrint, HLE_HOOK_START, HLE_TYPE_DEBUG},
|
||||
{"nlPrintf", HLE_OS::HLE_GeneralDebugPrint, HLE_HOOK_START, HLE_TYPE_DEBUG},
|
||||
{"puts", HLE_OS::HLE_GeneralDebugPrint, HLE_HOOK_START, HLE_TYPE_DEBUG}, // gcc-optimized printf?
|
||||
{"___blank", HLE_OS::HLE_GeneralDebugPrint, HLE_HOOK_START, HLE_TYPE_DEBUG}, // used for early init things (normally)
|
||||
|
|
|
@ -110,6 +110,32 @@ void HLE_write_console()
|
|||
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, SHIFTJISToUTF8(report_message).c_str());
|
||||
}
|
||||
|
||||
// Log (v)dprintf message if fd is 1 (stdout) or 2 (stderr)
|
||||
void HLE_LogDPrint(ParameterType parameter_type)
|
||||
{
|
||||
NPC = LR;
|
||||
|
||||
if (GPR(3) != 1 && GPR(3) != 2)
|
||||
return;
|
||||
|
||||
std::string report_message = GetStringVA(4, parameter_type);
|
||||
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, SHIFTJISToUTF8(report_message).c_str());
|
||||
}
|
||||
|
||||
// Log dprintf message
|
||||
// -> int dprintf(int fd, const char* format, ...);
|
||||
void HLE_LogDPrint()
|
||||
{
|
||||
HLE_LogDPrint(ParameterType::ParameterList);
|
||||
}
|
||||
|
||||
// Log vdprintf message
|
||||
// -> int vdprintf(int fd, const char* format, va_list ap);
|
||||
void HLE_LogVDPrint()
|
||||
{
|
||||
HLE_LogDPrint(ParameterType::VariableArgumentList);
|
||||
}
|
||||
|
||||
std::string GetStringVA(u32 str_reg, ParameterType parameter_type)
|
||||
{
|
||||
std::string ArgumentBuffer;
|
||||
|
|
|
@ -10,4 +10,6 @@ void HLE_GeneralDebugPrint();
|
|||
void HLE_GeneralDebugVPrint();
|
||||
void HLE_write_console();
|
||||
void HLE_OSPanic();
|
||||
void HLE_LogDPrint();
|
||||
void HLE_LogVDPrint();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue