Added new option "Copy Float (32 bit)" to Windows Debugger UI

This commit is contained in:
Nemoumbra 2023-03-28 13:18:20 +03:00
parent 4739d6c37d
commit 4a54409f09
3 changed files with 13 additions and 0 deletions

View file

@ -4,6 +4,7 @@
#include <tchar.h>
#include <math.h>
#include <iomanip>
#include <sstream>
#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<MemBlockInfo> memRangeInfo = FindMemInfoByFlag(highlightFlags_, curAddress_, 1);

View file

@ -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"

View file

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