summaryrefslogtreecommitdiffstats
path: root/src/emu/config.cpp
diff options
context:
space:
mode:
author Vas Crabb <cuavas@users.noreply.github.com>2021-08-22 09:06:15 +1000
committer GitHub <noreply@github.com>2021-08-22 09:06:15 +1000
commite8bbea1fc6e94e14768509d322f6c624403ffb36 (patch)
tree74dd1606a900d83de8aecff17a6737af4113308d /src/emu/config.cpp
parente319bde5fc3696d7f48f62b15b6366c4377fe5d1 (diff)
formats, osd, util: Started refactoring file I/O stuff. (#8456)
Added more modern generic I/O interfaces with implementation backed by stdio, osd_file and core_file, replacing io_generic. Also replaced core_file's build-in zlib compression with a filter. unzip.cpp, un7z.cpp: Added option to supply abstract I/O interface rather than filename. Converted osd_file, core_file, archive_file, chd_file and device_image_interface to use std::error_condition rather than their own error enums. Allow mounting TI-99 RPK from inside archives.
Diffstat (limited to 'src/emu/config.cpp')
-rw-r--r--src/emu/config.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/emu/config.cpp b/src/emu/config.cpp
index 46bec43c1dd..792da6f255d 100644
--- a/src/emu/config.cpp
+++ b/src/emu/config.cpp
@@ -64,16 +64,16 @@ bool configuration_manager::load_settings()
type.load(config_type::INIT, config_level::DEFAULT, nullptr);
// now load the controller file
- const char *controller = machine().options().ctrlr();
+ char const *const controller = machine().options().ctrlr();
if (controller && *controller)
{
// open the config file
emu_file file(machine().options().ctrlr_path(), OPEN_FLAG_READ);
osd_printf_verbose("Attempting to parse: %s.cfg\n", controller);
- osd_file::error filerr = file.open(std::string(controller) + ".cfg");
+ std::error_condition const filerr = file.open(std::string(controller) + ".cfg");
- if (filerr != osd_file::error::NONE)
- throw emu_fatalerror("Could not open controller file %s.cfg", controller);
+ if (filerr)
+ throw emu_fatalerror("Could not open controller file %s.cfg (%s:%d %s)", controller, filerr.category().name(), filerr.value(), filerr.message());
// load the XML
if (!load_xml(file, config_type::CONTROLLER))
@@ -82,15 +82,15 @@ bool configuration_manager::load_settings()
// next load the defaults file
emu_file file(machine().options().cfg_directory(), OPEN_FLAG_READ);
- osd_file::error filerr = file.open("default.cfg");
+ std::error_condition filerr = file.open("default.cfg");
osd_printf_verbose("Attempting to parse: default.cfg\n");
- if (filerr == osd_file::error::NONE)
+ if (!filerr)
load_xml(file, config_type::DEFAULT);
// finally, load the game-specific file
filerr = file.open(machine().basename() + ".cfg");
osd_printf_verbose("Attempting to parse: %s.cfg\n",machine().basename());
- const bool loaded = (osd_file::error::NONE == filerr) && load_xml(file, config_type::SYSTEM);
+ const bool loaded = !filerr && load_xml(file, config_type::SYSTEM);
// loop over all registrants and call their final function
for (const auto &type : m_typelist)
@@ -110,13 +110,13 @@ void configuration_manager::save_settings()
// save the defaults file
emu_file file(machine().options().cfg_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
- osd_file::error filerr = file.open("default.cfg");
- if (filerr == osd_file::error::NONE)
+ std::error_condition filerr = file.open("default.cfg");
+ if (!filerr)
save_xml(file, config_type::DEFAULT);
// finally, save the system-specific file
filerr = file.open(machine().basename() + ".cfg");
- if (filerr == osd_file::error::NONE)
+ if (!filerr)
save_xml(file, config_type::SYSTEM);
// loop over all registrants and call their final function