From 04a0e630db3def7b3d20e091b750bc338d013917 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Sun, 25 Oct 2009 03:26:39 +0000 Subject: [PATCH] little fix to __write_console logging, the char* is in r4, not r3, heh git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4466 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/HLE/HLE.cpp | 2 +- Source/Core/Core/Src/HLE/HLE_OS.cpp | 17 ++++++++++++++--- Source/Core/Core/Src/HLE/HLE_OS.h | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/Src/HLE/HLE.cpp b/Source/Core/Core/Src/HLE/HLE.cpp index 1ae34277fc..fcc429f89e 100644 --- a/Source/Core/Core/Src/HLE/HLE.cpp +++ b/Source/Core/Core/Src/HLE/HLE.cpp @@ -64,7 +64,7 @@ static const SPatch OSPatches[] = { "printf", HLE_OS::HLE_GeneralDebugPrint }, { "puts", HLE_OS::HLE_GeneralDebugPrint }, // gcc-optimized printf? { "___blank(char *,...)", HLE_OS::HLE_GeneralDebugPrint }, // dunno, but awesome :D - { "__write_console", HLE_OS::HLE_GeneralDebugPrint }, // used by sysmenu (+more?) + { "__write_console", HLE_OS::HLE_write_console }, // used by sysmenu (+more?) // wii only { "__OSInitAudioSystem", HLE_Misc::UnimplementedFunction }, diff --git a/Source/Core/Core/Src/HLE/HLE_OS.cpp b/Source/Core/Core/Src/HLE/HLE_OS.cpp index 909a8c7490..9ad6c6f730 100644 --- a/Source/Core/Core/Src/HLE/HLE_OS.cpp +++ b/Source/Core/Core/Src/HLE/HLE_OS.cpp @@ -27,7 +27,7 @@ namespace HLE_OS { -void GetStringVA(std::string& _rOutBuffer); +void GetStringVA(std::string& _rOutBuffer, u32 strReg = 3); void HLE_OSPanic() { @@ -51,13 +51,24 @@ void HLE_GeneralDebugPrint() NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, ReportMessage.c_str()); } -void GetStringVA(std::string& _rOutBuffer) +// __write_console is slightly abnormal +void HLE_write_console() +{ + std::string ReportMessage; + GetStringVA(ReportMessage, 4); + NPC = LR; + + //PanicAlert("(%08x->%08x) %s", LR, PC, ReportMessage.c_str()); + NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, ReportMessage.c_str()); +} + +void GetStringVA(std::string& _rOutBuffer, u32 strReg) { _rOutBuffer = ""; char ArgumentBuffer[256]; u32 ParameterCounter = 4; u32 FloatingParameterCounter = 1; - char* pString = (char*)Memory::GetPointer(GPR(3)); + char* pString = (char*)Memory::GetPointer(GPR(strReg)); if (!pString) { //PanicAlert("Invalid GetStringVA call"); return; diff --git a/Source/Core/Core/Src/HLE/HLE_OS.h b/Source/Core/Core/Src/HLE/HLE_OS.h index ac1d1b48ae..01ed59a667 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_write_console(); void HLE_OSPanic(); }