1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
// license:BSD-3-Clause
// copyright-holders:Aaron Giles, Vas Crabb
//============================================================
//
// debugwininfo.h - Win32 debug window handling
//
//============================================================
#ifndef __DEBUG_WIN_DEBUG_WIN_INFO_H__
#define __DEBUG_WIN_DEBUG_WIN_INFO_H__
#include "debugwin.h"
#include "debugbaseinfo.h"
class debugwin_info : protected debugbase_info
{
public:
debugwin_info(debugger_windows_interface &debugger, bool is_main_console, LPCSTR title, WNDPROC handler);
virtual ~debugwin_info();
bool is_valid() const { return m_wnd != nullptr; }
void set_ignore_char_lparam(LPARAM value) { m_ignore_char_lparam = value >> 16; }
bool check_ignore_char_lparam(LPARAM value)
{
if (m_ignore_char_lparam == (value >> 16))
{
m_ignore_char_lparam = 0;
return false;
}
else
{
return true;
}
}
void show() const { smart_show_window(m_wnd, true); }
void hide() const { smart_show_window(m_wnd, false); }
void set_foreground() const { SetForegroundWindow(m_wnd); }
void destroy();
virtual bool set_default_focus();
void prev_view(debugview_info *curview);
void next_view(debugview_info *curview);
virtual bool restore_field(HWND wnd) { return false; }
virtual bool handle_key(WPARAM wparam, LPARAM lparam);
protected:
static DWORD const DEBUG_WINDOW_STYLE = (WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN) & (~WS_MINIMIZEBOX & ~WS_MAXIMIZEBOX);
static DWORD const DEBUG_WINDOW_STYLE_EX = 0;
static int const MAX_VIEWS = 4;
static int const EDGE_WIDTH = 3;
enum
{
ID_NEW_MEMORY_WND = 1,
ID_NEW_DISASM_WND,
ID_NEW_LOG_WND,
ID_NEW_POINTS_WND,
ID_RUN,
ID_RUN_AND_HIDE,
ID_RUN_VBLANK,
ID_RUN_IRQ,
ID_NEXT_CPU,
ID_STEP,
ID_STEP_OVER,
ID_STEP_OUT,
ID_REWIND_STEP,
ID_HARD_RESET,
ID_SOFT_RESET,
ID_EXIT,
ID_1_BYTE_CHUNKS,
ID_2_BYTE_CHUNKS,
ID_4_BYTE_CHUNKS,
ID_8_BYTE_CHUNKS,
ID_FLOATING_POINT_32BIT,
ID_FLOATING_POINT_64BIT,
ID_FLOATING_POINT_80BIT,
ID_LOGICAL_ADDRESSES,
ID_PHYSICAL_ADDRESSES,
ID_REVERSE_VIEW,
ID_INCREASE_MEM_WIDTH,
ID_DECREASE_MEM_WIDTH,
ID_TOGGLE_BREAKPOINT,
ID_DISABLE_BREAKPOINT,
ID_RUN_TO_CURSOR,
ID_SHOW_RAW,
ID_SHOW_ENCRYPTED,
ID_SHOW_COMMENTS,
ID_SHOW_BREAKPOINTS,
ID_SHOW_WATCHPOINTS,
ID_DEVICE_OPTIONS // always keep this at the end
};
bool is_main_console() const { return m_is_main_console; }
HWND window() const { return m_wnd; }
uint32_t minwidth() const { return m_minwidth; }
uint32_t maxwidth() const { return m_maxwidth; }
void set_minwidth(uint32_t value) { m_minwidth = value; }
void set_maxwidth(uint32_t value) { m_maxwidth = value; }
virtual void recompute_children();
virtual void update_menu() { }
virtual bool handle_command(WPARAM wparam, LPARAM lparam);
virtual void draw_contents(HDC dc);
void draw_border(HDC dc, RECT &bounds);
void draw_border(HDC dc, HWND child);
std::unique_ptr<debugview_info> m_views[MAX_VIEWS];
private:
LRESULT window_proc(UINT message, WPARAM wparam, LPARAM lparam);
HMENU create_standard_menubar();
static LRESULT CALLBACK static_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam);
static void register_window_class();
bool const m_is_main_console;
HWND m_wnd;
WNDPROC const m_handler;
uint32_t m_minwidth, m_maxwidth;
uint32_t m_minheight, m_maxheight;
uint16_t m_ignore_char_lparam;
static bool s_window_class_registered;
};
#endif
|