From b5558df1cfabe52689dc61628e62fe3a499ea08e Mon Sep 17 00:00:00 2001 From: couriersud Date: Wed, 14 Jan 2015 03:35:10 +0100 Subject: [PATCH] Removed some machine() references --- src/osd/sdl/input.c | 4 +-- src/osd/sdl/osdsdl.h | 16 +++++------ src/osd/sdl/sdlmain.c | 27 +++++++++--------- src/osd/sdl/video.c | 65 ++++++++++++++++++++----------------------- src/osd/sdl/window.c | 2 +- 5 files changed, 54 insertions(+), 60 deletions(-) diff --git a/src/osd/sdl/input.c b/src/osd/sdl/input.c index 13d5a8a1e64..4b2f1e57093 100644 --- a/src/osd/sdl/input.c +++ b/src/osd/sdl/input.c @@ -1416,7 +1416,7 @@ bool sdl_osd_interface::input_init() } // get Sixaxis special mode info - sixaxis_mode = downcast(machine().options()).sixaxis(); + sixaxis_mode = options().sixaxis(); // register the joysticks sdlinput_register_joysticks(machine()); @@ -2086,7 +2086,7 @@ void sdl_osd_interface::customize_input_type_list(simple_list { // configurable UI mode switch case IPT_UI_TOGGLE_UI: - uimode = downcast(machine().options()).ui_mode_key(); + uimode = options().ui_mode_key(); if(!strcmp(uimode,"auto")) { #if defined(__APPLE__) && defined(__MACH__) diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h index 537a0b6d91a..2203f2c1a03 100644 --- a/src/osd/sdl/osdsdl.h +++ b/src/osd/sdl/osdsdl.h @@ -6,6 +6,7 @@ #include "watchdog.h" #include "clifront.h" #include "modules/lib/osdobj_common.h" +#include "video.h" //============================================================ // System dependent defines @@ -224,20 +225,19 @@ public: private: virtual void osd_exit(); + + void extract_window_config(int index, sdl_window_config *conf); + + // FIXME: remove machine usage + void extract_video_config(running_machine &machine); + + sdl_options &m_options; watchdog *m_watchdog; }; - - -//============================================================ -// sound.c -//============================================================ - -void sdlaudio_init(running_machine &machine); - //============================================================ // sdlwork.c //============================================================ diff --git a/src/osd/sdl/sdlmain.c b/src/osd/sdl/sdlmain.c index edd1c71a4be..fc402337a4a 100644 --- a/src/osd/sdl/sdlmain.c +++ b/src/osd/sdl/sdlmain.c @@ -589,30 +589,29 @@ void sdl_osd_interface::init(running_machine &machine) // call our parent osd_common_t::init(machine); - sdl_options &options = downcast(machine.options()); const char *stemp; // determine if we are benchmarking, and adjust options appropriately - int bench = options.bench(); + int bench = options().bench(); astring error_string; if (bench > 0) { - options.set_value(OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM, error_string); - options.set_value(OSDOPTION_SOUND, "none", OPTION_PRIORITY_MAXIMUM, error_string); - options.set_value(OSDOPTION_VIDEO, "none", OPTION_PRIORITY_MAXIMUM, error_string); - options.set_value(OPTION_SECONDS_TO_RUN, bench, OPTION_PRIORITY_MAXIMUM, error_string); + options().set_value(OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM, error_string); + options().set_value(OSDOPTION_SOUND, "none", OPTION_PRIORITY_MAXIMUM, error_string); + options().set_value(OSDOPTION_VIDEO, "none", OPTION_PRIORITY_MAXIMUM, error_string); + options().set_value(OPTION_SECONDS_TO_RUN, bench, OPTION_PRIORITY_MAXIMUM, error_string); assert(!error_string); } // Some driver options - must be before audio init! - stemp = options.audio_driver(); + stemp = options().audio_driver(); if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0) { osd_printf_verbose("Setting SDL audiodriver '%s' ...\n", stemp); osd_setenv(SDLENV_AUDIODRIVER, stemp, 1); } - stemp = options.video_driver(); + stemp = options().video_driver(); if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0) { osd_printf_verbose("Setting SDL videodriver '%s' ...\n", stemp); @@ -620,7 +619,7 @@ void sdl_osd_interface::init(running_machine &machine) } #if (SDLMAME_SDL2) - stemp = options.render_driver(); + stemp = options().render_driver(); if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0) { osd_printf_verbose("Setting SDL renderdriver '%s' ...\n", stemp); @@ -635,7 +634,7 @@ void sdl_osd_interface::init(running_machine &machine) #if USE_OPENGL /* FIXME: move lib loading code from drawogl.c here */ - stemp = options.gl_lib(); + stemp = options().gl_lib(); if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0) { osd_setenv("SDL_VIDEO_GL_DRIVER", stemp, 1); @@ -644,7 +643,7 @@ void sdl_osd_interface::init(running_machine &machine) #endif /* get number of processors */ - stemp = options.numprocessors(); + stemp = options().numprocessors(); osd_num_processors = 0; @@ -685,12 +684,12 @@ void sdl_osd_interface::init(running_machine &machine) osd_common_t::init_subsystems(); - if (options.oslog()) + if (options().oslog()) machine.add_logerror_callback(output_oslog); /* now setup watchdog */ - int watchdog_timeout = options.watchdog(); + int watchdog_timeout = options().watchdog(); if (watchdog_timeout != 0) { @@ -1037,7 +1036,7 @@ osd_font sdl_osd_interface::font_open(const char *_name, int &height) if (!font) { osd_printf_verbose("Searching font %s in -%s\n", name.cstr(), OPTION_FONTPATH); - emu_file file(machine().options().font_path(), OPEN_FLAG_READ); + emu_file file(options().font_path(), OPEN_FLAG_READ); if (file.open(name) == FILERR_NONE) { astring full_name = file.fullpath(); diff --git a/src/osd/sdl/video.c b/src/osd/sdl/video.c index c8a33fadd79..2070a6043e4 100644 --- a/src/osd/sdl/video.c +++ b/src/osd/sdl/video.c @@ -85,8 +85,6 @@ static sdl_monitor_info *pick_monitor(sdl_options &options, int index); static void check_osd_inputs(running_machine &machine); -static void extract_video_config(running_machine &machine); -static void extract_window_config(running_machine &machine, int index, sdl_window_config *conf); static float get_aspect(const char *defdata, const char *data, int report_error); static void get_resolution(const char *defdata, const char *data, sdl_window_config *config, int report_error); @@ -106,20 +104,19 @@ bool sdl_osd_interface::video_init() init_monitors(); // we need the beam width in a float, contrary to what the core does. - video_config.beamwidth = machine().options().beam(); + video_config.beamwidth = options().beam(); // initialize the window system so we can make windows if (!window_init()) return false; // create the windows - sdl_options &options = downcast(machine().options()); for (index = 0; index < video_config.numscreens; index++) { sdl_window_config conf; memset(&conf, 0, sizeof(conf)); - extract_window_config(machine(), index, &conf); - if (sdlwindow_video_window_create(machine(), index, pick_monitor(options, index), &conf)) + extract_window_config(index, &conf); + if (sdlwindow_video_window_create(machine(), index, pick_monitor(options(), index), &conf)) return false; } @@ -615,31 +612,29 @@ static void check_osd_inputs(running_machine &machine) // extract_window_config //============================================================ -static void extract_window_config(running_machine &machine, int index, sdl_window_config *conf) +void sdl_osd_interface::extract_window_config(int index, sdl_window_config *conf) { - sdl_options &options = downcast(machine.options()); // per-window options: extract the data - get_resolution(options.resolution(), options.resolution(index), conf, TRUE); + get_resolution(options().resolution(), options().resolution(index), conf, TRUE); } //============================================================ // extract_video_config //============================================================ -static void extract_video_config(running_machine &machine) +void sdl_osd_interface::extract_video_config(running_machine &machine) { const char *stemp; - sdl_options &options = downcast(machine.options()); - video_config.perftest = options.video_fps(); + video_config.perftest = options().video_fps(); // global options: extract the data - video_config.windowed = options.window(); - video_config.keepaspect = options.keep_aspect(); - video_config.numscreens = options.numscreens(); - video_config.fullstretch = options.uneven_stretch(); + video_config.windowed = options().window(); + video_config.keepaspect = options().keep_aspect(); + video_config.numscreens = options().numscreens(); + video_config.fullstretch = options().uneven_stretch(); #ifdef SDLMAME_X11 - video_config.restrictonemonitor = !options.use_all_heads(); + video_config.restrictonemonitor = !options().use_all_heads(); #endif @@ -650,7 +645,7 @@ static void extract_video_config(running_machine &machine) video_config.novideo = 0; // d3d options: extract the data - stemp = options.video(); + stemp = options().video(); if (strcmp(stemp, "auto") == 0) { #ifdef SDLMAME_MACOSX @@ -666,7 +661,7 @@ static void extract_video_config(running_machine &machine) video_config.mode = VIDEO_MODE_SOFT; video_config.novideo = 1; - if (options.seconds_to_run() == 0) + if (options().seconds_to_run() == 0) osd_printf_warning("Warning: -video none doesn't make much sense without -seconds_to_run\n"); } else if (USE_OPENGL && (strcmp(stemp, SDLOPTVAL_OPENGL) == 0)) @@ -681,11 +676,11 @@ static void extract_video_config(running_machine &machine) video_config.mode = VIDEO_MODE_SOFT; } - video_config.switchres = options.switch_res(); - video_config.centerh = options.centerh(); - video_config.centerv = options.centerv(); - video_config.waitvsync = options.wait_vsync(); - video_config.syncrefresh = options.sync_refresh(); + video_config.switchres = options().switch_res(); + video_config.centerh = options().centerh(); + video_config.centerv = options().centerv(); + video_config.waitvsync = options().wait_vsync(); + video_config.syncrefresh = options().sync_refresh(); if (!video_config.waitvsync && video_config.syncrefresh) { osd_printf_warning("-syncrefresh specified without -waitsync. Reverting to -nosyncrefresh\n"); @@ -693,33 +688,33 @@ static void extract_video_config(running_machine &machine) } #if (USE_OPENGL || SDLMAME_SDL2) - video_config.filter = options.filter(); + video_config.filter = options().filter(); #endif #if (USE_OPENGL) - video_config.prescale = options.prescale(); + video_config.prescale = options().prescale(); if (video_config.prescale < 1 || video_config.prescale > 3) { osd_printf_warning("Invalid prescale option, reverting to '1'\n"); video_config.prescale = 1; } // default to working video please - video_config.forcepow2texture = options.gl_force_pow2_texture(); - video_config.allowtexturerect = !(options.gl_no_texture_rect()); - video_config.vbo = options.gl_vbo(); - video_config.pbo = options.gl_pbo(); - video_config.glsl = options.gl_glsl(); + video_config.forcepow2texture = options().gl_force_pow2_texture(); + video_config.allowtexturerect = !(options().gl_no_texture_rect()); + video_config.vbo = options().gl_vbo(); + video_config.pbo = options().gl_pbo(); + video_config.glsl = options().gl_glsl(); if ( video_config.glsl ) { int i; - video_config.glsl_filter = options.glsl_filter(); + video_config.glsl_filter = options().glsl_filter(); video_config.glsl_shader_mamebm_num=0; for(i=0; i0) { video_config.glsl_shader_mamebm[i] = (char *) malloc(strlen(stemp)+1); @@ -734,7 +729,7 @@ static void extract_video_config(running_machine &machine) for(i=0; i0) { video_config.glsl_shader_scrn[i] = (char *) malloc(strlen(stemp)+1); @@ -777,7 +772,7 @@ static void extract_video_config(running_machine &machine) } #endif // yuv settings ... - stemp = options.scale_mode(); + stemp = options().scale_mode(); video_config.scale_mode = drawsdl_scale_mode(stemp); if (video_config.scale_mode < 0) { diff --git a/src/osd/sdl/window.c b/src/osd/sdl/window.c index ee7eb91755a..7059b444224 100644 --- a/src/osd/sdl/window.c +++ b/src/osd/sdl/window.c @@ -222,7 +222,7 @@ bool sdl_osd_interface::window_init() { osd_printf_verbose("Enter sdlwindow_init\n"); // determine if we are using multithreading or not - multithreading_enabled = downcast(machine().options()).multithreading(); + multithreading_enabled = options().multithreading(); // get the main thread ID before anything else main_threadid = SDL_ThreadID();