summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debugint/debugint.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2011-03-29 15:50:04 +0000
committer Aaron Giles <aaron@aarongiles.com>2011-03-29 15:50:04 +0000
commit2ad50720237fdd19cf5ab45b8cb6bb21119c00b8 (patch)
treedb21eee69668a06abc3f310ebbd51f5dbadf2de7 /src/emu/debugint/debugint.c
parentb72cf3c5702b749c7bf26383ff05a9ab55022d31 (diff)
BIG update.
Remove redundant machine items from address_space and device_t. Neither machine nor m_machine are directly accessible anymore. Instead a new getter machine() is available which returns a machine reference. So: space->machine->xxx ==> space->machine().xxx device->machine->yyy ==> device->machine().yyy Globally changed all running_machine pointers to running_machine references. Any function/method that takes a running_machine takes it as a required parameter (1 or 2 exceptions). Being consistent here gets rid of a lot of odd &machine or *machine, but it does mean a very large bulk change across the project. Structs which have a running_machine * now have that variable renamed to m_machine, and now have a shiny new machine() method that works like the space and device methods above. Since most of these are things that should eventually be devices anyway, consider this a step in that direction. 98% of the update was done with regex searches. The changes are architected such that the compiler will catch the remaining errors: // find things that use an embedded machine directly and replace // with a machine() getter call S: ->machine-> R: ->machine\(\)\. // do the same if via a reference S: \.machine-> R: \.machine\(\)\. // convert function parameters to running_machine & S: running_machine \*machine([^;]) R: running_machine \&machine\1 // replace machine-> with machine. S: machine-> R: machine\. // replace &machine() with machine() S: \&([()->a-z0-9_]+machine\(\)) R: \1 // sanity check: look for this used as a cast (running_machine &) // and change to this: *(running_machine *)
Diffstat (limited to 'src/emu/debugint/debugint.c')
-rw-r--r--src/emu/debugint/debugint.c104
1 files changed, 53 insertions, 51 deletions
diff --git a/src/emu/debugint/debugint.c b/src/emu/debugint/debugint.c
index a6fedf61500..82a393105f0 100644
--- a/src/emu/debugint/debugint.c
+++ b/src/emu/debugint/debugint.c
@@ -150,7 +150,7 @@ class DView
DISABLE_COPYING(DView);
public:
- DView(render_target *target, running_machine *machine, debug_view_type type, int flags)
+ DView(render_target *target, running_machine &machine, debug_view_type type, int flags)
: next(NULL),
type(0),
state(0),
@@ -160,9 +160,9 @@ public:
this->target = target;
//dv->container = render_target_get_component_container(target, name, &pos);
this->container = target->debug_alloc();
- this->view = machine->debug_view().alloc_view(type, dview_update, this);
+ this->view = machine.debug_view().alloc_view(type, dview_update, this);
this->type = type;
- this->machine = machine;
+ this->m_machine = &machine;
this->state = flags | VIEW_STATE_NEEDS_UPDATE;
// initial size
@@ -186,16 +186,18 @@ public:
~DView()
{
this->target->debug_free(*this->container);
- machine->debug_view().free_view(*this->view);
+ m_machine->debug_view().free_view(*this->view);
}
+ running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
+
DView * next;
int type;
debug_view * view;
render_container * container;
render_target * target;
- running_machine * machine;
+ running_machine * m_machine;
int state;
// drawing
rectangle bounds;
@@ -299,7 +301,7 @@ static void set_focus_view(DView *dv)
}
}
-static DView *dview_alloc(render_target *target, running_machine *machine, debug_view_type type, int flags)
+static DView *dview_alloc(render_target *target, running_machine &machine, debug_view_type type, int flags)
{
DView *dv;
@@ -316,7 +318,7 @@ static void dview_free(DView *dv)
{
//astring_free(dv->title);
LIST_REMOVE(list, dv, DView);
- auto_free(dv->machine, dv);
+ auto_free(dv->machine(), dv);
}
static void dview_get_rect(DView *dv, int type, rectangle *rect)
@@ -895,11 +897,11 @@ static void debugint_exit(running_machine &machine)
}
-void debugint_init(running_machine *machine)
+void debugint_init(running_machine &machine)
{
unicode_char ch;
int chw;
- debug_font = machine->render().font_alloc("ui.bdf"); //ui_get_font(machine);
+ debug_font = machine.render().font_alloc("ui.bdf"); //ui_get_font(machine);
debug_font_width = 0;
debug_font_height = 15;
@@ -908,7 +910,7 @@ void debugint_init(running_machine *machine)
list = NULL;
focus_view = NULL;
- debug_font_aspect = machine->render().ui_aspect();
+ debug_font_aspect = machine.render().ui_aspect();
for (ch=0;ch<=127;ch++)
{
@@ -919,7 +921,7 @@ void debugint_init(running_machine *machine)
debug_font_width++;
/* FIXME: above does not really work */
debug_font_width = 10;
- machine->add_notifier(MACHINE_NOTIFY_EXIT, debugint_exit);
+ machine.add_notifier(MACHINE_NOTIFY_EXIT, debugint_exit);
}
#if 0
@@ -957,9 +959,9 @@ static void process_string(DView *dv, const char *str)
break;
case DVT_CONSOLE:
if(!dv->editor.str[(long)0])
- debug_cpu_get_visible_cpu(dv->machine)->debug()->single_step();
+ debug_cpu_get_visible_cpu(dv->machine())->debug()->single_step();
else
- debug_console_execute_command(dv->machine, str, 1);
+ debug_console_execute_command(dv->machine(), str, 1);
break;
case DVT_MEMORY:
downcast<debug_view_memory *>(dv->view)->set_expression(str);
@@ -977,11 +979,11 @@ static void on_disassembly_window_activate(DView *dv, const ui_menu_event *event
render_target *target;
const debug_view_source *source;
- target = &dv->machine->render().ui_target();
+ target = &dv->machine().render().ui_target();
- ndv = dview_alloc(target, dv->machine, DVT_DISASSEMBLY, 0);
+ ndv = dview_alloc(target, dv->machine(), DVT_DISASSEMBLY, 0);
ndv->editor.active = TRUE;
- ndv->editor.container = &dv->machine->render().ui_container();
+ ndv->editor.container = &dv->machine().render().ui_container();
source = ndv->view->source();
dview_set_title(ndv, source->name());
set_focus_view(ndv);
@@ -1010,8 +1012,8 @@ static void on_log_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_LOG, 0);
+ target = &dv->machine().render().ui_target();
+ ndv = dview_alloc(target, dv->machine(), DVT_LOG, 0);
dview_set_title(ndv, "Log");
set_focus_view(ndv);
}
@@ -1025,63 +1027,63 @@ static void on_close_activate(DView *dv, const ui_menu_event *event)
static void on_run_activate(DView *dv, const ui_menu_event *event)
{
- debug_cpu_get_visible_cpu(dv->machine)->debug()->go();
+ debug_cpu_get_visible_cpu(dv->machine())->debug()->go();
}
#if 0
void on_run_h_activate(DView *dv, const ui_menu_event *event)
{
debugwin_show(0);
- debug_cpu_get_visible_cpu(dv->machine)->debug()->go();
+ debug_cpu_get_visible_cpu(dv->machine())->debug()->go();
}
#endif
static void on_run_cpu_activate(DView *dv, const ui_menu_event *event)
{
- debug_cpu_get_visible_cpu(dv->machine)->debug()->go_next_device();
+ debug_cpu_get_visible_cpu(dv->machine())->debug()->go_next_device();
}
static void on_run_irq_activate(DView *dv, const ui_menu_event *event)
{
- debug_cpu_get_visible_cpu(dv->machine)->debug()->go_interrupt();
+ debug_cpu_get_visible_cpu(dv->machine())->debug()->go_interrupt();
}
static void on_run_vbl_activate(DView *dv, const ui_menu_event *event)
{
- debug_cpu_get_visible_cpu(dv->machine)->debug()->go_vblank();
+ debug_cpu_get_visible_cpu(dv->machine())->debug()->go_vblank();
}
static void on_step_into_activate(DView *dv, const ui_menu_event *event)
{
- debug_cpu_get_visible_cpu(dv->machine)->debug()->single_step();
+ debug_cpu_get_visible_cpu(dv->machine())->debug()->single_step();
}
static void on_step_over_activate(DView *dv, const ui_menu_event *event)
{
- debug_cpu_get_visible_cpu(dv->machine)->debug()->single_step_over();
+ debug_cpu_get_visible_cpu(dv->machine())->debug()->single_step_over();
}
#ifdef UNUSED_CODE
static void on_step_out_activate(DView *dv, const ui_menu_event *event)
{
- debug_cpu_get_visible_cpu(dv->machine)->debug()->single_step_out();
+ debug_cpu_get_visible_cpu(dv->machine())->debug()->single_step_out();
}
#endif
static void on_hard_reset_activate(DView *dv, const ui_menu_event *event)
{
- dv->machine->schedule_hard_reset();
+ dv->machine().schedule_hard_reset();
}
static void on_soft_reset_activate(DView *dv, const ui_menu_event *event)
{
- dv->machine->schedule_soft_reset();
- debug_cpu_get_visible_cpu(dv->machine)->debug()->go();
+ dv->machine().schedule_soft_reset();
+ debug_cpu_get_visible_cpu(dv->machine())->debug()->go();
}
static void on_exit_activate(DView *dv, const ui_menu_event *event)
{
- dv->machine->schedule_exit();
+ dv->machine().schedule_exit();
}
static void on_view_opcodes_activate(DView *dv, const ui_menu_event *event)
@@ -1108,11 +1110,11 @@ static void on_run_to_cursor_activate(DView *dv, const ui_menu_event *event)
{
char command[64];
- if (dv->view->cursor_visible() && debug_cpu_get_visible_cpu(dv->machine) == dv->view->source()->device())
+ if (dv->view->cursor_visible() && debug_cpu_get_visible_cpu(dv->machine()) == dv->view->source()->device())
{
offs_t address = downcast<debug_view_disasm *>(dv->view)->selected_address();
sprintf(command, "go %X", address);
- debug_console_execute_command(dv->machine, command, 1);
+ debug_console_execute_command(dv->machine(), command, 1);
}
}
@@ -1157,7 +1159,7 @@ static void render_editor(DView_edit *editor)
menu_main_populate - populate the main menu
-------------------------------------------------*/
-static void CreateMainMenu(running_machine *machine)
+static void CreateMainMenu(running_machine &machine)
{
const char *subtext = "";
int rc;
@@ -1165,7 +1167,7 @@ static void CreateMainMenu(running_machine *machine)
if (menu != NULL)
ui_menu_free(menu);
- menu = ui_menu_alloc(machine, &machine->render().ui_container(),NULL,NULL);
+ menu = ui_menu_alloc(machine, &machine.render().ui_container(),NULL,NULL);
switch (focus_view->type)
{
@@ -1258,7 +1260,7 @@ static int map_point(DView *dv, INT32 target_x, INT32 target_y, INT32 *mapped_x,
return FALSE;
}
-static void handle_mouse(running_machine *machine)
+static void handle_mouse(running_machine &machine)
{
render_target * mouse_target;
INT32 x,y;
@@ -1288,7 +1290,7 @@ static void handle_mouse(running_machine *machine)
handle_editor - handle the editor
-------------------------------------------------*/
-static void handle_editor(running_machine *machine)
+static void handle_editor(running_machine &machine)
{
if (focus_view->editor.active)
{
@@ -1344,12 +1346,12 @@ static void handle_editor(running_machine *machine)
menu_main - handle the main menu
-------------------------------------------------*/
-static void handle_menus(running_machine *machine)
+static void handle_menus(running_machine &machine)
{
const ui_menu_event *event;
- machine->render().ui_container().empty();
- ui_input_frame_update(*machine);
+ machine.render().ui_container().empty();
+ ui_input_frame_update(machine);
if (menu != NULL)
{
/* process the menu */
@@ -1447,35 +1449,35 @@ void debugint_wait_for_debugger(device_t &device, bool firststop)
DView *dv;
render_target *target;
- target = &device.machine->render().ui_target();
+ target = &device.machine().render().ui_target();
//set_view_by_name(target, "Debug");
- dv = dview_alloc(target, device.machine, DVT_DISASSEMBLY, VIEW_STATE_FOLLOW_CPU);
+ dv = dview_alloc(target, device.machine(), DVT_DISASSEMBLY, VIEW_STATE_FOLLOW_CPU);
dv->editor.active = TRUE;
- dv->editor.container = &device.machine->render().ui_container();
- dv = dview_alloc(target, device.machine, DVT_STATE, VIEW_STATE_FOLLOW_CPU);
- dv = dview_alloc(target, device.machine, DVT_CONSOLE, VIEW_STATE_FOLLOW_CPU);
+ dv->editor.container = &device.machine().render().ui_container();
+ dv = dview_alloc(target, device.machine(), DVT_STATE, VIEW_STATE_FOLLOW_CPU);
+ dv = dview_alloc(target, device.machine(), DVT_CONSOLE, VIEW_STATE_FOLLOW_CPU);
dview_set_title(dv, "Console");
dv->editor.active = TRUE;
- dv->editor.container = &device.machine->render().ui_container();
+ dv->editor.container = &device.machine().render().ui_container();
set_focus_view(dv);
}
followers_set_cpu(&device);
- //ui_update_and_render(device.machine, &device.machine->render().ui_container()());
+ //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);
+ device.machine().osd().update(false);
+ handle_menus(device.machine());
+ handle_mouse(device.machine());
//osd_sleep(osd_ticks_per_second()/60);
}
-void debugint_update_during_game(running_machine *machine)
+void debugint_update_during_game(running_machine &machine)
{
- if (!debug_cpu_is_stopped(machine) && machine->phase() == MACHINE_PHASE_RUNNING)
+ if (!debug_cpu_is_stopped(machine) && machine.phase() == MACHINE_PHASE_RUNNING)
{
update_views();
}