From 01de77883140db58faed3edac982ddceea6f1b22 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sun, 29 Jun 2014 08:48:32 +0200 Subject: [PATCH] wx3.0: various buggy code (wx assertion) v3: reenable dc.GetSize, I didn't manage to reproduce the assertion failure --- pcsx2/gui/Debugger/CtrlDisassemblyView.cpp | 4 ++-- pcsx2/gui/Debugger/CtrlMemView.cpp | 2 +- pcsx2/gui/Debugger/DebuggerLists.cpp | 2 +- pcsx2/gui/MemoryCardFile.cpp | 10 ++++++---- pcsx2/gui/Panels/PluginSelectorPanel.cpp | 3 ++- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/pcsx2/gui/Debugger/CtrlDisassemblyView.cpp b/pcsx2/gui/Debugger/CtrlDisassemblyView.cpp index ec67f64f7f..0d50b6f139 100644 --- a/pcsx2/gui/Debugger/CtrlDisassemblyView.cpp +++ b/pcsx2/gui/Debugger/CtrlDisassemblyView.cpp @@ -77,7 +77,7 @@ inline wxIcon _wxGetIconFromMemory(const unsigned char *data, int length) { } CtrlDisassemblyView::CtrlDisassemblyView(wxWindow* parent, DebugInterface* _cpu) - : wxWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxWANTS_CHARS|wxBORDER), cpu(_cpu) + : wxWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxWANTS_CHARS|wxBORDER|wxVSCROLL), cpu(_cpu) { manager.setCpu(cpu); windowStart = 0x100000; @@ -390,7 +390,7 @@ void CtrlDisassemblyView::render(wxDC& dc) int width,height; dc.GetSize(&width,&height); - dc.DrawRectangle(0,0,width,height); + dc.DrawRectangle(0, 0, width, height); if (!cpu->isAlive()) return; diff --git a/pcsx2/gui/Debugger/CtrlMemView.cpp b/pcsx2/gui/Debugger/CtrlMemView.cpp index b22f541f8c..c87c8bd598 100644 --- a/pcsx2/gui/Debugger/CtrlMemView.cpp +++ b/pcsx2/gui/Debugger/CtrlMemView.cpp @@ -49,7 +49,7 @@ enum MemoryViewMenuIdentifiers }; CtrlMemView::CtrlMemView(wxWindow* parent, DebugInterface* _cpu) - : wxWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxWANTS_CHARS), cpu(_cpu) + : wxWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxWANTS_CHARS|wxVSCROLL), cpu(_cpu) { rowHeight = g_Conf->EmuOptions.Debugger.FontHeight; charWidth = g_Conf->EmuOptions.Debugger.FontWidth; diff --git a/pcsx2/gui/Debugger/DebuggerLists.cpp b/pcsx2/gui/Debugger/DebuggerLists.cpp index 71244d35d6..bcfea875f6 100644 --- a/pcsx2/gui/Debugger/DebuggerLists.cpp +++ b/pcsx2/gui/Debugger/DebuggerLists.cpp @@ -34,7 +34,7 @@ void insertListViewColumns(wxListCtrl* list, GenericListViewColumn* columns, int void resizeListViewColumns(wxListCtrl* list, GenericListViewColumn* columns, int count, int totalWidth) { - for (int i = 0; i < count; i++) + for (int i = 0; i < std::min(list->GetColumnCount(), count); i++) { list->SetColumnWidth(i,totalWidth*columns[i].size); } diff --git a/pcsx2/gui/MemoryCardFile.cpp b/pcsx2/gui/MemoryCardFile.cpp index bc692a487c..7c3cd2bd20 100644 --- a/pcsx2/gui/MemoryCardFile.cpp +++ b/pcsx2/gui/MemoryCardFile.cpp @@ -217,11 +217,13 @@ void FileMemoryCard::Close() { for( int slot=0; slot<8; ++slot ) { - // Store checksum - if(!m_ispsx[slot] && !!m_file[slot].Seek( m_chkaddr )) - m_file[slot].Write( &m_chksum[slot], 8 ); + if (m_file[slot].IsOpened()) { + // Store checksum + if(!m_ispsx[slot] && !!m_file[slot].Seek( m_chkaddr )) + m_file[slot].Write( &m_chksum[slot], 8 ); - m_file[slot].Close(); + m_file[slot].Close(); + } } } diff --git a/pcsx2/gui/Panels/PluginSelectorPanel.cpp b/pcsx2/gui/Panels/PluginSelectorPanel.cpp index d3786cf68e..8dfaf589a3 100644 --- a/pcsx2/gui/Panels/PluginSelectorPanel.cpp +++ b/pcsx2/gui/Panels/PluginSelectorPanel.cpp @@ -330,7 +330,8 @@ void Panels::PluginSelectorPanel::StatusPanel::SetGaugeLength( int len ) void Panels::PluginSelectorPanel::StatusPanel::AdvanceProgress( const wxString& msg ) { m_label.SetLabel( msg ); - m_gauge.SetValue( ++m_progress ); + if (m_progress < m_gauge.GetRange()) + m_gauge.SetValue( ++m_progress ); } void Panels::PluginSelectorPanel::StatusPanel::Reset()