diff options
Diffstat (limited to 'src/osd/modules/debugger')
38 files changed, 713 insertions, 475 deletions
diff --git a/src/osd/modules/debugger/debugint.cpp b/src/osd/modules/debugger/debugint.cpp index 2598f481ca6..28b6379f70e 100644 --- a/src/osd/modules/debugger/debugint.cpp +++ b/src/osd/modules/debugger/debugint.cpp @@ -17,9 +17,14 @@ #include "debug/debugvw.h" #include "debug/dvdisasm.h" #include "debug/dvmemory.h" +#include "debug/dvbpoints.h" +#include "debug/dvwpoints.h" #include "debug/debugcon.h" #include "debug/debugcpu.h" +#include "config.h" +#include "debugger.h" +#include "modules/lib/osdobj_common.h" #include "debug_module.h" #include "modules/osdmodule.h" @@ -28,21 +33,23 @@ class debug_internal : public osd_module, public debug_module public: debug_internal() : osd_module(OSD_DEBUG_PROVIDER, "internal"), debug_module(), - m_machine(NULL) + m_machine(nullptr) { } virtual ~debug_internal() { } - virtual int init(const osd_options &options) { return 0; } - virtual void exit(); + virtual int init(const osd_options &options) override { return 0; } + virtual void exit() override; - virtual void init_debugger(running_machine &machine); - virtual void wait_for_debugger(device_t &device, bool firststop); - virtual void debugger_update(); + virtual void init_debugger(running_machine &machine) override; + virtual void wait_for_debugger(device_t &device, bool firststop) override; + virtual void debugger_update() override; private: - running_machine *m_machine; + running_machine* m_machine; + const char* font_name; + float font_size; }; @@ -55,7 +62,7 @@ private: #define BORDER_XTHICKNESS 1 #define HSB_HEIGHT 20 #define VSB_WIDTH 20 -#define TITLE_HEIGHT 20 +#define TITLE_HEIGHT (debug_font_height + 3*BORDER_YTHICKNESS) enum { @@ -73,7 +80,8 @@ enum VIEW_STATE_MOVING = 0x02, VIEW_STATE_SIZING = 0x04, VIEW_STATE_NEEDS_UPDATE = 0x08, - VIEW_STATE_FOLLOW_CPU = 0x10 + VIEW_STATE_FOLLOW_CPU = 0x10, + VIEW_STATE_VISIBLE = 0x20 }; /*************************************************************************** @@ -94,17 +102,17 @@ enum #define LIST_GET_PREVIOUS(_list, _elem, _prev) \ do { \ - _prev = NULL; \ + _prev = nullptr; \ if (_list != _elem) \ - for (_prev = _list; _prev != NULL; _prev = _prev->next) \ + for (_prev = _list; _prev != nullptr; _prev = _prev->next) \ if ((_prev)->next == _elem) \ break; \ } while (0) #define LIST_GET_LAST(_list, _last) \ do { \ - for (_last = _list; _last != NULL; _last = _last->next) \ - if ((_last)->next == NULL) \ + for (_last = _list; _last != nullptr; _last = _last->next) \ + if ((_last)->next == nullptr) \ break; \ } while (0) @@ -112,7 +120,7 @@ enum do { \ _type *_hlp; \ LIST_GET_PREVIOUS(_list, _elem, _hlp); \ - if (_hlp != NULL) \ + if (_hlp != nullptr) \ (_hlp)->next = (_elem)->next; \ else \ _list = (_elem)->next; \ @@ -122,7 +130,7 @@ enum do { \ _type *_hlp; \ LIST_GET_LAST(_list, _hlp); \ - if (_hlp != NULL) \ + if (_hlp != nullptr) \ (_hlp)->next = _elem; \ else \ _list = _elem; \ @@ -150,11 +158,12 @@ class DView_edit DISABLE_COPYING(DView_edit); public: - DView_edit(): active(0), container(NULL) { } + DView_edit(DView* owner): active(0), container(nullptr), owner(owner) { } ~DView_edit() { } int active; render_container * container; std::string str; + DView* owner; }; /*************************************************************************** @@ -170,11 +179,12 @@ class DView public: DView(render_target *target, running_machine &machine, debug_view_type type, int flags) - : next(NULL), + : next(nullptr), type(0), state(0), ofs_x(0), - ofs_y(0) + ofs_y(0), + editor(this) { this->target = target; //dv->container = render_target_get_component_container(target, name, &pos); @@ -182,8 +192,7 @@ public: this->view = machine.debug_view().alloc_view(type, dview_update, this); this->type = type; this->m_machine = &machine; - this->state = flags | VIEW_STATE_NEEDS_UPDATE; - + this->state = flags | VIEW_STATE_NEEDS_UPDATE | VIEW_STATE_VISIBLE; // initial size this->bounds.set(0, 300, 0, 300); @@ -205,7 +214,7 @@ public: machine().debug_view().free_view(*this->view); } - running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } + running_machine &machine() const { assert(m_machine != nullptr); return *m_machine; } DView * next; @@ -237,17 +246,17 @@ public: INLINE FUNCTIONS ***************************************************************************/ -INLINE int dview_is_state(DView *dv, int state) +static inline int dview_is_state(DView *dv, int state) { return ((dv->state & state) ? TRUE : FALSE); } -INLINE int dview_is_state_all(DView *dv, int state) +static inline int dview_is_state_all(DView *dv, int state) { return ((dv->state & state) == state ? TRUE : FALSE); } -INLINE void dview_set_state(DView *dv, int state, int onoff) +static inline void dview_set_state(DView *dv, int state, int onoff) { if (onoff) dv->state |= state; @@ -259,22 +268,23 @@ INLINE void dview_set_state(DView *dv, int state, int onoff) LOCAL VARIABLES ***************************************************************************/ -static render_font * debug_font = NULL; +static render_font * debug_font = nullptr; static int debug_font_width; static int debug_font_height; static float debug_font_aspect; -static DView * list = NULL; +static DView * list = nullptr; static DView * focus_view; static ui_menu * menu; static DView_edit * cur_editor; +static int win_count; static void set_focus_view(DView *dv) { - if (focus_view != NULL) + if (focus_view != nullptr) dview_set_state(focus_view, VIEW_STATE_NEEDS_UPDATE, TRUE); - if (dv != NULL) + if (dv != nullptr) dview_set_state(dv, VIEW_STATE_NEEDS_UPDATE, TRUE); if (focus_view != dv) @@ -282,7 +292,7 @@ static void set_focus_view(DView *dv) focus_view = dv; LIST_REMOVE(list, dv, DView); LIST_ADD_FRONT(list, dv, DView); - dv->target->debug_top(*dv->container); + dv->target->debug_append(*dv->container); } } @@ -301,6 +311,7 @@ static DView *dview_alloc(render_target *target, running_machine &machine, debug static void dview_free(DView *dv) { + dv->container->empty(); LIST_REMOVE(list, dv, DView); global_free(dv); } @@ -372,6 +383,16 @@ static void dview_draw_box(DView *dv, int rtype, int x, int y, int w, int h, rgb PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); } +static void dview_draw_line(DView *dv, int rtype, int x1, int y1, int x2, int y2, rgb_t col) +{ + rectangle r; + + dview_get_rect(dv, rtype, r); + dv->container->add_line(NX(dv, x1 + r.min_x), NY(dv, y1 + r.min_y), + NX(dv, x2 + r.min_x), NY(dv, y2 + r.min_y), UI_LINE_WIDTH, col, + PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); +} + static void dview_draw_char(DView *dv, int rtype, int x, int y, int h, rgb_t col, UINT16 ch) { rectangle r; @@ -409,8 +430,15 @@ static void dview_draw_hsb(DView *dv) dview_get_rect(dv, RECT_DVIEW_HSB, r); - dview_draw_outlined_box(dv, RECT_DVIEW_HSB, 0, 0, VSB_WIDTH,HSB_HEIGHT, rgb_t(0xff, 0xff, 0x00, 0x00)); - dview_draw_outlined_box(dv, RECT_DVIEW_HSB, r.width() - VSB_WIDTH, 0, VSB_WIDTH, HSB_HEIGHT, rgb_t(0xff, 0xff, 0x00, 0x00)); + dview_draw_box(dv, RECT_DVIEW_HSB, 0, 0, r.width(), r.height(), rgb_t(0xff, 0x60, 0x60, 0x60)); + dview_draw_outlined_box(dv, RECT_DVIEW_HSB, 0, 0, VSB_WIDTH,HSB_HEIGHT, rgb_t(0xff, 0xc0, 0xc0, 0xc0)); + dview_draw_outlined_box(dv, RECT_DVIEW_HSB, r.width() - VSB_WIDTH, 0, VSB_WIDTH, HSB_HEIGHT, rgb_t(0xff, 0xc0, 0xc0, 0xc0)); + + // draw arrows + dview_draw_line(dv, RECT_DVIEW_HSB, (VSB_WIDTH/3)*2, HSB_HEIGHT/4, VSB_WIDTH/3, HSB_HEIGHT/2, rgb_t(0xff, 0x00, 0x00, 0x00)); + dview_draw_line(dv, RECT_DVIEW_HSB, VSB_WIDTH/3, HSB_HEIGHT/2, (VSB_WIDTH/3)*2, (HSB_HEIGHT/4)*3, rgb_t(0xff, 0x00, 0x00, 0x00)); + dview_draw_line(dv, RECT_DVIEW_HSB, r.width() - (VSB_WIDTH/3)*2, HSB_HEIGHT/4, r.width() - VSB_WIDTH/3, HSB_HEIGHT/2, rgb_t(0xff, 0x00, 0x00, 0x00)); + dview_draw_line(dv, RECT_DVIEW_HSB, r.width() - VSB_WIDTH/3, HSB_HEIGHT/2, r.width() - (VSB_WIDTH/3)*2, (HSB_HEIGHT/4)*3, rgb_t(0xff, 0x00, 0x00, 0x00)); ts = (r.width()) - 2 * VSB_WIDTH; @@ -419,7 +447,7 @@ static void dview_draw_hsb(DView *dv) vt = (ts * (sb->value - sb->lower)) / (sb->upper - sb->lower - sb->page_size) + sz / 2 + r.min_x + VSB_WIDTH; - dview_draw_outlined_box(dv, RECT_DVIEW_HSB, vt - sz / 2, 0, sz, HSB_HEIGHT, rgb_t(0xff, 0xff, 0x00, 0x00)); + dview_draw_outlined_box(dv, RECT_DVIEW_HSB, vt - sz / 2, 0, sz, HSB_HEIGHT, rgb_t(0xff, 0xc0, 0xc0, 0xc0)); } static void dview_draw_vsb(DView *dv) @@ -433,8 +461,15 @@ static void dview_draw_vsb(DView *dv) dview_get_rect(dv, RECT_DVIEW_VSB, r); - dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, r.height() - HSB_HEIGHT, VSB_WIDTH, HSB_HEIGHT, rgb_t(0xff, 0xff, 0x00, 0x00)); - dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, 0, VSB_WIDTH, HSB_HEIGHT, rgb_t(0xff, 0xff, 0x00, 0x00)); + dview_draw_box(dv, RECT_DVIEW_VSB, 0, 0, r.width(), r.height(), rgb_t(0xff, 0x60, 0x60, 0x60)); + dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, r.height() - HSB_HEIGHT, VSB_WIDTH, HSB_HEIGHT, rgb_t(0xff, 0xc0, 0xc0, 0xc0)); + dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, 0, VSB_WIDTH, HSB_HEIGHT, rgb_t(0xff, 0xc0, 0xc0, 0xc0)); + + // draw arrows + dview_draw_line(dv, RECT_DVIEW_VSB, VSB_WIDTH/4, (HSB_HEIGHT/3)*2, VSB_WIDTH/2, HSB_HEIGHT/3, rgb_t(0xff, 0x00, 0x00, 0x00)); + dview_draw_line(dv, RECT_DVIEW_VSB, VSB_WIDTH/2, HSB_HEIGHT/3, (VSB_WIDTH/4)*3, (HSB_HEIGHT/3)*2, rgb_t(0xff, 0x00, 0x00, 0x00)); + dview_draw_line(dv, RECT_DVIEW_VSB, VSB_WIDTH/4, r.height() - (HSB_HEIGHT/3)*2, VSB_WIDTH/2, r.height() - HSB_HEIGHT/3, rgb_t(0xff, 0x00, 0x00, 0x00)); + dview_draw_line(dv, RECT_DVIEW_VSB, VSB_WIDTH/2, r.height() - HSB_HEIGHT/3, (VSB_WIDTH/4)*3, r.height() - (HSB_HEIGHT/3)*2, rgb_t(0xff, 0x00, 0x00, 0x00)); ts = r.height() - 2 * HSB_HEIGHT; @@ -443,7 +478,7 @@ static void dview_draw_vsb(DView *dv) vt = (ts * (sb->value - sb->lower)) / (sb->upper - sb->lower - sb->page_size) + sz / 2 + HSB_HEIGHT; - dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, vt - sz / 2, VSB_WIDTH, sz, rgb_t(0xff, 0xff, 0x00, 0x00)); + dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, vt - sz / 2, VSB_WIDTH, sz, rgb_t(0xff, 0xc0, 0xc0, 0xc0)); } static void dview_draw_size(DView *dv) @@ -453,7 +488,15 @@ static void dview_draw_size(DView *dv) dview_get_rect(dv, RECT_DVIEW_SIZE, r); dview_draw_outlined_box(dv, RECT_DVIEW_SIZE, 0, 0, - r.width(),r.height(), rgb_t(0xff, 0xff, 0xff, 0x00)); + r.width(),r.height(), rgb_t(0xff, 0x80, 0x80, 0x80)); + dview_draw_line(dv, RECT_DVIEW_SIZE, 11, r.height()-1, r.width()-1, 11, rgb_t(0xff, 0xc0, 0xc0, 0xc0)); + dview_draw_line(dv, RECT_DVIEW_SIZE, 12, r.height()-1, r.width()-1, 12, rgb_t(0xff, 0x60, 0x60, 0x60)); + dview_draw_line(dv, RECT_DVIEW_SIZE, 13, r.height()-1, r.width()-1, 13, rgb_t(0xff, 0xc0, 0xc0, 0xc0)); + dview_draw_line(dv, RECT_DVIEW_SIZE, 14, r.height()-1, r.width()-1, 14, rgb_t(0xff, 0x60, 0x60, 0x60)); + dview_draw_line(dv, RECT_DVIEW_SIZE, 15, r.height()-1, r.width()-1, 15, rgb_t(0xff, 0xc0, 0xc0, 0xc0)); + dview_draw_line(dv, RECT_DVIEW_SIZE, 16, r.height()-1, r.width()-1, 16, rgb_t(0xff, 0x60, 0x60, 0x60)); + dview_draw_line(dv, RECT_DVIEW_SIZE, 17, r.height()-1, r.width()-1, 17, rgb_t(0xff, 0xc0, 0xc0, 0xc0)); + dview_draw_line(dv, RECT_DVIEW_SIZE, 18, r.height()-1, r.width()-1, 18, rgb_t(0xff, 0x60, 0x60, 0x60)); } static void dview_set_title(DView *dv, std::string title) @@ -470,6 +513,7 @@ static void dview_draw_title(DView *dv) int i; rgb_t col = rgb_t(0xff,0x00,0x00,0xff); rectangle r; + int str_x = 2; dview_get_rect(dv, RECT_DVIEW_TITLE, r); @@ -483,9 +527,13 @@ static void dview_draw_title(DView *dv) for (i = 0; i<strlen(dv->title.c_str()); i++) { - dview_draw_char(dv, RECT_DVIEW_TITLE, i * debug_font_width + BORDER_XTHICKNESS, + if(str_x < r.width() - debug_font_width) + { + dview_draw_char(dv, RECT_DVIEW_TITLE, str_x, BORDER_YTHICKNESS, debug_font_height, //r.max_y - 2 * BORDER_YTHICKNESS, rgb_t(0xff,0xff,0xff,0xff), (UINT16) dv->title[i] ); + } + str_x += debug_font->char_width(debug_font_height, debug_font_aspect,(UINT16) dv->title[i]) + 2*BORDER_XTHICKNESS; } } @@ -648,7 +696,7 @@ static int dview_on_mouse(DView *dv, int mx, int my, bool button) } -INLINE void map_attr_to_fg_bg(unsigned char attr, rgb_t *fg, rgb_t *bg) +static inline void map_attr_to_fg_bg(unsigned char attr, rgb_t *fg, rgb_t *bg) { *bg = rgb_t(0xff,0xff,0xff,0xff); *fg = rgb_t(0xff,0x00,0x00,0x00); @@ -698,50 +746,29 @@ static void dview_draw(DView *dv) r.width() /*- (dv->vs ? VSB_WIDTH : 0)*/, r.height() /*- (dv->hsb.visible ? HSB_HEIGHT : 0)*/, bg_base); - /* background first */ + /* draw background and text */ viewdata = dv->view->viewdata(); - yy = BORDER_YTHICKNESS; for(j=0; j<vsize.y; j++) { xx = BORDER_XTHICKNESS; for(i=0; i<vsize.x; i++) { - map_attr_to_fg_bg(viewdata->attrib, &fg, &bg); + UINT16 s = ' '; + unsigned char v = viewdata->byte; + if(v < 128) { + s = v; + } else { + s = 0xc0 | (v>>6); + s |= (0x80 | (v & 0x3f)); + } + map_attr_to_fg_bg(viewdata->attrib, &fg, &bg); if (bg != bg_base) dview_draw_box(dv, RECT_DVIEW_CLIENT, xx, yy, debug_font_width, debug_font_height, bg); - xx += debug_font_width; - viewdata++; - } - yy += debug_font_height; - } - - /* now the text */ - viewdata = dv->view->viewdata(); - - yy = BORDER_YTHICKNESS; - for(j=0; j<vsize.y; j++) - { - xx = BORDER_XTHICKNESS; - for(i=0; i<vsize.x; i++) - { - UINT16 s; - unsigned char v = viewdata->byte; - if (v != ' ') - { - if(v < 128) { - s = v; - } else { - s = 0xc0 | (v>>6); - s |= (0x80 | (v & 0x3f)); - } - map_attr_to_fg_bg(viewdata->attrib, &fg, &bg); - dview_draw_char(dv, RECT_DVIEW_CLIENT, xx, yy, debug_font_height, fg, s); - } xx += debug_font_width; viewdata++; } @@ -781,9 +808,9 @@ static void dview_size_allocate(DView *dv) dv->vsb.visible = (size.y * debug_font_height > r.height() ? 1 : 0); dview_get_rect(dv, RECT_DVIEW_CLIENT, r); - dv->hsb.visible = (size.x * debug_font_width > r.width() ? 1 : 0); - dv->vsb.visible = (size.y * debug_font_height > r.height() ? 1 : 0); - dview_get_rect(dv, RECT_DVIEW_CLIENT, r); +// dv->hsb.visible = (size.x * debug_font_width > r.width() ? 1 : 0); +// dv->vsb.visible = (size.y * debug_font_height > r.height() ? 1 : 0); +// dview_get_rect(dv, RECT_DVIEW_CLIENT, r); col.y = (r.height() - 2 * BORDER_YTHICKNESS /*+ debug_font_height - 1*/) / debug_font_height; col.x = (r.width() - 2 * BORDER_XTHICKNESS /*+ debug_font_width - 1*/) / debug_font_width; @@ -863,16 +890,16 @@ static void dview_update(debug_view &dw, void *osdprivate) void debug_internal::exit() { - for (DView *ndv = list; ndv != NULL; ) + for (DView *ndv = list; ndv != nullptr; ) { DView *temp = ndv; ndv = ndv->next; dview_free(temp); } - if (debug_font != NULL) + if (debug_font != nullptr) { m_machine->render().font_free(debug_font); - debug_font = NULL; + debug_font = nullptr; } if (menu) global_free(menu); @@ -884,15 +911,23 @@ void debug_internal::init_debugger(running_machine &machine) int chw; m_machine = &machine; + font_name = (downcast<osd_options &>(m_machine->options()).debugger_font()); + font_size = (downcast<osd_options &>(m_machine->options()).debugger_font_size()); - debug_font = m_machine->render().font_alloc("ui.bdf"); //ui_get_font(machine); + if(!strcmp(font_name, OSDOPTVAL_AUTO)) + debug_font = m_machine->render().font_alloc("Courier New"); + else + debug_font = m_machine->render().font_alloc(font_name); + debug_font_width = 0; - debug_font_height = 15; - - menu = NULL; - cur_editor = NULL; - list = NULL; - focus_view = NULL; + if(font_size < 8) + debug_font_height = 16; // default + else + debug_font_height = font_size; + menu = nullptr; + cur_editor = nullptr; + list = nullptr; + focus_view = nullptr; debug_font_aspect = m_machine->render().ui_aspect(); @@ -902,9 +937,7 @@ void debug_internal::init_debugger(running_machine &machine) if (chw>debug_font_width) debug_font_width = chw; } - debug_font_width++; - /* FIXME: above does not really work */ - debug_font_width = 10; + debug_font_width += 2*BORDER_XTHICKNESS; } #if 0 @@ -916,7 +949,7 @@ static void set_view_by_name(render_target *target, const char *name) for (i = 0; ; i++ ) { s = target->view_name(i); - if (s == NULL) + if (s == nullptr) return; //printf("%d %s\n", i, s); if (strcmp(name, s) == 0) @@ -952,8 +985,39 @@ static void process_string(DView *dv, const char *str) } } +static void debug_hide_all() +{ + for (DView *dv = list; dv != nullptr; dv = dv->next) + { + dv->container->empty(); + dview_set_state(dv,VIEW_STATE_VISIBLE,false); + } +} + +static void debug_show_all() +{ + for (DView *dv = list; dv != nullptr; dv = dv->next) + dview_set_state(dv,VIEW_STATE_VISIBLE,true); +} + static void on_memory_window_activate(DView *dv, const ui_menu_event *event) { + DView *ndv; + render_target *target; + const debug_view_source *source; + + target = &dv->machine().render().ui_target(); + + ndv = dview_alloc(target, dv->machine(), DVT_MEMORY, 0); + ndv->editor.active = TRUE; + ndv->editor.container = &dv->machine().render().ui_container(); + source = ndv->view->source(); + dview_set_title(ndv, source->name()); + ndv->ofs_x = ndv->ofs_y = win_count * TITLE_HEIGHT; + ndv->bounds.setx(0,500); + win_count++; + + set_focus_view(ndv); } static void on_disassembly_window_activate(DView *dv, const ui_menu_event *event) @@ -969,8 +1033,9 @@ static void on_disassembly_window_activate(DView *dv, const ui_menu_event *event ndv->editor.container = &dv->machine().render().ui_container(); source = ndv->view->source(); dview_set_title(ndv, source->name()); + ndv->ofs_x = ndv->ofs_y = win_count * TITLE_HEIGHT; + win_count++; set_focus_view(ndv); - } static void on_disasm_cpu_activate(DView *dv, const ui_menu_event *event) @@ -980,7 +1045,7 @@ static void on_disasm_cpu_activate(DView *dv, const ui_menu_event *event) if (event->iptkey == IPT_UI_RIGHT) { current = current->next(); - if (current == NULL) + if (current == nullptr) current = dv->view->first_source(); dv->view->set_source(*current); dview_set_state(dv, VIEW_STATE_NEEDS_UPDATE, TRUE); @@ -996,6 +1061,37 @@ static void on_log_window_activate(DView *dv, const ui_menu_event *event) target = &dv->machine().render().ui_target(); ndv = dview_alloc(target, dv->machine(), DVT_LOG, 0); dview_set_title(ndv, "Log"); + ndv->ofs_x = ndv->ofs_y = win_count * TITLE_HEIGHT; + ndv->bounds.setx(0,600); + win_count++; + set_focus_view(ndv); +} + +static void on_bp_window_activate(DView *dv, const ui_menu_event *event) +{ + DView *ndv; + render_target *target; + + target = &dv->machine().render().ui_target(); + ndv = dview_alloc(target, dv->machine(), DVT_BREAK_POINTS, 0); + dview_set_title(ndv, "Breakpoints"); + ndv->ofs_x = ndv->ofs_y = win_count * TITLE_HEIGHT; + ndv->bounds.setx(0,600); + win_count++; + set_focus_view(ndv); +} + +static void on_wp_window_activate(DView *dv, const ui_menu_event *event) +{ + DView *ndv; + render_target *target; + + target = &dv->machine().render().ui_target(); + ndv = dview_alloc(target, dv->machine(), DVT_WATCH_POINTS, 0); + dview_set_title(ndv, "Watchpoints"); + ndv->ofs_x = ndv->ofs_y = win_count * TITLE_HEIGHT; + ndv->bounds.setx(0,600); + win_count++; set_focus_view(ndv); } @@ -1003,6 +1099,7 @@ static void on_close_activate(DView *dv, const ui_menu_event *event) { if (focus_view == dv) set_focus_view(dv->next); + win_count--; dview_free(dv); } @@ -1011,13 +1108,11 @@ static void on_run_activate(DView *dv, const ui_menu_event *event) debug_cpu_get_visible_cpu(dv->machine())->debug()->go(); } -#if 0 -void on_run_h_activate(DView *dv, const ui_menu_event *event) +static void on_run_h_activate(DView *dv, const ui_menu_event *event) { - debugwin_show(0); + debug_hide_all(); debug_cpu_get_visible_cpu(dv->machine())->debug()->go(); } -#endif static void on_run_cpu_activate(DView *dv, const ui_menu_event *event) { @@ -1099,40 +1194,108 @@ static void on_run_to_cursor_activate(DView *dv, const ui_menu_event *event) } } -/*------------------------------------------------- - editor - -------------------------------------------------*/ - -static void render_editor(DView_edit *editor) +static void on_memory_address_type(DView *dv, const ui_menu_event *event) { - float width, maxwidth; - float x1, y1, x2, y2; + debug_view_memory *memview = downcast<debug_view_memory *>(focus_view->view); + bool phys = memview->physical(); - editor->container->empty(); - /* get the size of the text */ - editor->container->manager().machine().ui().draw_text_full(editor->container, editor->str.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, NULL); - width += 2 * UI_BOX_LR_BORDER; - maxwidth = MAX(width, 0.5f); + if (event->iptkey == IPT_UI_RIGHT) + { + memview->set_physical(!phys); + dview_set_state(dv, VIEW_STATE_NEEDS_UPDATE, TRUE); + } +} - /* compute our bounds */ - x1 = 0.5f - 0.5f * maxwidth; - x2 = x1 + maxwidth; - y1 = 0.25f; - y2 = 0.45f - UI_BOX_TB_BORDER; +static void on_memory_data_format(DView *dv, const ui_menu_event *event) +{ + debug_view_memory *memview = downcast<debug_view_memory *>(focus_view->view); + int format = memview->get_data_format(); + int idx = 0; + int order[7] = { 1, 2, 4, 8, 9, 10, 11 }; - /* draw a box */ - editor->container->manager().machine().ui().draw_outlined_box(editor->container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + for(int x=0; x<7; x++) + { + if(order[x] == format) + idx = x; + } + + if (event->iptkey == IPT_UI_RIGHT) + { + idx++; + if(idx >= 7) + idx = 0; + memview->set_data_format(order[idx]); + dview_set_state(dv, VIEW_STATE_NEEDS_UPDATE, TRUE); + } + if (event->iptkey == IPT_UI_LEFT) + { + idx--; + if(idx < 0) + idx = 6; + memview->set_data_format(order[idx]); + dview_set_state(dv, VIEW_STATE_NEEDS_UPDATE, TRUE); + } +} - /* take off the borders */ - x1 += UI_BOX_LR_BORDER; - x2 -= UI_BOX_LR_BORDER; - y1 += UI_BOX_TB_BORDER; +static void on_memory_region(DView *dv, const ui_menu_event *event) +{ + debug_view_memory *memview = downcast<debug_view_memory *>(focus_view->view); + const debug_view_source *source = memview->source(); - /* draw the text within it */ - editor->container->manager().machine().ui().draw_text_full(editor->container, editor->str.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL); + if (event->iptkey == IPT_UI_LEFT) + { + int idx = memview->source_list().indexof(*source); + if(idx > 0) + memview->set_source(*memview->source_list().find(idx-1)); + else + memview->set_source(*memview->source_list().find(memview->source_list().count()-1)); + dview_set_state(dv, VIEW_STATE_NEEDS_UPDATE, TRUE); + dview_set_title(dv, memview->source()->name()); + } + if (event->iptkey == IPT_UI_RIGHT) + { + if(source->next() != nullptr) + memview->set_source(*source->next()); + else + memview->set_source(*memview->first_source()); + dview_set_state(dv, VIEW_STATE_NEEDS_UPDATE, TRUE); + dview_set_title(dv, memview->source()->name()); + } +} + +/*------------------------------------------------- + editor + -------------------------------------------------*/ +static void render_editor(DView_edit *editor) +{ + DView* dv = editor->owner; + rectangle r; + const char* str = editor->str.c_str(); + int str_x = 2 * BORDER_XTHICKNESS; + int start; +// int editor_width; + + dview_get_rect(dv,RECT_DVIEW_HSB,r); + +// editor_width = debug_font->string_width(debug_font_height, debug_font_aspect, editor->str.c_str()); + // figure out which character to start drawing, so that you can always see the end of the string you're typing + start = strlen(str) - (r.width() / (debug_font_width + 2*BORDER_XTHICKNESS)); + if(start < 0) + start = 0; + + dview_draw_box(dv,RECT_DVIEW_HSB,0,0,r.width(),r.height(),rgb_t(0xff,0xff,0xff,0xff)); + dview_draw_line(dv,RECT_DVIEW_HSB,0,0,r.width(),0,rgb_t(0xff,0xc0,0xc0,0xc0)); + dview_draw_line(dv,RECT_DVIEW_HSB,r.width(),0,r.width(),r.height(),rgb_t(0xff,0x60,0x60,0x60)); + dview_draw_line(dv,RECT_DVIEW_HSB,r.width(),r.height(),0,r.height(),rgb_t(0xff,0x60,0x60,0x60)); + dview_draw_line(dv,RECT_DVIEW_HSB,0,r.height(),0,0,rgb_t(0xff,0xc0,0xc0,0xc0)); + + for(int x=start;x<strlen(str);x++) + { + if(str_x < r.width() - debug_font_width) + dview_draw_char(dv,RECT_DVIEW_HSB,str_x,BORDER_YTHICKNESS,r.height(),rgb_t(0xff,0x00,0x00,0x00),(UINT16)str[x]); + str_x += debug_font->char_width(r.height(),debug_font_aspect,(UINT16)str[x]) + 2*BORDER_XTHICKNESS; + } } /*------------------------------------------------- @@ -1143,8 +1306,8 @@ class ui_menu_debug : public ui_menu { public: ui_menu_debug(running_machine &machine, render_container *container) : ui_menu(machine, container) {} virtual ~ui_menu_debug() {} - virtual void populate() {} - virtual void handle() {} + virtual void populate() override {} + virtual void handle() override {} }; static void CreateMainMenu(running_machine &machine) @@ -1174,10 +1337,16 @@ static void CreateMainMenu(running_machine &machine) case DVT_STATE: title = "State:"; break; + case DVT_BREAK_POINTS: + title = "Breakpoints:"; + break; + case DVT_WATCH_POINTS: + title = "Watchpoints:"; + break; } - menu->item_append(title.append(focus_view->title).c_str(), NULL, MENU_FLAG_DISABLE, NULL); - menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); + menu->item_append(title.append(focus_view->title).c_str(), nullptr, MENU_FLAG_DISABLE, nullptr); + menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); switch (focus_view->type) { @@ -1191,37 +1360,64 @@ static void CreateMainMenu(running_machine &machine) case DASM_RIGHTCOL_COMMENTS: subtext = "Comments"; break; } menu->item_append("View", subtext, MENU_FLAG_RIGHT_ARROW, (void *)on_view_opcodes_activate); - menu->item_append("Run to cursor", NULL, 0, (void *)on_run_to_cursor_activate); + menu->item_append("Run to cursor", nullptr, 0, (void *)on_run_to_cursor_activate); if (!dview_is_state(focus_view, VIEW_STATE_FOLLOW_CPU)) { menu->item_append("CPU", focus_view->view->source()->name(), MENU_FLAG_RIGHT_ARROW, (void *)on_disasm_cpu_activate); } - menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); + menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + break; + } + case DVT_MEMORY: + { + bool phys = downcast<debug_view_memory *>(focus_view->view)->physical(); + int format = downcast<debug_view_memory *>(focus_view->view)->get_data_format(); + const debug_view_source* source = downcast<debug_view_memory *>(focus_view->view)->source(); + menu->item_append("Region", source->name(), MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)on_memory_region); + if(phys) + menu->item_append("Address type", "Physical", MENU_FLAG_RIGHT_ARROW, (void *)on_memory_address_type); + else + menu->item_append("Address type", "Logical", MENU_FLAG_RIGHT_ARROW, (void *)on_memory_address_type); + switch(format) + { + case 1: subtext = "1 byte chunks"; break; + case 2: subtext = "2 byte chunks"; break; + case 4: subtext = "4 byte chunks"; break; + case 8: subtext = "8 byte chunks"; break; + case 9: subtext = "32-bit floating point"; break; + case 10: subtext = "64-bit floating point"; break; + case 11: subtext = "80-bit floating point"; break; + } + menu->item_append("Format", subtext, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)on_memory_data_format); + menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); break; } } /* add input menu items */ - menu->item_append("New Memory Window", NULL, 0, (void *)on_memory_window_activate); - menu->item_append("New Disassembly Window", NULL, 0, (void *)on_disassembly_window_activate); - menu->item_append("New Error Log Window", NULL, 0, (void *)on_log_window_activate); - menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); - menu->item_append("Run", NULL, 0, (void *)on_run_activate); - menu->item_append("Run to Next CPU", NULL, 0, (void *)on_run_cpu_activate); - menu->item_append("Run until Next Interrupt on This CPU", NULL, 0, (void *)on_run_irq_activate); - menu->item_append("Run until Next VBLANK", NULL, 0, (void *)on_run_vbl_activate); - menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); - menu->item_append("Step Into", NULL, 0, (void *)on_step_into_activate); - menu->item_append("Step Over", NULL, 0, (void *)on_step_over_activate); - menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); - menu->item_append("Soft Reset", NULL, 0, (void *)on_soft_reset_activate); - menu->item_append("Hard Reset", NULL, 0, (void *)on_hard_reset_activate); - menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); + menu->item_append("New Memory Window", nullptr, 0, (void *)on_memory_window_activate); + menu->item_append("New Disassembly Window", nullptr, 0, (void *)on_disassembly_window_activate); + menu->item_append("New Error Log Window", nullptr, 0, (void *)on_log_window_activate); + menu->item_append("New Breakpoints Window", nullptr, 0, (void *)on_bp_window_activate); + menu->item_append("New Watchpoints Window", nullptr, 0, (void *)on_wp_window_activate); + menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + menu->item_append("Run", nullptr, 0, (void *)on_run_activate); + menu->item_append("Run and Hide Debugger", nullptr, 0, (void *)on_run_h_activate); + menu->item_append("Run to Next CPU", nullptr, 0, (void *)on_run_cpu_activate); + menu->item_append("Run until Next Interrupt on This CPU", nullptr, 0, (void *)on_run_irq_activate); + menu->item_append("Run until Next VBLANK", nullptr, 0, (void *)on_run_vbl_activate); + menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + menu->item_append("Step Into", nullptr, 0, (void *)on_step_into_activate); + menu->item_append("Step Over", nullptr, 0, (void *)on_step_over_activate); + menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + menu->item_append("Soft Reset", nullptr, 0, (void *)on_soft_reset_activate); + menu->item_append("Hard Reset", nullptr, 0, (void *)on_hard_reset_activate); + menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); if (!dview_is_state(focus_view, VIEW_STATE_FOLLOW_CPU)) - menu->item_append("Close Window", NULL, 0, (void *)on_close_activate); - menu->item_append("Exit", NULL, 0, (void *)on_exit_activate); + menu->item_append("Close Window", nullptr, 0, (void *)on_close_activate); + menu->item_append("Exit", nullptr, 0, (void *)on_exit_activate); } static int map_point(DView *dv, INT32 target_x, INT32 target_y, INT32 *mapped_x, INT32 *mapped_y) @@ -1254,16 +1450,16 @@ static void handle_mouse(running_machine &machine) INT32 x,y; bool button; - if (menu != NULL) + if (menu != nullptr) return; mouse_target = ui_input_find_mouse(machine, &x, &y, &button); - if (mouse_target == NULL) + if (mouse_target == nullptr) return; //printf("mouse %d %d %d\n", x, y, button); - for (DView *dv = list; dv != NULL; dv = dv->next) + for (DView *dv = list; dv != nullptr; dv = dv->next) { if (mouse_target == dv->target) { @@ -1313,17 +1509,17 @@ static void handle_editor(running_machine &machine) break; } } - if (cur_editor != NULL) + if (cur_editor != nullptr) { render_editor(cur_editor); if (ui_input_pressed(machine, IPT_UI_SELECT)) { process_string(focus_view, focus_view->editor.str.c_str()); focus_view->editor.str = ""; - cur_editor = NULL; + cur_editor = nullptr; } if (ui_input_pressed(machine, IPT_UI_CANCEL)) - cur_editor = NULL; + cur_editor = nullptr; } } @@ -1340,22 +1536,22 @@ static void handle_menus(running_machine &machine) machine.render().ui_container().empty(); ui_input_frame_update(machine); - if (menu != NULL) + if (menu != nullptr) { /* process the menu */ event = menu->process(0); - if (event != NULL && (event->iptkey == IPT_UI_SELECT || (event->iptkey == IPT_UI_RIGHT))) + if (event != nullptr && (event->iptkey == IPT_UI_SELECT || (event->iptkey == IPT_UI_LEFT) || (event->iptkey == IPT_UI_RIGHT))) { //global_free(menu); - //menu = NULL; + //menu = nullptr; ((void (*)(DView *, const ui_menu_event *)) event->itemref)(focus_view, event); - //ui_menu_stack_push(ui_menu_alloc(machine, menu->container, (ui_menu_handler_func)event->itemref, NULL)); + //ui_menu_stack_push(ui_menu_alloc(machine, menu->container, (ui_menu_handler_func)event->itemref,nullptr)); CreateMainMenu(machine); } else if (ui_input_pressed(machine, IPT_UI_CONFIGURE)) { global_free(menu); - menu = NULL; + menu = nullptr; } } else @@ -1378,7 +1574,7 @@ static void followers_set_cpu(device_t *device) { std::string title; - for (DView *dv = list; dv != NULL; dv = dv->next) + for (DView *dv = list; dv != nullptr; dv = dv->next) { if (dview_is_state(dv, VIEW_STATE_FOLLOW_CPU)) { @@ -1409,7 +1605,8 @@ static void dview_update_view(DView *dv) if (dview_is_state(dv, VIEW_STATE_NEEDS_UPDATE) || dv->rt_width != old_rt_width || dv->rt_height != old_rt_height) { dview_size_allocate(dv); - dview_draw(dv); + if(dview_is_state(dv, VIEW_STATE_VISIBLE)) + dview_draw(dv); dview_set_state(dv, VIEW_STATE_NEEDS_UPDATE, FALSE); } } @@ -1417,41 +1614,47 @@ static void dview_update_view(DView *dv) static void update_views(void) { - DView *dv, *prev; + DView *dv; - LIST_GET_LAST(list, dv); - while (dv != NULL) - { + for(dv=list;dv!=nullptr;dv=dv->next) dview_update_view(dv); - LIST_GET_PREVIOUS(list, dv, prev); - dv = prev; - } } void debug_internal::wait_for_debugger(device_t &device, bool firststop) { - if (firststop && list == NULL) + if (firststop && list == nullptr) { render_target *target = &device.machine().render().ui_target(); //set_view_by_name(target, "Debug"); + win_count = 0; DView *disassembly = dview_alloc(target, device.machine(), DVT_DISASSEMBLY, VIEW_STATE_FOLLOW_CPU); disassembly->editor.active = TRUE; disassembly->editor.container = &device.machine().render().ui_container(); - - dview_alloc(target, device.machine(), DVT_STATE, VIEW_STATE_FOLLOW_CPU); - + disassembly->ofs_x = 500; + disassembly->bounds.setx(0,600); + win_count++; + + DView *statewin = dview_alloc(target, device.machine(), DVT_STATE, VIEW_STATE_FOLLOW_CPU); + statewin->ofs_x = 350; + statewin->bounds.set(0,150,0,600); + win_count++; + DView *console = dview_alloc(target, device.machine(), DVT_CONSOLE, VIEW_STATE_FOLLOW_CPU); dview_set_title(console, "Console"); console->editor.active = TRUE; console->editor.container = &device.machine().render().ui_container(); + console->bounds.setx(0,600); + console->ofs_x = 500; + console->ofs_y = 300; + win_count++; set_focus_view(console); } followers_set_cpu(&device); - + debug_show_all(); //ui_update_and_render(device.machine(), device.machine().render().ui_container()()); update_views(); device.machine().osd().update(false); @@ -1463,7 +1666,7 @@ void debug_internal::wait_for_debugger(device_t &device, bool firststop) void debug_internal::debugger_update() { - if ((m_machine != NULL) && (!debug_cpu_is_stopped(*m_machine)) && (m_machine->phase() == MACHINE_PHASE_RUNNING)) + if ((m_machine != nullptr) && (!debug_cpu_is_stopped(*m_machine)) && (m_machine->phase() == MACHINE_PHASE_RUNNING)) { update_views(); } diff --git a/src/osd/modules/debugger/debugqt.cpp b/src/osd/modules/debugger/debugqt.cpp index 692e58d6551..75d925f1f24 100644 --- a/src/osd/modules/debugger/debugqt.cpp +++ b/src/osd/modules/debugger/debugqt.cpp @@ -8,9 +8,7 @@ // //============================================================ -#if (!defined(NO_MEM_TRACKING)) #define NO_MEM_TRACKING -#endif #include "debug_module.h" #include "modules/osdmodule.h" @@ -19,8 +17,9 @@ #include <vector> -#include <QtGui/QtGui> -#include <QtGui/QApplication> +#include <QtWidgets/QApplication> +#include <QtCore/QAbstractEventDispatcher> +#include <QtCore/QAbstractNativeEventFilter> #include "emu.h" #include "config.h" @@ -36,6 +35,9 @@ #include "qt/deviceinformationwindow.h" class debug_qt : public osd_module, public debug_module +#if defined(WIN32) && !defined(SDLMAME_WIN32) +, public QAbstractNativeEventFilter +#endif { public: debug_qt() @@ -52,7 +54,9 @@ public: virtual void init_debugger(running_machine &machine); virtual void wait_for_debugger(device_t &device, bool firststop); virtual void debugger_update(); - +#if defined(WIN32) && !defined(SDLMAME_WIN32) + virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *) Q_DECL_OVERRIDE; +#endif private: running_machine *m_machine; }; @@ -234,6 +238,12 @@ static void bring_main_window_to_front() #if defined(WIN32) && !defined(SDLMAME_WIN32) bool winwindow_qt_filter(void *message); + +bool debug_qt::nativeEventFilter(const QByteArray &eventType, void *message, long *) +{ + winwindow_qt_filter(message); + return false; +} #endif void debug_qt::init_debugger(running_machine &machine) @@ -243,7 +253,7 @@ void debug_qt::init_debugger(running_machine &machine) // If you're starting from scratch, create a new qApp new QApplication(qtArgc, qtArgv); #if defined(WIN32) && !defined(SDLMAME_WIN32) - QAbstractEventDispatcher::instance()->setEventFilter((QAbstractEventDispatcher::EventFilter)&winwindow_qt_filter); + QAbstractEventDispatcher::instance()->installNativeEventFilter(this); #endif } else diff --git a/src/osd/modules/debugger/debugwin.cpp b/src/osd/modules/debugger/debugwin.cpp index b7bf048adae..b31d12ea67a 100644 --- a/src/osd/modules/debugger/debugwin.cpp +++ b/src/osd/modules/debugger/debugwin.cpp @@ -44,35 +44,35 @@ public: virtual ~debugger_windows() { } - virtual int init(const osd_options &options) { return 0; } - virtual void exit(); + virtual int init(const osd_options &options) override { return 0; } + virtual void exit() override; - virtual void init_debugger(running_machine &machine); - virtual void wait_for_debugger(device_t &device, bool firststop); - virtual void debugger_update(); + virtual void init_debugger(running_machine &machine) override; + virtual void wait_for_debugger(device_t &device, bool firststop) override; + virtual void debugger_update() override; protected: - virtual running_machine &machine() const { return *m_machine; } + virtual running_machine &machine() const override { return *m_machine; } - virtual ui_metrics &metrics() const { return *m_metrics; } + virtual ui_metrics &metrics() const override { return *m_metrics; } - virtual bool const &waiting_for_debugger() const { return m_waiting_for_debugger; } - virtual bool seq_pressed() const; + virtual bool const &waiting_for_debugger() const override { return m_waiting_for_debugger; } + virtual bool seq_pressed() const override; - virtual void create_memory_window() { create_window<memorywin_info>(); } - virtual void create_disasm_window() { create_window<disasmwin_info>(); } - virtual void create_log_window() { create_window<logwin_info>(); } - virtual void create_points_window() { create_window<pointswin_info>(); } - virtual void remove_window(debugwin_info &info); + virtual void create_memory_window() override { create_window<memorywin_info>(); } + virtual void create_disasm_window() override { create_window<disasmwin_info>(); } + virtual void create_log_window() override { create_window<logwin_info>(); } + virtual void create_points_window() override { create_window<pointswin_info>(); } + virtual void remove_window(debugwin_info &info) override; - virtual void show_all(); - virtual void hide_all(); + virtual void show_all() override; + virtual void hide_all() override; private: template <typename T> T *create_window(); running_machine *m_machine; - auto_pointer<ui_metrics> m_metrics; + std::unique_ptr<ui_metrics> m_metrics; bool m_waiting_for_debugger; simple_list<debugwin_info> m_window_list; consolewin_info *m_main_console; @@ -94,7 +94,7 @@ void debugger_windows::exit() void debugger_windows::init_debugger(running_machine &machine) { m_machine = &machine; - m_metrics.reset(global_alloc(ui_metrics(downcast<osd_options &>(m_machine->options())))); + m_metrics = std::make_unique<ui_metrics>(downcast<osd_options &>(m_machine->options())); } diff --git a/src/osd/modules/debugger/none.cpp b/src/osd/modules/debugger/none.cpp index 48085afd089..27157bbee1b 100644 --- a/src/osd/modules/debugger/none.cpp +++ b/src/osd/modules/debugger/none.cpp @@ -16,18 +16,18 @@ class debug_none : public osd_module, public debug_module public: debug_none() : osd_module(OSD_DEBUG_PROVIDER, "none"), debug_module(), - m_machine(NULL) + m_machine(nullptr) { } virtual ~debug_none() { } - virtual int init(const osd_options &options) { return 0; } - virtual void exit() { } + virtual int init(const osd_options &options) override { return 0; } + virtual void exit() override { } - virtual void init_debugger(running_machine &machine); - virtual void wait_for_debugger(device_t &device, bool firststop); - virtual void debugger_update(); + virtual void init_debugger(running_machine &machine) override; + virtual void wait_for_debugger(device_t &device, bool firststop) override; + virtual void debugger_update() override; private: running_machine *m_machine; diff --git a/src/osd/modules/debugger/osx/memoryview.mm b/src/osd/modules/debugger/osx/memoryview.mm index ca9e6a2b99f..c32476bd89b 100644 --- a/src/osd/modules/debugger/osx/memoryview.mm +++ b/src/osd/modules/debugger/osx/memoryview.mm @@ -33,7 +33,7 @@ if (action == @selector(showChunkSize:)) { - [item setState:((tag == memview->bytes_per_chunk()) ? NSOnState : NSOffState)]; + [item setState:((tag == memview->get_data_format()) ? NSOnState : NSOffState)]; return YES; } else if (action == @selector(showPhysicalAddresses:)) @@ -171,7 +171,7 @@ - (IBAction)showChunkSize:(id)sender { - downcast<debug_view_memory *>(view)->set_bytes_per_chunk([sender tag]); + downcast<debug_view_memory *>(view)->set_data_format([sender tag]); } @@ -208,6 +208,27 @@ [chunkItem setTag:tag]; } + NSMenuItem *chunkItem = [menu insertItemWithTitle:@"32-bit floats" + action:@selector(showChunkSize:) + keyEquivalent:@"F" + atIndex:index++]; + [chunkItem setTarget:self]; + [chunkItem setTag:9]; + + NSMenuItem *chunkItem2 = [menu insertItemWithTitle:@"64-bit floats" + action:@selector(showChunkSize:) + keyEquivalent:@"D" + atIndex:index++]; + [chunkItem2 setTarget:self]; + [chunkItem2 setTag:10]; + + NSMenuItem *chunkItem3 = [menu insertItemWithTitle:@"80-bit floats" + action:@selector(showChunkSize:) + keyEquivalent:@"E" + atIndex:index++]; + [chunkItem3 setTarget:self]; + [chunkItem3 setTag:11]; + [menu insertItem:[NSMenuItem separatorItem] atIndex:index++]; NSMenuItem *logicalItem = [menu insertItemWithTitle:@"Logical Addresses" diff --git a/src/osd/modules/debugger/qt/breakpointswindow.cpp b/src/osd/modules/debugger/qt/breakpointswindow.cpp index d1aea9fbd46..e1d90146b18 100644 --- a/src/osd/modules/debugger/qt/breakpointswindow.cpp +++ b/src/osd/modules/debugger/qt/breakpointswindow.cpp @@ -2,6 +2,12 @@ // copyright-holders:Andrew Gardner #define NO_MEM_TRACKING +#include <QtWidgets/QActionGroup> +#include <QtWidgets/QHBoxLayout> +#include <QtWidgets/QMenu> +#include <QtWidgets/QMenuBar> +#include <QtWidgets/QVBoxLayout> + #include "breakpointswindow.h" #include "debug/debugcon.h" @@ -54,7 +60,7 @@ BreakpointsWindow::BreakpointsWindow(running_machine* machine, QWidget* parent) typeBreak->setShortcut(QKeySequence("Ctrl+1")); typeWatch->setShortcut(QKeySequence("Ctrl+2")); typeBreak->setChecked(true); - connect(typeGroup, SIGNAL(triggered(QAction*)), this, SLOT(typeChanged(QAction*))); + connect(typeGroup, &QActionGroup::triggered, this, &BreakpointsWindow::typeChanged); // Assemble the options menu QMenu* optionsMenu = menuBar()->addMenu("&Options"); diff --git a/src/osd/modules/debugger/qt/breakpointswindow.h b/src/osd/modules/debugger/qt/breakpointswindow.h index 9a041f8de07..6c4335e334c 100644 --- a/src/osd/modules/debugger/qt/breakpointswindow.h +++ b/src/osd/modules/debugger/qt/breakpointswindow.h @@ -3,8 +3,6 @@ #ifndef __DEBUG_QT_BREAK_POINTS_WINDOW_H__ #define __DEBUG_QT_BREAK_POINTS_WINDOW_H__ -#include <QtGui/QtGui> - #include "debuggerview.h" #include "windowqt.h" diff --git a/src/osd/modules/debugger/qt/dasmwindow.cpp b/src/osd/modules/debugger/qt/dasmwindow.cpp index 14de9080876..71b92c59ce4 100644 --- a/src/osd/modules/debugger/qt/dasmwindow.cpp +++ b/src/osd/modules/debugger/qt/dasmwindow.cpp @@ -2,6 +2,12 @@ // copyright-holders:Andrew Gardner #define NO_MEM_TRACKING +#include <QtWidgets/QHBoxLayout> +#include <QtWidgets/QVBoxLayout> +#include <QtWidgets/QAction> +#include <QtWidgets/QMenu> +#include <QtWidgets/QMenuBar> + #include "dasmwindow.h" #include "debug/debugcon.h" @@ -30,17 +36,17 @@ DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) : // The input edit m_inputEdit = new QLineEdit(topSubFrame); - connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(expressionSubmitted())); + connect(m_inputEdit, &QLineEdit::returnPressed, this, &DasmWindow::expressionSubmitted); // The cpu combo box m_cpuComboBox = new QComboBox(topSubFrame); m_cpuComboBox->setObjectName("cpu"); m_cpuComboBox->setMinimumWidth(300); - connect(m_cpuComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(cpuChanged(int))); + connect(m_cpuComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &DasmWindow::cpuChanged); // The main disasm window m_dasmView = new DebuggerView(DVT_DISASSEMBLY, m_machine, this); - connect(m_dasmView, SIGNAL(updated()), this, SLOT(dasmViewUpdated())); + connect(m_dasmView, &DebuggerView::updated, this, &DasmWindow::dasmViewUpdated); // Force a recompute of the disassembly region downcast<debug_view_disasm*>(m_dasmView->view())->set_expression("curpc"); @@ -77,9 +83,9 @@ DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) : m_breakpointToggleAct->setShortcut(Qt::Key_F9); m_breakpointEnableAct->setShortcut(Qt::SHIFT + Qt::Key_F9); m_runToCursorAct->setShortcut(Qt::Key_F4); - connect(m_breakpointToggleAct, SIGNAL(triggered(bool)), this, SLOT(toggleBreakpointAtCursor(bool))); - connect(m_breakpointEnableAct, SIGNAL(triggered(bool)), this, SLOT(enableBreakpointAtCursor(bool))); - connect(m_runToCursorAct, SIGNAL(triggered(bool)), this, SLOT(runToCursor(bool))); + connect(m_breakpointToggleAct, &QAction::triggered, this, &DasmWindow::toggleBreakpointAtCursor); + connect(m_breakpointEnableAct, &QAction::triggered, this, &DasmWindow::enableBreakpointAtCursor); + connect(m_runToCursorAct, &QAction::triggered, this, &DasmWindow::runToCursor); // Right bar options QActionGroup* rightBarGroup = new QActionGroup(this); @@ -97,7 +103,7 @@ DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) : rightActEncrypted->setShortcut(QKeySequence("Ctrl+E")); rightActComments->setShortcut(QKeySequence("Ctrl+C")); rightActRaw->setChecked(true); - connect(rightBarGroup, SIGNAL(triggered(QAction*)), this, SLOT(rightBarChanged(QAction*))); + connect(rightBarGroup, &QActionGroup::triggered, this, &DasmWindow::rightBarChanged); // Assemble the options menu QMenu* optionsMenu = menuBar()->addMenu("&Options"); diff --git a/src/osd/modules/debugger/qt/dasmwindow.h b/src/osd/modules/debugger/qt/dasmwindow.h index 9912841603a..44368c4e11f 100644 --- a/src/osd/modules/debugger/qt/dasmwindow.h +++ b/src/osd/modules/debugger/qt/dasmwindow.h @@ -3,7 +3,8 @@ #ifndef __DEBUG_QT_DASM_WINDOW_H__ #define __DEBUG_QT_DASM_WINDOW_H__ -#include <QtGui/QtGui> +#include <QtWidgets/QLineEdit> +#include <QtWidgets/QComboBox> #include "debuggerview.h" #include "windowqt.h" diff --git a/src/osd/modules/debugger/qt/debuggerview.cpp b/src/osd/modules/debugger/qt/debuggerview.cpp index d1be4815288..c0cefdda759 100644 --- a/src/osd/modules/debugger/qt/debuggerview.cpp +++ b/src/osd/modules/debugger/qt/debuggerview.cpp @@ -2,6 +2,11 @@ // copyright-holders:Andrew Gardner #define NO_MEM_TRACKING +#include <QtWidgets/QScrollBar> +#include <QtWidgets/QApplication> +#include <QtGui/QPainter> +#include <QtGui/QKeyEvent> + #include "debuggerview.h" #include "modules/lib/osdobj_common.h" @@ -28,10 +33,10 @@ DebuggerView::DebuggerView(const debug_view_type& type, DebuggerView::debuggerViewUpdate, this); - connect(verticalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(verticalScrollSlot(int))); - connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(horizontalScrollSlot(int))); + connect(verticalScrollBar(), &QScrollBar::valueChanged, + this, &DebuggerView::verticalScrollSlot); + connect(horizontalScrollBar(), &QScrollBar::valueChanged, + this, &DebuggerView::horizontalScrollSlot); } @@ -41,127 +46,12 @@ DebuggerView::~DebuggerView() m_machine->debug_view().free_view(*m_view); } -// TODO: remove this version no later than January 1, 2015 -#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0) -void DebuggerView::paintEvent(QPaintEvent* event) -{ - // Tell the MAME debug view how much real estate is available - QFontMetrics actualFont = fontMetrics(); - const int fontWidth = MAX(1, actualFont.width('_')); - const int fontHeight = MAX(1, actualFont.height()); - m_view->set_visible_size(debug_view_xy(width()/fontWidth, height()/fontHeight)); - - - // Handle the scroll bars - const int horizontalScrollCharDiff = m_view->total_size().x - m_view->visible_size().x; - const int horizontalScrollSize = horizontalScrollCharDiff < 0 ? 0 : horizontalScrollCharDiff; - horizontalScrollBar()->setRange(0, horizontalScrollSize); - - // If the horizontal scroll bar appears, make sure to adjust the vertical scrollbar accordingly - const int verticalScrollAdjust = horizontalScrollSize > 0 ? 1 : 0; - - const int verticalScrollCharDiff = m_view->total_size().y - m_view->visible_size().y; - const int verticalScrollSize = verticalScrollCharDiff < 0 ? 0 : verticalScrollCharDiff+verticalScrollAdjust; - bool atEnd = false; - if (verticalScrollBar()->value() == verticalScrollBar()->maximum()) - { - atEnd = true; - } - verticalScrollBar()->setRange(0, verticalScrollSize); - if (m_preferBottom && atEnd) - { - verticalScrollBar()->setValue(verticalScrollSize); - } - - - // Draw the viewport widget - QPainter painter(viewport()); - painter.fillRect(0, 0, width(), height(), QBrush(Qt::white)); - painter.setBackgroundMode(Qt::OpaqueMode); - painter.setBackground(QColor(255,255,255)); - - // Background control - QBrush bgBrush; - bgBrush.setStyle(Qt::SolidPattern); - painter.setPen(QPen(QColor(0,0,0))); - - size_t viewDataOffset = 0; - const debug_view_xy& visibleCharDims = m_view->visible_size(); - for (int y = 0; y < visibleCharDims.y; y++) - { - for (int x = 0; x < visibleCharDims.x; x++) - { - const unsigned char textAttr = m_view->viewdata()[viewDataOffset].attrib; - - if (x == 0 || textAttr != m_view->viewdata()[viewDataOffset-1].attrib) - { - // Text color handling - QColor fgColor(0,0,0); - QColor bgColor(255,255,255); - - if(textAttr & DCA_VISITED) - { - bgColor.setRgb(0xc6, 0xe2, 0xff); - } - if(textAttr & DCA_ANCILLARY) - { - bgColor.setRgb(0xe0, 0xe0, 0xe0); - } - if(textAttr & DCA_SELECTED) - { - bgColor.setRgb(0xff, 0x80, 0x80); - } - if(textAttr & DCA_CURRENT) - { - bgColor.setRgb(0xff, 0xff, 0x00); - } - if ((textAttr & DCA_SELECTED) && (textAttr & DCA_CURRENT)) - { - bgColor.setRgb(0xff,0xc0,0x80); - } - if(textAttr & DCA_CHANGED) - { - fgColor.setRgb(0xff, 0x00, 0x00); - } - if(textAttr & DCA_INVALID) - { - fgColor.setRgb(0x00, 0x00, 0xff); - } - if(textAttr & DCA_DISABLED) - { - fgColor.setRgb((fgColor.red() + bgColor.red()) >> 1, - (fgColor.green() + bgColor.green()) >> 1, - (fgColor.blue() + bgColor.blue()) >> 1); - } - if(textAttr & DCA_COMMENT) - { - fgColor.setRgb(0x00, 0x80, 0x00); - } - - bgBrush.setColor(bgColor); - painter.setBackground(bgBrush); - painter.setPen(QPen(fgColor)); - } - - // Your character is not guaranteed to take up the entire fontWidth x fontHeight, so fill before. - painter.fillRect(x*fontWidth, y*fontHeight, fontWidth, fontHeight, bgBrush); - - // There is a touchy interplay between font height, drawing difference, visible position, etc - // Fonts don't get drawn "down and to the left" like boxes, so some wiggling is needed. - painter.drawText(x*fontWidth, - (y*fontHeight + (fontHeight*0.80)), - QString(m_view->viewdata()[viewDataOffset].byte)); - viewDataOffset++; - } - } -} -#else void DebuggerView::paintEvent(QPaintEvent* event) { // Tell the MAME debug view how much real estate is available QFontMetrics actualFont = fontMetrics(); const double fontWidth = actualFont.width(QString(100, '_')) / 100.; - const int fontHeight = MAX(1, actualFont.height()); + const int fontHeight = MAX(1, actualFont.lineSpacing()); m_view->set_visible_size(debug_view_xy(width()/fontWidth, height()/fontHeight)); @@ -272,7 +162,6 @@ void DebuggerView::paintEvent(QPaintEvent* event) } } } -#endif void DebuggerView::keyPressEvent(QKeyEvent* event) { diff --git a/src/osd/modules/debugger/qt/debuggerview.h b/src/osd/modules/debugger/qt/debuggerview.h index e064b86e9c1..7b1aed6fd2c 100644 --- a/src/osd/modules/debugger/qt/debuggerview.h +++ b/src/osd/modules/debugger/qt/debuggerview.h @@ -3,7 +3,7 @@ #ifndef __DEBUG_QT_DEBUGGER_VIEW_H__ #define __DEBUG_QT_DEBUGGER_VIEW_H__ -#include <QtGui/QtGui> +#include <QtWidgets/QAbstractScrollArea> #include "debug/debugvw.h" diff --git a/src/osd/modules/debugger/qt/deviceinformationwindow.cpp b/src/osd/modules/debugger/qt/deviceinformationwindow.cpp index 303dc650b70..ca6913f0b06 100644 --- a/src/osd/modules/debugger/qt/deviceinformationwindow.cpp +++ b/src/osd/modules/debugger/qt/deviceinformationwindow.cpp @@ -2,6 +2,10 @@ // copyright-holders:Andrew Gardner #define NO_MEM_TRACKING +#include <QtWidgets/QFrame> +#include <QtWidgets/QLabel> +#include <QtWidgets/QVBoxLayout> + #include "deviceinformationwindow.h" diff --git a/src/osd/modules/debugger/qt/deviceinformationwindow.h b/src/osd/modules/debugger/qt/deviceinformationwindow.h index 6ea38de60c3..b0d9898488a 100644 --- a/src/osd/modules/debugger/qt/deviceinformationwindow.h +++ b/src/osd/modules/debugger/qt/deviceinformationwindow.h @@ -3,8 +3,6 @@ #ifndef __DEBUG_QT_DEVICE_INFORMATION_WINDOW_H__ #define __DEBUG_QT_DEVICE_INFORMATION_WINDOW_H__ -#include <QtGui/QtGui> - #include "windowqt.h" //============================================================ diff --git a/src/osd/modules/debugger/qt/deviceswindow.cpp b/src/osd/modules/debugger/qt/deviceswindow.cpp index 0a71fd8fbdf..75d84f4bc7e 100644 --- a/src/osd/modules/debugger/qt/deviceswindow.cpp +++ b/src/osd/modules/debugger/qt/deviceswindow.cpp @@ -128,8 +128,8 @@ DevicesWindow::DevicesWindow(running_machine* machine, QWidget* parent) : m_devices_view->setModel(&m_devices_model); m_devices_view->expandAll(); m_devices_view->resizeColumnToContents(0); - connect(m_devices_view->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &,const QModelIndex &)), this, SLOT(currentRowChanged(const QModelIndex &,const QModelIndex &))); - connect(m_devices_view, SIGNAL(activated(const QModelIndex &)), this, SLOT(activated(const QModelIndex &))); + connect(m_devices_view->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &DevicesWindow::currentRowChanged); + connect(m_devices_view, &QTreeView::activated, this, &DevicesWindow::activated); setCentralWidget(m_devices_view); } diff --git a/src/osd/modules/debugger/qt/deviceswindow.h b/src/osd/modules/debugger/qt/deviceswindow.h index 614dd11edde..13965b9dce5 100644 --- a/src/osd/modules/debugger/qt/deviceswindow.h +++ b/src/osd/modules/debugger/qt/deviceswindow.h @@ -3,7 +3,7 @@ #ifndef __DEBUG_QT_DEVICES_WINDOW_H__ #define __DEBUG_QT_DEVICES_WINDOW_H__ -#include <QtGui/QtGui> +#include <QtWidgets/QTreeView> #include "windowqt.h" diff --git a/src/osd/modules/debugger/qt/logwindow.cpp b/src/osd/modules/debugger/qt/logwindow.cpp index 95b379f9c28..38cb33d0f0b 100644 --- a/src/osd/modules/debugger/qt/logwindow.cpp +++ b/src/osd/modules/debugger/qt/logwindow.cpp @@ -2,6 +2,8 @@ // copyright-holders:Andrew Gardner #define NO_MEM_TRACKING +#include <QtWidgets/QVBoxLayout> + #include "logwindow.h" #include "debug/debugcon.h" diff --git a/src/osd/modules/debugger/qt/logwindow.h b/src/osd/modules/debugger/qt/logwindow.h index 97aa81c41a1..a406cfb8eb3 100644 --- a/src/osd/modules/debugger/qt/logwindow.h +++ b/src/osd/modules/debugger/qt/logwindow.h @@ -3,8 +3,6 @@ #ifndef __DEBUG_QT_LOG_WINDOW_H__ #define __DEBUG_QT_LOG_WINDOW_H__ -#include <QtGui/QtGui> - #include "debuggerview.h" #include "windowqt.h" diff --git a/src/osd/modules/debugger/qt/mainwindow.cpp b/src/osd/modules/debugger/qt/mainwindow.cpp index bb4db219912..12b6a09dd77 100644 --- a/src/osd/modules/debugger/qt/mainwindow.cpp +++ b/src/osd/modules/debugger/qt/mainwindow.cpp @@ -2,6 +2,14 @@ // copyright-holders:Andrew Gardner #define NO_MEM_TRACKING +#include <QtWidgets/QAction> +#include <QtWidgets/QMenu> +#include <QtWidgets/QMenuBar> +#include <QtWidgets/QDockWidget> +#include <QtWidgets/QScrollBar> +#include <QtWidgets/QFileDialog> +#include <QtGui/QCloseEvent> + #include "mainwindow.h" #include "debug/debugcon.h" @@ -23,7 +31,7 @@ MainWindow::MainWindow(running_machine* machine, QWidget* parent) : // The input line m_inputEdit = new QLineEdit(mainWindowFrame); - connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(executeCommand())); + connect(m_inputEdit, &QLineEdit::returnPressed, this, &MainWindow::executeCommandSlot); m_inputEdit->installEventFilter(this); @@ -52,9 +60,9 @@ MainWindow::MainWindow(running_machine* machine, QWidget* parent) : m_breakpointToggleAct->setShortcut(Qt::Key_F9); m_breakpointEnableAct->setShortcut(Qt::SHIFT + Qt::Key_F9); m_runToCursorAct->setShortcut(Qt::Key_F4); - connect(m_breakpointToggleAct, SIGNAL(triggered(bool)), this, SLOT(toggleBreakpointAtCursor(bool))); - connect(m_breakpointEnableAct, SIGNAL(triggered(bool)), this, SLOT(enableBreakpointAtCursor(bool))); - connect(m_runToCursorAct, SIGNAL(triggered(bool)), this, SLOT(runToCursor(bool))); + connect(m_breakpointToggleAct, &QAction::triggered, this, &MainWindow::toggleBreakpointAtCursor); + connect(m_breakpointEnableAct, &QAction::triggered, this, &MainWindow::enableBreakpointAtCursor); + connect(m_runToCursorAct, &QAction::triggered, this, &MainWindow::runToCursor); // Right bar options QActionGroup* rightBarGroup = new QActionGroup(this); @@ -72,7 +80,7 @@ MainWindow::MainWindow(running_machine* machine, QWidget* parent) : rightActEncrypted->setShortcut(QKeySequence("Ctrl+E")); rightActComments->setShortcut(QKeySequence("Ctrl+C")); rightActRaw->setChecked(true); - connect(rightBarGroup, SIGNAL(triggered(QAction*)), this, SLOT(rightBarChanged(QAction*))); + connect(rightBarGroup, &QActionGroup::triggered, this, &MainWindow::rightBarChanged); // Assemble the options menu QMenu* optionsMenu = menuBar()->addMenu("&Options"); @@ -115,7 +123,7 @@ MainWindow::MainWindow(running_machine* machine, QWidget* parent) : dasmDock->setAllowedAreas(Qt::TopDockWidgetArea); m_dasmFrame = new DasmDockWidget(m_machine, dasmDock); dasmDock->setWidget(m_dasmFrame); - connect(m_dasmFrame->view(), SIGNAL(updated()), this, SLOT(dasmViewUpdated())); + connect(m_dasmFrame->view(), &DebuggerView::updated, this, &MainWindow::dasmViewUpdated); addDockWidget(Qt::TopDockWidgetArea, dasmDock); dockMenu->addAction(dasmDock->toggleViewAction()); @@ -300,6 +308,10 @@ void MainWindow::rightBarChanged(QAction* changedTo) m_dasmFrame->view()->viewport()->update(); } +void MainWindow::executeCommandSlot() +{ + executeCommand(true); +} void MainWindow::executeCommand(bool withClear) { @@ -477,8 +489,8 @@ void MainWindow::createImagesMenu() mountAct->setData(QVariant(interfaceIndex)); unmountAct->setObjectName("unmount"); unmountAct->setData(QVariant(interfaceIndex)); - connect(mountAct, SIGNAL(triggered(bool)), this, SLOT(mountImage(bool))); - connect(unmountAct, SIGNAL(triggered(bool)), this, SLOT(unmountImage(bool))); + connect(mountAct, &QAction::triggered, this, &MainWindow::mountImage); + connect(unmountAct, &QAction::triggered, this, &MainWindow::unmountImage); if (!img->exists()) unmountAct->setEnabled(false); diff --git a/src/osd/modules/debugger/qt/mainwindow.h b/src/osd/modules/debugger/qt/mainwindow.h index 53a9969baa2..4a93608772f 100644 --- a/src/osd/modules/debugger/qt/mainwindow.h +++ b/src/osd/modules/debugger/qt/mainwindow.h @@ -3,9 +3,12 @@ #ifndef __DEBUG_QT_MAIN_WINDOW_H__ #define __DEBUG_QT_MAIN_WINDOW_H__ -#include <QtGui/QtGui> #include <vector> +#include <QtWidgets/QLineEdit> +#include <QtWidgets/QVBoxLayout> +#include <QtWidgets/QComboBox> + #include "debug/dvdisasm.h" #include "debuggerview.h" @@ -43,7 +46,7 @@ private slots: void runToCursor(bool changedTo); void rightBarChanged(QAction* changedTo); - void executeCommand(bool withClear=true); + void executeCommandSlot(); void mountImage(bool changedTo); void unmountImage(bool changedTo); @@ -72,6 +75,7 @@ private: int m_historyIndex; std::vector<QString> m_inputHistory; void addToHistory(const QString& command); + void executeCommand(bool withClear); }; diff --git a/src/osd/modules/debugger/qt/memorywindow.cpp b/src/osd/modules/debugger/qt/memorywindow.cpp index 3aee20a0cd0..925c8b86bd1 100644 --- a/src/osd/modules/debugger/qt/memorywindow.cpp +++ b/src/osd/modules/debugger/qt/memorywindow.cpp @@ -2,6 +2,17 @@ // copyright-holders:Andrew Gardner #define NO_MEM_TRACKING +#include <QtGui/QClipboard> +#include <QtGui/QMouseEvent> +#include <QtWidgets/QActionGroup> +#include <QtWidgets/QApplication> +#include <QtWidgets/QHBoxLayout> +#include <QtWidgets/QMenu> +#include <QtWidgets/QMenuBar> +#include <QtWidgets/QScrollBar> +#include <QtWidgets/QToolTip> +#include <QtWidgets/QVBoxLayout> + #include "memorywindow.h" #include "debug/dvmemory.h" @@ -30,13 +41,13 @@ MemoryWindow::MemoryWindow(running_machine* machine, QWidget* parent) : // The input edit m_inputEdit = new QLineEdit(topSubFrame); - connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(expressionSubmitted())); + connect(m_inputEdit, &QLineEdit::returnPressed, this, &MemoryWindow::expressionSubmitted); // The memory space combo box m_memoryComboBox = new QComboBox(topSubFrame); m_memoryComboBox->setObjectName("memoryregion"); m_memoryComboBox->setMinimumWidth(300); - connect(m_memoryComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(memoryRegionChanged(int))); + connect(m_memoryComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &MemoryWindow::memoryRegionChanged); // The main memory window m_memTable = new DebuggerMemView(DVT_MEMORY, m_machine, this); @@ -59,27 +70,45 @@ MemoryWindow::MemoryWindow(running_machine* machine, QWidget* parent) : // // Menu bars // - // Create a byte-chunk group - QActionGroup* chunkGroup = new QActionGroup(this); - chunkGroup->setObjectName("chunkgroup"); - QAction* chunkActOne = new QAction("1-byte chunks", this); - chunkActOne->setObjectName("chunkActOne"); - QAction* chunkActTwo = new QAction("2-byte chunks", this); - chunkActTwo->setObjectName("chunkActTwo"); - QAction* chunkActFour = new QAction("4-byte chunks", this); - chunkActFour->setObjectName("chunkActFour"); - chunkActOne->setCheckable(true); - chunkActTwo->setCheckable(true); - chunkActFour->setCheckable(true); - chunkActOne->setActionGroup(chunkGroup); - chunkActTwo->setActionGroup(chunkGroup); - chunkActFour->setActionGroup(chunkGroup); - chunkActOne->setShortcut(QKeySequence("Ctrl+1")); - chunkActTwo->setShortcut(QKeySequence("Ctrl+2")); - chunkActFour->setShortcut(QKeySequence("Ctrl+4")); - chunkActOne->setChecked(true); - connect(chunkGroup, SIGNAL(triggered(QAction*)), this, SLOT(chunkChanged(QAction*))); + // Create a data format group + QActionGroup* dataFormat = new QActionGroup(this); + dataFormat->setObjectName("dataformat"); + QAction* formatActOne = new QAction("1-byte chunks", this); + QAction* formatActTwo = new QAction("2-byte chunks", this); + QAction* formatActFour = new QAction("4-byte chunks", this); + QAction* formatActEight = new QAction("8-byte chunks", this); + QAction* formatAct32bitFloat = new QAction("32 bit floating point", this); + QAction* formatAct64bitFloat = new QAction("64 bit floating point", this); + QAction* formatAct80bitFloat = new QAction("80 bit floating point", this); + formatActOne->setObjectName("formatActOne"); + formatActTwo->setObjectName("formatActTwo"); + formatActFour->setObjectName("formatActFour"); + formatActEight->setObjectName("formatActEight"); + formatAct32bitFloat->setObjectName("formatAct32bitFloat"); + formatAct64bitFloat->setObjectName("formatAct64bitFloat"); + formatAct80bitFloat->setObjectName("formatAct80bitFloat"); + formatActOne->setCheckable(true); + formatActTwo->setCheckable(true); + formatActFour->setCheckable(true); + formatActEight->setCheckable(true); + formatAct32bitFloat->setCheckable(true); + formatAct64bitFloat->setCheckable(true); + formatAct80bitFloat->setCheckable(true); + formatActOne->setActionGroup(dataFormat); + formatActTwo->setActionGroup(dataFormat); + formatActFour->setActionGroup(dataFormat); + formatActEight->setActionGroup(dataFormat); + formatAct32bitFloat->setActionGroup(dataFormat); + formatAct64bitFloat->setActionGroup(dataFormat); + formatAct80bitFloat->setActionGroup(dataFormat); + formatActOne->setShortcut(QKeySequence("Ctrl+1")); + formatActTwo->setShortcut(QKeySequence("Ctrl+2")); + formatActFour->setShortcut(QKeySequence("Ctrl+4")); + formatActEight->setShortcut(QKeySequence("Ctrl+8")); + formatAct32bitFloat->setShortcut(QKeySequence("Ctrl+9")); + formatActOne->setChecked(true); + connect(dataFormat, &QActionGroup::triggered, this, &MemoryWindow::formatChanged); // Create a address display group QActionGroup* addressGroup = new QActionGroup(this); addressGroup->setObjectName("addressgroup"); @@ -92,26 +121,26 @@ MemoryWindow::MemoryWindow(running_machine* machine, QWidget* parent) : addressActLogical->setShortcut(QKeySequence("Ctrl+G")); addressActPhysical->setShortcut(QKeySequence("Ctrl+Y")); addressActLogical->setChecked(true); - connect(addressGroup, SIGNAL(triggered(QAction*)), this, SLOT(addressChanged(QAction*))); + connect(addressGroup, &QActionGroup::triggered, this, &MemoryWindow::addressChanged); // Create a reverse view radio QAction* reverseAct = new QAction("Reverse View", this); reverseAct->setObjectName("reverse"); reverseAct->setCheckable(true); reverseAct->setShortcut(QKeySequence("Ctrl+R")); - connect(reverseAct, SIGNAL(toggled(bool)), this, SLOT(reverseChanged(bool))); + connect(reverseAct, &QAction::toggled, this, &MemoryWindow::reverseChanged); // Create increase and decrease bytes-per-line actions QAction* increaseBplAct = new QAction("Increase Bytes Per Line", this); QAction* decreaseBplAct = new QAction("Decrease Bytes Per Line", this); increaseBplAct->setShortcut(QKeySequence("Ctrl+P")); decreaseBplAct->setShortcut(QKeySequence("Ctrl+O")); - connect(increaseBplAct, SIGNAL(triggered(bool)), this, SLOT(increaseBytesPerLine(bool))); - connect(decreaseBplAct, SIGNAL(triggered(bool)), this, SLOT(decreaseBytesPerLine(bool))); + connect(increaseBplAct, &QAction::triggered, this, &MemoryWindow::increaseBytesPerLine); + connect(decreaseBplAct, &QAction::triggered, this, &MemoryWindow::decreaseBytesPerLine); // Assemble the options menu QMenu* optionsMenu = menuBar()->addMenu("&Options"); - optionsMenu->addActions(chunkGroup->actions()); + optionsMenu->addActions(dataFormat->actions()); optionsMenu->addSeparator(); optionsMenu->addActions(addressGroup->actions()); optionsMenu->addSeparator(); @@ -141,13 +170,17 @@ void MemoryWindow::memoryRegionChanged(int index) m_memTable->view()->set_source(*m_memTable->view()->source_list().find(index)); m_memTable->viewport()->update(); - // Update the chunk size radio buttons to the memory region's default + // Update the data format radio buttons to the memory region's default debug_view_memory* memView = downcast<debug_view_memory*>(m_memTable->view()); - switch(memView->bytes_per_chunk()) + switch(memView->get_data_format()) { - case 1: chunkSizeMenuItem("chunkActOne")->setChecked(true); break; - case 2: chunkSizeMenuItem("chunkActTwo")->setChecked(true); break; - case 4: chunkSizeMenuItem("chunkActFour")->setChecked(true); break; + case 1: dataFormatMenuItem("formatActOne")->setChecked(true); break; + case 2: dataFormatMenuItem("formatActTwo")->setChecked(true); break; + case 4: dataFormatMenuItem("formatActFour")->setChecked(true); break; + case 8: dataFormatMenuItem("formatActEight")->setChecked(true); break; + case 9: dataFormatMenuItem("formatAct32bitFloat")->setChecked(true); break; + case 10: dataFormatMenuItem("formatAct64bitFloat")->setChecked(true); break; + case 11: dataFormatMenuItem("formatAct80bitFloat")->setChecked(true); break; default: break; } } @@ -171,20 +204,36 @@ void MemoryWindow::expressionSubmitted() } -void MemoryWindow::chunkChanged(QAction* changedTo) +void MemoryWindow::formatChanged(QAction* changedTo) { debug_view_memory* memView = downcast<debug_view_memory*>(m_memTable->view()); if (changedTo->text() == "1-byte chunks") { - memView->set_bytes_per_chunk(1); + memView->set_data_format(1); } else if (changedTo->text() == "2-byte chunks") { - memView->set_bytes_per_chunk(2); + memView->set_data_format(2); } else if (changedTo->text() == "4-byte chunks") { - memView->set_bytes_per_chunk(4); + memView->set_data_format(4); + } + else if (changedTo->text() == "8-byte chunks") + { + memView->set_data_format(8); + } + else if (changedTo->text() == "32 bit floating point") + { + memView->set_data_format(9); + } + else if (changedTo->text() == "64 bit floating point") + { + memView->set_data_format(10); + } + else if (changedTo->text() == "80 bit floating point") + { + memView->set_data_format(11); } m_memTable->viewport()->update(); } @@ -254,7 +303,7 @@ void MemoryWindow::setToCurrentCpu() // I have a hard time storing QActions as class members. This is a substitute. -QAction* MemoryWindow::chunkSizeMenuItem(const QString& itemName) +QAction* MemoryWindow::dataFormatMenuItem(const QString& itemName) { QList<QMenu*> menus = menuBar()->findChildren<QMenu*>(); for (int i = 0; i < menus.length(); i++) @@ -349,13 +398,21 @@ void MemoryWindowQtConfig::buildFromQWidget(QWidget* widget) else if (addressGroup->checkedAction()->text() == "Physical Addresses") m_addressMode = 1; - QActionGroup* chunkGroup = window->findChild<QActionGroup*>("chunkgroup"); - if (chunkGroup->checkedAction()->text() == "1-byte chunks") - m_chunkSize = 0; - else if (chunkGroup->checkedAction()->text() == "2-byte chunks") - m_chunkSize = 1; - else if (chunkGroup->checkedAction()->text() == "4-byte chunks") - m_chunkSize = 2; + QActionGroup* dataFormat = window->findChild<QActionGroup*>("dataformat"); + if (dataFormat->checkedAction()->text() == "1-byte chunks") + m_dataFormat = 0; + else if (dataFormat->checkedAction()->text() == "2-byte chunks") + m_dataFormat = 1; + else if (dataFormat->checkedAction()->text() == "4-byte chunks") + m_dataFormat = 2; + else if (dataFormat->checkedAction()->text() == "8-byte chunks") + m_dataFormat = 3; + else if (dataFormat->checkedAction()->text() == "32 bit floating point") + m_dataFormat = 4; + else if (dataFormat->checkedAction()->text() == "64 bit floating point") + m_dataFormat = 5; + else if (dataFormat->checkedAction()->text() == "80 bit floating point") + m_dataFormat = 6; } @@ -372,8 +429,8 @@ void MemoryWindowQtConfig::applyToQWidget(QWidget* widget) QActionGroup* addressGroup = window->findChild<QActionGroup*>("addressgroup"); addressGroup->actions()[m_addressMode]->trigger(); - QActionGroup* chunkGroup = window->findChild<QActionGroup*>("chunkgroup"); - chunkGroup->actions()[m_chunkSize]->trigger(); + QActionGroup* dataFormat = window->findChild<QActionGroup*>("dataformat"); + dataFormat->actions()[m_dataFormat]->trigger(); } @@ -383,7 +440,7 @@ void MemoryWindowQtConfig::addToXmlDataNode(xml_data_node* node) const xml_set_attribute_int(node, "memoryregion", m_memoryRegion); xml_set_attribute_int(node, "reverse", m_reverse); xml_set_attribute_int(node, "addressmode", m_addressMode); - xml_set_attribute_int(node, "chunksize", m_chunkSize); + xml_set_attribute_int(node, "dataformat", m_dataFormat); } @@ -393,5 +450,5 @@ void MemoryWindowQtConfig::recoverFromXmlNode(xml_data_node* node) m_memoryRegion = xml_get_attribute_int(node, "memoryregion", m_memoryRegion); m_reverse = xml_get_attribute_int(node, "reverse", m_reverse); m_addressMode = xml_get_attribute_int(node, "addressmode", m_addressMode); - m_chunkSize = xml_get_attribute_int(node, "chunksize", m_chunkSize); + m_dataFormat = xml_get_attribute_int(node, "dataformat", m_dataFormat); } diff --git a/src/osd/modules/debugger/qt/memorywindow.h b/src/osd/modules/debugger/qt/memorywindow.h index 5233c619d19..d5fb74f677a 100644 --- a/src/osd/modules/debugger/qt/memorywindow.h +++ b/src/osd/modules/debugger/qt/memorywindow.h @@ -3,7 +3,8 @@ #ifndef __DEBUG_QT_MEMORY_WINDOW_H__ #define __DEBUG_QT_MEMORY_WINDOW_H__ -#include <QtGui/QtGui> +#include <QtWidgets/QLineEdit> +#include <QtWidgets/QComboBox> #include "debuggerview.h" #include "windowqt.h" @@ -26,7 +27,7 @@ public: private slots: void memoryRegionChanged(int index); void expressionSubmitted(); - void chunkChanged(QAction* changedTo); + void formatChanged(QAction* changedTo); void addressChanged(QAction* changedTo); void reverseChanged(bool changedTo); void increaseBytesPerLine(bool changedTo); @@ -36,7 +37,7 @@ private slots: private: void populateComboBox(); void setToCurrentCpu(); - QAction* chunkSizeMenuItem(const QString& itemName); + QAction* dataFormatMenuItem(const QString& itemName); private: @@ -75,7 +76,7 @@ public: WindowQtConfig(WIN_TYPE_MEMORY), m_reverse(0), m_addressMode(0), - m_chunkSize(0), + m_dataFormat(0), m_memoryRegion(0) { } @@ -85,7 +86,7 @@ public: // Settings int m_reverse; int m_addressMode; - int m_chunkSize; + int m_dataFormat; int m_memoryRegion; void buildFromQWidget(QWidget* widget); diff --git a/src/osd/modules/debugger/qt/windowqt.cpp b/src/osd/modules/debugger/qt/windowqt.cpp index e455e586b00..01b4983ec06 100644 --- a/src/osd/modules/debugger/qt/windowqt.cpp +++ b/src/osd/modules/debugger/qt/windowqt.cpp @@ -2,6 +2,9 @@ // copyright-holders:Andrew Gardner #define NO_MEM_TRACKING +#include <QtWidgets/QMenu> +#include <QtWidgets/QMenuBar> + #include "windowqt.h" #include "logwindow.h" #include "dasmwindow.h" @@ -27,71 +30,71 @@ WindowQt::WindowQt(running_machine* machine, QWidget* parent) : // The Debug menu bar QAction* debugActOpenMemory = new QAction("New &Memory Window", this); debugActOpenMemory->setShortcut(QKeySequence("Ctrl+M")); - connect(debugActOpenMemory, SIGNAL(triggered()), this, SLOT(debugActOpenMemory())); + connect(debugActOpenMemory, &QAction::triggered, this, &WindowQt::debugActOpenMemory); QAction* debugActOpenDasm = new QAction("New &Dasm Window", this); debugActOpenDasm->setShortcut(QKeySequence("Ctrl+D")); - connect(debugActOpenDasm, SIGNAL(triggered()), this, SLOT(debugActOpenDasm())); + connect(debugActOpenDasm, &QAction::triggered, this, &WindowQt::debugActOpenDasm); QAction* debugActOpenLog = new QAction("New &Log Window", this); debugActOpenLog->setShortcut(QKeySequence("Ctrl+L")); - connect(debugActOpenLog, SIGNAL(triggered()), this, SLOT(debugActOpenLog())); + connect(debugActOpenLog, &QAction::triggered, this, &WindowQt::debugActOpenLog); QAction* debugActOpenPoints = new QAction("New &Break|Watchpoints Window", this); debugActOpenPoints->setShortcut(QKeySequence("Ctrl+B")); - connect(debugActOpenPoints, SIGNAL(triggered()), this, SLOT(debugActOpenPoints())); + connect(debugActOpenPoints, &QAction::triggered, this, &WindowQt::debugActOpenPoints); QAction* debugActOpenDevices = new QAction("New D&evices Window", this); debugActOpenDevices->setShortcut(QKeySequence("Shift+Ctrl+D")); - connect(debugActOpenDevices, SIGNAL(triggered()), this, SLOT(debugActOpenDevices())); + connect(debugActOpenDevices, &QAction::triggered, this, &WindowQt::debugActOpenDevices); QAction* dbgActRun = new QAction("Run", this); dbgActRun->setShortcut(Qt::Key_F5); - connect(dbgActRun, SIGNAL(triggered()), this, SLOT(debugActRun())); + connect(dbgActRun, &QAction::triggered, this, &WindowQt::debugActRun); QAction* dbgActRunAndHide = new QAction("Run And Hide Debugger", this); dbgActRunAndHide->setShortcut(Qt::Key_F12); - connect(dbgActRunAndHide, SIGNAL(triggered()), this, SLOT(debugActRunAndHide())); + connect(dbgActRunAndHide, &QAction::triggered, this, &WindowQt::debugActRunAndHide); QAction* dbgActRunToNextCpu = new QAction("Run to Next CPU", this); dbgActRunToNextCpu->setShortcut(Qt::Key_F6); - connect(dbgActRunToNextCpu, SIGNAL(triggered()), this, SLOT(debugActRunToNextCpu())); + connect(dbgActRunToNextCpu, &QAction::triggered, this, &WindowQt::debugActRunToNextCpu); QAction* dbgActRunNextInt = new QAction("Run to Next Interrupt on This CPU", this); dbgActRunNextInt->setShortcut(Qt::Key_F7); - connect(dbgActRunNextInt, SIGNAL(triggered()), this, SLOT(debugActRunNextInt())); + connect(dbgActRunNextInt, &QAction::triggered, this, &WindowQt::debugActRunNextInt); QAction* dbgActRunNextVBlank = new QAction("Run to Next VBlank", this); dbgActRunNextVBlank->setShortcut(Qt::Key_F8); - connect(dbgActRunNextVBlank, SIGNAL(triggered()), this, SLOT(debugActRunNextVBlank())); + connect(dbgActRunNextVBlank, &QAction::triggered, this, &WindowQt::debugActRunNextVBlank); QAction* dbgActStepInto = new QAction("Step Into", this); dbgActStepInto->setShortcut(Qt::Key_F11); - connect(dbgActStepInto, SIGNAL(triggered()), this, SLOT(debugActStepInto())); + connect(dbgActStepInto, &QAction::triggered, this, &WindowQt::debugActStepInto); QAction* dbgActStepOver = new QAction("Step Over", this); dbgActStepOver->setShortcut(Qt::Key_F10); - connect(dbgActStepOver, SIGNAL(triggered()), this, SLOT(debugActStepOver())); + connect(dbgActStepOver, &QAction::triggered, this, &WindowQt::debugActStepOver); QAction* dbgActStepOut = new QAction("Step Out", this); dbgActStepOut->setShortcut(QKeySequence("Shift+F11")); - connect(dbgActStepOut, SIGNAL(triggered()), this, SLOT(debugActStepOut())); + connect(dbgActStepOut, &QAction::triggered, this, &WindowQt::debugActStepOut); QAction* dbgActSoftReset = new QAction("Soft Reset", this); dbgActSoftReset->setShortcut(Qt::Key_F3); - connect(dbgActSoftReset, SIGNAL(triggered()), this, SLOT(debugActSoftReset())); + connect(dbgActSoftReset, &QAction::triggered, this, &WindowQt::debugActSoftReset); QAction* dbgActHardReset = new QAction("Hard Reset", this); dbgActHardReset->setShortcut(QKeySequence("Shift+F3")); - connect(dbgActHardReset, SIGNAL(triggered()), this, SLOT(debugActHardReset())); + connect(dbgActHardReset, &QAction::triggered, this, &WindowQt::debugActHardReset); QAction* dbgActClose = new QAction("Close &Window", this); dbgActClose->setShortcut(QKeySequence::Close); - connect(dbgActClose, SIGNAL(triggered()), this, SLOT(debugActClose())); + connect(dbgActClose, &QAction::triggered, this, &WindowQt::debugActClose); QAction* dbgActQuit = new QAction("&Quit", this); dbgActQuit->setShortcut(QKeySequence::Quit); - connect(dbgActQuit, SIGNAL(triggered()), this, SLOT(debugActQuit())); + connect(dbgActQuit, &QAction::triggered, this, &WindowQt::debugActQuit); // Construct the menu QMenu* debugMenu = menuBar()->addMenu("&Debug"); diff --git a/src/osd/modules/debugger/qt/windowqt.h b/src/osd/modules/debugger/qt/windowqt.h index 5b16b47463f..e2e334792b2 100644 --- a/src/osd/modules/debugger/qt/windowqt.h +++ b/src/osd/modules/debugger/qt/windowqt.h @@ -3,7 +3,7 @@ #ifndef __DEBUG_QT_WINDOW_QT_H__ #define __DEBUG_QT_WINDOW_QT_H__ -#include <QtGui/QtGui> +#include <QtWidgets/QMainWindow> #include "emu.h" #include "config.h" diff --git a/src/osd/modules/debugger/win/consolewininfo.h b/src/osd/modules/debugger/win/consolewininfo.h index f788b044873..8281dda4e97 100644 --- a/src/osd/modules/debugger/win/consolewininfo.h +++ b/src/osd/modules/debugger/win/consolewininfo.h @@ -23,9 +23,9 @@ public: void set_cpu(device_t &device); protected: - virtual void recompute_children(); - virtual void update_menu(); - virtual bool handle_command(WPARAM wparam, LPARAM lparam); + virtual void recompute_children() override; + virtual void update_menu() override; + virtual bool handle_command(WPARAM wparam, LPARAM lparam) override; private: enum @@ -41,7 +41,7 @@ private: DEVOPTION_MAX }; - virtual void process_string(char const *string); + virtual void process_string(char const *string) override; static void build_generic_filter(device_image_interface *img, bool is_save, std::string &filter); static void add_filter_entry(std::string &dest, char const *description, char const *extensions); diff --git a/src/osd/modules/debugger/win/debugbaseinfo.cpp b/src/osd/modules/debugger/win/debugbaseinfo.cpp index 66824b9f029..9f53899affd 100644 --- a/src/osd/modules/debugger/win/debugbaseinfo.cpp +++ b/src/osd/modules/debugger/win/debugbaseinfo.cpp @@ -25,7 +25,7 @@ void debugbase_info::smart_set_window_bounds(HWND wnd, HWND parent, RECT const & // first get the current bounds, relative to the parent GetWindowRect(wnd, &curbounds); - if (parent != NULL) + if (parent != nullptr) { RECT parentbounds; GetWindowRect(parent, &parentbounds); @@ -44,7 +44,7 @@ void debugbase_info::smart_set_window_bounds(HWND wnd, HWND parent, RECT const & // if we need to, reposition the window if (flags != (SWP_NOMOVE | SWP_NOSIZE)) - SetWindowPos(wnd, NULL, + SetWindowPos(wnd, nullptr, bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | flags); diff --git a/src/osd/modules/debugger/win/debugwininfo.cpp b/src/osd/modules/debugger/win/debugwininfo.cpp index 79468e3793b..64d178de9f9 100644 --- a/src/osd/modules/debugger/win/debugwininfo.cpp +++ b/src/osd/modules/debugger/win/debugwininfo.cpp @@ -80,7 +80,7 @@ void debugwin_info::prev_view(debugview_info *curview) { for (curindex = numviews - 1; curindex > 0; curindex--) { - if (m_views[curindex] == curview) + if (m_views[curindex].get() == curview) break; } if (curindex < 0) @@ -126,7 +126,7 @@ void debugwin_info::next_view(debugview_info *curview) { for (curindex = numviews - 1; curindex > 0; curindex--) { - if (m_views[curindex] == curview) + if (m_views[curindex].get() == curview) break; } } diff --git a/src/osd/modules/debugger/win/debugwininfo.h b/src/osd/modules/debugger/win/debugwininfo.h index 51acc70018f..c0825bcf8d1 100644 --- a/src/osd/modules/debugger/win/debugwininfo.h +++ b/src/osd/modules/debugger/win/debugwininfo.h @@ -24,7 +24,7 @@ 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 != NULL; } + bool is_valid() const { return m_wnd != nullptr; } debugwin_info *next() const { return m_next; } void set_ignore_char_lparam(LPARAM value) { m_ignore_char_lparam = value >> 16; } @@ -82,6 +82,9 @@ protected: 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, @@ -115,7 +118,7 @@ protected: void draw_border(HDC dc, RECT &bounds); void draw_border(HDC dc, HWND child); - auto_pointer<debugview_info> m_views[MAX_VIEWS]; + std::unique_ptr<debugview_info> m_views[MAX_VIEWS]; private: LRESULT window_proc(UINT message, WPARAM wparam, LPARAM lparam); diff --git a/src/osd/modules/debugger/win/disasmbasewininfo.cpp b/src/osd/modules/debugger/win/disasmbasewininfo.cpp index 783cc8d75fa..f7f516ca24c 100644 --- a/src/osd/modules/debugger/win/disasmbasewininfo.cpp +++ b/src/osd/modules/debugger/win/disasmbasewininfo.cpp @@ -25,7 +25,7 @@ disasmbasewin_info::disasmbasewin_info(debugger_windows_interface &debugger, boo return; m_views[0].reset(global_alloc(disasmview_info(debugger, *this, window()))); - if ((m_views[0] == NULL) || !m_views[0]->is_valid()) + if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); return; @@ -115,10 +115,10 @@ void disasmbasewin_info::update_menu() // first find an existing breakpoint at this address device_debug::breakpoint *bp = debug->breakpoint_first(); - while ((bp != NULL) && (bp->address() != address)) + while ((bp != nullptr) && (bp->address() != address)) bp = bp->next(); - if (bp == NULL) + if (bp == nullptr) { ModifyMenu(menu, ID_TOGGLE_BREAKPOINT, MF_BYCOMMAND, ID_TOGGLE_BREAKPOINT, TEXT("Set breakpoint at cursor\tF9")); ModifyMenu(menu, ID_DISABLE_BREAKPOINT, MF_BYCOMMAND, ID_DISABLE_BREAKPOINT, TEXT("Disable breakpoint at cursor\tShift+F9")); @@ -131,7 +131,7 @@ void disasmbasewin_info::update_menu() else ModifyMenu(menu, ID_DISABLE_BREAKPOINT, MF_BYCOMMAND, ID_DISABLE_BREAKPOINT, TEXT("Enable breakpoint at cursor\tShift+F9")); } - bool const available = (bp != NULL) && (!is_main_console() || dasmview->source_is_visible_cpu()); + bool const available = (bp != nullptr) && (!is_main_console() || dasmview->source_is_visible_cpu()); EnableMenuItem(menu, ID_DISABLE_BREAKPOINT, MF_BYCOMMAND | (available ? MF_ENABLED : MF_GRAYED)); } else @@ -168,7 +168,7 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam) INT32 bpindex = -1; // first find an existing breakpoint at this address - for (device_debug::breakpoint *bp = debug->breakpoint_first(); bp != NULL; bp = bp->next()) + for (device_debug::breakpoint *bp = debug->breakpoint_first(); bp != nullptr; bp = bp->next()) { if (address == bp->address()) { @@ -182,7 +182,7 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam) { if (bpindex == -1) { - bpindex = debug->breakpoint_set(address, NULL, NULL); + bpindex = debug->breakpoint_set(address, nullptr, nullptr); debug_console_printf(machine(), "Breakpoint %X set\n", bpindex); } else @@ -213,11 +213,11 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam) // first find an existing breakpoint at this address device_debug::breakpoint *bp = debug->breakpoint_first(); - while ((bp != NULL) && (bp->address() != address)) + while ((bp != nullptr) && (bp->address() != address)) bp = bp->next(); // if it doesn't exist, add a new one - if (bp != NULL) + if (bp != nullptr) { if (!is_main_console()) { diff --git a/src/osd/modules/debugger/win/disasmbasewininfo.h b/src/osd/modules/debugger/win/disasmbasewininfo.h index 085ec351c98..26cd481b7f6 100644 --- a/src/osd/modules/debugger/win/disasmbasewininfo.h +++ b/src/osd/modules/debugger/win/disasmbasewininfo.h @@ -20,11 +20,11 @@ public: disasmbasewin_info(debugger_windows_interface &debugger, bool is_main_console, LPCSTR title, WNDPROC handler); virtual ~disasmbasewin_info(); - virtual bool handle_key(WPARAM wparam, LPARAM lparam); + virtual bool handle_key(WPARAM wparam, LPARAM lparam) override; protected: - virtual void update_menu(); - virtual bool handle_command(WPARAM wparam, LPARAM lparam); + virtual void update_menu() override; + virtual bool handle_command(WPARAM wparam, LPARAM lparam) override; }; #endif diff --git a/src/osd/modules/debugger/win/disasmwininfo.h b/src/osd/modules/debugger/win/disasmwininfo.h index e55b74ba3c1..6297b628168 100644 --- a/src/osd/modules/debugger/win/disasmwininfo.h +++ b/src/osd/modules/debugger/win/disasmwininfo.h @@ -21,12 +21,12 @@ public: virtual ~disasmwin_info(); protected: - virtual void recompute_children(); - virtual bool handle_command(WPARAM wparam, LPARAM lparam); - virtual void draw_contents(HDC dc); + virtual void recompute_children() override; + virtual bool handle_command(WPARAM wparam, LPARAM lparam) override; + virtual void draw_contents(HDC dc) override; private: - virtual void process_string(char const *string); + virtual void process_string(char const *string) override; void update_caption(); diff --git a/src/osd/modules/debugger/win/editwininfo.h b/src/osd/modules/debugger/win/editwininfo.h index f1b729a1f59..5da80597272 100644 --- a/src/osd/modules/debugger/win/editwininfo.h +++ b/src/osd/modules/debugger/win/editwininfo.h @@ -20,9 +20,9 @@ public: editwin_info(debugger_windows_interface &debugger, bool is_main_console, LPCSTR title, WNDPROC handler); virtual ~editwin_info(); - virtual bool restore_field(HWND wnd); + virtual bool restore_field(HWND wnd) override; - virtual bool set_default_focus(); + virtual bool set_default_focus() override; protected: static DWORD const COMBO_BOX_STYLE = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_VSCROLL; @@ -33,7 +33,7 @@ protected: void editwnd_select_all(); void set_edit_defstr(char const *string) { m_edit_defstr = string; } - virtual void draw_contents(HDC dc); + virtual void draw_contents(HDC dc) override; private: virtual void process_string(char const *string) = 0; diff --git a/src/osd/modules/debugger/win/logwininfo.cpp b/src/osd/modules/debugger/win/logwininfo.cpp index 6610e8a296f..2f631e199d3 100644 --- a/src/osd/modules/debugger/win/logwininfo.cpp +++ b/src/osd/modules/debugger/win/logwininfo.cpp @@ -12,13 +12,13 @@ logwin_info::logwin_info(debugger_windows_interface &debugger) : - debugwin_info(debugger, false, std::string("Errorlog: ").append(debugger.machine().system().description).append(" [").append(debugger.machine().system().name).append("]").c_str(), NULL) + debugwin_info(debugger, false, std::string("Errorlog: ").append(debugger.machine().system().description).append(" [").append(debugger.machine().system().name).append("]").c_str(), nullptr) { if (!window()) return; m_views[0].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_LOG))); - if ((m_views[0] == NULL) || !m_views[0]->is_valid()) + if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); return; diff --git a/src/osd/modules/debugger/win/memoryviewinfo.cpp b/src/osd/modules/debugger/win/memoryviewinfo.cpp index 644b429e0d9..7bd4baa6448 100644 --- a/src/osd/modules/debugger/win/memoryviewinfo.cpp +++ b/src/osd/modules/debugger/win/memoryviewinfo.cpp @@ -22,9 +22,9 @@ memoryview_info::~memoryview_info() } -UINT8 memoryview_info::bytes_per_chunk() const +UINT8 memoryview_info::data_format() const { - return view<debug_view_memory>()->bytes_per_chunk(); + return view<debug_view_memory>()->get_data_format(); } @@ -51,9 +51,9 @@ void memoryview_info::set_expression(char const *string) view<debug_view_memory>()->set_expression(string); } -void memoryview_info::set_bytes_per_chunk(UINT8 chunkbytes) +void memoryview_info::set_data_format(UINT8 dataformat) { - view<debug_view_memory>()->set_bytes_per_chunk(chunkbytes); + view<debug_view_memory>()->set_data_format(dataformat); } void memoryview_info::set_chunks_per_row(UINT32 rowchunks) diff --git a/src/osd/modules/debugger/win/memoryviewinfo.h b/src/osd/modules/debugger/win/memoryviewinfo.h index 8089d050a4e..2245ace307d 100644 --- a/src/osd/modules/debugger/win/memoryviewinfo.h +++ b/src/osd/modules/debugger/win/memoryviewinfo.h @@ -20,14 +20,14 @@ public: memoryview_info(debugger_windows_interface &debugger, debugwin_info &owner, HWND parent); virtual ~memoryview_info(); - UINT8 bytes_per_chunk() const; + UINT8 data_format() const; UINT32 chunks_per_row() const; bool reverse() const; bool ascii() const; bool physical() const; void set_expression(char const *string); - void set_bytes_per_chunk(UINT8 chunkbytes); + void set_data_format(UINT8 dataformat); void set_chunks_per_row(UINT32 rowchunks); void set_reverse(bool reverse); void set_physical(bool physical); diff --git a/src/osd/modules/debugger/win/memorywininfo.cpp b/src/osd/modules/debugger/win/memorywininfo.cpp index e925dbaa26b..b6d2b83614b 100644 --- a/src/osd/modules/debugger/win/memorywininfo.cpp +++ b/src/osd/modules/debugger/win/memorywininfo.cpp @@ -35,6 +35,9 @@ memorywin_info::memorywin_info(debugger_windows_interface &debugger) : AppendMenu(optionsmenu, MF_ENABLED, ID_2_BYTE_CHUNKS, TEXT("2-byte chunks\tCtrl+2")); AppendMenu(optionsmenu, MF_ENABLED, ID_4_BYTE_CHUNKS, TEXT("4-byte chunks\tCtrl+4")); AppendMenu(optionsmenu, MF_ENABLED, ID_8_BYTE_CHUNKS, TEXT("8-byte chunks\tCtrl+8")); + AppendMenu(optionsmenu, MF_ENABLED, ID_FLOATING_POINT_32BIT, TEXT("32 bit floating point\tCtrl+9")); + AppendMenu(optionsmenu, MF_ENABLED, ID_FLOATING_POINT_64BIT, TEXT("64 bit floating point")); + AppendMenu(optionsmenu, MF_ENABLED, ID_FLOATING_POINT_80BIT, TEXT("80 bit floating point")); AppendMenu(optionsmenu, MF_DISABLED | MF_SEPARATOR, 0, TEXT("")); AppendMenu(optionsmenu, MF_ENABLED, ID_LOGICAL_ADDRESSES, TEXT("Logical Addresses\tCtrl+L")); AppendMenu(optionsmenu, MF_ENABLED, ID_PHYSICAL_ADDRESSES, TEXT("Physical Addresses\tCtrl+Y")); @@ -97,6 +100,10 @@ bool memorywin_info::handle_key(WPARAM wparam, LPARAM lparam) SendMessage(window(), WM_COMMAND, ID_8_BYTE_CHUNKS, 0); return true; + case '9': + SendMessage(window(), WM_COMMAND, ID_FLOATING_POINT_32BIT, 0); + return true; + case 'L': SendMessage(window(), WM_COMMAND, ID_LOGICAL_ADDRESSES, 0); return true; @@ -172,10 +179,13 @@ void memorywin_info::update_menu() memoryview_info *const memview = downcast<memoryview_info *>(m_views[0].get()); HMENU const menu = GetMenu(window()); - CheckMenuItem(menu, ID_1_BYTE_CHUNKS, MF_BYCOMMAND | (memview->bytes_per_chunk() == 1 ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(menu, ID_2_BYTE_CHUNKS, MF_BYCOMMAND | (memview->bytes_per_chunk() == 2 ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(menu, ID_4_BYTE_CHUNKS, MF_BYCOMMAND | (memview->bytes_per_chunk() == 4 ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(menu, ID_8_BYTE_CHUNKS, MF_BYCOMMAND | (memview->bytes_per_chunk() == 8 ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(menu, ID_1_BYTE_CHUNKS, MF_BYCOMMAND | (memview->data_format() == 1 ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(menu, ID_2_BYTE_CHUNKS, MF_BYCOMMAND | (memview->data_format() == 2 ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(menu, ID_4_BYTE_CHUNKS, MF_BYCOMMAND | (memview->data_format() == 4 ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(menu, ID_8_BYTE_CHUNKS, MF_BYCOMMAND | (memview->data_format() == 8 ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(menu, ID_FLOATING_POINT_32BIT, MF_BYCOMMAND | (memview->data_format() == 9 ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(menu, ID_FLOATING_POINT_64BIT, MF_BYCOMMAND | (memview->data_format() == 10 ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(menu, ID_FLOATING_POINT_80BIT, MF_BYCOMMAND | (memview->data_format() == 11 ? MF_CHECKED : MF_UNCHECKED)); CheckMenuItem(menu, ID_LOGICAL_ADDRESSES, MF_BYCOMMAND | (memview->physical() ? MF_UNCHECKED : MF_CHECKED)); CheckMenuItem(menu, ID_PHYSICAL_ADDRESSES, MF_BYCOMMAND | (memview->physical() ? MF_CHECKED : MF_UNCHECKED)); CheckMenuItem(menu, ID_REVERSE_VIEW, MF_BYCOMMAND | (memview->reverse() ? MF_CHECKED : MF_UNCHECKED)); @@ -209,19 +219,31 @@ bool memorywin_info::handle_command(WPARAM wparam, LPARAM lparam) switch (LOWORD(wparam)) { case ID_1_BYTE_CHUNKS: - memview->set_bytes_per_chunk(1); + memview->set_data_format(1); return true; case ID_2_BYTE_CHUNKS: - memview->set_bytes_per_chunk(2); + memview->set_data_format(2); return true; case ID_4_BYTE_CHUNKS: - memview->set_bytes_per_chunk(4); + memview->set_data_format(4); return true; case ID_8_BYTE_CHUNKS: - memview->set_bytes_per_chunk(8); + memview->set_data_format(8); + return true; + + case ID_FLOATING_POINT_32BIT: + memview->set_data_format(9); + return true; + + case ID_FLOATING_POINT_64BIT: + memview->set_data_format(10); + return true; + + case ID_FLOATING_POINT_80BIT: + memview->set_data_format(11); return true; case ID_LOGICAL_ADDRESSES: diff --git a/src/osd/modules/debugger/win/memorywininfo.h b/src/osd/modules/debugger/win/memorywininfo.h index a52315829b8..f0fe535cf16 100644 --- a/src/osd/modules/debugger/win/memorywininfo.h +++ b/src/osd/modules/debugger/win/memorywininfo.h @@ -20,16 +20,16 @@ public: memorywin_info(debugger_windows_interface &debugger); virtual ~memorywin_info(); - virtual bool handle_key(WPARAM wparam, LPARAM lparam); + virtual bool handle_key(WPARAM wparam, LPARAM lparam) override; protected: - virtual void recompute_children(); - virtual void update_menu(); - virtual bool handle_command(WPARAM wparam, LPARAM lparam); - virtual void draw_contents(HDC dc); + virtual void recompute_children() override; + virtual void update_menu() override; + virtual bool handle_command(WPARAM wparam, LPARAM lparam) override; + virtual void draw_contents(HDC dc) override; private: - virtual void process_string(char const *string); + virtual void process_string(char const *string) override; void update_caption(); diff --git a/src/osd/modules/debugger/win/pointswininfo.h b/src/osd/modules/debugger/win/pointswininfo.h index a6c944bc160..8ba1b31fc00 100644 --- a/src/osd/modules/debugger/win/pointswininfo.h +++ b/src/osd/modules/debugger/win/pointswininfo.h @@ -20,11 +20,11 @@ public: pointswin_info(debugger_windows_interface &debugger); virtual ~pointswin_info(); - virtual bool handle_key(WPARAM wparam, LPARAM lparam); + virtual bool handle_key(WPARAM wparam, LPARAM lparam) override; protected: - virtual void update_menu(); - virtual bool handle_command(WPARAM wparam, LPARAM lparam); + virtual void update_menu() override; + virtual bool handle_command(WPARAM wparam, LPARAM lparam) override; }; #endif diff --git a/src/osd/modules/debugger/win/uimetrics.cpp b/src/osd/modules/debugger/win/uimetrics.cpp index aebbf1cfe06..7da41d6f79f 100644 --- a/src/osd/modules/debugger/win/uimetrics.cpp +++ b/src/osd/modules/debugger/win/uimetrics.cpp @@ -12,7 +12,7 @@ ui_metrics::ui_metrics(osd_options const &options) : - m_debug_font(NULL), + m_debug_font(nullptr), m_debug_font_height(0), m_debug_font_width(0), m_debug_font_ascent(0), |
