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
This commit is contained in:
Jake.Stine 2010-08-06 19:15:43 +00:00
parent e6e8992218
commit 4528621d5c
2 changed files with 20 additions and 17 deletions

View File

@ -424,7 +424,6 @@ namespace ioman {
u32 buf = a1; u32 buf = a1;
u32 count = a2; u32 count = a2;
#ifdef PCSX2_DEVBUILD
if (fd == 1) // stdout if (fd == 1) // stdout
{ {
iopConLog(ShiftJIS_ConvertString(Ra1, a2)); iopConLog(ShiftJIS_ConvertString(Ra1, a2));
@ -432,9 +431,7 @@ namespace ioman {
v0 = a2; v0 = a2;
return 1; return 1;
} }
else else if (IOManFile *file = getfd<IOManFile>(fd))
#endif
if (IOManFile *file = getfd<IOManFile>(fd))
{ {
if (!iopVirtMemR<void>(buf)) if (!iopVirtMemR<void>(buf))
return 0; return 0;
@ -451,14 +448,23 @@ namespace ioman {
namespace sysmem { namespace sysmem {
int Kprintf_HLE() int Kprintf_HLE()
{ {
char tmp[1024], tmp2[1024]; // Emulate the expected Kprintf functionality:
char *ptmp = tmp;
int n=1, i=0, j = 0;
iopMemWrite32(sp, a0); iopMemWrite32(sp, a0);
iopMemWrite32(sp + 4, a1); iopMemWrite32(sp + 4, a1);
iopMemWrite32(sp + 8, a2); iopMemWrite32(sp + 8, a2);
iopMemWrite32(sp + 12, a3); 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]) while (Ra0[i])
{ {
@ -535,10 +541,8 @@ _start:
} }
} }
*ptmp = 0; *ptmp = 0;
iopConLog( ShiftJIS_ConvertString(tmp, 1023) ); iopConLog( ShiftJIS_ConvertString(tmp, 1023) );
pc = ra;
return 1; return 1;
} }
} }
@ -616,12 +620,11 @@ const char* irxImportFuncname(const char libname[8], u16 index)
irxHLE irxImportHLE(const char libname[8], u16 index) irxHLE irxImportHLE(const char libname[8], u16 index)
{ {
#ifdef PCSX2_DEVBUILD
// debugging output // debugging output
MODULE(sysmem) MODULE(sysmem)
EXPORT_H( 14, Kprintf) EXPORT_H( 14, Kprintf)
END_MODULE END_MODULE
#endif
MODULE(ioman) MODULE(ioman)
EXPORT_H( 4, open) EXPORT_H( 4, open)
EXPORT_H( 5, close) EXPORT_H( 5, close)

View File

@ -1241,7 +1241,7 @@ void SysCorePlugins::Close()
// Close plugins in reverse order of the initialization procedure, which // Close plugins in reverse order of the initialization procedure, which
// ensures the GS gets closed last. // ensures the GS gets closed last.
DbgCon.WriteLn( Color_StrongBlue, "Closing plugins..." ); Console.WriteLn( Color_StrongBlue, "Closing plugins..." );
if( AtomicExchange( m_mcdOpen, false ) ) if( AtomicExchange( m_mcdOpen, false ) )
{ {
@ -1252,7 +1252,7 @@ void SysCorePlugins::Close()
for( int i=PluginId_Count-1; i>=0; --i ) for( int i=PluginId_Count-1; i>=0; --i )
Close( tbl_PluginInfo[i].id ); 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 ) void SysCorePlugins::Init( PluginsEnum_t pid )
@ -1331,7 +1331,7 @@ bool SysCorePlugins::Shutdown()
GetMTGS().Cancel(); // cancel it for speedier 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... // Shutdown plugins in reverse order (probably doesn't matter...
// ... but what the heck, right?) // ... but what the heck, right?)
@ -1349,7 +1349,7 @@ bool SysCorePlugins::Shutdown()
SysPlugins.Mcd = NULL; SysPlugins.Mcd = NULL;
} }
DbgCon.WriteLn( Color_StrongGreen, "Plugins shutdown successfully." ); Console.WriteLn( Color_StrongGreen, "Plugins shutdown successfully." );
return true; return true;
} }