From 4a54409f0916c0c4236544638ecbc56bdc8c4b95 Mon Sep 17 00:00:00 2001 From: Nemoumbra Date: Tue, 28 Mar 2023 13:18:20 +0300 Subject: [PATCH] Added new option "Copy Float (32 bit)" to Windows Debugger UI --- Windows/Debugger/CtrlMemView.cpp | 11 +++++++++++ Windows/ppsspp.rc | 1 + Windows/resource.h | 1 + 3 files changed, 13 insertions(+) diff --git a/Windows/Debugger/CtrlMemView.cpp b/Windows/Debugger/CtrlMemView.cpp index f4eb61df2e..c4d318a367 100644 --- a/Windows/Debugger/CtrlMemView.cpp +++ b/Windows/Debugger/CtrlMemView.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "ext/xxhash.h" #include "Core/Config.h" #include "Core/MemMap.h" @@ -496,6 +497,7 @@ void CtrlMemView::onMouseUp(WPARAM wParam, LPARAM lParam, int button) { HMENU menu = GetContextMenu(ContextMenuID::MEMVIEW); EnableMenuItem(menu, ID_MEMVIEW_COPYVALUE_16, enable16 ? MF_ENABLED : MF_GRAYED); EnableMenuItem(menu, ID_MEMVIEW_COPYVALUE_32, enable32 ? MF_ENABLED : MF_GRAYED); + EnableMenuItem(menu, ID_MEMVIEW_COPYFLOAT_32, enable32 ? MF_ENABLED : MF_GRAYED); switch (TriggerContextMenu(ContextMenuID::MEMVIEW, wnd, ContextPoint::FromEvent(lParam))) { case ID_MEMVIEW_DUMP: @@ -577,6 +579,15 @@ void CtrlMemView::onMouseUp(WPARAM wParam, LPARAM lParam, int button) { } break; + case ID_MEMVIEW_COPYFLOAT_32: + { + auto memLock = Memory::Lock(); + std::ostringstream stream; + stream << (Memory::IsValidAddress(curAddress_) ? Memory::Read_Float(curAddress_) : NAN); + W32Util::CopyTextToClipboard(wnd, stream.str().c_str()); + } + break; + case ID_MEMVIEW_EXTENTBEGIN: { std::vector memRangeInfo = FindMemInfoByFlag(highlightFlags_, curAddress_, 1); diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index d2a2c921d9..368dfa16d3 100644 --- a/Windows/ppsspp.rc +++ b/Windows/ppsspp.rc @@ -700,6 +700,7 @@ BEGIN MENUITEM "Copy Value (8 bit)", ID_MEMVIEW_COPYVALUE_8 MENUITEM "Copy Value (16 bit)", ID_MEMVIEW_COPYVALUE_16 MENUITEM "Copy Value (32 bit)", ID_MEMVIEW_COPYVALUE_32 + MENUITEM "Copy Float (32 bit)", ID_MEMVIEW_COPYFLOAT_32 MENUITEM "Dump...", ID_MEMVIEW_DUMP END POPUP "disasm" diff --git a/Windows/resource.h b/Windows/resource.h index ffe653d58a..1331ce32b5 100644 --- a/Windows/resource.h +++ b/Windows/resource.h @@ -250,6 +250,7 @@ #define ID_OPTIONS_LANGUAGE 40141 #define ID_MEMVIEW_COPYVALUE_16 40142 #define ID_MEMVIEW_COPYVALUE_32 40143 +#define ID_MEMVIEW_COPYFLOAT_32 40229 #define ID_EMULATION_SWITCH_UMD 40144 #define ID_DEBUG_EXTRACTFILE 40145 #define ID_OPTIONS_IGNOREWINKEY 40146