diff --git a/common/include/Utilities/Exceptions.h b/common/include/Utilities/Exceptions.h index 34cfa5fad8..635564e336 100644 --- a/common/include/Utilities/Exceptions.h +++ b/common/include/Utilities/Exceptions.h @@ -29,16 +29,28 @@ void pxTrap(); // exception. Use this macro to dispose of these dangerous exceptions, and generate a // friendly error log in their wake. // +// Note: Console can also fire an Exception::OutOfMemory #define __DESTRUCTOR_CATCHALL( funcname ) \ catch( BaseException& ex ) \ { \ - Console.Error( "Unhandled BaseException in %s (ignored!):", funcname ); \ - Console.Error( ex.FormatDiagnosticMessage() ); \ + try { \ + Console.Error( "Unhandled BaseException in %s (ignored!):", funcname ); \ + Console.Error( ex.FormatDiagnosticMessage() ); \ + } catch (...) { \ + fprintf(stderr, "ERROR: (out of memory?)\n"); \ + } \ } \ catch( std::exception& ex ) \ { \ - Console.Error( "Unhandled std::exception in %s (ignored!):", funcname ); \ - Console.Error( ex.what() ); \ + try { \ + Console.Error( "Unhandled std::exception in %s (ignored!):", funcname ); \ + Console.Error( ex.what() ); \ + } catch (...) { \ + fprintf(stderr, "ERROR: (out of memory?)\n"); \ + } \ + } \ + catch(...) { \ + /* Unreachable code */ \ } #define DESTRUCTOR_CATCHALL __DESTRUCTOR_CATCHALL( __pxFUNCTION__ ) diff --git a/common/include/Utilities/PageFaultSource.h b/common/include/Utilities/PageFaultSource.h index 899fcf0f6b..fc4e88ce4d 100644 --- a/common/include/Utilities/PageFaultSource.h +++ b/common/include/Utilities/PageFaultSource.h @@ -109,7 +109,7 @@ protected: bool m_handled; public: - SrcType_PageFault() {} + SrcType_PageFault() : m_handled(false) {} virtual ~SrcType_PageFault() throw() { } bool WasHandled() const { return m_handled; } diff --git a/common/include/Utilities/StringHelpers.h b/common/include/Utilities/StringHelpers.h index 874db63973..c0ec12937f 100644 --- a/common/include/Utilities/StringHelpers.h +++ b/common/include/Utilities/StringHelpers.h @@ -145,7 +145,6 @@ class FastFormatAscii protected: ScopedAlignedAlloc* m_dest; bool m_deleteDest; - uint m_Length; public: FastFormatAscii(); @@ -155,7 +154,6 @@ public: void Clear(); bool IsEmpty() const; - uint Length() const { return m_Length; } const char* c_str() const { return m_dest->GetPtr(); } operator const char*() const { return m_dest->GetPtr(); } diff --git a/common/include/Utilities/TraceLog.h b/common/include/Utilities/TraceLog.h index d727be9b41..0426b02b13 100644 --- a/common/include/Utilities/TraceLog.h +++ b/common/include/Utilities/TraceLog.h @@ -159,7 +159,7 @@ public: ConsoleColors DefaultColor; protected: - ConsoleLogSource() {} + ConsoleLogSource() : DefaultColor(Color_Gray) {} public: ConsoleLog_ImplementBaseAPI(ConsoleLogSource) diff --git a/common/src/Utilities/Console.cpp b/common/src/Utilities/Console.cpp index 3ff0469ca0..49ba913cbd 100644 --- a/common/src/Utilities/Console.cpp +++ b/common/src/Utilities/Console.cpp @@ -558,7 +558,10 @@ ConsoleIndentScope::ConsoleIndentScope( int tabs ) ConsoleIndentScope::~ConsoleIndentScope() throw() { - LeaveScope(); + try { + LeaveScope(); + } + DESTRUCTOR_CATCHALL } void ConsoleIndentScope::EnterScope() @@ -581,8 +584,11 @@ ConsoleAttrScope::ConsoleAttrScope( ConsoleColors newcolor, int indent ) ConsoleAttrScope::~ConsoleAttrScope() throw() { - Console.SetColor( m_old_color ); - Console.SetIndent( -m_tabsize ); + try { + Console.SetColor( m_old_color ); + Console.SetIndent( -m_tabsize ); + } + DESTRUCTOR_CATCHALL } diff --git a/common/src/Utilities/FastFormatString.cpp b/common/src/Utilities/FastFormatString.cpp index c6b7b72934..144e25789f 100644 --- a/common/src/Utilities/FastFormatString.cpp +++ b/common/src/Utilities/FastFormatString.cpp @@ -261,10 +261,13 @@ FastFormatUnicode::FastFormatUnicode() FastFormatUnicode::~FastFormatUnicode() throw() { - if (m_deleteDest) - delete m_dest; - else - m_buffer_tls.Get()->ReleaseBuffer(); + try { + if (m_deleteDest) + delete m_dest; + else + m_buffer_tls.Get()->ReleaseBuffer(); + } + DESTRUCTOR_CATCHALL } void FastFormatUnicode::Clear() @@ -396,10 +399,13 @@ FastFormatAscii::FastFormatAscii() FastFormatAscii::~FastFormatAscii() throw() { - if (m_deleteDest) - delete m_dest; - else - m_buffer_tls.Get()->ReleaseBuffer(); + try { + if (m_deleteDest) + delete m_dest; + else + m_buffer_tls.Get()->ReleaseBuffer(); + } + DESTRUCTOR_CATCHALL } void FastFormatAscii::Clear() diff --git a/common/src/Utilities/VirtualMemory.cpp b/common/src/Utilities/VirtualMemory.cpp index 9861ccfb12..cb7c2dbe6b 100644 --- a/common/src/Utilities/VirtualMemory.cpp +++ b/common/src/Utilities/VirtualMemory.cpp @@ -342,7 +342,7 @@ void BaseVmReserveListener::OnPageFaultEvent(const PageFaultInfo& info, bool& ha // -------------------------------------------------------------------------------------- SpatialArrayReserve::SpatialArrayReserve( const wxString& name ) : - _parent( name ) + _parent( name ), m_numblocks(0) { m_prot_mode = PageAccess_ReadWrite(); } diff --git a/common/src/Utilities/pxStaticText.cpp b/common/src/Utilities/pxStaticText.cpp index 2a0eb617d4..b3faf78b12 100644 --- a/common/src/Utilities/pxStaticText.cpp +++ b/common/src/Utilities/pxStaticText.cpp @@ -23,7 +23,12 @@ pxStaticText::pxStaticText( wxWindow* parent ) : _parent( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER ) { + m_align = wxALIGN_CENTRE_HORIZONTAL; + m_autowrap = true; + m_wrappedWidth = -1; m_heightInLines = 1; + + SetPaddingDefaults(); } pxStaticText::pxStaticText( wxWindow* parent, const wxString& label, wxAlignment align ) diff --git a/pcsx2/AsyncFileReader.h b/pcsx2/AsyncFileReader.h index d4cc7e1a1c..4eca98e9a5 100644 --- a/pcsx2/AsyncFileReader.h +++ b/pcsx2/AsyncFileReader.h @@ -25,7 +25,7 @@ class AsyncFileReader { protected: - AsyncFileReader() : m_dataoffset(0) {} + AsyncFileReader() : m_dataoffset(0), m_blocksize(0) {} wxString m_filename; diff --git a/pcsx2/CDVD/BlockdumpFileReader.cpp b/pcsx2/CDVD/BlockdumpFileReader.cpp index 6720d5535a..69fe172b14 100644 --- a/pcsx2/CDVD/BlockdumpFileReader.cpp +++ b/pcsx2/CDVD/BlockdumpFileReader.cpp @@ -45,7 +45,12 @@ bool BlockdumpFileReader::DetectBlockdump(AsyncFileReader* reader) return isbd; } -BlockdumpFileReader::BlockdumpFileReader(void) +BlockdumpFileReader::BlockdumpFileReader(void) : + m_file(NULL), + m_blocks(0), + m_blockofs(0), + m_dtablesize(0), + m_lresult(0) { } diff --git a/pcsx2/CDVD/CsoFileReader.cpp b/pcsx2/CDVD/CsoFileReader.cpp index 4cc85af403..9105e34bc3 100644 --- a/pcsx2/CDVD/CsoFileReader.cpp +++ b/pcsx2/CDVD/CsoFileReader.cpp @@ -43,10 +43,12 @@ bool CsoFileReader::CanHandle(const wxString& fileName) { if (wxFileName::FileExists(fileName) && fileName.Lower().EndsWith(L".cso")) { FILE* fp = PX_fopen_rb(fileName); CsoHeader hdr; - if (fp && fread(&hdr, 1, sizeof(hdr), fp) == sizeof(hdr)) { - supported = ValidateHeader(hdr); + if (fp) { + if (fread(&hdr, 1, sizeof(hdr), fp) == sizeof(hdr)) { + supported = ValidateHeader(hdr); + } + fclose(fp); } - fclose(fp); } return supported; } diff --git a/pcsx2/CDVD/CsoFileReader.h b/pcsx2/CDVD/CsoFileReader.h index 04f5c19ab1..dca3ffe890 100644 --- a/pcsx2/CDVD/CsoFileReader.h +++ b/pcsx2/CDVD/CsoFileReader.h @@ -37,8 +37,12 @@ class CsoFileReader : public AsyncFileReader DeclareNoncopyableObject(CsoFileReader); public: CsoFileReader(void) : + m_frameSize(0), + m_frameShift(0), + m_indexShift(0), m_readBuffer(0), m_zlibBuffer(0), + m_zlibBufferFrame(0), m_index(0), m_totalSize(0), m_src(0), diff --git a/pcsx2/CDVD/GzippedFileReader.cpp b/pcsx2/CDVD/GzippedFileReader.cpp index 7c2dcc40db..536a59ed40 100644 --- a/pcsx2/CDVD/GzippedFileReader.cpp +++ b/pcsx2/CDVD/GzippedFileReader.cpp @@ -178,6 +178,7 @@ static wxString iso2indexname(const wxString& isoname) { } GzippedFileReader::GzippedFileReader(void) : + mBytesRead(0), m_pIndex(0), m_zstates(0), m_src(0), diff --git a/pcsx2/CDVD/IsoFS/IsoFS.cpp b/pcsx2/CDVD/IsoFS/IsoFS.cpp index 47c4906933..80a215ccd4 100644 --- a/pcsx2/CDVD/IsoFS/IsoFS.cpp +++ b/pcsx2/CDVD/IsoFS/IsoFS.cpp @@ -105,6 +105,7 @@ IsoDirectory::IsoDirectory(SectorSource& r) IsoDirectory::IsoDirectory(SectorSource& r, IsoFileDescriptor directoryEntry) : internalReader(r) { + m_fstype = FStype_ISO9660; Init(directoryEntry); } diff --git a/pcsx2/DebugTools/Breakpoints.cpp b/pcsx2/DebugTools/Breakpoints.cpp index 105c3610f8..90d24572d6 100644 --- a/pcsx2/DebugTools/Breakpoints.cpp +++ b/pcsx2/DebugTools/Breakpoints.cpp @@ -45,7 +45,14 @@ u32 __fastcall standardizeBreakpointAddress(u32 addr) return addr; } -MemCheck::MemCheck() +MemCheck::MemCheck() : + start(0), + end(0), + cond(MEMCHECK_READWRITE), + result(MEMCHECK_BOTH), + lastPC(0), + lastAddr(0), + lastSize(0) { numHits = 0; } diff --git a/pcsx2/DebugTools/Breakpoints.h b/pcsx2/DebugTools/Breakpoints.h index 48f79f5563..131eb2e521 100644 --- a/pcsx2/DebugTools/Breakpoints.h +++ b/pcsx2/DebugTools/Breakpoints.h @@ -43,7 +43,8 @@ struct BreakPointCond struct BreakPoint { - BreakPoint() : hasCond(false) {} + BreakPoint() : addr(0), enabled(false), temporary(false), hasCond(false) + {} u32 addr; bool enabled; diff --git a/pcsx2/MTGS.cpp b/pcsx2/MTGS.cpp index 11670eb98d..7abad90e45 100644 --- a/pcsx2/MTGS.cpp +++ b/pcsx2/MTGS.cpp @@ -90,7 +90,10 @@ void SysMtgsThread::OnStart() SysMtgsThread::~SysMtgsThread() throw() { - _parent::Cancel(); + try { + _parent::Cancel(); + } + DESTRUCTOR_CATCHALL } void SysMtgsThread::OnResumeReady() diff --git a/pcsx2/MTVU.cpp b/pcsx2/MTVU.cpp index cfba1966e9..58d958e9e5 100644 --- a/pcsx2/MTVU.cpp +++ b/pcsx2/MTVU.cpp @@ -64,7 +64,10 @@ VU_Thread::VU_Thread(BaseVUmicroCPU*& _vuCPU, VURegs& _vuRegs) : VU_Thread::~VU_Thread() throw() { - pxThread::Cancel(); + try { + pxThread::Cancel(); + } + DESTRUCTOR_CATCHALL } void VU_Thread::Reset() diff --git a/pcsx2/System.cpp b/pcsx2/System.cpp index 1365b9e0d3..d086ca92c0 100644 --- a/pcsx2/System.cpp +++ b/pcsx2/System.cpp @@ -322,8 +322,11 @@ CpuInitializer< CpuType >::CpuInitializer() template< typename CpuType > CpuInitializer< CpuType >::~CpuInitializer() throw() { - if (MyCpu) - MyCpu->Shutdown(); + try { + if (MyCpu) + MyCpu->Shutdown(); + } + DESTRUCTOR_CATCHALL } // -------------------------------------------------------------------------------------- @@ -366,7 +369,10 @@ SysMainMemory::SysMainMemory() SysMainMemory::~SysMainMemory() throw() { - ReleaseAll(); + try { + ReleaseAll(); + } + DESTRUCTOR_CATCHALL } void SysMainMemory::ReserveAll() diff --git a/pcsx2/System/SysCoreThread.cpp b/pcsx2/System/SysCoreThread.cpp index a932d7ec8a..04e3925e4b 100644 --- a/pcsx2/System/SysCoreThread.cpp +++ b/pcsx2/System/SysCoreThread.cpp @@ -55,7 +55,10 @@ SysCoreThread::SysCoreThread() SysCoreThread::~SysCoreThread() throw() { - SysCoreThread::Cancel(); + try { + SysCoreThread::Cancel(); + } + DESTRUCTOR_CATCHALL } void SysCoreThread::Cancel( bool isBlocking ) diff --git a/pcsx2/VUmicro.h b/pcsx2/VUmicro.h index 097231ab2c..f0943f6144 100644 --- a/pcsx2/VUmicro.h +++ b/pcsx2/VUmicro.h @@ -61,12 +61,16 @@ public: BaseCpuProvider() { m_Reserved = 0; + IsInterpreter = false; } virtual ~BaseCpuProvider() throw() { - if( m_Reserved != 0 ) - Console.Warning( "Cleanup miscount detected on CPU provider. Count=%d", m_Reserved ); + try { + if( m_Reserved != 0 ) + Console.Warning( "Cleanup miscount detected on CPU provider. Count=%d", m_Reserved ); + } + DESTRUCTOR_CATCHALL } virtual const char* GetShortName() const=0; diff --git a/pcsx2/ZipTools/ThreadedZipTools.h b/pcsx2/ZipTools/ThreadedZipTools.h index 01614ce22d..51b896c320 100644 --- a/pcsx2/ZipTools/ThreadedZipTools.h +++ b/pcsx2/ZipTools/ThreadedZipTools.h @@ -198,6 +198,8 @@ public: protected: BaseCompressThread() { + m_gzfp = NULL; + m_src_list = NULL; m_PendingSaveFlag = false; } diff --git a/pcsx2/ZipTools/thread_gzip.cpp b/pcsx2/ZipTools/thread_gzip.cpp index 41d09eecd7..7d1a4ede53 100644 --- a/pcsx2/ZipTools/thread_gzip.cpp +++ b/pcsx2/ZipTools/thread_gzip.cpp @@ -24,12 +24,15 @@ BaseCompressThread::~BaseCompressThread() throw() { - _parent::Cancel(); - if( m_PendingSaveFlag ) - { - wxGetApp().ClearPendingSave(); - m_PendingSaveFlag = false; + try { + _parent::Cancel(); + if( m_PendingSaveFlag ) + { + wxGetApp().ClearPendingSave(); + m_PendingSaveFlag = false; + } } + DESTRUCTOR_CATCHALL } void BaseCompressThread::SetPendingSave() diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h index 40dc665655..01498a4f3f 100644 --- a/pcsx2/gui/App.h +++ b/pcsx2/gui/App.h @@ -219,10 +219,12 @@ struct AppImageIds ToolbarIds() { - Settings = Play = - PluginVideo = - PluginAudio = - PluginPad = -1; + Settings = -1; + Play = -1; + Resume = -1; + PluginVideo = -1; + PluginAudio = -1; + PluginPad = -1; } } Toolbars; }; @@ -262,8 +264,6 @@ protected: int m_fpsqueue_writepos; uint m_initpause; - uint m_FrameCounter; - public: FramerateManager() { Reset(); } virtual ~FramerateManager() throw() {} diff --git a/pcsx2/gui/AppCoreThread.cpp b/pcsx2/gui/AppCoreThread.cpp index c3c93ee244..ff41edc8cf 100644 --- a/pcsx2/gui/AppCoreThread.cpp +++ b/pcsx2/gui/AppCoreThread.cpp @@ -89,7 +89,10 @@ AppCoreThread::AppCoreThread() : SysCoreThread() AppCoreThread::~AppCoreThread() throw() { - _parent::Cancel(); // use parent's, skips thread affinity check. + try { + _parent::Cancel(); // use parent's, skips thread affinity check. + } + DESTRUCTOR_CATCHALL } static void _Cancel() @@ -734,8 +737,11 @@ ScopedCoreThreadClose::ScopedCoreThreadClose() ScopedCoreThreadClose::~ScopedCoreThreadClose() throw() { if( m_alreadyScoped ) return; - _parent::DoResume(); - ScopedCore_IsFullyClosed = false; + try { + _parent::DoResume(); + ScopedCore_IsFullyClosed = false; + } + DESTRUCTOR_CATCHALL } ScopedCoreThreadPause::ScopedCoreThreadPause( BaseSysExecEvent_ScopedCore* abuse_me ) @@ -761,8 +767,11 @@ ScopedCoreThreadPause::ScopedCoreThreadPause( BaseSysExecEvent_ScopedCore* abuse ScopedCoreThreadPause::~ScopedCoreThreadPause() throw() { if( m_alreadyScoped ) return; - _parent::DoResume(); - ScopedCore_IsPaused = false; + try { + _parent::DoResume(); + ScopedCore_IsPaused = false; + } + DESTRUCTOR_CATCHALL } ScopedCoreThreadPopup::ScopedCoreThreadPopup() diff --git a/pcsx2/gui/AppGameDatabase.h b/pcsx2/gui/AppGameDatabase.h index 40e3734096..4ad44db994 100644 --- a/pcsx2/gui/AppGameDatabase.h +++ b/pcsx2/gui/AppGameDatabase.h @@ -48,7 +48,10 @@ protected: public: AppGameDatabase() {} virtual ~AppGameDatabase() throw() { - Console.WriteLn( "(GameDB) Unloading..." ); + try { + Console.WriteLn( "(GameDB) Unloading..." ); + } + DESTRUCTOR_CATCHALL } AppGameDatabase& LoadFromFile(const wxString& file = Path::Combine( PathDefs::GetProgramDataDir(), wxFileName(L"GameIndex.dbf") ), const wxString& key = L"Serial" ); diff --git a/pcsx2/gui/AppInit.cpp b/pcsx2/gui/AppInit.cpp index 1a70e57980..8e4cd4b0ff 100644 --- a/pcsx2/gui/AppInit.cpp +++ b/pcsx2/gui/AppInit.cpp @@ -374,7 +374,10 @@ public: virtual ~GameDatabaseLoaderThread() throw() { - _parent::Cancel(); + try { + _parent::Cancel(); + } + DESTRUCTOR_CATCHALL } protected: @@ -697,10 +700,13 @@ Pcsx2App::Pcsx2App() m_PendingSaves = 0; m_ScheduledTermination = false; + m_UseGUI = true; + m_NoGuiExitPrompt = true; m_id_MainFrame = wxID_ANY; m_id_GsFrame = wxID_ANY; m_id_ProgramLogBox = wxID_ANY; + m_id_Disassembler = wxID_ANY; m_ptr_ProgramLog = NULL; SetAppName( L"PCSX2" ); diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp index 81d1d24a18..478fdf231c 100644 --- a/pcsx2/gui/AppMain.cpp +++ b/pcsx2/gui/AppMain.cpp @@ -519,8 +519,6 @@ void FramerateManager::Resume() void FramerateManager::DoFrame() { - ++m_FrameCounter; - m_fpsqueue_writepos = (m_fpsqueue_writepos + 1) % FramerateQueueDepth; m_fpsqueue[m_fpsqueue_writepos] = GetCPUTicks(); @@ -1092,6 +1090,7 @@ public: SysExecEvent_Execute() : m_UseCDVDsrc(false) , m_UseELFOverride(false) + , m_cdvdsrc_type(CDVDsrc_Iso) { } diff --git a/pcsx2/gui/ConsoleLogger.cpp b/pcsx2/gui/ConsoleLogger.cpp index 58f631a68d..8848c55eca 100644 --- a/pcsx2/gui/ConsoleLogger.cpp +++ b/pcsx2/gui/ConsoleLogger.cpp @@ -163,7 +163,10 @@ ConsoleLogFrame::ColorArray::ColorArray( int fontsize ) ConsoleLogFrame::ColorArray::~ColorArray() throw() { - Cleanup(); + try { + Cleanup(); + } + DESTRUCTOR_CATCHALL } void ConsoleLogFrame::ColorArray::Create( int fontsize ) diff --git a/pcsx2/gui/ConsoleLogger.h b/pcsx2/gui/ConsoleLogger.h index 3f18649bcb..49e2d971e7 100644 --- a/pcsx2/gui/ConsoleLogger.h +++ b/pcsx2/gui/ConsoleLogger.h @@ -165,7 +165,7 @@ protected: ConsoleColors color; int startpoint; - ColorSection() {} + ColorSection() : color(Color_Default), startpoint(0) {} ColorSection( ConsoleColors _color, int msgptr ) : color(_color), startpoint(msgptr) { } }; diff --git a/pcsx2/gui/Debugger/CtrlRegisterList.cpp b/pcsx2/gui/Debugger/CtrlRegisterList.cpp index 86b237caa8..a99f504933 100644 --- a/pcsx2/gui/Debugger/CtrlRegisterList.cpp +++ b/pcsx2/gui/Debugger/CtrlRegisterList.cpp @@ -45,8 +45,9 @@ CtrlRegisterList::CtrlRegisterList(wxWindow* parent, DebugInterface* _cpu) { rowHeight = g_Conf->EmuOptions.Debugger.FontHeight+2; charWidth = g_Conf->EmuOptions.Debugger.FontWidth; - category = 0; - maxBits = 128; + category = 0; + maxBits = 128; + lastPc = 0xFFFFFFFF; for (int i = 0; i < cpu->getRegisterCategoryCount(); i++) { diff --git a/pcsx2/gui/Debugger/DisassemblyDialog.h b/pcsx2/gui/Debugger/DisassemblyDialog.h index ab2d0cb62a..2dcd9fad04 100644 --- a/pcsx2/gui/Debugger/DisassemblyDialog.h +++ b/pcsx2/gui/Debugger/DisassemblyDialog.h @@ -102,10 +102,9 @@ private: CpuTabPage* currentCpu; wxBoxSizer* topSizer; - wxStatusBar* statusBar; wxButton* breakRunButton; wxButton* stepIntoButton; wxButton* stepOverButton; wxButton* stepOutButton; wxButton* breakpointButton; -}; \ No newline at end of file +}; diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index 41f38e9c9c..2fff6a6a1c 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -544,12 +544,15 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title) MainEmuFrame::~MainEmuFrame() throw() { - if( m_RestartEmuOnDelete ) - { - sApp.SetExitOnFrameDelete( false ); - sApp.PostAppMethod( &Pcsx2App::DetectCpuAndUserMode ); - sApp.WipeUserModeSettings(); + try { + if( m_RestartEmuOnDelete ) + { + sApp.SetExitOnFrameDelete( false ); + sApp.PostAppMethod( &Pcsx2App::DetectCpuAndUserMode ); + sApp.WipeUserModeSettings(); + } } + DESTRUCTOR_CATCHALL } void MainEmuFrame::DoGiveHelp(const wxString& text, bool show) diff --git a/pcsx2/gui/Panels/ConfigurationPanels.h b/pcsx2/gui/Panels/ConfigurationPanels.h index 1f10130eff..20173d3e91 100644 --- a/pcsx2/gui/Panels/ConfigurationPanels.h +++ b/pcsx2/gui/Panels/ConfigurationPanels.h @@ -561,7 +561,10 @@ namespace Panels public: virtual ~EnumThread() throw() { - pxThread::Cancel(); + try { + pxThread::Cancel(); + } + DESTRUCTOR_CATCHALL } EnumThread( PluginSelectorPanel& master ); diff --git a/pcsx2/vtlb.h b/pcsx2/vtlb.h index 13917b18cd..c271a48e70 100644 --- a/pcsx2/vtlb.h +++ b/pcsx2/vtlb.h @@ -208,6 +208,7 @@ namespace vtlb_private MapData() { vmap = NULL; + ppmap = NULL; } }; diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index 1447d7c5ee..8d95aff883 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -194,7 +194,7 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1) threads = theApp.GetConfig("extrathreads", 0); } - GSWnd* wnd[2]; + GSWnd* wnd[2] = { NULL, NULL }; try { @@ -315,7 +315,6 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1) wnd[1] = new GSWndOGL(); #else wnd[0] = new GSWndOGL(); - wnd[1] = NULL; #endif #endif } diff --git a/plugins/GSdx/GSDevice.cpp b/plugins/GSdx/GSDevice.cpp index 893c35feb7..526ef24991 100644 --- a/plugins/GSdx/GSDevice.cpp +++ b/plugins/GSdx/GSDevice.cpp @@ -35,6 +35,7 @@ GSDevice::GSDevice() , m_fxaa(NULL) , m_shadeboost(NULL) , m_1x1(NULL) + , m_current(NULL) , m_frame(0) { memset(&m_vertex, 0, sizeof(m_vertex)); diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 292e5fed81..977737b3bf 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -46,12 +46,16 @@ int GSDeviceOGL::s_n = 0; FILE* GSDeviceOGL::m_debug_gl_file = NULL; GSDeviceOGL::GSDeviceOGL() - : m_free_window(false) - , m_window(NULL) - , m_fbo(0) - , m_fbo_read(0) - , m_va(NULL) - , m_shader(NULL) + : m_msaa(0) + , m_window(NULL) + , m_fbo(0) + , m_fbo_read(0) + , m_va(NULL) + , m_apitrace(0) + , m_palette_ss(0) + , m_vs_cb(NULL) + , m_ps_cb(NULL) + , m_shader(NULL) { memset(&m_merge_obj, 0, sizeof(m_merge_obj)); memset(&m_interlace, 0, sizeof(m_interlace)); @@ -59,6 +63,8 @@ GSDeviceOGL::GSDeviceOGL() memset(&m_fxaa, 0, sizeof(m_fxaa)); memset(&m_shaderfx, 0, sizeof(m_shaderfx)); memset(&m_date, 0, sizeof(m_date)); + memset(&m_shadeboost, 0, sizeof(m_shadeboost)); + memset(&m_om_dss, 0, sizeof(m_om_dss)); GLState::Clear(); // Reset the debug file diff --git a/plugins/GSdx/GSDeviceOGL.h b/plugins/GSdx/GSDeviceOGL.h index d170650dfa..c906bf3d22 100644 --- a/plugins/GSdx/GSDeviceOGL.h +++ b/plugins/GSdx/GSDeviceOGL.h @@ -390,7 +390,6 @@ class GSDeviceOGL : public GSDevice static bool m_debug_gl_call; static FILE* m_debug_gl_file; - bool m_free_window; GSWnd* m_window; GLuint m_fbo; // frame buffer container @@ -446,7 +445,6 @@ class GSDeviceOGL : public GSDevice GLuint m_apitrace; GLuint m_palette_ss; - GLuint m_rt_ss; GSUniformBufferOGL* m_vs_cb; GSUniformBufferOGL* m_ps_cb; diff --git a/plugins/GSdx/GSDump.cpp b/plugins/GSdx/GSDump.cpp index 3ab56cfb0f..973fe6acb8 100644 --- a/plugins/GSdx/GSDump.cpp +++ b/plugins/GSdx/GSDump.cpp @@ -25,6 +25,7 @@ GSDump::GSDump() : m_gs(NULL) , m_frames(0) + , m_extra_frames(0) { } diff --git a/plugins/GSdx/GSLzma.cpp b/plugins/GSdx/GSLzma.cpp index 06c8fd9145..77a76dc55e 100644 --- a/plugins/GSdx/GSLzma.cpp +++ b/plugins/GSdx/GSLzma.cpp @@ -130,6 +130,11 @@ GSDumpLzma::~GSDumpLzma() { /******************************************************************/ GSDumpRaw::GSDumpRaw(char* filename) : GSDumpFile(filename) { + m_buff_size = 0; + m_area = NULL; + m_inbuf = NULL; + m_avail = 0; + m_start = 0; } GSDumpRaw::~GSDumpRaw() { diff --git a/plugins/GSdx/GSLzma.h b/plugins/GSdx/GSLzma.h index fac92a44cb..596d97e255 100644 --- a/plugins/GSdx/GSLzma.h +++ b/plugins/GSdx/GSLzma.h @@ -48,7 +48,6 @@ class GSDumpLzma : public GSDumpFile { size_t m_avail; size_t m_start; - bool m_eof; void Decompress(); @@ -70,7 +69,6 @@ class GSDumpRaw : public GSDumpFile { size_t m_avail; size_t m_start; - bool m_eof; void Decompress(); diff --git a/plugins/GSdx/GSRenderer.cpp b/plugins/GSdx/GSRenderer.cpp index a0f8e36e25..a5a5da18eb 100644 --- a/plugins/GSdx/GSRenderer.cpp +++ b/plugins/GSdx/GSRenderer.cpp @@ -29,6 +29,8 @@ GSRenderer::GSRenderer() : m_shader(0) , m_shift_key(false) , m_control_key(false) + , m_framelimit(false) + , m_texture_shuffle(false) , m_wnd(NULL) , m_dev(NULL) { diff --git a/plugins/GSdx/GSRenderer.h b/plugins/GSdx/GSRenderer.h index 4459c5ead5..cca70a3486 100644 --- a/plugins/GSdx/GSRenderer.h +++ b/plugins/GSdx/GSRenderer.h @@ -30,7 +30,6 @@ class GSRenderer : public GSState { GSCapture m_capture; string m_snapshot; - bool m_snapdump; int m_shader; bool Merge(int field); diff --git a/plugins/GSdx/GSRendererHW.cpp b/plugins/GSdx/GSRendererHW.cpp index 6e8b4483f2..284863ea6f 100644 --- a/plugins/GSdx/GSRendererHW.cpp +++ b/plugins/GSdx/GSRendererHW.cpp @@ -49,21 +49,21 @@ GSRendererHW::GSRendererHW(GSTextureCache* tc) void GSRendererHW::SetScaling() { - m_buffer_size = max(m_context->FRAME.FBW * 64, m_regs->DISP[m_regs->PMODE.EN1 == 1 ? 0 : 1].DISPFB.FBW * 64); + int buffer_size = max(m_context->FRAME.FBW * 64, m_regs->DISP[m_regs->PMODE.EN1 == 1 ? 0 : 1].DISPFB.FBW * 64); //Only increase the buffer size, don't make it smaller, it breaks games (GH3) // Also don't change the size for custom resolution (m_upscale_multiplier = 0). - if (m_upscale_multiplier && m_width < (m_buffer_size * m_upscale_multiplier)) { + if (m_upscale_multiplier && m_width < (buffer_size * m_upscale_multiplier)) { m_tc->RemovePartial(); } else { return; } - m_height = m_buffer_size < 1024 ? 512 : 1024; + m_height = buffer_size < 1024 ? 512 : 1024; if (m_upscale_multiplier > 1) { - m_width = m_buffer_size * m_upscale_multiplier; + m_width = buffer_size * m_upscale_multiplier; m_height *= m_upscale_multiplier; } diff --git a/plugins/GSdx/GSRendererHW.h b/plugins/GSdx/GSRendererHW.h index 2f2c5f8237..dd5d866ac5 100644 --- a/plugins/GSdx/GSRendererHW.h +++ b/plugins/GSdx/GSRendererHW.h @@ -35,7 +35,6 @@ private: int m_skip; bool m_reset; int m_upscale_multiplier; - int m_buffer_size; int m_userhacks_skipdraw; bool m_userhacks_align_sprite_X; diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index e114466172..9bdc7972ab 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -35,6 +35,8 @@ GSRendererOGL::GSRendererOGL() UserHacks_TCO_x = (UserHacks_TCOffset & 0xFFFF) / -1000.0f; UserHacks_TCO_y = ((UserHacks_TCOffset >> 16) & 0xFFFF) / -1000.0f; + m_prim_overlap = PRIM_OVERLAP_UNKNOW; + if (!theApp.GetConfig("UserHacks", 0)) { UserHacks_TCOffset = 0; UserHacks_TCO_x = 0; diff --git a/plugins/GSdx/GSRendererSW.cpp b/plugins/GSdx/GSRendererSW.cpp index 0a62b65840..2398e200bc 100644 --- a/plugins/GSdx/GSRendererSW.cpp +++ b/plugins/GSdx/GSRendererSW.cpp @@ -1534,6 +1534,8 @@ GSRendererSW::SharedData::SharedData(GSRendererSW* parent) : m_parent(parent) , m_fb_pages(NULL) , m_zb_pages(NULL) + , m_fpsm(0) + , m_zpsm(0) , m_using_pages(false) , m_syncpoint(SyncNone) { diff --git a/plugins/GSdx/GSShaderOGL.cpp b/plugins/GSdx/GSShaderOGL.cpp index fadbbca92e..778d840ab3 100644 --- a/plugins/GSdx/GSShaderOGL.cpp +++ b/plugins/GSdx/GSShaderOGL.cpp @@ -24,6 +24,7 @@ #include "GLState.h" GSShaderOGL::GSShaderOGL(bool debug) : + m_pipeline(0), m_debug_shader(debug) { m_single_prog.clear(); diff --git a/plugins/GSdx/GSState.cpp b/plugins/GSdx/GSState.cpp index 99af3c3568..f515e00e15 100644 --- a/plugins/GSdx/GSState.cpp +++ b/plugins/GSdx/GSState.cpp @@ -4143,7 +4143,7 @@ bool GSC_ShadowofRome(const GSFrameInfo& fi, int& skip) { skip = 1; } - else if(fi.TME && (fi.FBP >=0x0) && fi.FPSM == PSM_PSMCT32 && (fi.TBP0 ==0x0160 ||fi.TBP0==0x01e0 || fi.TBP0<=0x0800) && fi.TPSM == PSM_PSMT8) + else if(fi.TME && fi.FPSM == PSM_PSMCT32 && (fi.TBP0 ==0x0160 ||fi.TBP0==0x01e0 || fi.TBP0<=0x0800) && fi.TPSM == PSM_PSMT8) { skip = 1; } @@ -5113,7 +5113,7 @@ bool GSC_AlpineRacer3(const GSFrameInfo& fi, int& skip) { if(skip == 0) { - if(!fi.TME && fi.FBP == 0 && fi.TBP0>=0 && (fi.TPSM >= 0 ) && (fi.FBMSK ==0x0001 ||fi.FBMSK == 0x00FFFFFF)) + if(!fi.TME && fi.FBP == 0 && (fi.FBMSK ==0x0001 ||fi.FBMSK == 0x00FFFFFF)) { skip = 2; } @@ -5179,7 +5179,7 @@ bool GSC_TalesofSymphonia(const GSFrameInfo& fi, int& skip) { if(skip == 0) { - if(fi.TME && (fi.FBP >= 0) && fi.FPSM == PSM_PSMCT32 && (fi.TBP0 == 0x2bc0 || fi.TBP0 <= 0x0200) && (fi.FBMSK==0xFF000000 ||fi.FBMSK==0x00FFFFFF)) + if(fi.TME && fi.FPSM == PSM_PSMCT32 && (fi.TBP0 == 0x2bc0 || fi.TBP0 <= 0x0200) && (fi.FBMSK==0xFF000000 ||fi.FBMSK==0x00FFFFFF)) { skip = 1; //fi.FBMSK==0 } diff --git a/plugins/GSdx/GSTexture.cpp b/plugins/GSdx/GSTexture.cpp index c71b0ac4fb..9460deb5bf 100644 --- a/plugins/GSdx/GSTexture.cpp +++ b/plugins/GSdx/GSTexture.cpp @@ -26,7 +26,11 @@ GSTexture::GSTexture() : m_scale(1, 1) , m_size(0, 0) , m_type(0) + , m_format(0) , m_msaa(false) + , last_frame_used(0) , LikelyOffset(false) + , OffsetHack_modx(0.0f) + , OffsetHack_mody(0.0f) { } diff --git a/plugins/GSdx/GSTextureCache.cpp b/plugins/GSdx/GSTextureCache.cpp index 933b0d351c..0fcf6f87f3 100644 --- a/plugins/GSdx/GSTextureCache.cpp +++ b/plugins/GSdx/GSTextureCache.cpp @@ -1251,6 +1251,7 @@ GSTextureCache::Source::Source(GSRenderer* r, const GIFRegTEX0& TEX0, const GIFR , m_initpalette(true) , m_target(false) , m_complete(false) + , m_spritehack_t(false) , m_p2t(NULL) { m_TEX0 = TEX0; diff --git a/plugins/GSdx/GSVertexArrayOGL.h b/plugins/GSdx/GSVertexArrayOGL.h index 59ddaae0eb..9134dd5efb 100644 --- a/plugins/GSdx/GSVertexArrayOGL.h +++ b/plugins/GSdx/GSVertexArrayOGL.h @@ -60,11 +60,11 @@ class GSBufferOGL { // Warning m_limit is the number of object (not the size in Bytes) m_limit = 8 * 1024 * 1024 / m_stride; - if (m_buffer_storage) { - for (size_t i = 0; i < 5; i++) { - m_fence[i] = 0; - } + for (size_t i = 0; i < 5; i++) { + m_fence[i] = 0; + } + if (m_buffer_storage) { // TODO: if we do manually the synchronization, I'm not sure size is important. It worths to investigate it. // => bigger buffer => less sync bind(); @@ -254,7 +254,7 @@ class GSVertexBufferStateOGL { GLenum m_topology; public: - GSVertexBufferStateOGL(size_t stride, GSInputLayoutOGL* layout, uint32 layout_nbr) : m_vb(NULL), m_ib(NULL) + GSVertexBufferStateOGL(size_t stride, GSInputLayoutOGL* layout, uint32 layout_nbr) : m_vb(NULL), m_ib(NULL), m_topology(0) { gl_GenVertexArrays(1, &m_va); gl_BindVertexArray(m_va); diff --git a/plugins/GSdx/GSVertexTrace.cpp b/plugins/GSdx/GSVertexTrace.cpp index 1a979f0411..9ef65d86bb 100644 --- a/plugins/GSdx/GSVertexTrace.cpp +++ b/plugins/GSdx/GSVertexTrace.cpp @@ -29,6 +29,9 @@ const GSVector4 GSVertexTrace::s_minmax(FLT_MAX, -FLT_MAX); GSVertexTrace::GSVertexTrace(const GSState* state) : m_state(state) { + m_primclass = GS_INVALID_CLASS; + memset(&m_alpha, 0, sizeof(m_alpha)); + #define InitUpdate3(P, IIP, TME, FST, COLOR) \ m_fmm[COLOR][FST][TME][IIP][P] = &GSVertexTrace::FindMinMax; diff --git a/plugins/GSdx/GSWndOGL.cpp b/plugins/GSdx/GSWndOGL.cpp index e89b7ae9a3..6e085666f8 100644 --- a/plugins/GSdx/GSWndOGL.cpp +++ b/plugins/GSdx/GSWndOGL.cpp @@ -24,7 +24,7 @@ #if defined(__linux__) GSWndOGL::GSWndOGL() - : m_NativeWindow(0), m_NativeDisplay(NULL), m_swapinterval(NULL) + : m_NativeWindow(0), m_NativeDisplay(NULL), m_context(0), m_swapinterval(NULL) { } diff --git a/plugins/GSdx/GSdx.cpp b/plugins/GSdx/GSdx.cpp index c744aeff51..9930984570 100644 --- a/plugins/GSdx/GSdx.cpp +++ b/plugins/GSdx/GSdx.cpp @@ -243,13 +243,13 @@ void GSdxApp::BuildConfigurationMap(const char* lpFileName) m_configuration_map["inifile"] = inifile_value; // Load config from file - char value[255]; - char key[255]; + char value[256]; + char key[256]; FILE* f = fopen(lpFileName, "r"); if (f == NULL) return; // FIXME print a nice message - while( fscanf(f, "%s = %s\n", key, value) != EOF ) { + while( fscanf(f, "%255s = %255s\n", key, value) != EOF ) { std::string key_s(key); std::string value_s(value); m_configuration_map[key_s] = value_s;