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

@ -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;
} }