Make memory view row size configurable, store it and "Align window to row size" in settings

This commit is contained in:
Kingcom 2017-04-15 09:41:40 +02:00 committed by Jonathan Li
parent a378e307b3
commit 4b9d409628
4 changed files with 18 additions and 12 deletions

View File

@ -413,12 +413,15 @@ struct Pcsx2Config
BITFIELD32() BITFIELD32()
bool bool
ShowDebuggerOnStart :1; ShowDebuggerOnStart :1;
bool
AlignMemoryWindowStart :1;
BITFIELD_END BITFIELD_END
u8 FontWidth; u8 FontWidth;
u8 FontHeight; u8 FontHeight;
u32 WindowWidth; u32 WindowWidth;
u32 WindowHeight; u32 WindowHeight;
u32 MemoryViewBytesPerRow;
DebugOptions(); DebugOptions();
void LoadSave( IniInterface& conf ); void LoadSave( IniInterface& conf );
@ -426,7 +429,7 @@ struct Pcsx2Config
bool operator ==( const DebugOptions& right ) const bool operator ==( const DebugOptions& right ) const
{ {
return OpEqu( bitset ) && OpEqu( FontWidth ) && OpEqu( FontHeight ) return OpEqu( bitset ) && OpEqu( FontWidth ) && OpEqu( FontHeight )
&& OpEqu( WindowWidth ) && OpEqu( WindowHeight ); && OpEqu( WindowWidth ) && OpEqu( WindowHeight ) && OpEqu( MemoryViewBytesPerRow );
} }
bool operator !=( const DebugOptions& right ) const bool operator !=( const DebugOptions& right ) const

View File

@ -374,10 +374,12 @@ void Pcsx2Config::GamefixOptions::LoadSave( IniInterface& ini )
Pcsx2Config::DebugOptions::DebugOptions() Pcsx2Config::DebugOptions::DebugOptions()
{ {
ShowDebuggerOnStart = false; ShowDebuggerOnStart = false;
AlignMemoryWindowStart = true;
FontWidth = 8; FontWidth = 8;
FontHeight = 12; FontHeight = 12;
WindowWidth = 0; WindowWidth = 0;
WindowHeight = 0; WindowHeight = 0;
MemoryViewBytesPerRow = 16;
} }
void Pcsx2Config::DebugOptions::LoadSave( IniInterface& ini ) void Pcsx2Config::DebugOptions::LoadSave( IniInterface& ini )
@ -385,10 +387,12 @@ void Pcsx2Config::DebugOptions::LoadSave( IniInterface& ini )
ScopedIniGroup path( ini, L"Debugger" ); ScopedIniGroup path( ini, L"Debugger" );
IniBitBool( ShowDebuggerOnStart ); IniBitBool( ShowDebuggerOnStart );
IniBitfield(FontWidth); IniBitBool( AlignMemoryWindowStart );
IniBitfield(FontHeight); IniBitfield( FontWidth );
IniBitfield(WindowWidth); IniBitfield( FontHeight );
IniBitfield(WindowHeight); IniBitfield( WindowWidth );
IniBitfield( WindowHeight );
IniBitfield( MemoryViewBytesPerRow );
} }

View File

@ -74,9 +74,8 @@ CtrlMemView::CtrlMemView(wxWindow* parent, DebugInterface* _cpu)
selectedNibble = 0; selectedNibble = 0;
addressStart = charWidth; addressStart = charWidth;
hexStart = addressStart + 9*charWidth; hexStart = addressStart + 9*charWidth;
alignWindowStart = true;
setRowSize(32); setRowSize(g_Conf->EmuOptions.Debugger.MemoryViewBytesPerRow);
font = pxGetFixedFont(8); font = pxGetFixedFont(8);
underlineFont = pxGetFixedFont(8, wxFONTWEIGHT_NORMAL, true); underlineFont = pxGetFixedFont(8, wxFONTWEIGHT_NORMAL, true);
@ -103,7 +102,7 @@ CtrlMemView::CtrlMemView(wxWindow* parent, DebugInterface* _cpu)
menu.Enable(ID_MEMVIEW_DUMP,false); menu.Enable(ID_MEMVIEW_DUMP,false);
menu.AppendSeparator(); menu.AppendSeparator();
menu.AppendCheckItem(ID_MEMVIEW_ALIGNWINDOW, L"Align window to row size"); menu.AppendCheckItem(ID_MEMVIEW_ALIGNWINDOW, L"Align window to row size");
menu.Check(ID_MEMVIEW_ALIGNWINDOW, alignWindowStart); menu.Check(ID_MEMVIEW_ALIGNWINDOW, g_Conf->EmuOptions.Debugger.AlignMemoryWindowStart);
menu.Bind(wxEVT_MENU, &CtrlMemView::onPopupClick, this); menu.Bind(wxEVT_MENU, &CtrlMemView::onPopupClick, this);
SetScrollbar(wxVERTICAL,100,1,201,true); SetScrollbar(wxVERTICAL,100,1,201,true);
@ -397,7 +396,8 @@ void CtrlMemView::onPopupClick(wxCommandEvent& evt)
} }
break; break;
case ID_MEMVIEW_ALIGNWINDOW: case ID_MEMVIEW_ALIGNWINDOW:
if (alignWindowStart = evt.IsChecked()) { g_Conf->EmuOptions.Debugger.AlignMemoryWindowStart = evt.IsChecked();
if (g_Conf->EmuOptions.Debugger.AlignMemoryWindowStart) {
windowStart -= windowStart % rowSize; windowStart -= windowStart % rowSize;
redraw(); redraw();
} }
@ -431,7 +431,7 @@ void CtrlMemView::mouseEvent(wxMouseEvent& evt)
menu.Enable(ID_MEMVIEW_COPYVALUE_32,(curAddress & 3) == 0); menu.Enable(ID_MEMVIEW_COPYVALUE_32,(curAddress & 3) == 0);
menu.Enable(ID_MEMVIEW_COPYVALUE_16,(curAddress & 1) == 0); menu.Enable(ID_MEMVIEW_COPYVALUE_16,(curAddress & 1) == 0);
menu.Check(ID_MEMVIEW_ALIGNWINDOW, alignWindowStart); menu.Check(ID_MEMVIEW_ALIGNWINDOW, g_Conf->EmuOptions.Debugger.AlignMemoryWindowStart);
PopupMenu(&menu); PopupMenu(&menu);
return; return;
@ -659,7 +659,7 @@ void CtrlMemView::gotoAddress(u32 addr, bool pushInHistory)
curAddress = addr; curAddress = addr;
selectedNibble = 0; selectedNibble = 0;
if (alignWindowStart) { if (g_Conf->EmuOptions.Debugger.AlignMemoryWindowStart) {
int visibleRows = GetClientSize().y / rowHeight; int visibleRows = GetClientSize().y / rowHeight;
u32 windowEnd = windowStart + visibleRows*rowSize; u32 windowEnd = windowStart + visibleRows*rowSize;

View File

@ -51,7 +51,6 @@ private:
int rowHeight; int rowHeight;
int charWidth; int charWidth;
u32 windowStart; u32 windowStart;
bool alignWindowStart;
u32 curAddress; // current selected address u32 curAddress; // current selected address
u32 referencedAddress; // refrenced by register u32 referencedAddress; // refrenced by register
u32 byteGroupSize; u32 byteGroupSize;