diff options
Diffstat (limited to 'src/osd/modules/debugger/debugint.cpp')
-rw-r--r-- | src/osd/modules/debugger/debugint.cpp | 437 |
1 files changed, 343 insertions, 94 deletions
diff --git a/src/osd/modules/debugger/debugint.cpp b/src/osd/modules/debugger/debugint.cpp index 1f03d125a31..40a6e2a297b 100644 --- a/src/osd/modules/debugger/debugint.cpp +++ b/src/osd/modules/debugger/debugint.cpp @@ -17,6 +17,8 @@ #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" @@ -60,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 { @@ -156,11 +158,12 @@ class DView_edit DISABLE_COPYING(DView_edit); public: - DView_edit(): active(0), container(nullptr) { } + DView_edit(DView* owner): active(0), container(nullptr), owner(owner) { } ~DView_edit() { } int active; render_container * container; std::string str; + DView* owner; }; /*************************************************************************** @@ -180,7 +183,8 @@ public: 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); @@ -273,6 +277,8 @@ static DView * focus_view; static ui_menu * menu; static DView_edit * cur_editor; +static int win_count; +static void* menu_sel; // selected item in the menu static void set_focus_view(DView *dv) { @@ -287,7 +293,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); } } @@ -381,7 +387,7 @@ static void dview_draw_box(DView *dv, int rtype, int x, int y, int w, int h, rgb 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, @@ -447,10 +453,10 @@ static void dview_draw_hsb(DView *dv) static void dview_draw_vsb(DView *dv) { - int vt; - int ts; + INT64 vt; + INT64 ts; //int sz = SLIDER_SIZE; - int sz; + INT64 sz; rectangle r; adjustment *sb = &dv->vsb; @@ -522,9 +528,12 @@ static void dview_draw_title(DView *dv) for (i = 0; i<strlen(dv->title.c_str()); i++) { - dview_draw_char(dv, RECT_DVIEW_TITLE, str_x, + 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; } } @@ -749,20 +758,18 @@ static void dview_draw(DView *dv) 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); - if (bg != bg_base) - dview_draw_box(dv, RECT_DVIEW_CLIENT, xx, yy, - debug_font_width, debug_font_height, bg); - dview_draw_char(dv, RECT_DVIEW_CLIENT, xx, yy, debug_font_height, fg, s); + 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); + if (v != ' ') + dview_draw_char(dv, RECT_DVIEW_CLIENT, xx, yy, debug_font_height, fg, s); xx += debug_font_width; viewdata++; } @@ -782,6 +789,7 @@ static void dview_size_allocate(DView *dv) debug_view_xy size, pos, col, vsize; render_container::user_settings rcus; rectangle r; + std::string title; dv->container->get_user_settings(rcus); rcus.m_xoffset = (float) dv->ofs_x / (float) dv->rt_width; @@ -799,12 +807,12 @@ static void dview_size_allocate(DView *dv) 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); + dv->vsb.visible = ((INT64)size.y * (INT64)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; @@ -912,9 +920,9 @@ void debug_internal::init_debugger(running_machine &machine) debug_font = m_machine->render().font_alloc("Courier New"); else debug_font = m_machine->render().font_alloc(font_name); - + debug_font_width = 0; - if(font_size == 0) + if(font_size < 8) debug_font_height = 16; // default else debug_font_height = font_size; @@ -1007,6 +1015,10 @@ static void on_memory_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; + ndv->bounds.setx(0,500); + win_count++; + dview_set_state(ndv,VIEW_STATE_VISIBLE,true); set_focus_view(ndv); } @@ -1023,8 +1035,10 @@ 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++; + dview_set_state(ndv,VIEW_STATE_VISIBLE,true); set_focus_view(ndv); - } static void on_disasm_cpu_activate(DView *dv, const ui_menu_event *event) @@ -1050,6 +1064,40 @@ 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++; + dview_set_state(ndv,VIEW_STATE_VISIBLE,true); + 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++; + dview_set_state(ndv,VIEW_STATE_VISIBLE,true); + 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++; + dview_set_state(ndv,VIEW_STATE_VISIBLE,true); set_focus_view(ndv); } @@ -1057,6 +1105,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); } @@ -1167,7 +1216,7 @@ 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; + int idx = 0; int order[7] = { 1, 2, 4, 8, 9, 10, 11 }; for(int x=0; x<7; x++) @@ -1175,11 +1224,11 @@ static void on_memory_data_format(DView *dv, const ui_menu_event *event) if(order[x] == format) idx = x; } - + if (event->iptkey == IPT_UI_RIGHT) { idx++; - if(idx >= 7) + if(idx >= 7) idx = 0; memview->set_data_format(order[idx]); dview_set_state(dv, VIEW_STATE_NEEDS_UPDATE, TRUE); @@ -1187,7 +1236,7 @@ static void on_memory_data_format(DView *dv, const ui_menu_event *event) if (event->iptkey == IPT_UI_LEFT) { idx--; - if(idx < 0) + if(idx < 0) idx = 6; memview->set_data_format(order[idx]); dview_set_state(dv, VIEW_STATE_NEEDS_UPDATE, TRUE); @@ -1226,34 +1275,33 @@ static void on_memory_region(DView *dv, const ui_menu_event *event) static void render_editor(DView_edit *editor) { - float width, maxwidth; - float x1, y1, x2, y2; - - 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, nullptr); - width += 2 * UI_BOX_LR_BORDER; - maxwidth = MAX(width, 0.5f); - - /* compute our bounds */ - x1 = 0.5f - 0.5f * maxwidth; - x2 = x1 + maxwidth; - y1 = 0.25f; - y2 = 0.45f - UI_BOX_TB_BORDER; - - /* draw a box */ - editor->container->manager().machine().ui().draw_outlined_box(editor->container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); - - /* take off the borders */ - x1 += UI_BOX_LR_BORDER; - x2 -= UI_BOX_LR_BORDER; - y1 += UI_BOX_TB_BORDER; - - /* 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, nullptr, nullptr); - + 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; + } } /*------------------------------------------------- @@ -1275,8 +1323,11 @@ static void CreateMainMenu(running_machine &machine) std::string title; if (menu) + { + menu_sel = menu->get_selection(); global_free( menu); - menu = global_alloc_clear(ui_menu_debug(machine, &machine.render().ui_container())); + } + menu = global_alloc_clear<ui_menu_debug>(machine, &machine.render().ui_container()); switch (focus_view->type) { @@ -1295,6 +1346,12 @@ 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(), nullptr, MENU_FLAG_DISABLE, nullptr); @@ -1349,25 +1406,28 @@ static void CreateMainMenu(running_machine &machine) /* add input menu items */ - 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 Memory Window", "[Ctrl+M]", 0, (void *)on_memory_window_activate); + menu->item_append("New Disassembly Window", "[Ctrl+D]", 0, (void *)on_disassembly_window_activate); + menu->item_append("New Error Log Window", "[Ctrl+L]", 0, (void *)on_log_window_activate); + menu->item_append("New Breakpoints Window", "[Ctrl+B]", 0, (void *)on_bp_window_activate); + menu->item_append("New Watchpoints Window", "[Ctrl+W]", 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("Run", "[F5]", 0, (void *)on_run_activate); + menu->item_append("Run and Hide Debugger", "[F12]", 0, (void *)on_run_h_activate); + menu->item_append("Run to Next CPU", "[F6]", 0, (void *)on_run_cpu_activate); + menu->item_append("Run until Next Interrupt on This CPU", "[F7]", 0, (void *)on_run_irq_activate); + menu->item_append("Run until Next VBLANK", "[F8]", 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("Step Into", "[F11]", 0, (void *)on_step_into_activate); + menu->item_append("Step Over", "[F10]", 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("Soft Reset", "[F3]", 0, (void *)on_soft_reset_activate); + menu->item_append("Hard Reset", "[Shift+F3]", 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", nullptr, 0, (void *)on_close_activate); + menu->item_append("Close Window", "[Shift+F4]", 0, (void *)on_close_activate); menu->item_append("Exit", nullptr, 0, (void *)on_exit_activate); + menu->set_selection(menu_sel); } static int map_point(DView *dv, INT32 target_x, INT32 target_y, INT32 *mapped_x, INT32 *mapped_y) @@ -1403,7 +1463,7 @@ static void handle_mouse(running_machine &machine) if (menu != nullptr) return; - mouse_target = ui_input_find_mouse(machine, &x, &y, &button); + mouse_target = machine.ui_input().find_mouse(&x, &y, &button); if (mouse_target == nullptr) return; @@ -1419,6 +1479,186 @@ static void handle_mouse(running_machine &machine) } } +static void handle_keys(running_machine &machine) +{ + if (menu != nullptr) + return; + + // global keys + if(machine.input().code_pressed_once(KEYCODE_F3)) + { + if(machine.input().code_pressed(KEYCODE_LSHIFT)) + machine.schedule_hard_reset(); + else + { + machine.schedule_soft_reset(); + debug_cpu_get_visible_cpu(machine)->debug()->go(); + } + } + + if(machine.input().code_pressed_once(KEYCODE_F5)) + debug_cpu_get_visible_cpu(machine)->debug()->go(); + if(machine.input().code_pressed_once(KEYCODE_F6)) + debug_cpu_get_visible_cpu(machine)->debug()->go_next_device(); + if(machine.input().code_pressed_once(KEYCODE_F7)) + debug_cpu_get_visible_cpu(machine)->debug()->go_interrupt(); + if(machine.input().code_pressed_once(KEYCODE_F8)) + debug_cpu_get_visible_cpu(machine)->debug()->go_vblank(); + if(machine.input().code_pressed_once(KEYCODE_F10)) + debug_cpu_get_visible_cpu(machine)->debug()->single_step_over(); + if(machine.input().code_pressed_once(KEYCODE_F11)) + debug_cpu_get_visible_cpu(machine)->debug()->single_step(); + if(machine.input().code_pressed_once(KEYCODE_F12)) + { + debug_hide_all(); + debug_cpu_get_visible_cpu(machine)->debug()->go(); + } + + // TODO: make common functions to be shared here and with the menu callbacks + if(machine.input().code_pressed_once(KEYCODE_D)) + { + if(machine.input().code_pressed(KEYCODE_LCONTROL)) + { + DView *ndv; + render_target *target; + const debug_view_source *source; + + target = &machine.render().ui_target(); + + ndv = dview_alloc(target, machine, DVT_DISASSEMBLY, 0); + ndv->editor.active = TRUE; + ndv->editor.container = &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); + } + } + if(machine.input().code_pressed_once(KEYCODE_M)) + { + if(machine.input().code_pressed(KEYCODE_LCONTROL)) + { + DView *ndv; + render_target *target; + const debug_view_source *source; + + target = &machine.render().ui_target(); + + ndv = dview_alloc(target, machine, DVT_MEMORY, 0); + ndv->editor.active = TRUE; + ndv->editor.container = &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); + } + } + if(machine.input().code_pressed_once(KEYCODE_L)) + { + if(machine.input().code_pressed(KEYCODE_LCONTROL)) + { + DView *ndv; + render_target *target; + + target = &machine.render().ui_target(); + ndv = dview_alloc(target, 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); + } + } + if(machine.input().code_pressed_once(KEYCODE_B)) + { + if(machine.input().code_pressed(KEYCODE_LCONTROL)) + { + DView *ndv; + render_target *target; + + target = &machine.render().ui_target(); + ndv = dview_alloc(target, 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); + } + } + if(machine.input().code_pressed_once(KEYCODE_W)) + { + if(machine.input().code_pressed(KEYCODE_LCONTROL)) + { + DView *ndv; + render_target *target; + + target = &machine.render().ui_target(); + ndv = dview_alloc(target, 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); + } + } + if (!dview_is_state(focus_view, VIEW_STATE_FOLLOW_CPU)) + { + if(machine.input().code_pressed_once(KEYCODE_F4)) + { + if(machine.input().code_pressed(KEYCODE_LSHIFT)) // use shift+F4, as ctrl+F4 is used to toggle keepaspect. + { + DView* dv = focus_view; + set_focus_view(focus_view->next); + win_count--; + dview_free(dv); + } + } + } + + + // pass keypresses to debug view with focus + if(machine.input().code_pressed_once(KEYCODE_UP)) + focus_view->view->process_char(DCH_UP); + if(machine.input().code_pressed_once(KEYCODE_DOWN)) + focus_view->view->process_char(DCH_DOWN); + if(machine.input().code_pressed_once(KEYCODE_LEFT)) + { + if(machine.input().code_pressed(KEYCODE_LCONTROL)) + focus_view->view->process_char(DCH_CTRLLEFT); + else + focus_view->view->process_char(DCH_LEFT); + } + if(machine.input().code_pressed_once(KEYCODE_RIGHT)) + { + if(machine.input().code_pressed(KEYCODE_LCONTROL)) + focus_view->view->process_char(DCH_CTRLRIGHT); + else + focus_view->view->process_char(DCH_RIGHT); + } + if(machine.input().code_pressed_once(KEYCODE_PGUP)) + focus_view->view->process_char(DCH_PUP); + if(machine.input().code_pressed_once(KEYCODE_PGDN)) + focus_view->view->process_char(DCH_PDOWN); + if(machine.input().code_pressed_once(KEYCODE_HOME)) + { + if(machine.input().code_pressed(KEYCODE_LCONTROL)) + focus_view->view->process_char(DCH_CTRLHOME); + else + focus_view->view->process_char(DCH_HOME); + } + if(machine.input().code_pressed_once(KEYCODE_END)) + { + if(machine.input().code_pressed(KEYCODE_LCONTROL)) + focus_view->view->process_char(DCH_CTRLEND); + else + focus_view->view->process_char(DCH_END); + } +} + /*------------------------------------------------- handle_editor - handle the editor @@ -1426,12 +1666,12 @@ static void handle_mouse(running_machine &machine) static void handle_editor(running_machine &machine) { - if (focus_view->editor.active) + if (focus_view->editor.active && dview_is_state(focus_view, VIEW_STATE_VISIBLE)) { ui_event event; /* loop while we have interesting events */ - while (ui_input_pop_event(machine, &event)) + while (machine.ui_input().pop_event(&event)) { switch (event.event_type) { @@ -1462,13 +1702,13 @@ static void handle_editor(running_machine &machine) if (cur_editor != nullptr) { render_editor(cur_editor); - if (ui_input_pressed(machine, IPT_UI_SELECT)) + if (machine.ui_input().pressed(IPT_UI_SELECT)) { process_string(focus_view, focus_view->editor.str.c_str()); focus_view->editor.str = ""; cur_editor = nullptr; } - if (ui_input_pressed(machine, IPT_UI_CANCEL)) + if (machine.ui_input().pressed(IPT_UI_CANCEL)) cur_editor = nullptr; } } @@ -1485,7 +1725,7 @@ static void handle_menus(running_machine &machine) const ui_menu_event *event; machine.render().ui_container().empty(); - ui_input_frame_update(machine); + machine.ui_input().frame_update(); if (menu != nullptr) { /* process the menu */ @@ -1498,8 +1738,9 @@ static void handle_menus(running_machine &machine) //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)) + else if (machine.ui_input().pressed(IPT_UI_CONFIGURE)) { + menu_sel = menu->get_selection(); global_free(menu); menu = nullptr; } @@ -1507,7 +1748,7 @@ static void handle_menus(running_machine &machine) else { /* turn on menus if requested */ - if (ui_input_pressed(machine, IPT_UI_CONFIGURE)) + if (machine.ui_input().pressed(IPT_UI_CONFIGURE)) CreateMainMenu(machine); /* turn on editor if requested */ //if (ui_input_pressed(machine, IPT_UI_UP) && focus_view->editor.active) @@ -1564,15 +1805,10 @@ static void dview_update_view(DView *dv) static void update_views(void) { - DView *dv, *prev; + DView *dv; - LIST_GET_LAST(list, dv); - while (dv != nullptr) - { + for(dv=list;dv!=nullptr;dv=dv->next) dview_update_view(dv); - LIST_GET_PREVIOUS(list, dv, prev); - dv = prev; - } } @@ -1583,30 +1819,43 @@ void debug_internal::wait_for_debugger(device_t &device, bool firststop) 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(); - disassembly->ofs_x = 300; + disassembly->ofs_x = 500; + disassembly->bounds.setx(0,600); + win_count++; - dview_alloc(target, device.machine(), DVT_STATE, VIEW_STATE_FOLLOW_CPU); + DView *statewin = dview_alloc(target, device.machine(), DVT_STATE, VIEW_STATE_FOLLOW_CPU); + statewin->ofs_x = 300; + statewin->bounds.set(0,200,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 = 600; + console->ofs_x = 500; + console->ofs_y = 300; + win_count++; set_focus_view(console); } followers_set_cpu(&device); - debug_show_all(); + if(firststop) + { + debug_show_all(); + device.machine().ui_input().reset(); + } //ui_update_and_render(device.machine(), device.machine().render().ui_container()()); update_views(); device.machine().osd().update(false); handle_menus(device.machine()); handle_mouse(device.machine()); + handle_keys(device.machine()); //osd_sleep(osd_ticks_per_second()/60); } |