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();
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
@ -1152,7 +1152,7 @@ void CtrlDisassemblyView::mouseEvent(wxMouseEvent& evt)
toggleBreakpoint(false);
}
if(setNewAddress)
if (setNewAddress)
setCurAddress(newAddress, wxGetKeyState(WXK_SHIFT));
SetFocus();

View File

@ -334,22 +334,16 @@ void CtrlMemSearch::onSearchTypeChanged(wxCommandEvent& evt)
case SEARCHTYPE::QWORD:
radBigEndian->Enable(true);
radLittleEndian->Enable(true);
chkHexadecimal->Enable(false);
chkHexadecimal->Enable(true);
break;
case SEARCHTYPE::FLOAT:
case SEARCHTYPE::DOUBLE:
case SEARCHTYPE::STRING:
radBigEndian->Enable(false);
radLittleEndian->Enable(false);
chkHexadecimal->Enable(false);
chkHexadecimal->SetValue(false);
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 "CtrlRegisterList.h"
#include "DebugTools/Debug.h"
#include "Utilities/BitCast.h"
#include "DebugEvents.h"
#include "gui/AppConfig.h"
@ -288,8 +289,7 @@ void CtrlRegisterList::OnDraw(wxDC& dc)
// 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
sprintf(str, "%7.2f", *(float*)&val._u32[j]);
sprintf(str, "%7.2f", bit_cast<float,u32>(val._u32[j]));
dc.DrawText(wxString(str), x, y + 2);
x += charWidth * 8 + 2;
}