mirror of https://github.com/PCSX2/pcsx2.git
Debugger: Remove 64/32 bit views. Revamped VU0F titles
This commit is contained in:
parent
77e630b78a
commit
b12f0d865f
|
@ -31,10 +31,7 @@ wxBEGIN_EVENT_TABLE(CtrlRegisterList, wxWindow)
|
||||||
wxEND_EVENT_TABLE()
|
wxEND_EVENT_TABLE()
|
||||||
|
|
||||||
enum DisassemblyMenuIdentifiers {
|
enum DisassemblyMenuIdentifiers {
|
||||||
ID_REGISTERLIST_DISPLAY32 = 1,
|
ID_REGISTERLIST_RESOLVESTRINGS,
|
||||||
ID_REGISTERLIST_DISPLAY64,
|
|
||||||
ID_REGISTERLIST_DISPLAY128,
|
|
||||||
ID_REGISTERLIST_DISPLAY128STRINGS,
|
|
||||||
ID_REGISTERLIST_DISPLAYVU0FFLOATS,
|
ID_REGISTERLIST_DISPLAYVU0FFLOATS,
|
||||||
ID_REGISTERLIST_CHANGELOWER,
|
ID_REGISTERLIST_CHANGELOWER,
|
||||||
ID_REGISTERLIST_CHANGEUPPER,
|
ID_REGISTERLIST_CHANGEUPPER,
|
||||||
|
@ -51,7 +48,6 @@ CtrlRegisterList::CtrlRegisterList(wxWindow* parent, DebugInterface* _cpu)
|
||||||
rowHeight = getDebugFontHeight() + 2;
|
rowHeight = getDebugFontHeight() + 2;
|
||||||
charWidth = getDebugFontWidth();
|
charWidth = getDebugFontWidth();
|
||||||
category = 0;
|
category = 0;
|
||||||
maxBits = 128;
|
|
||||||
lastPc = 0xFFFFFFFF;
|
lastPc = 0xFFFFFFFF;
|
||||||
resolvePointerStrings = false;
|
resolvePointerStrings = false;
|
||||||
displayVU0FAsFloat = false;
|
displayVU0FAsFloat = false;
|
||||||
|
@ -77,9 +73,9 @@ CtrlRegisterList::CtrlRegisterList(wxWindow* parent, DebugInterface* _cpu)
|
||||||
|
|
||||||
SetDoubleBuffered(true);
|
SetDoubleBuffered(true);
|
||||||
|
|
||||||
const wxSize actualSize = getOptimalSize();
|
const wxSize optSize = getOptimalSize();
|
||||||
SetVirtualSize(actualSize);
|
SetVirtualSize(optSize);
|
||||||
SetScrollbars(1, rowHeight, actualSize.x, actualSize.y / rowHeight, 0, 0);
|
SetScrollbars(1, rowHeight, optSize.x, optSize.y / rowHeight, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
CtrlRegisterList::~CtrlRegisterList()
|
CtrlRegisterList::~CtrlRegisterList()
|
||||||
|
@ -90,32 +86,18 @@ CtrlRegisterList::~CtrlRegisterList()
|
||||||
|
|
||||||
wxSize CtrlRegisterList::getOptimalSize() const
|
wxSize CtrlRegisterList::getOptimalSize() const
|
||||||
{
|
{
|
||||||
int columnChars = 0;
|
wxSize optRegListSize;
|
||||||
int maxWidth = 0;
|
if (cpu->getCpuType() == BreakPointCpu::BREAKPOINT_EE)
|
||||||
int maxRows = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < cpu->getRegisterCategoryCount(); i++)
|
|
||||||
{
|
{
|
||||||
int bits = std::min<u32>(maxBits, cpu->getRegisterSize(i));
|
optRegListSize = wxSize(331, 504);
|
||||||
|
}
|
||||||
// Workaround for displaying VU0F registers as floats
|
else
|
||||||
if (i == EECAT_VU0F && displayVU0FAsFloat && category == EECAT_VU0F)
|
{
|
||||||
bits = 128;
|
// We are constructing the IOP register view
|
||||||
|
optRegListSize = wxSize(133, 504);
|
||||||
const int start = startPositions[i];
|
|
||||||
|
|
||||||
int w = start + (bits / 4) * charWidth;
|
|
||||||
if (bits > 32)
|
|
||||||
w += (bits / 32) * 2 - 2;
|
|
||||||
|
|
||||||
maxWidth = std::max<int>(maxWidth, w);
|
|
||||||
columnChars += strlen(cpu->getRegisterCategoryName(i)) + 1;
|
|
||||||
maxRows = std::max<int>(maxRows, cpu->getRegisterCount(i));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
maxWidth = std::max<int>(columnChars * charWidth, maxWidth + 4);
|
return wxSize(optRegListSize.x, optRegListSize.y);
|
||||||
|
|
||||||
return wxSize(maxWidth, (maxRows + 1) * rowHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CtrlRegisterList::postEvent(wxEventType type, wxString text)
|
void CtrlRegisterList::postEvent(wxEventType type, wxString text)
|
||||||
|
@ -253,7 +235,7 @@ void CtrlRegisterList::OnDraw(wxDC& dc)
|
||||||
endRow = std::min<int>(cpu->getRegisterCount(category) - 1, endRow - 1);
|
endRow = std::min<int>(cpu->getRegisterCount(category) - 1, endRow - 1);
|
||||||
|
|
||||||
const wxString vu0fTitles[5] = {"W", "Z", "Y", "X"};
|
const wxString vu0fTitles[5] = {"W", "Z", "Y", "X"};
|
||||||
int vu0fTitleCur = abs(maxBits / 32 - 4);
|
int vu0fTitleCur = 0;
|
||||||
const int nameStart = 17;
|
const int nameStart = 17;
|
||||||
const int valueStart = startPositions[category];
|
const int valueStart = startPositions[category];
|
||||||
|
|
||||||
|
@ -289,7 +271,6 @@ void CtrlRegisterList::OnDraw(wxDC& dc)
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
[[fallthrough]]; // If we fallthrough, display VU0f as hexadecimal
|
|
||||||
case DebugInterface::SPECIAL: // let debug interface format them and just display them
|
case DebugInterface::SPECIAL: // let debug interface format them and just display them
|
||||||
{
|
{
|
||||||
if (changed.changed[0] || changed.changed[1] || changed.changed[2] || changed.changed[3])
|
if (changed.changed[0] || changed.changed[1] || changed.changed[2] || changed.changed[3])
|
||||||
|
@ -303,23 +284,32 @@ void CtrlRegisterList::OnDraw(wxDC& dc)
|
||||||
{
|
{
|
||||||
char str[256];
|
char str[256];
|
||||||
const u128 val = cpu->getRegister(category, i);
|
const u128 val = cpu->getRegister(category, i);
|
||||||
|
// Print each register part individually so we know exactly where each part starts
|
||||||
|
// and use this information for printing the VU0F titles
|
||||||
|
for (int j = 3; j >= 0; j--)
|
||||||
|
{
|
||||||
// Use std::bit_cast in C++20. The below is technically UB
|
// Use std::bit_cast in C++20. The below is technically UB
|
||||||
sprintf(str, "%7.2f %7.2f %7.2f %7.2f", *(float*)&val._u32[3], *(float*)&val._u32[2], *(float*)&val._u32[1], *(float*)&val._u32[0]);
|
sprintf(str, "%7.2f", *(float*)&val._u32[j]);
|
||||||
dc.DrawText(wxString(str), x, y + 2);
|
dc.DrawText(wxString(str), x, y + 2);
|
||||||
|
x += charWidth * 8 + 2;
|
||||||
|
}
|
||||||
|
|
||||||
// Only draw the VU0f titles when we are drawing the first row
|
// Only draw the VU0f titles when we are drawing the first row
|
||||||
if (i == startRow)
|
if (i == startRow)
|
||||||
{
|
{
|
||||||
|
x = valueStart; // Reset our X back to the starting position
|
||||||
|
|
||||||
for (int j = 0; j < 4; j++)
|
for (int j = 0; j < 4; j++)
|
||||||
{
|
{
|
||||||
dc.SetTextForeground(colorNormal);
|
dc.SetTextForeground(colorNormal);
|
||||||
dc.DrawText(vu0fTitles[j], x + charWidth * 4, rowHeight + 2);
|
dc.DrawText(vu0fTitles[j], (x + charWidth * 4) - 4, rowHeight + 2);
|
||||||
x += charWidth * 8 + 2;
|
x += charWidth * 8 + 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
[[fallthrough]]; // If we fallthrough, display VU0f as hexadecimal
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -331,7 +321,7 @@ void CtrlRegisterList::OnDraw(wxDC& dc)
|
||||||
{
|
{
|
||||||
case 128:
|
case 128:
|
||||||
{
|
{
|
||||||
int startIndex = std::min<int>(3, maxBits / 32 - 1);
|
int startIndex = 3;
|
||||||
|
|
||||||
if (resolvePointerStrings && cpu->isAlive())
|
if (resolvePointerStrings && cpu->isAlive())
|
||||||
{
|
{
|
||||||
|
@ -374,7 +364,7 @@ void CtrlRegisterList::OnDraw(wxDC& dc)
|
||||||
if (category == EECAT_VU0F && i == startRow)
|
if (category == EECAT_VU0F && i == startRow)
|
||||||
{
|
{
|
||||||
dc.SetTextForeground(colorNormal);
|
dc.SetTextForeground(colorNormal);
|
||||||
dc.DrawText(vu0fTitles[vu0fTitleCur++], x + charWidth * 4, rowHeight + 2);
|
dc.DrawText(vu0fTitles[vu0fTitleCur++], x + (charWidth * 2.5) , rowHeight + 2);
|
||||||
}
|
}
|
||||||
x += charWidth * 8 + 2;
|
x += charWidth * 8 + 2;
|
||||||
}
|
}
|
||||||
|
@ -383,12 +373,6 @@ void CtrlRegisterList::OnDraw(wxDC& dc)
|
||||||
}
|
}
|
||||||
case 64:
|
case 64:
|
||||||
{
|
{
|
||||||
if (maxBits < 64 && changed.changed[1])
|
|
||||||
{
|
|
||||||
dc.SetTextForeground(colorChanged);
|
|
||||||
dc.DrawText(L"+", x - charWidth, y + 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int j = 1; j >= 0; j--)
|
for (int j = 1; j >= 0; j--)
|
||||||
{
|
{
|
||||||
if (changed.changed[j])
|
if (changed.changed[j])
|
||||||
|
@ -463,27 +447,8 @@ void CtrlRegisterList::onPopupClick(wxCommandEvent& evt)
|
||||||
{
|
{
|
||||||
switch (evt.GetId())
|
switch (evt.GetId())
|
||||||
{
|
{
|
||||||
case ID_REGISTERLIST_DISPLAY32:
|
case ID_REGISTERLIST_RESOLVESTRINGS:
|
||||||
resolvePointerStrings = false;
|
resolvePointerStrings = !resolvePointerStrings;
|
||||||
maxBits = 32;
|
|
||||||
postEvent(debEVT_UPDATELAYOUT, 0);
|
|
||||||
Refresh();
|
|
||||||
break;
|
|
||||||
case ID_REGISTERLIST_DISPLAY64:
|
|
||||||
resolvePointerStrings = false;
|
|
||||||
maxBits = 64;
|
|
||||||
postEvent(debEVT_UPDATELAYOUT, 0);
|
|
||||||
Refresh();
|
|
||||||
break;
|
|
||||||
case ID_REGISTERLIST_DISPLAY128:
|
|
||||||
resolvePointerStrings = false;
|
|
||||||
maxBits = 128;
|
|
||||||
postEvent(debEVT_UPDATELAYOUT, 0);
|
|
||||||
Refresh();
|
|
||||||
break;
|
|
||||||
case ID_REGISTERLIST_DISPLAY128STRINGS:
|
|
||||||
resolvePointerStrings = true;
|
|
||||||
maxBits = 128;
|
|
||||||
postEvent(debEVT_UPDATELAYOUT, 0);
|
postEvent(debEVT_UPDATELAYOUT, 0);
|
||||||
Refresh();
|
Refresh();
|
||||||
break;
|
break;
|
||||||
|
@ -579,37 +544,20 @@ void CtrlRegisterList::mouseEvent(wxMouseEvent& evt)
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenu menu;
|
wxMenu menu;
|
||||||
const int bits = cpu->getRegisterSize(category);
|
|
||||||
|
|
||||||
if (!(category == EECAT_VU0F && displayVU0FAsFloat))
|
|
||||||
{
|
|
||||||
menu.AppendRadioItem(ID_REGISTERLIST_DISPLAY32, L"Display 32 bit");
|
|
||||||
menu.AppendRadioItem(ID_REGISTERLIST_DISPLAY64, L"Display 64 bit");
|
|
||||||
menu.AppendRadioItem(ID_REGISTERLIST_DISPLAY128, L"Display 128 bit");
|
|
||||||
menu.AppendRadioItem(ID_REGISTERLIST_DISPLAY128STRINGS, L"Display 128 bit + Resolve string pointers");
|
|
||||||
|
|
||||||
switch (maxBits)
|
|
||||||
{
|
|
||||||
case 128:
|
|
||||||
if (resolvePointerStrings)
|
|
||||||
menu.Check(ID_REGISTERLIST_DISPLAY128STRINGS, true);
|
|
||||||
else
|
|
||||||
menu.Check(ID_REGISTERLIST_DISPLAY128, true);
|
|
||||||
break;
|
|
||||||
case 64:
|
|
||||||
menu.Check(ID_REGISTERLIST_DISPLAY64, true);
|
|
||||||
break;
|
|
||||||
case 32:
|
|
||||||
menu.Check(ID_REGISTERLIST_DISPLAY32, true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (category == EECAT_VU0F)
|
if (category == EECAT_VU0F)
|
||||||
|
{
|
||||||
menu.AppendCheckItem(ID_REGISTERLIST_DISPLAYVU0FFLOATS, L"Display VU0f registers as floats")->Check(displayVU0FAsFloat);
|
menu.AppendCheckItem(ID_REGISTERLIST_DISPLAYVU0FFLOATS, L"Display VU0f registers as floats")->Check(displayVU0FAsFloat);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menu.AppendCheckItem(ID_REGISTERLIST_RESOLVESTRINGS, L"Resolve string pointers")->Check(resolvePointerStrings);
|
||||||
|
}
|
||||||
|
|
||||||
menu.AppendSeparator();
|
menu.AppendSeparator();
|
||||||
|
|
||||||
|
const int bits = cpu->getRegisterSize(category);
|
||||||
if (bits >= 64)
|
if (bits >= 64)
|
||||||
{
|
{
|
||||||
menu.Append(ID_REGISTERLIST_CHANGELOWER, L"Change lower 64 bit");
|
menu.Append(ID_REGISTERLIST_CHANGELOWER, L"Change lower 64 bit");
|
||||||
|
|
|
@ -78,7 +78,6 @@ private:
|
||||||
int rowHeight, charWidth;
|
int rowHeight, charWidth;
|
||||||
u32 lastPc;
|
u32 lastPc;
|
||||||
int category;
|
int category;
|
||||||
int maxBits;
|
|
||||||
bool resolvePointerStrings;
|
bool resolvePointerStrings;
|
||||||
bool displayVU0FAsFloat;
|
bool displayVU0FAsFloat;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue