diff options
author | Vas Crabb <vas@vastheman.com> | 2020-03-10 18:21:10 +1100 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2020-03-10 18:21:10 +1100 |
commit | 9c600695f0ed4456270bf5f1676b8fadaed34127 (patch) | |
tree | 1e52fb8b786e9bece80b05e2f583bba207f5af7c /src/frontend/mame | |
parent | cc70fe02bacdf8dc17fe75065e387276c8056e5e (diff) |
(nw) Cleanup on the way:
* Add doxygen comments for bit manipulation functions
* Add an overload of BIT that works like the AArch64 UBFX instruction
* Kill off some of the silly concatenating overloads for emu_file::open
* Make searchpath acually useful for devices
This is a checkpoint - I'm planning to improve ROM loading behaviour at
least a little.
Diffstat (limited to 'src/frontend/mame')
-rw-r--r-- | src/frontend/mame/audit.cpp | 27 | ||||
-rw-r--r-- | src/frontend/mame/audit.h | 6 | ||||
-rw-r--r-- | src/frontend/mame/cheat.cpp | 26 | ||||
-rw-r--r-- | src/frontend/mame/cheat.h | 16 | ||||
-rw-r--r-- | src/frontend/mame/clifront.cpp | 2 | ||||
-rw-r--r-- | src/frontend/mame/language.cpp | 2 | ||||
-rw-r--r-- | src/frontend/mame/mameopts.cpp | 2 | ||||
-rw-r--r-- | src/frontend/mame/ui/auditmenu.cpp | 2 | ||||
-rw-r--r-- | src/frontend/mame/ui/miscmenu.cpp | 26 | ||||
-rw-r--r-- | src/frontend/mame/ui/optsmenu.cpp | 2 | ||||
-rw-r--r-- | src/frontend/mame/ui/selgame.cpp | 10 | ||||
-rw-r--r-- | src/frontend/mame/ui/selsoft.cpp | 8 | ||||
-rw-r--r-- | src/frontend/mame/ui/ui.cpp | 4 |
13 files changed, 65 insertions, 68 deletions
diff --git a/src/frontend/mame/audit.cpp b/src/frontend/mame/audit.cpp index dbba78e20ec..256f9876f1b 100644 --- a/src/frontend/mame/audit.cpp +++ b/src/frontend/mame/audit.cpp @@ -29,7 +29,7 @@ media_auditor::media_auditor(const driver_enumerator &enumerator) : m_enumerator(enumerator) , m_validation(AUDIT_VALIDATE_FULL) - , m_searchpath(nullptr) + , m_searchpath() { } @@ -47,10 +47,6 @@ media_auditor::summary media_auditor::audit_media(const char *validation) // store validation for later m_validation = validation; -// temporary hack until romload is update: get the driver path and support it for -// all searches -const char *driverpath = m_enumerator.config()->root_device().searchpath(); - std::size_t found = 0; std::size_t required = 0; std::size_t shared_found = 0; @@ -60,17 +56,17 @@ const char *driverpath = m_enumerator.config()->root_device().searchpath(); for (device_t &device : device_iterator(m_enumerator.config()->root_device())) { // determine the search path for this source and iterate through the regions - m_searchpath = device.searchpath(); + m_searchpath.clear(); + for (const std::string &path : device.searchpath()) + { + if (!m_searchpath.empty()) + m_searchpath += ';'; + m_searchpath += path; + } // now iterate over regions and ROMs within for (const rom_entry *region = rom_first_region(device); region; region = rom_next_region(region)) { -// temporary hack: add the driver path & region name -std::string combinedpath = util::string_format("%s;%s", device.searchpath(), driverpath); -if (device.shortname()) - combinedpath.append(";").append(device.shortname()); -m_searchpath = combinedpath.c_str(); - for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom)) { char const *const name(ROM_GETNAME(rom)); @@ -166,7 +162,7 @@ media_auditor::summary media_auditor::audit_software(const std::string &list_nam locationtag.append(swinfo->parentname()); combinedpath.append(util::string_format(";%s;%s%s%s", swinfo->parentname(), list_name, PATH_SEPARATOR, swinfo->parentname())); } - m_searchpath = combinedpath.c_str(); + m_searchpath = combinedpath; std::size_t found = 0; std::size_t required = 0; @@ -225,9 +221,9 @@ media_auditor::summary media_auditor::audit_samples() while (path.next(curpath, samplename)) { // attempt to access the file (.flac) or (.wav) - osd_file::error filerr = file.open(curpath, ".flac"); + osd_file::error filerr = file.open(curpath + ".flac"); if (filerr != osd_file::error::NONE) - filerr = file.open(curpath, ".wav"); + filerr = file.open(curpath + ".wav"); if (filerr == osd_file::error::NONE) { @@ -392,6 +388,7 @@ media_auditor::audit_record &media_auditor::audit_one_rom(const rom_entry *rom) file.set_restrict_to_mediapath(true); path_iterator path(m_searchpath); std::string curpath; + // FIXME: needs to be adjusted to match ROM loading behaviour while (path.next(curpath, record.name())) { // open the file if we can diff --git a/src/frontend/mame/audit.h b/src/frontend/mame/audit.h index be6dccf297c..42296d9260b 100644 --- a/src/frontend/mame/audit.h +++ b/src/frontend/mame/audit.h @@ -141,8 +141,8 @@ public: audit_status m_status; // status of audit on this item audit_substatus m_substatus; // finer-detail status const char * m_name; // name of item - uint64_t m_explength; // expected length of item - uint64_t m_length; // actual length of item + uint64_t m_explength; // expected length of item + uint64_t m_length; // actual length of item util::hash_collection m_exphashes; // expected hash data util::hash_collection m_hashes; // actual hash information device_t * m_shared_device; // device that shares the rom @@ -174,7 +174,7 @@ private: record_list m_record_list; const driver_enumerator & m_enumerator; const char * m_validation; - const char * m_searchpath; + std::string m_searchpath; }; diff --git a/src/frontend/mame/cheat.cpp b/src/frontend/mame/cheat.cpp index 38676366a61..e007f0d8372 100644 --- a/src/frontend/mame/cheat.cpp +++ b/src/frontend/mame/cheat.cpp @@ -138,7 +138,7 @@ inline std::string number_and_format::format() const // cheat_parameter - constructor //------------------------------------------------- -cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const ¶mnode) +cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols, std::string const &filename, util::xml::data_node const ¶mnode) : m_minval(number_and_format(paramnode.get_attribute_int("min", 0), paramnode.get_attribute_int_format("min"))) , m_maxval(number_and_format(paramnode.get_attribute_int("max", 0), paramnode.get_attribute_int_format("max"))) , m_stepval(number_and_format(paramnode.get_attribute_int("step", 1), paramnode.get_attribute_int_format("step"))) @@ -320,7 +320,7 @@ constexpr int cheat_script::script_entry::MAX_ARGUMENTS; cheat_script::cheat_script( cheat_manager &manager, symbol_table &symbols, - char const *filename, + std::string const &filename, util::xml::data_node const &scriptnode) : m_state(SCRIPT_STATE_RUN) { @@ -398,7 +398,7 @@ void cheat_script::save(emu_file &cheatfile) const cheat_script::script_entry::script_entry( cheat_manager &manager, symbol_table &symbols, - char const *filename, + std::string const &filename, util::xml::data_node const &entrynode, bool isaction) : m_condition(&symbols) @@ -574,7 +574,7 @@ void cheat_script::script_entry::save(emu_file &cheatfile) const // has the correct number and type of arguments //------------------------------------------------- -void cheat_script::script_entry::validate_format(const char *filename, int line) +void cheat_script::script_entry::validate_format(std::string const &filename, int line) { // first count arguments int argsprovided(0); @@ -608,7 +608,7 @@ void cheat_script::script_entry::validate_format(const char *filename, int line) cheat_script::script_entry::output_argument::output_argument( cheat_manager &manager, symbol_table &symbols, - char const *filename, + std::string const &filename, util::xml::data_node const &argnode) : m_expression(&symbols) , m_count(0) @@ -677,7 +677,7 @@ void cheat_script::script_entry::output_argument::save(emu_file &cheatfile) cons // cheat_entry - constructor //------------------------------------------------- -cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, const char *filename, util::xml::data_node const &cheatnode) +cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, std::string const &filename, util::xml::data_node const &cheatnode) : m_manager(manager) , m_symbols(&manager.machine(), &globaltable) , m_state(SCRIPT_STATE_OFF) @@ -1170,7 +1170,7 @@ void cheat_manager::reload() // have the same shortname if (image.loaded_through_softlist()) { - load_cheats(string_format("%s%s%s", image.software_list_name(), PATH_SEPARATOR, image.basename()).c_str()); + load_cheats(string_format("%s" PATH_SEPARATOR "%s", image.software_list_name(), image.basename())); break; } // else we are loading outside the software list, try to load machine_basename/crc32.xml @@ -1179,7 +1179,7 @@ void cheat_manager::reload() uint32_t crc = image.crc(); if (crc != 0) { - load_cheats(string_format("%s%s%08X", machine().basename(), PATH_SEPARATOR, crc).c_str()); + load_cheats(string_format("%s" PATH_SEPARATOR "%08X", machine().basename(), crc)); break; } } @@ -1201,11 +1201,11 @@ void cheat_manager::reload() // memory to the given filename //------------------------------------------------- -bool cheat_manager::save_all(const char *filename) +bool cheat_manager::save_all(std::string const &filename) { // open the file with the proper name emu_file cheatfile(machine().options().cheat_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - osd_file::error const filerr(cheatfile.open(filename, ".xml")); + osd_file::error const filerr(cheatfile.open(filename + ".xml")); // if that failed, return nothing if (filerr != osd_file::error::NONE) @@ -1392,19 +1392,19 @@ void cheat_manager::frame_update() // and create the cheat entry list //------------------------------------------------- -void cheat_manager::load_cheats(const char *filename) +void cheat_manager::load_cheats(std::string const &filename) { std::string searchstr(machine().options().cheat_path()); std::string curpath; for (path_iterator path(searchstr); path.next(curpath); ) { - searchstr.append(";").append(curpath).append(PATH_SEPARATOR).append("cheat"); + searchstr.append(";").append(curpath).append(PATH_SEPARATOR "cheat"); } emu_file cheatfile(std::move(searchstr), OPEN_FLAG_READ); try { // loop over all instrances of the files found in our search paths - for (osd_file::error filerr = cheatfile.open(filename, ".xml"); filerr == osd_file::error::NONE; filerr = cheatfile.open_next()) + for (osd_file::error filerr = cheatfile.open(filename + ".xml"); filerr == osd_file::error::NONE; filerr = cheatfile.open_next()) { osd_printf_verbose("Loading cheats file from %s\n", cheatfile.fullpath()); diff --git a/src/frontend/mame/cheat.h b/src/frontend/mame/cheat.h index d05890c7152..b6faaa85e80 100644 --- a/src/frontend/mame/cheat.h +++ b/src/frontend/mame/cheat.h @@ -88,7 +88,7 @@ public: cheat_parameter( cheat_manager &manager, symbol_table &symbols, - char const *filename, + std::string const &filename, util::xml::data_node const ¶mnode); // queries @@ -153,7 +153,7 @@ public: cheat_script( cheat_manager &manager, symbol_table &symbols, - char const *filename, + std::string const &filename, util::xml::data_node const &scriptnode); // getters @@ -172,7 +172,7 @@ private: script_entry( cheat_manager &manager, symbol_table &symbols, - char const *filename, + std::string const &filename, util::xml::data_node const &entrynode, bool isaction); @@ -189,7 +189,7 @@ private: output_argument( cheat_manager &manager, symbol_table &symbols, - char const *filename, + std::string const &filename, util::xml::data_node const &argnode); // getters @@ -206,7 +206,7 @@ private: }; // internal helpers - void validate_format(char const *filename, int line); + void validate_format(std::string const &filename, int line); // internal state parsed_expression m_condition; // condition under which this is executed @@ -233,7 +233,7 @@ class cheat_entry { public: // construction/destruction - cheat_entry(cheat_manager &manager, symbol_table &globaltable, const char *filename, util::xml::data_node const &cheatnode); + cheat_entry(cheat_manager &manager, symbol_table &globaltable, std::string const &filename, util::xml::data_node const &cheatnode); ~cheat_entry(); // getters @@ -319,7 +319,7 @@ public: // actions void reload(); - bool save_all(const char *filename); + bool save_all(std::string const &filename); void render_text(mame_ui_manager &mui, render_container &container); // output helpers @@ -333,7 +333,7 @@ public: private: // internal helpers void frame_update(); - void load_cheats(char const *filename); + void load_cheats(std::string const &filename); // internal state running_machine & m_machine; // reference to our machine diff --git a/src/frontend/mame/clifront.cpp b/src/frontend/mame/clifront.cpp index 3a881c1f667..fa63a283465 100644 --- a/src/frontend/mame/clifront.cpp +++ b/src/frontend/mame/clifront.cpp @@ -1650,7 +1650,7 @@ void cli_frontend::execute_commands(const char *exename) { // attempt to open the output file emu_file file(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - if (file.open(emulator_info::get_configname(), ".ini") != osd_file::error::NONE) + if (file.open(std::string(emulator_info::get_configname()) + ".ini") != osd_file::error::NONE) throw emu_fatalerror("Unable to create file %s.ini\n",emulator_info::get_configname()); // generate the updated INI diff --git a/src/frontend/mame/language.cpp b/src/frontend/mame/language.cpp index 2740aed973f..446157e6f19 100644 --- a/src/frontend/mame/language.cpp +++ b/src/frontend/mame/language.cpp @@ -68,7 +68,7 @@ void load_translation(emu_options &m_options) strreplace(name, "(", ""); strreplace(name, ")", ""); emu_file file(m_options.language_path(), OPEN_FLAG_READ); - if (file.open(name, PATH_SEPARATOR "strings.mo") != osd_file::error::NONE) + if (file.open(name + PATH_SEPARATOR "strings.mo") != osd_file::error::NONE) { osd_printf_error("Error opening translation file %s\n", name); return; diff --git a/src/frontend/mame/mameopts.cpp b/src/frontend/mame/mameopts.cpp index 48df66a337e..296d900d679 100644 --- a/src/frontend/mame/mameopts.cpp +++ b/src/frontend/mame/mameopts.cpp @@ -130,7 +130,7 @@ void mame_options::parse_one_ini(emu_options &options, const char *basename, int // open the file; if we fail, that's ok emu_file file(options.ini_path(), OPEN_FLAG_READ); osd_printf_verbose("Attempting load of %s.ini\n", basename); - osd_file::error filerr = file.open(basename, ".ini"); + osd_file::error filerr = file.open(std::string(basename) + ".ini"); if (filerr != osd_file::error::NONE) return; diff --git a/src/frontend/mame/ui/auditmenu.cpp b/src/frontend/mame/ui/auditmenu.cpp index 2289762ae49..32d73b1fadd 100644 --- a/src/frontend/mame/ui/auditmenu.cpp +++ b/src/frontend/mame/ui/auditmenu.cpp @@ -228,7 +228,7 @@ void menu_audit::save_available_machines() { // attempt to open the output file emu_file file(ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - if (file.open(emulator_info::get_configname(), "_avail.ini") == osd_file::error::NONE) + if (file.open(std::string(emulator_info::get_configname()) + "_avail.ini") == osd_file::error::NONE) { // generate header file.printf("#\n%s%s\n#\n\n", UI_VERSION_TAG, emulator_info::get_bare_build_version()); diff --git a/src/frontend/mame/ui/miscmenu.cpp b/src/frontend/mame/ui/miscmenu.cpp index 55147b020ec..82b7916e3a5 100644 --- a/src/frontend/mame/ui/miscmenu.cpp +++ b/src/frontend/mame/ui/miscmenu.cpp @@ -598,8 +598,8 @@ void menu_export::handle() { // process the menu process_parent(); - const event *menu_event = process(PROCESS_NOIMAGE); - if (menu_event != nullptr && menu_event->itemref != nullptr) + const event *const menu_event = process(PROCESS_NOIMAGE); + if (menu_event && menu_event->itemref) { switch (uintptr_t(menu_event->itemref)) { @@ -609,11 +609,11 @@ void menu_export::handle() { std::string filename("exported"); emu_file infile(ui().options().ui_path(), OPEN_FLAG_READ); - if (infile.open(filename, ".xml") == osd_file::error::NONE) + if (infile.open(filename + ".xml") == osd_file::error::NONE) for (int seq = 0; ; ++seq) { - std::string seqtext = string_format("%s_%04d", filename, seq); - if (infile.open(seqtext, ".xml") != osd_file::error::NONE) + const std::string seqtext = string_format("%s_%04d", filename, seq); + if (infile.open(seqtext + ".xml") != osd_file::error::NONE) { filename = seqtext; break; @@ -622,9 +622,9 @@ void menu_export::handle() // attempt to open the output file emu_file file(ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - if (file.open(filename, ".xml") == osd_file::error::NONE) + if (file.open(filename + ".xml") == osd_file::error::NONE) { - std::string fullpath(file.fullpath()); + const std::string fullpath(file.fullpath()); file.close(); std::ofstream pfile(fullpath); @@ -654,11 +654,11 @@ void menu_export::handle() { std::string filename("exported"); emu_file infile(ui().options().ui_path(), OPEN_FLAG_READ); - if (infile.open(filename, ".txt") == osd_file::error::NONE) + if (infile.open(filename + ".txt") == osd_file::error::NONE) for (int seq = 0; ; ++seq) { - std::string seqtext = string_format("%s_%04d", filename, seq); - if (infile.open(seqtext, ".txt") != osd_file::error::NONE) + const std::string seqtext = string_format("%s_%04d", filename, seq); + if (infile.open(seqtext + ".txt") != osd_file::error::NONE) { filename = seqtext; break; @@ -667,7 +667,7 @@ void menu_export::handle() // attempt to open the output file emu_file file(ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - if (file.open(filename, ".txt") == osd_file::error::NONE) + if (file.open(filename + ".txt") == osd_file::error::NONE) { // print the header std::ostringstream buffer; @@ -762,9 +762,9 @@ void menu_machine_configure::handle() { case SAVE: { - std::string filename(m_drv.name); + const std::string filename(m_drv.name); emu_file file(machine().options().ini_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); - osd_file::error filerr = file.open(filename, ".ini"); + osd_file::error filerr = file.open(filename + ".ini"); if (filerr == osd_file::error::NONE) { std::string inistring = m_opts.output_ini(); diff --git a/src/frontend/mame/ui/optsmenu.cpp b/src/frontend/mame/ui/optsmenu.cpp index 17dddd10c67..98c1936510f 100644 --- a/src/frontend/mame/ui/optsmenu.cpp +++ b/src/frontend/mame/ui/optsmenu.cpp @@ -266,7 +266,7 @@ void menu_game_options::handle_item_event(event const &menu_event) if (machine_filter::CUSTOM == filter.get_type()) { emu_file file(ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - if (file.open("custom_", emulator_info::get_configname(), "_filter.ini") == osd_file::error::NONE) + if (file.open(util::string_format("custom_%s_filter.ini", emulator_info::get_configname())) == osd_file::error::NONE) { filter.save_ini(file, 0); file.close(); diff --git a/src/frontend/mame/ui/selgame.cpp b/src/frontend/mame/ui/selgame.cpp index 00113d8aeda..6bbe0c874f1 100644 --- a/src/frontend/mame/ui/selgame.cpp +++ b/src/frontend/mame/ui/selgame.cpp @@ -1244,12 +1244,12 @@ render_texture *menu_select_game::get_icon_texture(int linenum, void *selectedre bitmap_argb32 tmp; emu_file snapfile(std::string(m_icon_paths), OPEN_FLAG_READ); - if (snapfile.open(std::string(driver->name), ".ico") == osd_file::error::NONE) + if (snapfile.open(std::string(driver->name) + ".ico") == osd_file::error::NONE) { render_load_ico_highest_detail(snapfile, tmp); snapfile.close(); } - if (!tmp.valid() && cloneof && (snapfile.open(std::string(driver->parent), ".ico") == osd_file::error::NONE)) + if (!tmp.valid() && cloneof && (snapfile.open(std::string(driver->parent) + ".ico") == osd_file::error::NONE)) { render_load_ico_highest_detail(snapfile, tmp); snapfile.close(); @@ -1294,7 +1294,7 @@ bool menu_select_game::load_available_machines() { // try to load available drivers from file emu_file file(ui().options().ui_path(), OPEN_FLAG_READ); - if (file.open(emulator_info::get_configname(), "_avail.ini") != osd_file::error::NONE) + if (file.open(std::string(emulator_info::get_configname()) + "_avail.ini") != osd_file::error::NONE) return false; char rbuf[MAX_CHAR_INFO]; @@ -1347,7 +1347,7 @@ bool menu_select_game::load_available_machines() void menu_select_game::load_custom_filters() { emu_file file(ui().options().ui_path(), OPEN_FLAG_READ); - if (file.open("custom_", emulator_info::get_configname(), "_filter.ini") == osd_file::error::NONE) + if (file.open(util::string_format("custom_%s_filter.ini", emulator_info::get_configname())) == osd_file::error::NONE) { machine_filter::ptr flt(machine_filter::create(file, m_persistent_data.filter_data())); if (flt) @@ -1442,7 +1442,7 @@ void menu_select_game::filter_selected() if (machine_filter::CUSTOM == new_type) { emu_file file(ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - if (file.open("custom_", emulator_info::get_configname(), "_filter.ini") == osd_file::error::NONE) + if (file.open(util::string_format("custom_%s_filter.ini", emulator_info::get_configname())) == osd_file::error::NONE) { filter.save_ini(file, 0); file.close(); diff --git a/src/frontend/mame/ui/selsoft.cpp b/src/frontend/mame/ui/selsoft.cpp index 3c689d19239..4bbfb6fd294 100644 --- a/src/frontend/mame/ui/selsoft.cpp +++ b/src/frontend/mame/ui/selsoft.cpp @@ -521,7 +521,7 @@ void menu_select_software::load_sw_custom_filters() { // attempt to open the output file emu_file file(ui().options().ui_path(), OPEN_FLAG_READ); - if (file.open("custom_", m_driver.name, "_filter.ini") == osd_file::error::NONE) + if (file.open(util::string_format("custom_%s_filter.ini", m_driver.name)) == osd_file::error::NONE) { software_filter::ptr flt(software_filter::create(file, m_filter_data)); if (flt) @@ -597,12 +597,12 @@ render_texture *menu_select_software::get_icon_texture(int linenum, void *select bitmap_argb32 tmp; emu_file snapfile(std::string(paths->second), OPEN_FLAG_READ); - if (snapfile.open(std::string(swinfo->shortname), ".ico") == osd_file::error::NONE) + if (snapfile.open(std::string(swinfo->shortname) + ".ico") == osd_file::error::NONE) { render_load_ico_highest_detail(snapfile, tmp); snapfile.close(); } - if (!tmp.valid() && !swinfo->parentname.empty() && (snapfile.open(std::string(swinfo->parentname), ".ico") == osd_file::error::NONE)) + if (!tmp.valid() && !swinfo->parentname.empty() && (snapfile.open(std::string(swinfo->parentname) + ".ico") == osd_file::error::NONE)) { render_load_ico_highest_detail(snapfile, tmp); snapfile.close(); @@ -672,7 +672,7 @@ void menu_select_software::filter_selected() if (software_filter::CUSTOM == new_type) { emu_file file(ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - if (file.open("custom_", m_driver.name, "_filter.ini") == osd_file::error::NONE) + if (file.open(util::string_format("custom_%s_filter.ini", m_driver.name)) == osd_file::error::NONE) { filter.save_ini(file, 0); file.close(); diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp index b5b37a3450f..de1a7d5825c 100644 --- a/src/frontend/mame/ui/ui.cpp +++ b/src/frontend/mame/ui/ui.cpp @@ -2129,7 +2129,7 @@ void mame_ui_manager::save_main_option() // attempt to open the main ini file { emu_file file(machine().options().ini_path(), OPEN_FLAG_READ); - if (file.open(emulator_info::get_configname(), ".ini") == osd_file::error::NONE) + if (file.open(std::string(emulator_info::get_configname()) + ".ini") == osd_file::error::NONE) { try { @@ -2159,7 +2159,7 @@ void mame_ui_manager::save_main_option() // attempt to open the output file { emu_file file(machine().options().ini_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - if (file.open(emulator_info::get_configname(), ".ini") == osd_file::error::NONE) + if (file.open(std::string(emulator_info::get_configname()) + ".ini") == osd_file::error::NONE) { // generate the updated INI std::string initext = options.output_ini(); |