summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/mameopts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/mame/mameopts.cpp')
-rw-r--r--src/frontend/mame/mameopts.cpp90
1 files changed, 41 insertions, 49 deletions
diff --git a/src/frontend/mame/mameopts.cpp b/src/frontend/mame/mameopts.cpp
index 1ab0b81874f..cd754fcb0f3 100644
--- a/src/frontend/mame/mameopts.cpp
+++ b/src/frontend/mame/mameopts.cpp
@@ -11,14 +11,21 @@
#include "emu.h"
#include "mameopts.h"
+#include "clifront.h"
+
+// emu
#include "drivenum.h"
+#include "fileio.h"
+#include "hashfile.h"
+#include "main.h"
#include "screen.h"
#include "softlist_dev.h"
+
+// lib/util
+#include "path.h"
#include "zippath.h"
-#include "hashfile.h"
-#include "clifront.h"
-#include <ctype.h>
+#include <cctype>
#include <stack>
@@ -43,55 +50,40 @@ void mame_options::parse_standard_inis(emu_options &options, std::ostream &error
if (!cursystem)
return;
- // parse "vertical.ini" or "horizont.ini"
- if (cursystem->flags & ORIENTATION_SWAP_XY)
- parse_one_ini(options, "vertical", OPTION_PRIORITY_ORIENTATION_INI, &error_stream);
- else
- parse_one_ini(options, "horizont", OPTION_PRIORITY_ORIENTATION_INI, &error_stream);
-
- switch (cursystem->flags & machine_flags::MASK_TYPE)
+ if (&GAME_NAME(___empty) != cursystem) // hacky - this thing isn't a real system
{
- case machine_flags::TYPE_ARCADE:
- parse_one_ini(options, "arcade", OPTION_PRIORITY_SYSTYPE_INI, &error_stream);
- break;
- case machine_flags::TYPE_CONSOLE:
- parse_one_ini(options ,"console", OPTION_PRIORITY_SYSTYPE_INI, &error_stream);
- break;
- case machine_flags::TYPE_COMPUTER:
- parse_one_ini(options, "computer", OPTION_PRIORITY_SYSTYPE_INI, &error_stream);
- break;
- case machine_flags::TYPE_OTHER:
- parse_one_ini(options, "othersys", OPTION_PRIORITY_SYSTYPE_INI, &error_stream);
- break;
- default:
- break;
- }
-
- machine_config config(*cursystem, options);
- for (const screen_device &device : screen_device_iterator(config.root_device()))
- {
- // parse "raster.ini" for raster games
- if (device.screen_type() == SCREEN_TYPE_RASTER)
- {
- parse_one_ini(options, "raster", OPTION_PRIORITY_SCREEN_INI, &error_stream);
- break;
- }
- // parse "vector.ini" for vector games
- if (device.screen_type() == SCREEN_TYPE_VECTOR)
- {
- parse_one_ini(options, "vector", OPTION_PRIORITY_SCREEN_INI, &error_stream);
- break;
- }
- // parse "lcd.ini" for lcd games
- if (device.screen_type() == SCREEN_TYPE_LCD)
+ // parse "vertical.ini" or "horizont.ini"
+ if (cursystem->flags & ORIENTATION_SWAP_XY)
+ parse_one_ini(options, "vertical", OPTION_PRIORITY_ORIENTATION_INI, &error_stream);
+ else
+ parse_one_ini(options, "horizont", OPTION_PRIORITY_ORIENTATION_INI, &error_stream);
+
+ machine_config config(*cursystem, options);
+ for (const screen_device &device : screen_device_enumerator(config.root_device()))
{
- parse_one_ini(options, "lcd", OPTION_PRIORITY_SCREEN_INI, &error_stream);
- break;
+ // parse "raster.ini" for raster games
+ if (device.screen_type() == SCREEN_TYPE_RASTER)
+ {
+ parse_one_ini(options, "raster", OPTION_PRIORITY_SCREEN_INI, &error_stream);
+ break;
+ }
+ // parse "vector.ini" for vector games
+ if (device.screen_type() == SCREEN_TYPE_VECTOR)
+ {
+ parse_one_ini(options, "vector", OPTION_PRIORITY_SCREEN_INI, &error_stream);
+ break;
+ }
+ // parse "lcd.ini" for lcd games
+ if (device.screen_type() == SCREEN_TYPE_LCD)
+ {
+ parse_one_ini(options, "lcd", OPTION_PRIORITY_SCREEN_INI, &error_stream);
+ break;
+ }
}
}
// next parse "source/<sourcefile>.ini"
- std::string sourcename = core_filename_extract_base(cursystem->type.source(), true).insert(0, "source" PATH_SEPARATOR);
+ std::string sourcename = std::string(core_filename_extract_base(cursystem->type.source(), true)).insert(0, "source" PATH_SEPARATOR);
parse_one_ini(options, sourcename.c_str(), OPTION_PRIORITY_SOURCE_INI, &error_stream);
// then parse the grandparent, parent, and system-specific INIs
@@ -112,7 +104,7 @@ void mame_options::parse_standard_inis(emu_options &options, std::ostream &error
const game_driver *mame_options::system(const emu_options &options)
{
- int index = driver_list::find(core_filename_extract_base(options.system_name(), true).c_str());
+ int index = driver_list::find(std::string(core_filename_extract_base(options.system_name(), true)).c_str());
return (index != -1) ? &driver_list::driver(index) : nullptr;
}
@@ -130,8 +122,8 @@ 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");
- if (filerr != osd_file::error::NONE)
+ std::error_condition const filerr = file.open(std::string(basename) + ".ini");
+ if (filerr)
return;
// parse the file