diff options
author | 2010-06-30 03:46:21 +0000 | |
---|---|---|
committer | 2010-06-30 03:46:21 +0000 | |
commit | 733b797a3dae6c89b11c9b3f3eaad68995f6ef09 (patch) | |
tree | 6fa31dcfd68bd9c4a34dd8f2c139d63c00d3e33e /src/emu/uimenu.c | |
parent | 2c549dad23fd5b5e8dc48e5a9c8f7790d17e697d (diff) |
Split mame.c into mame.c and machine.c, the latter containing the
running_machine definition and implementation.
Moved global machine-level operations and accessors into methods on the
running_machine class. For the most part, this doesn't affect drivers
except for a few occasional bits:
mame_get_phase() == machine->phase()
add_reset_callback() == machine->add_notifier(MACHINE_NOTIFY_RESET, ...)
add_exit_callback() == machine->add_notifier(MACHINE_NOTIFY_EXIT, ...)
mame_get_base_datetime() == machine->base_datetime()
mame_get_current_datetime() == machine->current_datetime()
Cleaned up the region_info class, removing most global region accessors
except for memory_region() and memory_region_length(). Again, this doesn't
generally affect drivers.
Diffstat (limited to 'src/emu/uimenu.c')
-rw-r--r-- | src/emu/uimenu.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/src/emu/uimenu.c b/src/emu/uimenu.c index 997c7fc0121..7a6ecf0ac12 100644 --- a/src/emu/uimenu.c +++ b/src/emu/uimenu.c @@ -247,7 +247,7 @@ static const char exittext[] = "Exit"; FUNCTION PROTOTYPES ***************************************************************************/ -static void ui_menu_exit(running_machine *machine); +static void ui_menu_exit(running_machine &machine); /* internal menu processing */ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly); @@ -401,7 +401,7 @@ void ui_menu_init(running_machine *machine) arrow_texture = render_texture_alloc(menu_render_triangle, NULL); /* add an exit callback to free memory */ - add_exit_callback(machine, ui_menu_exit); + machine->add_notifier(MACHINE_NOTIFY_EXIT, ui_menu_exit); } @@ -409,11 +409,11 @@ void ui_menu_init(running_machine *machine) ui_menu_exit - clean up after ourselves -------------------------------------------------*/ -static void ui_menu_exit(running_machine *machine) +static void ui_menu_exit(running_machine &machine) { /* free menus */ - ui_menu_stack_reset(machine); - ui_menu_clear_free_list(machine); + ui_menu_stack_reset(&machine); + ui_menu_clear_free_list(&machine); /* free textures */ render_texture_free(hilight_texture); @@ -1230,7 +1230,12 @@ static void ui_menu_handle_keys(ui_menu *menu, UINT32 flags) /* pause enables/disables pause */ if (!ignorepause && exclusive_input_pressed(menu, IPT_UI_PAUSE, 0)) - mame_pause(menu->machine, !mame_is_paused(menu->machine)); + { + if (menu->machine->paused()) + menu->machine->resume(); + else + menu->machine->pause(); + } /* handle a toggle cheats request */ if (ui_input_pressed_repeat(menu->machine, IPT_UI_TOGGLE_CHEAT, 0)) @@ -1398,7 +1403,7 @@ UINT32 ui_slider_ui_handler(running_machine *machine, render_container *containe void ui_menu_force_game_select(running_machine *machine, render_container *container) { - char *gamename = (char *)options_get_string(mame_options(), OPTION_GAMENAME); + char *gamename = (char *)options_get_string(machine->options(), OPTION_GAMENAME); /* reset the menu stack */ ui_menu_stack_reset(machine); @@ -1411,7 +1416,7 @@ void ui_menu_force_game_select(running_machine *machine, render_container *conta ui_show_menu(); /* make sure MAME is paused */ - mame_pause(machine, TRUE); + machine->pause(); } @@ -1498,7 +1503,7 @@ static void menu_main_populate(running_machine *machine, ui_menu *menu, void *st int has_dips = FALSE; /* scan the input port array to see what options we need to enable */ - for (port = machine->portlist.first(); port != NULL; port = port->next()) + for (port = machine->m_portlist.first(); port != NULL; port = port->next()) for (field = port->fieldlist; field != NULL; field = field->next) { if (field->type == IPT_DIPSWITCH) @@ -1563,7 +1568,7 @@ static void menu_main_populate(running_machine *machine, ui_menu *menu, void *st ui_menu_item_append(menu, "Crosshair Options", NULL, 0, (void *)menu_crosshair); /* add cheat menu */ - if (options_get_bool(mame_options(), OPTION_CHEAT) && cheat_get_next_menu_entry(machine, NULL, NULL, NULL, NULL) != NULL) + if (options_get_bool(machine->options(), OPTION_CHEAT) && cheat_get_next_menu_entry(machine, NULL, NULL, NULL, NULL) != NULL) ui_menu_item_append(menu, "Cheat", NULL, 0, (void *)menu_cheat); /* add memory card menu */ @@ -1712,7 +1717,7 @@ static void menu_input_specific_populate(running_machine *machine, ui_menu *menu suborder[SEQ_TYPE_INCREMENT] = 2; /* iterate over the input ports and add menu items */ - for (port = machine->portlist.first(); port != NULL; port = port->next()) + for (port = machine->m_portlist.first(); port != NULL; port = port->next()) for (field = port->fieldlist; field != NULL; field = field->next) { const char *name = input_field_name(field); @@ -2066,7 +2071,7 @@ static void menu_settings_populate(running_machine *machine, ui_menu *menu, sett diplist_tailptr = &menustate->diplist; /* loop over input ports and set up the current values */ - for (port = machine->portlist.first(); port != NULL; port = port->next()) + for (port = machine->m_portlist.first(); port != NULL; port = port->next()) for (field = port->fieldlist; field != NULL; field = field->next) if (field->type == type && input_condition_true(machine, &field->condition)) { @@ -2320,7 +2325,7 @@ static void menu_analog_populate(running_machine *machine, ui_menu *menu) astring text; /* loop over input ports and add the items */ - for (port = machine->portlist.first(); port != NULL; port = port->next()) + for (port = machine->m_portlist.first(); port != NULL; port = port->next()) for (field = port->fieldlist; field != NULL; field = field->next) if (input_type_is_analog(field->type)) { @@ -2674,7 +2679,7 @@ static void menu_memory_card(running_machine *machine, ui_menu *menu, void *para /* handle card ejecting */ case MEMCARD_ITEM_EJECT: - memcard_eject(menu->machine); + memcard_eject(*menu->machine); popmessage("Memory card ejected"); break; @@ -3278,7 +3283,7 @@ static void menu_crosshair_populate(running_machine *machine, ui_menu *menu) /* search for crosshair graphics */ /* open a path to the crosshairs */ - path = mame_openpath(mame_options(), OPTION_CROSSHAIRPATH); + path = mame_openpath(machine->options(), OPTION_CROSSHAIRPATH); if (path != NULL) { const osd_directory_entry *dir; @@ -3387,7 +3392,7 @@ static void menu_crosshair_populate(running_machine *machine, ui_menu *menu) static void menu_quit_game(running_machine *machine, ui_menu *menu, void *parameter, void *state) { /* request a reset */ - mame_schedule_exit(machine); + machine->schedule_exit(); /* reset the menu stack */ ui_menu_stack_reset(machine); @@ -3445,7 +3450,7 @@ static void menu_select_game(running_machine *machine, ui_menu *menu, void *para int audit_result; /* audit the game first to see if we're going to work */ - audit_records = audit_images(mame_options(), driver, AUDIT_VALIDATE_FAST, &audit); + audit_records = audit_images(menu->machine->options(), driver, AUDIT_VALIDATE_FAST, &audit); audit_result = audit_summary(driver, audit_records, audit, FALSE); if (audit_records > 0) global_free(audit); @@ -3453,7 +3458,7 @@ static void menu_select_game(running_machine *machine, ui_menu *menu, void *para /* if everything looks good, schedule the new driver */ if (audit_result == CORRECT || audit_result == BEST_AVAILABLE) { - mame_schedule_new_driver(machine, driver); + machine->schedule_new_driver(*driver); ui_menu_stack_reset(machine); } @@ -3598,7 +3603,7 @@ static void menu_select_game_build_driver_list(ui_menu *menu, select_game_state memset(found, 0, (driver_count + 7) / 8); /* open a path to the ROMs and find them in the array */ - path = mame_openpath(mame_options(), OPTION_ROMPATH); + path = mame_openpath(menu->machine->options(), OPTION_ROMPATH); if (path != NULL) { const osd_directory_entry *dir; |