ui: only warn about external artwork when it wasn't loaded (nw)

This commit is contained in:
hap 2020-06-13 21:04:52 +02:00
parent a3c65b6ce2
commit 18bd40b8ca
3 changed files with 31 additions and 16 deletions

View File

@ -906,6 +906,7 @@ template <typename T> render_target::render_target(render_manager &manager, T &&
, m_maxtexwidth(65536)
, m_maxtexheight(65536)
, m_transform_container(true)
, m_external_artwork(false)
{
// determine the base layer configuration based on options
m_base_layerconfig.set_zoom_to_screen(manager.machine().options().artwork_crop());
@ -1530,7 +1531,7 @@ void render_target::update_layer_config()
void render_target::load_layout_files(const internal_layout *layoutfile, bool singlefile)
{
bool have_artwork = false;
bool have_artwork = false;
// if there's an explicit file, load that first
const std::string &basename = m_manager.machine().basename();
@ -1544,7 +1545,7 @@ void render_target::load_layout_files(const internal_layout *layoutfile, bool si
void render_target::load_layout_files(util::xml::data_node const &rootnode, bool singlefile)
{
bool have_artwork = false;
bool have_artwork = false;
// if there's an explicit file, load that first
const std::string &basename = m_manager.machine().basename();
@ -1557,32 +1558,31 @@ void render_target::load_layout_files(util::xml::data_node const &rootnode, bool
void render_target::load_additional_layout_files(const char *basename, bool have_artwork)
{
bool have_default = false;
bool have_override = false;
m_external_artwork = false;
// if override_artwork defined, load that and skip artwork other than default
const char *const override_art = m_manager.machine().options().override_artwork();
if (override_art && *override_art)
{
if (load_layout_file(override_art, override_art))
have_override = true;
m_external_artwork = true;
else if (load_layout_file(override_art, "default"))
have_override = true;
m_external_artwork = true;
}
const game_driver &system = m_manager.machine().system();
// Skip if override_artwork has found artwork
if (!have_override)
if (!m_external_artwork)
{
// try to load a file based on the driver name
if (!load_layout_file(basename, system.name))
have_artwork |= load_layout_file(basename, "default");
m_external_artwork |= load_layout_file(basename, "default");
else
have_artwork = true;
m_external_artwork = true;
// if a default view has been specified, use that as a fallback
bool have_default = false;
if (system.default_layout)
have_default |= load_layout_file(nullptr, *system.default_layout);
m_manager.machine().config().apply_default_layouts(
@ -1594,15 +1594,17 @@ void render_target::load_additional_layout_files(const char *basename, bool have
while (0 <= cloneof)
{
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");
m_external_artwork |= load_layout_file(driver_list::driver(cloneof).name, "default");
else
have_artwork = true;
m_external_artwork = true;
// Check the parent of the parent to cover bios based artwork
const game_driver &parent(driver_list::driver(cloneof));
cloneof = driver_list::clone(parent);
}
have_artwork |= m_external_artwork;
// Use fallback artwork if defined and no artwork has been found yet
if (!have_artwork)
{

View File

@ -922,6 +922,7 @@ public:
render_layer_config layer_config() const { return m_layerconfig; }
layout_view *current_view() const { return m_curview; }
int view() const { return view_index(*m_curview); }
bool external_artwork() const { return m_external_artwork; }
bool hidden() const { return ((m_flags & RENDER_CREATE_HIDDEN) != 0); }
bool is_ui_target() const;
int index() const;
@ -1038,6 +1039,7 @@ private:
s32 m_clear_extents[MAX_CLEAR_EXTENTS]; // array of clear extents
bool m_transform_container; // determines whether the screen container is transformed by the core renderer,
// otherwise the respective render API will handle the transformation (scale, offset)
bool m_external_artwork; // external artwork was loaded (driver file or override)
};

View File

@ -104,6 +104,17 @@ machine_static_info::machine_static_info(const ui_options &options, machine_conf
local_ports.append(device, sink);
}
// suppress "requires external artwork" warning when external artwork was loaded
if (config.root_device().has_running_machine())
{
for (render_target *target = config.root_device().machine().render().first_target(); target != nullptr; target = target->next())
if (!target->hidden() && target->external_artwork())
{
m_flags &= ~::machine_flags::REQUIRES_ARTWORK;
break;
}
}
// unemulated trumps imperfect when aggregating (always be pessimistic)
m_imperfect_features &= ~m_unemulated_features;
@ -136,7 +147,7 @@ rgb_t machine_static_info::status_color() const
{
if ((machine_flags() & MACHINE_ERRORS) || ((unemulated_features() | imperfect_features()) & device_t::feature::PROTECTION))
return UI_RED_COLOR;
else if ((machine_flags() & MACHINE_WARNINGS) || unemulated_features() || imperfect_features())
else if ((machine_flags() & MACHINE_WARNINGS & ~::machine_flags::REQUIRES_ARTWORK) || unemulated_features() || imperfect_features())
return UI_YELLOW_COLOR;
else
return UI_GREEN_COLOR;
@ -238,11 +249,11 @@ std::string machine_info::warnings_string() const
// add one line per machine warning flag
if (machine_flags() & ::machine_flags::NO_COCKTAIL)
buf << _("Screen flipping in cocktail mode is not supported.\n");
if (machine_flags() & ::machine_flags::REQUIRES_ARTWORK) // check if external artwork is present before displaying this warning?
if (machine_flags() & ::machine_flags::REQUIRES_ARTWORK)
buf << _("This machine requires external artwork files.\n");
if (machine_flags() & ::machine_flags::IS_INCOMPLETE )
if (machine_flags() & ::machine_flags::IS_INCOMPLETE)
buf << _("This machine was never completed. It may exhibit strange behavior or missing elements that are not bugs in the emulation.\n");
if (machine_flags() & ::machine_flags::NO_SOUND_HW )
if (machine_flags() & ::machine_flags::NO_SOUND_HW)
buf << _("This machine has no sound hardware, MAME will produce no sounds, this is expected behaviour.\n");
// these are more severe warnings