From 06ee6804dd5d1157a079e02d46abb6612571f21f Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Thu, 3 Mar 2011 17:05:24 +0000 Subject: Converted core_options to a class. Removed a bunch of marginal functionality in favor of alternate mechanisms. Errors are now reported via an astring rather than via callbacks. Every option must now specify a type (command, integer, float, string, boolean, etc). Command behavior has changed so that only one command is permitted. [Aaron Giles] Changed fileio system to accept just a raw searchpath instead of an options/option name combination. [Aaron Giles] Created emu_options class dervied from core_options which wraps core emulator options. Added mechanisms to cleanly change the system name and add/remove system-specific options, versus the old way using callbacks. Also added read accessors for all the options, to ensure consistency in how parameters are handled. Changed most core systems to access emu_options instead of core_options. Also changed machine->options() to return emu_options. [Aaron Giles] Created cli_options class derived from emu_options which adds the command-line specific options. Updated clifront code to leverage the new class and the new core behaviors. cli_execute() now accepts a cli_options object when called. [Aaron Giles] Updated both SDL and Windows to have their own options classes, derived from cli_options, which add the OSD-specific options on top of everything else. Added accessors for all the options so that queries are strongly typed and simplified. [Aaron Giles] Out of whatsnew: I've surely screwed up some stuff, though I have smoke tested a bunch of things. Let me know if you hit anything odd. Also I know this change will impact the WINUI stuff, please let me know if there are issues. All the functionality necessary should still be present. If it's not obvious, please talk to me before adding stuff to the core_options class. --- src/emu/ui.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/emu/ui.c') diff --git a/src/emu/ui.c b/src/emu/ui.c index 847e4315093..12a39b98d4e 100644 --- a/src/emu/ui.c +++ b/src/emu/ui.c @@ -247,7 +247,7 @@ int ui_init(running_machine *machine) single_step = FALSE; ui_set_handler(handler_messagebox, 0); /* retrieve options */ - ui_use_natural_keyboard = options_get_bool(&machine->options(), OPTION_NATURAL_KEYBOARD); + ui_use_natural_keyboard = machine->options().natural_keyboard(); return 0; } @@ -273,8 +273,8 @@ static void ui_exit(running_machine &machine) int ui_display_startup_screens(running_machine *machine, int first_time, int show_disclaimer) { const int maxstate = 3; - int str = options_get_int(&machine->options(), OPTION_SECONDS_TO_RUN); - int show_gameinfo = !options_get_bool(&machine->options(), OPTION_SKIP_GAMEINFO); + int str = machine->options().seconds_to_run(); + int show_gameinfo = !machine->options().skip_gameinfo(); int show_warnings = TRUE; int state; @@ -375,7 +375,7 @@ void ui_update_and_render(running_machine *machine, render_container *container) /* if we're paused, dim the whole screen */ if (machine->phase() >= MACHINE_PHASE_RESET && (single_step || machine->paused())) { - int alpha = (1.0f - options_get_float(&machine->options(), OPTION_PAUSE_BRIGHTNESS)) * 255.0f; + int alpha = (1.0f - machine->options().pause_brightness()) * 255.0f; if (ui_menu_is_force_game_select()) alpha = 255; if (alpha > 255) @@ -412,7 +412,7 @@ render_font *ui_get_font(running_machine &machine) { /* allocate the font and messagebox string */ if (ui_font == NULL) - ui_font = machine.render().font_alloc(options_get_string(&machine.options(), OPTION_UI_FONT)); + ui_font = machine.render().font_alloc(machine.options().ui_font()); return ui_font; } @@ -1640,7 +1640,7 @@ static slider_state *slider_init(running_machine *machine) } /* add CPU overclocking (cheat only) */ - if (options_get_bool(&machine->options(), OPTION_CHEAT)) + if (machine->options().cheat()) { device_execute_interface *exec = NULL; for (bool gotone = machine->m_devicelist.first(exec); gotone; gotone = exec->next(exec)) @@ -1662,7 +1662,7 @@ static slider_state *slider_init(running_machine *machine) void *param = (void *)screen; /* add refresh rate tweaker */ - if (options_get_bool(&machine->options(), OPTION_CHEAT)) + if (machine->options().cheat()) { string.printf("%s Refresh Rate", slider_get_screen_desc(*screen)); *tailptr = slider_alloc(machine, string, -10000, 0, 10000, 1000, slider_refresh, param); @@ -2214,6 +2214,8 @@ int ui_get_use_natural_keyboard(running_machine *machine) void ui_set_use_natural_keyboard(running_machine *machine, int use_natural_keyboard) { ui_use_natural_keyboard = use_natural_keyboard; - options_set_bool(&machine->options(), OPTION_NATURAL_KEYBOARD, use_natural_keyboard, OPTION_PRIORITY_CMDLINE); + astring error; + machine->options().set_value(OPTION_NATURAL_KEYBOARD, use_natural_keyboard, OPTION_PRIORITY_CMDLINE, error); + assert(!error); } -- cgit v1.2.3-70-g09d2