From ae1dcb7ac64e3d72e7870ba5b5b5c88b1465e589 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Sat, 21 Nov 2009 07:44:11 +0000 Subject: [PATCH] * Fixed some bugs in the SYSTEM.CNF loader (most notably it will not crash on files over 512 bytes -- some PS2 images pad their system.cnf to 32k) * Botting NoDisc with "Skip BIOS" enabled should work now (untested). * Renamed StaticText / StaticHeading helpers to simply Text and Heading. * Made the iR5900 recompiler's stack alignment check a dynamic toggle instead of a dev/debug build preprocessor. * Fix annoying linux linker errors. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2229 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/include/Utilities/wxGuiTools.h | 23 +++---- common/src/Utilities/wxGuiTools.cpp | 10 +++ common/src/Utilities/wxHelpers.cpp | 14 +++-- pcsx2/Config.h | 31 +++++---- pcsx2/Elfheader.cpp | 87 +++++++++++++------------- pcsx2/Pcsx2Config.cpp | 45 +++++++------ pcsx2/System/SysCoreThread.cpp | 2 +- pcsx2/gui/Dialogs/AboutBoxDialog.cpp | 2 +- pcsx2/gui/Panels/BiosSelectorPanel.cpp | 2 +- pcsx2/gui/Panels/MiscPanelStuff.cpp | 4 +- pcsx2/gui/Panels/VideoPanel.cpp | 28 ++++----- pcsx2/x86/ix86-32/iR5900-32.cpp | 2 +- 12 files changed, 135 insertions(+), 115 deletions(-) diff --git a/common/include/Utilities/wxGuiTools.h b/common/include/Utilities/wxGuiTools.h index 702567bd3e..39f87200bb 100644 --- a/common/include/Utilities/wxGuiTools.h +++ b/common/include/Utilities/wxGuiTools.h @@ -128,15 +128,8 @@ struct pxWindowAndFlags }; -__forceinline wxSizerFlags operator | ( const wxSizerFlags& _flgs, pxAlignmentType align ) -{ - return align.Apply( _flgs ); -} - -__forceinline wxSizerFlags operator | ( const wxSizerFlags& _flgs, pxStretchType stretch ) -{ - return stretch.Apply( _flgs ); -} +extern wxSizerFlags operator | ( const wxSizerFlags& _flgs, pxAlignmentType align ); +extern wxSizerFlags operator | ( const wxSizerFlags& _flgs, pxStretchType stretch ); template< typename WinType > pxWindowAndFlags operator | ( WinType* _win, const wxSizerFlags& _flgs ) @@ -245,8 +238,8 @@ public: virtual ~wxDialogWithHelpers() throw(); void AddOkCancel( wxSizer& sizer, bool hasApply=false ); - pxStaticText* StaticText( const wxString& label ); - pxStaticHeading* StaticHeading( const wxString& label ); + pxStaticText* Text( const wxString& label ); + pxStaticHeading* Heading( const wxString& label ); wxDialogWithHelpers& SetIdealWidth( int newWidth ) { m_idealWidth = newWidth; return *this; } int GetIdealWidth() const { return m_idealWidth; } @@ -267,7 +260,7 @@ protected: // to retrieve it, or use the "*this += window;" syntax to add windows directly to it. // // * Built-in support for StaticBoxes (aka groupboxes). Create one at construction with -// a wxString label, or add one "after the fact" using AddStaticBox. +// a wxString label, or add one "after the fact" using AddFrame. // // * Propagates IdealWidth settings from parenting wxPanelWithHelpers classes, and auto- // matically adjusts the width based on the sizer type (groupsizers get truncated to @@ -286,10 +279,10 @@ public: wxPanelWithHelpers( wxWindow* parent, const wxPoint& pos, const wxSize& size=wxDefaultSize ); explicit wxPanelWithHelpers( wxWindow* parent=NULL ); - wxPanelWithHelpers* AddStaticBox( const wxString& label, wxOrientation orient=wxVERTICAL ); + wxPanelWithHelpers* AddFrame( const wxString& label, wxOrientation orient=wxVERTICAL ); - pxStaticText* StaticText( const wxString& label ); - pxStaticHeading* StaticHeading( const wxString& label ); + pxStaticText* Text( const wxString& label ); + pxStaticHeading* Heading( const wxString& label ); // TODO : Propagate to children? wxPanelWithHelpers& SetIdealWidth( int width ) { m_idealWidth = width; return *this; } diff --git a/common/src/Utilities/wxGuiTools.cpp b/common/src/Utilities/wxGuiTools.cpp index b54155bef1..0917c9bd67 100644 --- a/common/src/Utilities/wxGuiTools.cpp +++ b/common/src/Utilities/wxGuiTools.cpp @@ -99,6 +99,16 @@ wxSizerFlags pxStretchType::Apply( wxSizerFlags flags ) const return flags; } +wxSizerFlags operator | ( const wxSizerFlags& _flgs, pxAlignmentType align ) +{ + return align.Apply( _flgs ); +} + +wxSizerFlags operator | ( const wxSizerFlags& _flgs, pxStretchType stretch ) +{ + return stretch.Apply( _flgs ); +} + void operator+=( wxSizer& target, wxWindow* src ) { diff --git a/common/src/Utilities/wxHelpers.cpp b/common/src/Utilities/wxHelpers.cpp index 50ec077c7b..ba844c1419 100644 --- a/common/src/Utilities/wxHelpers.cpp +++ b/common/src/Utilities/wxHelpers.cpp @@ -78,12 +78,12 @@ wxDialogWithHelpers::~wxDialogWithHelpers() throw() pxAssert( m_DialogIdents[GetId()] >= 0 ); } -pxStaticText* wxDialogWithHelpers::StaticText( const wxString& label ) +pxStaticText* wxDialogWithHelpers::Text( const wxString& label ) { return new pxStaticText( this, label ); } -pxStaticHeading* wxDialogWithHelpers::StaticHeading( const wxString& label ) +pxStaticHeading* wxDialogWithHelpers::Heading( const wxString& label ) { return new pxStaticHeading( this, label ); } @@ -169,7 +169,11 @@ void wxPanelWithHelpers::Init() } } -wxPanelWithHelpers* wxPanelWithHelpers::AddStaticBox( const wxString& label, wxOrientation orient ) +// Creates a Static Box container for this panel. the static box sizer becomes the default +// sizer for this panel. If the panel already has a sizer set, then that sizer will be +// transfered to the new StaticBoxSizer (and will be the first item in it's list, retaining +// consistent and expected layout) +wxPanelWithHelpers* wxPanelWithHelpers::AddFrame( const wxString& label, wxOrientation orient ) { wxSizer* oldSizer = GetSizer(); @@ -182,12 +186,12 @@ wxPanelWithHelpers* wxPanelWithHelpers::AddStaticBox( const wxString& label, wxO return this; } -pxStaticText* wxPanelWithHelpers::StaticText( const wxString& label ) +pxStaticText* wxPanelWithHelpers::Text( const wxString& label ) { return new pxStaticText( this, label ); } -pxStaticHeading* wxPanelWithHelpers::StaticHeading( const wxString& label ) +pxStaticHeading* wxPanelWithHelpers::Heading( const wxString& label ) { return new pxStaticHeading( this, label ); } diff --git a/pcsx2/Config.h b/pcsx2/Config.h index 4156d73906..a4fe8e31e5 100644 --- a/pcsx2/Config.h +++ b/pcsx2/Config.h @@ -297,25 +297,28 @@ struct Pcsx2Config { BITFIELD32() bool - EnableEE:1, - EnableIOP:1, - EnableVU0:1, - EnableVU1:1; + EnableEE :1, + EnableIOP :1, + EnableVU0 :1, + EnableVU1 :1; bool - UseMicroVU0:1, - UseMicroVU1:1; + UseMicroVU0 :1, + UseMicroVU1 :1; bool - vuOverflow:1, - vuExtraOverflow:1, - vuSignOverflow:1, - vuUnderflow:1; + vuOverflow :1, + vuExtraOverflow :1, + vuSignOverflow :1, + vuUnderflow :1; bool - fpuOverflow:1, + fpuOverflow :1, fpuExtraOverflow:1, - fpuFullMode:1; + fpuFullMode :1; + + bool + StackFrameChecks:1; BITFIELD_END RecompilerOptions(); @@ -361,6 +364,10 @@ struct Pcsx2Config // ------------------------------------------------------------------------ struct VideoOptions { + // forces the MTGS to execute tags/tasks in fully blocking/synchronous + // style. Useful for debugging potential bugs in the MTGS pipeline. + bool SynchronousMTGS; + bool EnableFrameLimiting; bool EnableFrameSkipping; diff --git a/pcsx2/Elfheader.cpp b/pcsx2/Elfheader.cpp index 4d47601bc2..7caecf7724 100644 --- a/pcsx2/Elfheader.cpp +++ b/pcsx2/Elfheader.cpp @@ -610,57 +610,54 @@ int GetPS2ElfName( wxString& name ) int size = file.getLength(); if( size == 0 ) return 0; - file.read( buffer, size ); - buffer[size] = '\0'; + int retype = 0; + + while( !file.eof() ) + { + wxString original( fromUTF8(file.readLine().c_str()) ); + ParsedAssignmentString parts( original ); + + if( parts.lvalue.IsEmpty() && parts.rvalue.IsEmpty() ) continue; + if( parts.rvalue.IsEmpty() ) + { + Console.Error( "(GetElfName) Unusual or malformed entry in SYSTEM.CNF ignored:" ); + Console.Indent().WriteLn( original ); + continue; + } + + if( parts.lvalue == L"BOOT2" ) + { + name = parts.rvalue; + Console.WriteLn( Color_StrongBlue, L"(GetElfName) Detected PS2 Disc = " + name ); + retype = 2; + } + else if( parts.lvalue == L"BOOT" ) + { + name = parts.rvalue; + Console.WriteLn( Color_StrongBlue, L"(GetElfName) Detected PSX/PSone Disc = " + name ); + retype = 1; + } + else if( parts.lvalue == L"VMODE" ) + { + Console.WriteLn( Color_StrongBlue, L"(GetElfName) Disc region type = " + parts.rvalue ); + } + else if( parts.lvalue == L"VER" ) + { + Console.WriteLn( Color_StrongBlue, L"(GetElfName) Software version = " + parts.rvalue ); + } + } + + if( retype == 0 ) + { + Console.Error("(GetElfName) Disc image is *not* a Playstation or PS2 game!"); + return 0; + } } catch( Exception::FileNotFound& ) { return 0; // no SYSTEM.CNF, not a PS1/PS2 disc. } - int retype = 0; - wxArrayString lines; - SplitString( lines, fromUTF8((char*)buffer), L"\n" ); - - for( uint i=0; iSetPaddingHoriz( m_radio_UserMode->GetPaddingHoriz() + 4 ); m_radio_UserMode->Realize(); - *this += StaticText( (isFirstTime ? usermodeExplained : usermodeWarning) ); + *this += Text( (isFirstTime ? usermodeExplained : usermodeWarning) ); *this += m_radio_UserMode | pxSizerFlags::StdExpand(); *this += 4; } @@ -201,7 +201,7 @@ Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow* parent ) size, compiled.GetPtr(), wxCB_READONLY | wxCB_SORT ); m_picker->SetSelection( cursel ); - *this += StaticText(_("Select a language: ")) | pxMiddle; + *this += Text(_("Select a language: ")) | pxMiddle; *this += 5; *this += m_picker | pxSizerFlags::StdSpace(); } diff --git a/pcsx2/gui/Panels/VideoPanel.cpp b/pcsx2/gui/Panels/VideoPanel.cpp index e2ebea9f74..e9a6291e2e 100644 --- a/pcsx2/gui/Panels/VideoPanel.cpp +++ b/pcsx2/gui/Panels/VideoPanel.cpp @@ -93,22 +93,22 @@ Panels::FramelimiterPanel::FramelimiterPanel( wxWindow* parent ) wxFlexGridSizer& s_spins( *new wxFlexGridSizer( 5 ) ); s_spins.AddGrowableCol( 0 ); - s_spins += StaticText(_("Base Framerate Adjust:")); + s_spins += Text(_("Base Framerate Adjust:")); s_spins += 5; s_spins += m_spin_NominalPct | wxSF.Border(wxTOP, 3); - s_spins += StaticText(L"%" ); + s_spins += Text(L"%" ); s_spins += 5; - s_spins += StaticText(_("Slow Motion Adjust:")); + s_spins += Text(_("Slow Motion Adjust:")); s_spins += 5; s_spins += m_spin_SlomoPct | wxSF.Border(wxTOP, 3); - s_spins += StaticText(L"%" ); + s_spins += Text(L"%" ); s_spins += 5; - s_spins += StaticText(_("Turbo Adjust:")); + s_spins += Text(_("Turbo Adjust:")); s_spins += 5; s_spins += m_spin_TurboPct | wxSF.Border(wxTOP, 3); - s_spins += StaticText(L"%" ); + s_spins += Text(L"%" ); s_spins += 5; s_spins += 15; @@ -120,16 +120,16 @@ Panels::FramelimiterPanel::FramelimiterPanel( wxWindow* parent ) wxFlexGridSizer& s_fps( *new wxFlexGridSizer( 5 ) ); s_fps.AddGrowableCol( 0 ); - s_fps += StaticText(_("NTSC Framerate:")); + s_fps += Text(_("NTSC Framerate:")); s_fps += 5; s_fps += m_text_BaseNtsc | wxSF.Right().Border(wxTOP, 3); - s_fps += StaticText(_("FPS")); + s_fps += Text(_("FPS")); s_fps += 5; - s_fps += StaticText(_("PAL Framerate:")); + s_fps += Text(_("PAL Framerate:")); s_fps += 5; s_fps += m_text_BasePal | wxSF.Right().Border(wxTOP, 3); - s_fps += StaticText(_("FPS")); + s_fps += Text(_("FPS")); s_fps += 5; *this += s_spins | pxExpand; @@ -202,7 +202,7 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent ) wxBoxSizer& s_customsize( *new wxBoxSizer( wxHORIZONTAL ) ); s_customsize += m_text_WindowWidth; - s_customsize += StaticText(L"x" ); + s_customsize += Text(L"x" ); s_customsize += m_text_WindowHeight; //wxFlexGridSizer& s_winsize( *new wxFlexGridSizer( 2 ) ); @@ -242,10 +242,10 @@ Panels::VideoPanel::VideoPanel( wxWindow* parent ) : right->SetIdealWidth( (right->GetIdealWidth()-16) / 2 ); GSWindowSettingsPanel* winpan = new GSWindowSettingsPanel( left ); - winpan->AddStaticBox(_("Display/Window")); + winpan->AddFrame(_("Display/Window")); FramelimiterPanel* fpan = new FramelimiterPanel( right ); - fpan->AddStaticBox(_("Framelimiter")); + fpan->AddFrame(_("Framelimiter")); wxFlexGridSizer* s_table = new wxFlexGridSizer( 2 ); @@ -255,7 +255,7 @@ Panels::VideoPanel::VideoPanel( wxWindow* parent ) : *s_table += left | StdExpand(); *s_table += right | StdExpand(); - *this += StaticHeading(L"This panel is not implemented yet.\nIT DOES NOT WORK. AT ALL."); + *this += Heading(L"This panel is not implemented yet.\nIT DOES NOT WORK. AT ALL."); *this += s_table; // TODO: diff --git a/pcsx2/x86/ix86-32/iR5900-32.cpp b/pcsx2/x86/ix86-32/iR5900-32.cpp index 8f1fb87091..9c70a78a06 100644 --- a/pcsx2/x86/ix86-32/iR5900-32.cpp +++ b/pcsx2/x86/ix86-32/iR5900-32.cpp @@ -334,7 +334,7 @@ static void __fastcall StackFrameCheckFailed( int espORebp, int regval ) static void _DynGen_StackFrameCheck() { - if( !IsDevBuild ) return; + if( !EmuConfig.Recompiler.StackFrameChecks ) return; // --------- EBP Here -----------