From be4161635911599848030e0444947145d02c3d13 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Fri, 25 Aug 2017 07:22:08 -0700 Subject: [PATCH] Implements #462 sans: help disasm --- source/Debugger/Debug.cpp | 37 ++++++++++++++++++++++++++- source/Debugger/Debug.h | 1 + source/Debugger/Debugger_Commands.cpp | 1 + source/Debugger/Debugger_Types.h | 1 + source/Frame.cpp | 3 +++ 5 files changed, 42 insertions(+), 1 deletion(-) diff --git a/source/Debugger/Debug.cpp b/source/Debugger/Debug.cpp index 45718325..9517038a 100644 --- a/source/Debugger/Debug.cpp +++ b/source/Debugger/Debug.cpp @@ -188,6 +188,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Config - Disassembly bool g_bConfigDisasmAddressView = true; + int g_bConfigDisasmClick = 0; // GH#462 alt=1, ctrl=2, shift=4 bitmask bool g_bConfigDisasmAddressColon = true; bool g_bConfigDisasmOpcodesView = true; bool g_bConfigDisasmOpcodeSpaces = true; @@ -2489,7 +2490,7 @@ Update_t CmdConfigDisasm( int nArgs ) { case PARAM_CONFIG_BRANCH: if ((nArgs > 1) && (! bDisplayCurrentSettings)) // set - { + { iArg++; g_iConfigDisasmBranchType = g_aArgs[ iArg ].nValue; if (g_iConfigDisasmBranchType < 0) @@ -2505,6 +2506,30 @@ Update_t CmdConfigDisasm( int nArgs ) } break; + case PARAM_CONFIG_CLICK: // GH#462 + if ((nArgs > 1) && (! bDisplayCurrentSettings)) // set + { + iArg++; + g_bConfigDisasmClick = (g_aArgs[ iArg ].nValue) & 7; // MAGIC NUMBER + } +// else // Always show current setting -- TODO: Fix remaining disasm to show current setting when set + { + const char *aClickKey[8] = + { + "" // 0 + ,"Alt " // 1 + ,"Ctrl " // 2 + ,"Alt+Ctrl " // 3 + ,"Shift " // 4 + ,"Shift+Alt " // 5 + ,"Shift+Ctrl " // 6 + ,"Shift+Ctarl+Alt " // 7 + }; + ConsoleBufferPushFormat( sText, TEXT( "Click: %d = %sLeft click" ), g_bConfigDisasmClick, aClickKey[ g_bConfigDisasmClick & 7 ] ); + ConsoleBufferToDisplay(); + } + break; + case PARAM_CONFIG_COLON: if ((nArgs > 1) && (! bDisplayCurrentSettings)) // set { @@ -9647,6 +9672,16 @@ void DebuggerMouseClick( int x, int y ) if (g_nAppMode != MODE_DEBUG) return; + // NOTE: KeybUpdateCtrlShiftStatus() should be called before + int iAltCtrlShift = 0; + iAltCtrlShift |= (g_bAltKey & 1) << 0; + iAltCtrlShift |= (g_bCtrlKey & 1) << 1; + iAltCtrlShift |= (g_bShiftKey & 1) << 2; + + // GH#462 disasm click # + if (iAltCtrlShift != g_bConfigDisasmClick) + return; + int nFontWidth = g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontWidthAvg * GetViewportScale(); int nFontHeight = g_aFontConfig[ FONT_DISASM_DEFAULT ]._nLineHeight * GetViewportScale(); diff --git a/source/Debugger/Debug.h b/source/Debugger/Debug.h index 45d06185..27ee49a7 100644 --- a/source/Debugger/Debug.h +++ b/source/Debugger/Debug.h @@ -83,6 +83,7 @@ // Config - Disassembly extern bool g_bConfigDisasmAddressView ; + extern int g_bConfigDisasmClick ; // GH#462 extern bool g_bConfigDisasmAddressColon ; extern bool g_bConfigDisasmOpcodesView ; extern bool g_bConfigDisasmOpcodeSpaces ; diff --git a/source/Debugger/Debugger_Commands.cpp b/source/Debugger/Debugger_Commands.cpp index c01e068a..515504b1 100644 --- a/source/Debugger/Debugger_Commands.cpp +++ b/source/Debugger/Debugger_Commands.cpp @@ -420,6 +420,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {TEXT("N") , NULL, PARAM_FLAG_N }, // 1--- ---- Sign // Disasm {TEXT("BRANCH") , NULL, PARAM_CONFIG_BRANCH }, + {TEXT("CLICK") , NULL, PARAM_CONFIG_CLICK }, // GH#462 {TEXT("COLON") , NULL, PARAM_CONFIG_COLON }, {TEXT("OPCODE") , NULL, PARAM_CONFIG_OPCODE }, {TEXT("POINTER") , NULL, PARAM_CONFIG_POINTER }, diff --git a/source/Debugger/Debugger_Types.h b/source/Debugger/Debugger_Types.h index 66014dab..d50bdde8 100644 --- a/source/Debugger/Debugger_Types.h +++ b/source/Debugger/Debugger_Types.h @@ -1319,6 +1319,7 @@ const DisasmData_t* pDisasmData; // If != NULL then bytes are marked up as data // Disasm , _PARAM_CONFIG_BEGIN = _PARAM_REGS_END // Daisy Chain , PARAM_CONFIG_BRANCH = _PARAM_CONFIG_BEGIN // g_iConfigDisasmBranchType [0|1|2] + , PARAM_CONFIG_CLICK // g_bConfigDisasmClick [0..7] // GH#462 , PARAM_CONFIG_COLON // g_bConfigDisasmAddressColon [0|1] , PARAM_CONFIG_OPCODE // g_bConfigDisasmOpcodesView [0|1] , PARAM_CONFIG_POINTER // g_bConfigInfoTargetPointer [0|1] diff --git a/source/Frame.cpp b/source/Frame.cpp index 338d6e23..b6d917f1 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -1346,6 +1346,8 @@ LRESULT CALLBACK FrameWndProc ( break; case WM_LBUTTONDOWN: + KeybUpdateCtrlShiftStatus(); + if (buttondown == -1) { int x = LOWORD(lparam); @@ -1399,6 +1401,7 @@ LRESULT CALLBACK FrameWndProc ( } } } + DebuggerMouseClick( x, y ); } RelayEvent(WM_LBUTTONDOWN,wparam,lparam);