Debugger: Use bit_cast where needed, cleanup some stuff

This commit is contained in:
Ty Lamontagne 2021-11-03 21:52:11 -04:00 committed by refractionpcsx2
parent c863876dee
commit 6bec3162f6
3 changed files with 8 additions and 14 deletions

View File

@ -671,11 +671,11 @@ void CtrlDisassemblyView::assembleOpcode(u32 address, std::string defaultText)
{ {
SysClearExecutionCache(); SysClearExecutionCache();
if((selectRangeEnd - selectRangeStart) > 4) if ((selectRangeEnd - selectRangeStart) > 4)
{ {
for(u32 addr = selectRangeStart; addr < selectRangeEnd; addr += 0x4) for (u32 addr = selectRangeStart; addr < selectRangeEnd; addr += 0x4)
{ {
cpu->write32(addr,encoded); cpu->write32(addr, encoded);
} }
} }
else else
@ -1152,7 +1152,7 @@ void CtrlDisassemblyView::mouseEvent(wxMouseEvent& evt)
toggleBreakpoint(false); toggleBreakpoint(false);
} }
if(setNewAddress) if (setNewAddress)
setCurAddress(newAddress, wxGetKeyState(WXK_SHIFT)); setCurAddress(newAddress, wxGetKeyState(WXK_SHIFT));
SetFocus(); SetFocus();

View File

@ -334,22 +334,16 @@ void CtrlMemSearch::onSearchTypeChanged(wxCommandEvent& evt)
case SEARCHTYPE::QWORD: case SEARCHTYPE::QWORD:
radBigEndian->Enable(true); radBigEndian->Enable(true);
radLittleEndian->Enable(true); radLittleEndian->Enable(true);
chkHexadecimal->Enable(false); chkHexadecimal->Enable(true);
break; break;
case SEARCHTYPE::FLOAT: case SEARCHTYPE::FLOAT:
case SEARCHTYPE::DOUBLE: case SEARCHTYPE::DOUBLE:
case SEARCHTYPE::STRING:
radBigEndian->Enable(false); radBigEndian->Enable(false);
radLittleEndian->Enable(false); radLittleEndian->Enable(false);
chkHexadecimal->Enable(false); chkHexadecimal->Enable(false);
chkHexadecimal->SetValue(false); chkHexadecimal->SetValue(false);
break; break;
case SEARCHTYPE::STRING:
radBigEndian->Enable(true);
radLittleEndian->Enable(true);
chkHexadecimal->Enable(false);
chkHexadecimal->SetValue(false);
break;
} }
} }

View File

@ -16,6 +16,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "CtrlRegisterList.h" #include "CtrlRegisterList.h"
#include "DebugTools/Debug.h" #include "DebugTools/Debug.h"
#include "Utilities/BitCast.h"
#include "DebugEvents.h" #include "DebugEvents.h"
#include "gui/AppConfig.h" #include "gui/AppConfig.h"
@ -288,8 +289,7 @@ void CtrlRegisterList::OnDraw(wxDC& dc)
// and use this information for printing the VU0F titles // and use this information for printing the VU0F titles
for (int j = 3; j >= 0; j--) for (int j = 3; j >= 0; j--)
{ {
// Use std::bit_cast in C++20. The below is technically UB sprintf(str, "%7.2f", bit_cast<float,u32>(val._u32[j]));
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; x += charWidth * 8 + 2;
} }