Skip to content

Commit

Permalink
Fix default image artwork not used if video exists
Browse files Browse the repository at this point in the history
Fix for issue #59
  • Loading branch information
oomek committed Oct 14, 2024
1 parent 23d2cf5 commit 6b2fec5
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/fe_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3711,6 +3711,7 @@ bool gather_artwork_filenames(
const std::string &target_name,
std::vector<std::string> &vids,
std::vector<std::string> &images,
bool image_only,
FePathCache *path_cache )
{
for ( std::vector< std::string >::const_iterator itr = art_paths.begin();
Expand Down Expand Up @@ -3796,6 +3797,7 @@ bool gather_artwork_filenames(
}
}

if ( image_only ) vids.clear();
return ( !images.empty() || !vids.empty() );
}

Expand Down Expand Up @@ -3891,7 +3893,7 @@ bool FeSettings::internal_get_best_artwork_file(
const std::string &cloneof = rom.get_info( FeRomInfo::Cloneof );

std::vector<std::string> romname_image_list;
if ( gather_artwork_filenames( art_paths, romname, vid_list, romname_image_list, &m_path_cache ) )
if ( gather_artwork_filenames( art_paths, romname, vid_list, romname_image_list, image_only, &m_path_cache ) )
{
// test for "romname" specific videos first
if ( !image_only && !vid_list.empty() )
Expand All @@ -3901,7 +3903,7 @@ bool FeSettings::internal_get_best_artwork_file(
bool check_altname = ( !altname.empty() && ( romname.compare( altname ) != 0 ));

std::vector<std::string> altname_image_list;
if ( check_altname && gather_artwork_filenames( art_paths, altname, vid_list, altname_image_list, &m_path_cache ) )
if ( check_altname && gather_artwork_filenames( art_paths, altname, vid_list, altname_image_list, image_only, &m_path_cache ) )
{
// test for "altname" specific videos second
if ( !image_only && !vid_list.empty() )
Expand All @@ -3911,7 +3913,7 @@ bool FeSettings::internal_get_best_artwork_file(
bool check_cloneof = ( !cloneof.empty() && (altname.compare( cloneof ) != 0 ));

std::vector<std::string> cloneof_image_list;
if ( check_cloneof && gather_artwork_filenames( art_paths, cloneof, vid_list, cloneof_image_list, &m_path_cache ) )
if ( check_cloneof && gather_artwork_filenames( art_paths, cloneof, vid_list, cloneof_image_list, image_only, &m_path_cache ) )
{
// then "cloneof" specific videos
if ( !image_only && !vid_list.empty() )
Expand Down Expand Up @@ -3941,8 +3943,7 @@ bool FeSettings::internal_get_best_artwork_file(

// then "emulator"
if ( !ignore_emu && !emu_name.empty()
&& gather_artwork_filenames( art_paths,
emu_name, vid_list, image_list, &m_path_cache ) )
&& gather_artwork_filenames( art_paths, emu_name, vid_list, image_list, image_only, &m_path_cache ) )
return true;
}

Expand Down Expand Up @@ -3976,16 +3977,14 @@ void FeSettings::get_best_artwork_file(

// check for "[emulator-[artlabel]" artworks first
if ( gather_artwork_filenames( layout_paths,
emu_name + "-" + art_name,
vid_list, image_list, &m_path_cache ) )
emu_name + "-" + art_name, vid_list, image_list, image_only, &m_path_cache ) )
{
if ( !image_only && !vid_list.empty() )
return;
}

// then "[artlabel]"
gather_artwork_filenames( layout_paths,
art_name, vid_list, image_list, &m_path_cache );
gather_artwork_filenames( layout_paths, art_name, vid_list, image_list, image_only, &m_path_cache );

}

Expand Down Expand Up @@ -4043,7 +4042,7 @@ bool FeSettings::get_best_dynamic_image_file(
std::vector< std::string > paths;
paths.push_back( path );

return gather_artwork_filenames( paths, base, vid_list, image_list, NULL );
return gather_artwork_filenames( paths, base, vid_list, image_list, false, NULL ); // TODO: image_only variable, or false?
}

void FeSettings::update_romlist_after_edit(
Expand Down

0 comments on commit 6b2fec5

Please sign in to comment.