summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author phulshof <pieter@towel42.nl>2018-01-07 05:51:02 +0100
committer Vas Crabb <cuavas@users.noreply.github.com>2018-01-07 15:51:02 +1100
commit1aaed4a64ef0783c73730036dfa40edff7f572cc (patch)
treebcbb305859cff571e00031fa5a1a5dcd69905b6b
parente359046b0c128ef4512de2d1b0801960add57826 (diff)
Override and fallback options for artwork (#2908)
* Added fallback_artwork and override_artwork as MAME options to allow default artwork to be loaded. * Removed debug testing code. * - Allow loading of built-in layouts even if override_artwork is specified. - Allow loading of fallback_artwork if only default view have been found. - Fixed order of built-in layouts with regards to fallback_artwork as agreed upon the forums. * Changed |= true to = true, and changed override artwork so it only checks for default.lay if the <machine name>.lay is not found.
-rw-r--r--src/emu/emuopts.cpp2
-rw-r--r--src/emu/emuopts.h4
-rw-r--r--src/emu/render.cpp84
3 files changed, 69 insertions, 21 deletions
diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp
index b14192119bc..e9009e92dd4 100644
--- a/src/emu/emuopts.cpp
+++ b/src/emu/emuopts.cpp
@@ -118,6 +118,8 @@ const options_entry emu_options::s_option_entries[] =
{ OPTION_USE_BEZELS ";bezel", "1", OPTION_BOOLEAN, "enable bezels if artwork is enabled and available" },
{ OPTION_USE_CPANELS ";cpanel", "1", OPTION_BOOLEAN, "enable cpanels if artwork is enabled and available" },
{ OPTION_USE_MARQUEES ";marquee", "1", OPTION_BOOLEAN, "enable marquees if artwork is enabled and available" },
+ { OPTION_FALLBACK_ARTWORK, nullptr, OPTION_STRING, "fallback artwork if no external artwork or internal driver layout defined" },
+ { OPTION_OVERRIDE_ARTWORK, nullptr, OPTION_STRING, "override artwork for external artwork and internal driver layout" },
// screen options
{ nullptr, nullptr, OPTION_HEADER, "CORE SCREEN OPTIONS" },
diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h
index e079b7082f1..ab220e99bba 100644
--- a/src/emu/emuopts.h
+++ b/src/emu/emuopts.h
@@ -102,6 +102,8 @@
#define OPTION_USE_BEZELS "use_bezels"
#define OPTION_USE_CPANELS "use_cpanels"
#define OPTION_USE_MARQUEES "use_marquees"
+#define OPTION_FALLBACK_ARTWORK "fallback_artwork"
+#define OPTION_OVERRIDE_ARTWORK "override_artwork"
// core screen options
#define OPTION_BRIGHTNESS "brightness"
@@ -381,6 +383,8 @@ public:
bool use_bezels() const { return bool_value(OPTION_USE_BEZELS); }
bool use_cpanels() const { return bool_value(OPTION_USE_CPANELS); }
bool use_marquees() const { return bool_value(OPTION_USE_MARQUEES); }
+ const char *fallback_artwork() const { return value(OPTION_FALLBACK_ARTWORK); }
+ const char *override_artwork() const { return value(OPTION_OVERRIDE_ARTWORK); }
// core screen options
float brightness() const { return float_value(OPTION_BRIGHTNESS); }
diff --git a/src/emu/render.cpp b/src/emu/render.cpp
index 5634870b34a..318ff1c384f 100644
--- a/src/emu/render.cpp
+++ b/src/emu/render.cpp
@@ -1574,38 +1574,80 @@ void render_target::update_layer_config()
void render_target::load_layout_files(const internal_layout *layoutfile, bool singlefile)
{
- bool have_default = false;
+ bool have_default = false;
+ bool have_artwork = false;
+ bool have_override = false;
// if there's an explicit file, load that first
const char *basename = m_manager.machine().basename();
if (layoutfile)
- have_default |= load_layout_file(basename, layoutfile);
+ have_artwork |= load_layout_file(basename, layoutfile);
// if we're only loading this file, we know our final result
if (singlefile)
return;
- // try to load a file based on the driver name
+ // if override_artwork defined, load that and skip artwork other than default
+ if (m_manager.machine().options().override_artwork())
+ {
+ if (load_layout_file(m_manager.machine().options().override_artwork(), m_manager.machine().options().override_artwork()))
+ have_override = true;
+ else if (load_layout_file(m_manager.machine().options().override_artwork(), "default"))
+ have_override = true;
+ }
+
const game_driver &system = m_manager.machine().system();
- if (!load_layout_file(basename, system.name))
- have_default |= load_layout_file(basename, "default");
- else
- have_default |= true;
-
- // if a default view has been specified, use that as a fallback
- if (system.default_layout != nullptr)
- have_default |= load_layout_file(nullptr, system.default_layout);
- if (m_manager.machine().config().m_default_layout != nullptr)
- have_default |= load_layout_file(nullptr, m_manager.machine().config().m_default_layout);
-
- // try to load another file based on the parent driver name
- int cloneof = driver_list::clone(system);
- if (cloneof != -1) {
- if (!load_layout_file(driver_list::driver(cloneof).name, driver_list::driver(cloneof).name))
- have_default |= load_layout_file(driver_list::driver(cloneof).name, "default");
+
+ // Skip if override_artwork has found artwork
+ if (!have_override)
+ {
+
+ // try to load a file based on the driver name
+ if (!load_layout_file(basename, system.name))
+ have_artwork |= load_layout_file(basename, "default");
else
- have_default |= true;
+ have_artwork = true;
+
+ // if a default view has been specified, use that as a fallback
+ if (system.default_layout != nullptr)
+ have_default |= load_layout_file(nullptr, system.default_layout);
+ if (m_manager.machine().config().m_default_layout != nullptr)
+ have_default |= load_layout_file(nullptr, m_manager.machine().config().m_default_layout);
+
+ // try to load another file based on the parent driver name
+ int cloneof = driver_list::clone(system);
+ if (cloneof != -1)
+ {
+ if (!load_layout_file(driver_list::driver(cloneof).name, driver_list::driver(cloneof).name))
+ have_artwork |= load_layout_file(driver_list::driver(cloneof).name, "default");
+ else
+ have_artwork = true;
+ }
+
+ // Check the parent of the parent to cover bios based artwork
+ if (cloneof != -1) {
+ const game_driver &clone(driver_list::driver(cloneof));
+ int cloneofclone = driver_list::clone(clone);
+ if (cloneofclone != -1 && cloneofclone != cloneof)
+ {
+ if (!load_layout_file(driver_list::driver(cloneofclone).name, driver_list::driver(cloneofclone).name))
+ have_artwork |= load_layout_file(driver_list::driver(cloneofclone).name, "default");
+ else
+ have_artwork = true;
+ }
+ }
+
+ // Use fallback artwork if defined and no artwork has been found yet
+ if (!have_artwork && m_manager.machine().options().fallback_artwork())
+ {
+ if (!load_layout_file(m_manager.machine().options().fallback_artwork(), m_manager.machine().options().fallback_artwork()))
+ have_artwork |= load_layout_file(m_manager.machine().options().fallback_artwork(), "default");
+ else
+ have_artwork = true;
+ }
+
}
+
screen_device_iterator iter(m_manager.machine().root_device());
unsigned const screens = iter.count();
@@ -1620,7 +1662,7 @@ void render_target::load_layout_files(const internal_layout *layoutfile, bool si
throw emu_fatalerror("Couldn't parse default layout??");
}
- if (!have_default)
+ if (!have_default && !have_artwork)
{
if (screens == 0)
{