From 367ce4d6b75975809dbde39294349a3d294044b0 Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 31 Jul 2023 21:50:15 +0200 Subject: pluginopts: don't add library plugins to plugin.ini, clifront: don't write plugin.ini file if no plugins were found --- src/devices/machine/mos6530.cpp | 2 +- src/frontend/mame/clifront.cpp | 23 +++++++++++++++-------- src/frontend/mame/pluginopts.cpp | 13 ++++++++----- src/frontend/mame/ui/miscmenu.cpp | 10 +++++----- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/devices/machine/mos6530.cpp b/src/devices/machine/mos6530.cpp index 3d4981e2b20..599e3962bc8 100644 --- a/src/devices/machine/mos6530.cpp +++ b/src/devices/machine/mos6530.cpp @@ -101,7 +101,7 @@ mos6530_device_base::mos6530_device_base(const machine_config &mconfig, device_t m_pa_in(0xff), m_pa_out(0), m_pa_ddr(0), - m_pa7(0), + m_pa7(1), m_pa7_dir(0), m_pb_in(0xff), m_pb_out(0), diff --git a/src/frontend/mame/clifront.cpp b/src/frontend/mame/clifront.cpp index 90caed612cc..74e6c850786 100644 --- a/src/frontend/mame/clifront.cpp +++ b/src/frontend/mame/clifront.cpp @@ -1785,34 +1785,41 @@ void cli_frontend::execute_commands(std::string_view exename) // createconfig? if (m_options.command() == CLICOMMAND_CREATECONFIG) { - // attempt to open the output file + // attempt to open the output file and generate the updated (mame).ini emu_file file(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open(std::string(emulator_info::get_configname()) + ".ini")) throw emu_fatalerror("Unable to create file %s.ini\n",emulator_info::get_configname()); - // generate the updated INI file.puts(m_options.output_ini()); + // ui.ini ui_options ui_opts; emu_file file_ui(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file_ui.open("ui.ini")) throw emu_fatalerror("Unable to create file ui.ini\n"); - // generate the updated INI file_ui.puts(ui_opts.output_ini()); + // plugin.ini plugin_options plugin_opts; path_iterator iter(m_options.plugins_path()); std::string pluginpath; while (iter.next(pluginpath)) plugin_opts.scan_directory(pluginpath, true); - emu_file file_plugin(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - if (file_plugin.open("plugin.ini")) - throw emu_fatalerror("Unable to create file plugin.ini\n"); + std::string plugins(plugin_opts.output_ini()); - // generate the updated INI - file_plugin.puts(plugin_opts.output_ini()); + // only update the file when it found plugins + if (!plugins.empty()) + { + emu_file file_plugin(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + if (file_plugin.open("plugin.ini")) + throw emu_fatalerror("Unable to create file plugin.ini\n"); + + file_plugin.puts(plugins); + } + else + osd_printf_error("Skipped plugin.ini, could not find any plugins\n"); return; } diff --git a/src/frontend/mame/pluginopts.cpp b/src/frontend/mame/pluginopts.cpp index 89e05dc0ae0..d06bb4ce49b 100644 --- a/src/frontend/mame/pluginopts.cpp +++ b/src/frontend/mame/pluginopts.cpp @@ -142,11 +142,14 @@ static core_options create_core_options(const plugin_options &plugin_opts) // create an entry for each option for (const plugin_options::plugin &p : plugin_opts.plugins()) { - opts.add_entry( - { p.m_name }, - nullptr, - core_options::option_type::BOOLEAN, - p.m_start ? "1" : "0"); + if (p.m_type != "library") + { + opts.add_entry( + { p.m_name }, + nullptr, + core_options::option_type::BOOLEAN, + p.m_start ? "1" : "0"); + } } return opts; diff --git a/src/frontend/mame/ui/miscmenu.cpp b/src/frontend/mame/ui/miscmenu.cpp index 70e456e35ed..c05d01159fa 100644 --- a/src/frontend/mame/ui/miscmenu.cpp +++ b/src/frontend/mame/ui/miscmenu.cpp @@ -970,16 +970,16 @@ bool menu_plugins_configure::handle(event const *ev) void menu_plugins_configure::populate() { - plugin_options const &plugins = mame_machine_manager::instance()->plugins(); + plugin_options const &plugin_opts = mame_machine_manager::instance()->plugins(); bool first(true); - for (auto const &curentry : plugins.plugins()) + for (const plugin_options::plugin &p : plugin_opts.plugins()) { - if ("library" != curentry.m_type) + if (p.m_type != "library") { first = false; - bool const enabled = curentry.m_start; - item_append_on_off(curentry.m_description, enabled, 0, (void *)(uintptr_t)curentry.m_name.c_str()); + bool const enabled = p.m_start; + item_append_on_off(p.m_description, enabled, 0, (void *)(uintptr_t)p.m_name.c_str()); } } if (first) -- cgit v1.2.3