From a400c011a96197281e205d265c267ecd915fb597 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sun, 7 May 2017 14:40:12 +1000 Subject: Revert "Overhaul to how MAME handles options (#2260)" This reverts commit 536990e77b49ccc50ef275bfbf1018cc29c16154. Conflicts: src/frontend/mame/mame.cpp Sorry, but this change was half-baked. It breaks a lot of existing functionality and clearly hasn't been tested in more than a tiny subset of use cases. Please play this work back onto your own branch, and test it before submitting another PR. --- src/osd/modules/lib/osdobj_common.h | 2 +- src/osd/modules/render/drawbgfx.cpp | 1 + src/osd/sdl/sdlmain.cpp | 10 ++++++---- src/osd/windows/winmain.cpp | 15 +++++++++------ 4 files changed, 17 insertions(+), 11 deletions(-) (limited to 'src/osd') diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index 2c2f750fdbe..df8096840cf 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -270,7 +270,7 @@ private: // FIXME: should be elsewhere osd_module *select_module_options(const core_options &opts, const std::string &opt_name) { - std::string opt_val = opts.exists(opt_name) ? opts.value(opt_name.c_str()) : ""; + std::string opt_val = opts.value(opt_name.c_str()); if (opt_val.compare("auto")==0) opt_val = ""; else if (!m_mod_man.type_has_name(opt_name.c_str(), opt_val.c_str())) diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 31ddc58c145..2fb0d0b3a1e 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -85,6 +85,7 @@ renderer_bgfx::renderer_bgfx(std::shared_ptr w) , m_avi_writer(nullptr) , m_avi_target(nullptr) { + m_options = downcast(assert_window()->machine().options()); } //============================================================ diff --git a/src/osd/sdl/sdlmain.cpp b/src/osd/sdl/sdlmain.cpp index 10e57ec5766..31f65e2ba66 100644 --- a/src/osd/sdl/sdlmain.cpp +++ b/src/osd/sdl/sdlmain.cpp @@ -408,12 +408,14 @@ void sdl_osd_interface::init(running_machine &machine) // determine if we are benchmarking, and adjust options appropriately int bench = options().bench(); + std::string error_string; if (bench > 0) { - options().set_value(OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM); - options().set_value(OSDOPTION_SOUND, "none", OPTION_PRIORITY_MAXIMUM); - options().set_value(OSDOPTION_VIDEO, "none", OPTION_PRIORITY_MAXIMUM); - options().set_value(OPTION_SECONDS_TO_RUN, bench, OPTION_PRIORITY_MAXIMUM); + 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.c_str()[0] == 0); } // Some driver options - must be before audio init! diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp index 805a769d1b8..efec6700849 100644 --- a/src/osd/windows/winmain.cpp +++ b/src/osd/windows/winmain.cpp @@ -515,20 +515,23 @@ void windows_osd_interface::init(running_machine &machine) // determine if we are benchmarking, and adjust options appropriately int bench = options.bench(); + std::string error_string; if (bench > 0) { - options.set_value(OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM); - options.set_value(OSDOPTION_SOUND, "none", OPTION_PRIORITY_MAXIMUM); - options.set_value(OSDOPTION_VIDEO, "none", OPTION_PRIORITY_MAXIMUM); - options.set_value(OPTION_SECONDS_TO_RUN, bench, OPTION_PRIORITY_MAXIMUM); + 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.empty()); } // determine if we are profiling, and adjust options appropriately int profile = options.profile(); if (profile > 0) { - options.set_value(OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM); - options.set_value(OSDOPTION_NUMPROCESSORS, 1, OPTION_PRIORITY_MAXIMUM); + options.set_value(OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM, error_string); + options.set_value(OSDOPTION_NUMPROCESSORS, 1, OPTION_PRIORITY_MAXIMUM, error_string); + assert(error_string.empty()); } // thread priority -- cgit v1.2.3