diff options
author | 2018-01-07 05:51:02 +0100 | |
---|---|---|
committer | 2018-01-07 15:51:02 +1100 | |
commit | 1aaed4a64ef0783c73730036dfa40edff7f572cc (patch) | |
tree | bcbb305859cff571e00031fa5a1a5dcd69905b6b /src/emu/render.cpp | |
parent | e359046b0c128ef4512de2d1b0801960add57826 (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.
Diffstat (limited to 'src/emu/render.cpp')
-rw-r--r-- | src/emu/render.cpp | 84 |
1 files changed, 63 insertions, 21 deletions
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) { |