From 4528621d5c95c2a8abb843422a212508724e8eb2 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Fri, 6 Aug 2010 19:15:43 +0000 Subject: [PATCH] Enable IOP stdout and Kprintf HLE intercepts in Release mode builds. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3616 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/IopBios.cpp | 29 ++++++++++++++++------------- pcsx2/PluginManager.cpp | 8 ++++---- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/pcsx2/IopBios.cpp b/pcsx2/IopBios.cpp index 1e9819ab36..4a86176278 100644 --- a/pcsx2/IopBios.cpp +++ b/pcsx2/IopBios.cpp @@ -424,7 +424,6 @@ namespace ioman { u32 buf = a1; u32 count = a2; -#ifdef PCSX2_DEVBUILD if (fd == 1) // stdout { iopConLog(ShiftJIS_ConvertString(Ra1, a2)); @@ -432,9 +431,7 @@ namespace ioman { v0 = a2; return 1; } - else -#endif - if (IOManFile *file = getfd(fd)) + else if (IOManFile *file = getfd(fd)) { if (!iopVirtMemR(buf)) return 0; @@ -451,14 +448,23 @@ namespace ioman { namespace sysmem { int Kprintf_HLE() { - char tmp[1024], tmp2[1024]; - char *ptmp = tmp; - int n=1, i=0, j = 0; - + // Emulate the expected Kprintf functionality: iopMemWrite32(sp, a0); iopMemWrite32(sp + 4, a1); iopMemWrite32(sp + 8, a2); iopMemWrite32(sp + 12, a3); + pc = ra; + + + // From here we're intercepting the Kprintf and piping it to our console, complete with + // printf-style formatting processing. This part can be skipped if the user has the + // console disabled. + + if (!SysConsolePack.iopConsole.IsEnabled()) return 1; + + char tmp[1024], tmp2[1024]; + char *ptmp = tmp; + int n=1, i=0, j = 0; while (Ra0[i]) { @@ -535,10 +541,8 @@ _start: } } *ptmp = 0; - iopConLog( ShiftJIS_ConvertString(tmp, 1023) ); - - pc = ra; + return 1; } } @@ -616,12 +620,11 @@ const char* irxImportFuncname(const char libname[8], u16 index) irxHLE irxImportHLE(const char libname[8], u16 index) { -#ifdef PCSX2_DEVBUILD // debugging output MODULE(sysmem) EXPORT_H( 14, Kprintf) END_MODULE -#endif + MODULE(ioman) EXPORT_H( 4, open) EXPORT_H( 5, close) diff --git a/pcsx2/PluginManager.cpp b/pcsx2/PluginManager.cpp index 446a84c6eb..f54003d243 100644 --- a/pcsx2/PluginManager.cpp +++ b/pcsx2/PluginManager.cpp @@ -1241,7 +1241,7 @@ void SysCorePlugins::Close() // Close plugins in reverse order of the initialization procedure, which // ensures the GS gets closed last. - DbgCon.WriteLn( Color_StrongBlue, "Closing plugins..." ); + Console.WriteLn( Color_StrongBlue, "Closing plugins..." ); if( AtomicExchange( m_mcdOpen, false ) ) { @@ -1252,7 +1252,7 @@ void SysCorePlugins::Close() for( int i=PluginId_Count-1; i>=0; --i ) Close( tbl_PluginInfo[i].id ); - DbgCon.WriteLn( Color_StrongBlue, "Plugins closed successfully." ); + Console.WriteLn( Color_StrongBlue, "Plugins closed successfully." ); } void SysCorePlugins::Init( PluginsEnum_t pid ) @@ -1331,7 +1331,7 @@ bool SysCorePlugins::Shutdown() GetMTGS().Cancel(); // cancel it for speedier shutdown! - DbgCon.WriteLn( Color_StrongGreen, "Shutting down plugins..." ); + Console.WriteLn( Color_StrongGreen, "Shutting down plugins..." ); // Shutdown plugins in reverse order (probably doesn't matter... // ... but what the heck, right?) @@ -1349,7 +1349,7 @@ bool SysCorePlugins::Shutdown() SysPlugins.Mcd = NULL; } - DbgCon.WriteLn( Color_StrongGreen, "Plugins shutdown successfully." ); + Console.WriteLn( Color_StrongGreen, "Plugins shutdown successfully." ); return true; }