Add 'Print CDVD Info' back in. In Linux, make writing to stdio optional. Make a few log messages grey. A few misc things.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2191 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-11-12 12:51:00 +00:00
parent 4ac00ea969
commit 137f0da055
15 changed files with 157 additions and 143 deletions

View File

@ -56,7 +56,7 @@ int lastReadSize;
int lastLSN; // needed for block dumping int lastLSN; // needed for block dumping
// Records last read block length for block dumping // Records last read block length for block dumping
static int plsn = 0; //static int plsn = 0;
static isoFile *blockDumpFile = NULL; static isoFile *blockDumpFile = NULL;
// Assertion check for CDVD != NULL (in devel and debug builds), because its handier than // Assertion check for CDVD != NULL (in devel and debug builds), because its handier than

View File

@ -471,7 +471,9 @@ struct Pcsx2Config
McdEnableEjection:1, McdEnableEjection:1,
MultitapPort0_Enabled:1, MultitapPort0_Enabled:1,
MultitapPort1_Enabled:1; MultitapPort1_Enabled:1,
ConsoleToStdio:1;
BITFIELD_END BITFIELD_END
CpuOptions Cpu; CpuOptions Cpu;

View File

@ -21,6 +21,7 @@
#include "IPU/IPU.h" #include "IPU/IPU.h"
#include "AppConfig.h" #include "AppConfig.h"
#include "Utilities/AsciiFile.h"
using namespace R5900; using namespace R5900;
// fixme: currently should not be uncommented. // fixme: currently should not be uncommented.
@ -188,18 +189,6 @@ void iDumpVU1Registers()
#endif #endif
} }
#ifdef PCSX2_DEVBUILD
// and not sure what these might have once been used for... (air)
//static const char *txt0 = "EAX = %x : ECX = %x : EDX = %x\n";
//static const char *txt0RC = "EAX = %x : EBX = %x : ECX = %x : EDX = %x : ESI = %x : EDI = %x\n";
//static const char *txt1 = "REG[%d] = %x_%x\n";
//static const char *txt2 = "M32 = %x\n";
#endif
////////////////////////////////////////////////////
#include "Utilities/AsciiFile.h"
// Originally from iR5900-32.cpp // Originally from iR5900-32.cpp
void iDumpBlock( int startpc, u8 * ptr ) void iDumpBlock( int startpc, u8 * ptr )
{ {
@ -207,7 +196,7 @@ void iDumpBlock( int startpc, u8 * ptr )
u8 fpuused[33]; u8 fpuused[33];
int numused, fpunumused; int numused, fpunumused;
Console.WriteLn( "dump1 %x:%x, %x", startpc, pc, cpuRegs.cycle ); DbgCon.WriteLn( Color_Gray, "dump1 %x:%x, %x", startpc, pc, cpuRegs.cycle );
g_Conf->Folders.Logs.Mkdir(); g_Conf->Folders.Logs.Mkdir();
AsciiFile eff( AsciiFile eff(

View File

@ -505,7 +505,6 @@ u32 loadElfCRC( const char* filename )
{ {
u32 crcval = 0; u32 crcval = 0;
Console.WriteLn("loadElfCRC: %s", filename); Console.WriteLn("loadElfCRC: %s", filename);
int mylen = strlen( "cdromN:" );
IsoFSCDVD isofs; IsoFSCDVD isofs;
const int filesize = IsoDirectory(isofs).GetFileSize( fromUTF8(filename) ); const int filesize = IsoDirectory(isofs).GetFileSize( fromUTF8(filename) );

View File

@ -236,6 +236,7 @@ void Pcsx2Config::LoadSave( IniInterface& ini )
IniBitBool( CdvdVerboseReads ); IniBitBool( CdvdVerboseReads );
IniBitBool( CdvdDumpBlocks ); IniBitBool( CdvdDumpBlocks );
IniBitBool( EnablePatches ); IniBitBool( EnablePatches );
IniBitBool( ConsoleToStdio );
IniBitBool( SkipBiosSplash ); IniBitBool( SkipBiosSplash );

View File

@ -407,7 +407,6 @@ bool memLoadingState::SeekToSection( PluginsEnum_t pid )
if( m_sectid == FreezeId_End ) return false; if( m_sectid == FreezeId_End ) return false;
FreezeTag( "Plugin" ); FreezeTag( "Plugin" );
int seekpos = m_idx + 4;
int sectlen = 0xdead; int sectlen = 0xdead;
Freeze( sectlen ); Freeze( sectlen );

View File

@ -142,6 +142,8 @@ enum MenuIdentifiers
MenuId_Website, // Visit our awesome website! MenuId_Website, // Visit our awesome website!
MenuId_Profiler, // Enable profiler MenuId_Profiler, // Enable profiler
MenuId_Console, // Enable console MenuId_Console, // Enable console
MenuId_Console_Stdio, // Enable Stdio
MenuId_CDVD_Info,
// Debug Subsection // Debug Subsection
MenuId_Debug_Open, // opens the debugger window / starts a debug session MenuId_Debug_Open, // opens the debugger window / starts a debug session
@ -525,14 +527,14 @@ DECLARE_APP(Pcsx2App)
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// Use these for "silent fail" invocation of PCSX2 Application-related constructs. If the // Use these for "silent fail" invocation of PCSX2 Application-related constructs. If the
// construct (albeit wxApp, MainFrame, CoreThread, etc) is null, the requested method will // construct (albeit wxApp, MainFrame, CoreThread, etc) is null, the requested method will
// not be invoked, and an optional "else" clause cn be affixed for handling the end case. // not be invoked, and an optional "else" clause can be affixed for handling the end case.
// //
// Usage Examples: // Usage Examples:
// sMainFrame.ApplySettings(); // sMainFrame.ApplySettings();
// sMainFrame.ApplySettings(); else Console.WriteLn( "Judge Wapner" ); // 'else' clause for handling NULL scenarios. // sMainFrame.ApplySettings(); else Console.WriteLn( "Judge Wapner" ); // 'else' clause for handling NULL scenarios.
// //
// Note! These macros are not "syntax complete", which means they could generat unexpected // Note! These macros are not "syntax complete", which means they could generate unexpected
// syntax errors in some situatins, and more importantly they cannot be used for invoking // syntax errors in some situations, and more importantly, they cannot be used for invoking
// functions with return values. // functions with return values.
// //
// Rationale: There are a lot of situations where we want to invoke a void-style method on // Rationale: There are a lot of situations where we want to invoke a void-style method on
@ -558,7 +560,7 @@ DECLARE_APP(Pcsx2App)
// A scoped convenience class for closing a single plugin and saving its state to memory. // A scoped convenience class for closing a single plugin and saving its state to memory.
// Emulation is suspended as needed, and is restored when the object leaves scope. Within // Emulation is suspended as needed, and is restored when the object leaves scope. Within
// the scope of the object, code is free to call plugin re-configurations or even unload // the scope of the object, code is free to call plugin re-configurations or even unload
// a plugin entirely and re-load a different DLL in its place. // a plugin entirely and re-load a different plugin in its place.
// //
class SaveSinglePluginHelper class SaveSinglePluginHelper
{ {

View File

@ -639,18 +639,13 @@ void Pcsx2App::ProgramLog_PostEvent( wxEvent& evt )
// ConsoleImpl_ToFile // ConsoleImpl_ToFile
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
static void __concall _immediate_logger( const wxString& src )
{
#ifdef __LINUX__
ConsoleWriter_Stdio.DoWrite(src);
#endif
px_fputs( emuLog, src.ToUTF8() );
}
static void __concall ConsoleToFile_Newline() static void __concall ConsoleToFile_Newline()
{ {
#ifdef __LINUX__ #ifdef __LINUX__
ConsoleWriter_Stdio.Newline(); if (g_Conf->EmuOptions.ConsoleToStdio) ConsoleWriter_Stdio.Newline();
#endif
#ifdef __LINUX__
fputc( '\n', emuLog ); fputc( '\n', emuLog );
#else #else
fputs( "\r\n", emuLog ); fputs( "\r\n", emuLog );
@ -659,16 +654,19 @@ static void __concall ConsoleToFile_Newline()
static void __concall ConsoleToFile_DoWrite( const wxString& fmt ) static void __concall ConsoleToFile_DoWrite( const wxString& fmt )
{ {
_immediate_logger( fmt ); #ifdef __LINUX__
if (g_Conf->EmuOptions.ConsoleToStdio) ConsoleWriter_Stdio.DoWrite(fmt);
#endif
px_fputs( emuLog, fmt.ToUTF8() );
} }
static void __concall ConsoleToFile_DoWriteLn( const wxString& fmt ) static void __concall ConsoleToFile_DoWriteLn( const wxString& fmt )
{ {
_immediate_logger( fmt ); ConsoleToFile_DoWrite( fmt );
ConsoleToFile_Newline(); ConsoleToFile_Newline();
if( emuLog != NULL ) if (emuLog != NULL) fflush( emuLog );
fflush( emuLog );
} }
static void __concall ConsoleToFile_SetTitle( const wxString& title ) static void __concall ConsoleToFile_SetTitle( const wxString& title )

View File

@ -105,7 +105,6 @@ bool IsoDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filen
{ {
Console.WriteLn( L"(Drag&Drop) Found valid ISO file type!" ); Console.WriteLn( L"(Drag&Drop) Found valid ISO file type!" );
bool confirmed = true;
wxWindowID result = wxID_RESET; wxWindowID result = wxID_RESET;
if( SysHasValidState() ) if( SysHasValidState() )

View File

@ -171,6 +171,8 @@ void MainEmuFrame::ConnectMenus()
ConnectMenu( MenuId_Debug_Logging, Menu_Debug_Logging_Click ); ConnectMenu( MenuId_Debug_Logging, Menu_Debug_Logging_Click );
ConnectMenu( MenuId_Console, Menu_ShowConsole ); ConnectMenu( MenuId_Console, Menu_ShowConsole );
ConnectMenu( MenuId_Console_Stdio, Menu_ShowConsole_Stdio );
ConnectMenu( MenuId_CDVD_Info, Menu_PrintCDVD_Info );
ConnectMenu( MenuId_About, Menu_ShowAboutBox ); ConnectMenu( MenuId_About, Menu_ShowAboutBox );
} }
@ -263,6 +265,7 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title):
m_SaveStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Save01 ) ), m_SaveStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Save01 ) ),
m_MenuItem_Console( *new wxMenuItem( &m_menuMisc, MenuId_Console, L"Show Console", wxEmptyString, wxITEM_CHECK ) ), m_MenuItem_Console( *new wxMenuItem( &m_menuMisc, MenuId_Console, L"Show Console", wxEmptyString, wxITEM_CHECK ) ),
m_MenuItem_Console_Stdio( *new wxMenuItem( &m_menuMisc, MenuId_Console_Stdio, L"Console to Stdio", wxEmptyString, wxITEM_CHECK ) ),
m_Listener_CoreThreadStatus( wxGetApp().Source_CoreThreadStatus(), CmdEvt_Listener( this, OnCoreThreadStatusChanged ) ), m_Listener_CoreThreadStatus( wxGetApp().Source_CoreThreadStatus(), CmdEvt_Listener( this, OnCoreThreadStatusChanged ) ),
m_Listener_CorePluginStatus( wxGetApp().Source_CorePluginStatus(), EventListener<PluginEventType>( this, OnCorePluginStatusChanged ) ), m_Listener_CorePluginStatus( wxGetApp().Source_CorePluginStatus(), EventListener<PluginEventType>( this, OnCorePluginStatusChanged ) ),
@ -415,16 +418,19 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title):
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
m_menuMisc.Append( &m_MenuItem_Console ); m_menuMisc.Append( &m_MenuItem_Console );
#ifdef __LINUX__
m_menuMisc.Append( &m_MenuItem_Console_Stdio );
#endif
//Todo: Though not many people need this one :p //Todo: Though not many people need this one :p
//m_menuMisc.Append(MenuId_Profiler, _("Show Profiler"), wxEmptyString, wxITEM_CHECK); //m_menuMisc.Append(MenuId_Profiler, _("Show Profiler"), wxEmptyString, wxITEM_CHECK);
m_menuMisc.AppendSeparator(); //m_menuMisc.AppendSeparator();
// No dialogs implemented for these yet... // No dialogs implemented for these yet...
//m_menuMisc.Append(41, "Patch Browser...", wxEmptyString, wxITEM_NORMAL); //m_menuMisc.Append(41, "Patch Browser...", wxEmptyString, wxITEM_NORMAL);
//m_menuMisc.Append(42, "Patch Finder...", wxEmptyString, wxITEM_NORMAL); //m_menuMisc.Append(42, "Patch Finder...", wxEmptyString, wxITEM_NORMAL);
// Ref will want this re-added eventually. m_menuMisc.Append(MenuId_CDVD_Info, _T("Print CDVD Info"), wxEmptyString, wxITEM_CHECK);
//m_menuMisc.Append(47, _T("Print CDVD Info..."), wxEmptyString, wxITEM_CHECK); m_menuMisc.AppendSeparator();
//Todo: //Todo:
//There's a great working "open website" in the about panel. Less clutter by just using that. //There's a great working "open website" in the about panel. Less clutter by just using that.
@ -510,6 +516,10 @@ void MainEmuFrame::ApplySettings()
menubar.Check( MenuId_SkipBiosToggle, g_Conf->EmuOptions.SkipBiosSplash ); menubar.Check( MenuId_SkipBiosToggle, g_Conf->EmuOptions.SkipBiosSplash );
menubar.Check( MenuId_EnablePatches, g_Conf->EmuOptions.EnablePatches ); menubar.Check( MenuId_EnablePatches, g_Conf->EmuOptions.EnablePatches );
menubar.Check( MenuId_CDVD_Info, g_Conf->EmuOptions.CdvdVerboseReads );
#ifdef __LINUX__
menubar.Check( MenuId_Console_Stdio, g_Conf->EmuOptions.ConsoleToStdio );
#endif
menubar.Check( MenuId_Config_Multitap0Toggle, g_Conf->EmuOptions.MultitapPort0_Enabled ); menubar.Check( MenuId_Config_Multitap0Toggle, g_Conf->EmuOptions.MultitapPort0_Enabled );
menubar.Check( MenuId_Config_Multitap1Toggle, g_Conf->EmuOptions.MultitapPort1_Enabled ); menubar.Check( MenuId_Config_Multitap1Toggle, g_Conf->EmuOptions.MultitapPort1_Enabled );

View File

@ -115,6 +115,7 @@ protected:
wxMenu& m_SaveStatesSubmenu; wxMenu& m_SaveStatesSubmenu;
wxMenuItem& m_MenuItem_Console; wxMenuItem& m_MenuItem_Console;
wxMenuItem& m_MenuItem_Console_Stdio;
PerPluginMenuInfo m_PluginMenuPacks[PluginId_Count]; PerPluginMenuInfo m_PluginMenuPacks[PluginId_Count];
@ -147,6 +148,8 @@ protected:
void ApplyCoreStatus(); void ApplyCoreStatus();
void ApplyPluginStatus(); void ApplyPluginStatus();
void SaveEmuOptions();
void InitLogBoxPosition( AppConfig::ConsoleLogOptions& conf ); void InitLogBoxPosition( AppConfig::ConsoleLogOptions& conf );
void OnCloseWindow(wxCloseEvent& evt); void OnCloseWindow(wxCloseEvent& evt);
@ -180,6 +183,8 @@ protected:
void Menu_Debug_Logging_Click(wxCommandEvent &event); void Menu_Debug_Logging_Click(wxCommandEvent &event);
void Menu_ShowConsole(wxCommandEvent &event); void Menu_ShowConsole(wxCommandEvent &event);
void Menu_ShowConsole_Stdio(wxCommandEvent &event);
void Menu_PrintCDVD_Info(wxCommandEvent &event);
void Menu_ShowAboutBox(wxCommandEvent &event); void Menu_ShowAboutBox(wxCommandEvent &event);
bool _DoSelectIsoBrowser( wxString& dest ); bool _DoSelectIsoBrowser( wxString& dest );

View File

@ -23,10 +23,21 @@
#include "Dialogs/ConfigurationDialog.h" #include "Dialogs/ConfigurationDialog.h"
#include "Dialogs/LogOptionsDialog.h" #include "Dialogs/LogOptionsDialog.h"
#include "IniInterface.h"
using namespace Dialogs; using namespace Dialogs;
extern wxString GetMsg_ConfirmSysReset(); extern wxString GetMsg_ConfirmSysReset();
void MainEmuFrame::SaveEmuOptions()
{
if (wxConfigBase* conf = GetAppConfig())
{
IniSaver saver(*conf);
g_Conf->EmuOptions.LoadSave(saver);
}
}
void MainEmuFrame::Menu_ConfigSettings_Click(wxCommandEvent &event) void MainEmuFrame::Menu_ConfigSettings_Click(wxCommandEvent &event)
{ {
Dialogs::ConfigurationDialog( this ).ShowModal(); Dialogs::ConfigurationDialog( this ).ShowModal();
@ -146,8 +157,6 @@ void MainEmuFrame::Menu_IsoBrowse_Click( wxCommandEvent &event )
if( resume ) CoreThread.Resume(); if( resume ) CoreThread.Resume();
} }
#include "IniInterface.h"
void MainEmuFrame::Menu_MultitapToggle_Click( wxCommandEvent &event ) void MainEmuFrame::Menu_MultitapToggle_Click( wxCommandEvent &event )
{ {
g_Conf->EmuOptions.MultitapPort0_Enabled = GetMenuBar()->IsChecked( MenuId_Config_Multitap0Toggle ); g_Conf->EmuOptions.MultitapPort0_Enabled = GetMenuBar()->IsChecked( MenuId_Config_Multitap0Toggle );
@ -158,23 +167,13 @@ void MainEmuFrame::Menu_MultitapToggle_Click( wxCommandEvent &event )
void MainEmuFrame::Menu_SkipBiosToggle_Click( wxCommandEvent &event ) void MainEmuFrame::Menu_SkipBiosToggle_Click( wxCommandEvent &event )
{ {
g_Conf->EmuOptions.SkipBiosSplash = GetMenuBar()->IsChecked( MenuId_SkipBiosToggle ); g_Conf->EmuOptions.SkipBiosSplash = GetMenuBar()->IsChecked( MenuId_SkipBiosToggle );
SaveEmuOptions();
if( wxConfigBase* conf = GetAppConfig() )
{
IniSaver saver( *conf );
g_Conf->EmuOptions.LoadSave( saver );
}
} }
void MainEmuFrame::Menu_EnablePatches_Click( wxCommandEvent &event ) void MainEmuFrame::Menu_EnablePatches_Click( wxCommandEvent &event )
{ {
g_Conf->EmuOptions.EnablePatches = GetMenuBar()->IsChecked( MenuId_EnablePatches ); g_Conf->EmuOptions.EnablePatches = GetMenuBar()->IsChecked( MenuId_EnablePatches );
SaveEmuOptions();
if( wxConfigBase* conf = GetAppConfig() )
{
IniSaver saver( *conf );
g_Conf->EmuOptions.LoadSave( saver );
}
} }
void MainEmuFrame::Menu_OpenELF_Click(wxCommandEvent &event) void MainEmuFrame::Menu_OpenELF_Click(wxCommandEvent &event)
@ -283,6 +282,18 @@ void MainEmuFrame::Menu_ShowConsole(wxCommandEvent &event)
wxGetApp().ProgramLog_PostEvent( evt ); wxGetApp().ProgramLog_PostEvent( evt );
} }
void MainEmuFrame::Menu_ShowConsole_Stdio(wxCommandEvent &event)
{
g_Conf->EmuOptions.ConsoleToStdio = GetMenuBar()->IsChecked( MenuId_Console_Stdio );
SaveEmuOptions();
}
void MainEmuFrame::Menu_PrintCDVD_Info(wxCommandEvent &event)
{
g_Conf->EmuOptions.CdvdVerboseReads = GetMenuBar()->IsChecked( MenuId_CDVD_Info );
SaveEmuOptions();
}
void MainEmuFrame::Menu_ShowAboutBox(wxCommandEvent &event) void MainEmuFrame::Menu_ShowAboutBox(wxCommandEvent &event)
{ {
AboutBoxDialog( this, wxID_ANY ).ShowModal(); AboutBoxDialog( this, wxID_ANY ).ShowModal();

View File

@ -29,7 +29,7 @@ using namespace Internal;
template< typename T > template< typename T >
static __forceinline void _generic_write( u32 addr, T val ) static __forceinline void _generic_write( u32 addr, T val )
{ {
int bitsize = (sizeof(T) == 1) ? 8 : ( (sizeof(T) == 2) ? 16 : 32 ); //int bitsize = (sizeof(T) == 1) ? 8 : ( (sizeof(T) == 2) ? 16 : 32 );
IopHwTraceLog<T>( addr, val, "Write" ); IopHwTraceLog<T>( addr, val, "Write" );
psxHu(addr) = val; psxHu(addr) = val;
} }
@ -43,7 +43,7 @@ void __fastcall iopHwWrite32_generic( u32 addr, mem32_t val ) { _generic_write<m
template< typename T > template< typename T >
static __forceinline T _generic_read( u32 addr ) static __forceinline T _generic_read( u32 addr )
{ {
int bitsize = (sizeof(T) == 1) ? 8 : ( (sizeof(T) == 2) ? 16 : 32 ); //int bitsize = (sizeof(T) == 1) ? 8 : ( (sizeof(T) == 2) ? 16 : 32 );
T ret = psxHu(addr); T ret = psxHu(addr);
IopHwTraceLog<T>( addr, ret, "Read" ); IopHwTraceLog<T>( addr, ret, "Read" );

View File

@ -1315,9 +1315,7 @@ static void __fastcall recRecompile( const u32 startpc )
u32 usecop2; u32 usecop2;
#ifdef PCSX2_DEBUG #ifdef PCSX2_DEBUG
//dumplog |= 4; if (dumplog & 4) iDumpRegisters(startpc, 0);
if( dumplog & 4 )
iDumpRegisters(startpc, 0);
#endif #endif
pxAssert( startpc ); pxAssert( startpc );
@ -1540,14 +1538,15 @@ StartRecomp:
#ifdef PCSX2_DEBUG #ifdef PCSX2_DEBUG
// dump code // dump code
for(i = 0; i < ArraySize(s_recblocks); ++i) { for(i = 0; i < ArraySize(s_recblocks); ++i)
if( startpc == s_recblocks[i] ) { {
if (startpc == s_recblocks[i])
{
iDumpBlock(startpc, recPtr); iDumpBlock(startpc, recPtr);
} }
} }
if( (dumplog & 1) ) //|| usecop2 ) if (dumplog & 1) iDumpBlock(startpc, recPtr);
iDumpBlock(startpc, recPtr);
#endif #endif
u32 sz = (s_nEndBlock-startpc) >> 2; u32 sz = (s_nEndBlock-startpc) >> 2;
@ -1618,7 +1617,7 @@ StartRecomp:
} }
else else
{ {
DbgCon.WriteLn( "Uncounted Manual block @ 0x%08X : size=%3d page/offs=%05X/%03X inpgsz=%d", DbgCon.WriteLn( Color_Gray, "Uncounted Manual block @ 0x%08X : size=%3d page/offs=%05X/%03X inpgsz=%d",
startpc, sz, inpage_ptr>>12, inpage_ptr&0xfff, pgsz, inpage_sz ); startpc, sz, inpage_ptr>>12, inpage_ptr&0xfff, pgsz, inpage_sz );
} }