diff --git a/Source/Core/Core/Src/HLE/HLE.cpp b/Source/Core/Core/Src/HLE/HLE.cpp index 84c6b2eb86..c74126dccc 100644 --- a/Source/Core/Core/Src/HLE/HLE.cpp +++ b/Source/Core/Core/Src/HLE/HLE.cpp @@ -63,6 +63,15 @@ static const SPatch OSPatches[] = { "OSPanic", HLE_OS::HLE_OSPanic }, { "vprintf", HLE_OS::HLE_GeneralDebugPrint }, { "printf", HLE_OS::HLE_GeneralDebugPrint }, + { "printf1", HLE_OS::HLE_GeneralDebugPrintWithInt }, + { "printf2", HLE_OS::HLE_GeneralDebugPrint }, + { "printf3", HLE_OS::HLE_GeneralDebugPrint }, + { "printf4", HLE_OS::HLE_GeneralDebugPrint }, + { "printf5", HLE_OS::HLE_GeneralDebugPrint }, + { "printf6", HLE_OS::HLE_GeneralDebugPrint }, + { "printf7", HLE_OS::HLE_GeneralDebugPrint }, + { "printf8", HLE_OS::HLE_GeneralDebugPrint }, + { "printf9", HLE_OS::HLE_GeneralDebugPrint }, { "puts", HLE_OS::HLE_GeneralDebugPrint }, // gcc-optimized printf? { "___blank(char *,...)", HLE_OS::HLE_GeneralDebugPrint }, // used for early init things (normally) { "___blank", HLE_OS::HLE_GeneralDebugPrint }, diff --git a/Source/Core/Core/Src/HLE/HLE_OS.cpp b/Source/Core/Core/Src/HLE/HLE_OS.cpp index 3ced001268..bb8bb795c2 100644 --- a/Source/Core/Core/Src/HLE/HLE_OS.cpp +++ b/Source/Core/Core/Src/HLE/HLE_OS.cpp @@ -45,7 +45,22 @@ void HLE_OSPanic() void HLE_GeneralDebugPrint() { std::string ReportMessage; - GetStringVA(ReportMessage); + if(*(u32*)Memory::GetPointer(GPR(3)) > 0x80000000){ + GetStringVA(ReportMessage, 4); + }else{ + GetStringVA(ReportMessage); + } + NPC = LR; + + //PanicAlert("(%08x->%08x) %s", LR, PC, ReportMessage.c_str()); + NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, ReportMessage.c_str()); +} + +// Generalized func for just printing string pointed to by r3. +void HLE_GeneralDebugPrintWithInt() +{ + std::string ReportMessage; + GetStringVA(ReportMessage, 5); NPC = LR; //PanicAlert("(%08x->%08x) %s", LR, PC, ReportMessage.c_str()); @@ -67,7 +82,7 @@ void GetStringVA(std::string& _rOutBuffer, u32 strReg) { _rOutBuffer = ""; char ArgumentBuffer[256]; - u32 ParameterCounter = 4; + u32 ParameterCounter = strReg+1; u32 FloatingParameterCounter = 1; char *pString = (char*)Memory::GetPointer(GPR(strReg)); if (!pString) diff --git a/Source/Core/Core/Src/HLE/HLE_OS.h b/Source/Core/Core/Src/HLE/HLE_OS.h index 01ed59a667..c91c9e121f 100644 --- a/Source/Core/Core/Src/HLE/HLE_OS.h +++ b/Source/Core/Core/Src/HLE/HLE_OS.h @@ -23,6 +23,7 @@ namespace HLE_OS { void HLE_GeneralDebugPrint(); + void HLE_GeneralDebugPrintWithInt(); void HLE_write_console(); void HLE_OSPanic(); }