This is issue that liquid8's code solves to have pictures change using the catagory information. I changed it a little to be more generic and included my genre changing code below:
class to change an image based upon "fe.game_info()" possibilities
//////////////////////////////////////////////////
//
// a class that displays images according to
// data found in the emulator game list e.g: ersb
// graphic based upon name in a game list
//
//////////////////////////////////////////////////
class changingImage
{
mode = 1; //0 = first match, 1 = last match, 2 = random
supported = null;
folder=null;
infoType=null;
ref = null;
constructor( image, sup, f, i )
{
supported = sup;
folder= f;
infoType= i;
ref = image;
fe.add_transition_callback( this, "imagetransition" );
}
function imagetransition( ttype, var, ttime )
{
if ( ttype == Transition.ToNewSelection || ttype == Transition.ToNewList )
{
local cat = null;
if (infoType==Info.Tags)
{
cat = " " + fe.game_info(infoType, var);
} else {
cat = " " + fe.game_info(infoType, var).tolower();
}
local matches = [];
foreach( key, val in supported )
{
foreach( nickname in val )
{
if ( cat.find(nickname, 0) ) matches.push(key);
}
}
if ( matches.len() > 0 )
{
switch( mode )
{
case 0:
ref.file_name = "images/" + folder + "/" + matches[0] + ".png";
break;
case 1:
ref.file_name = "images/" + folder + "/" + matches[matches.len() - 1] + ".png";
break;
case 2:
local random_num = floor(((rand() % 1000 ) / 1000.0) * ((matches.len() - 1) - (0 - 1)) + 0);
ref.file_name = "images/" + folder + "/" + matches[random_num] + ".png";
break;
}
} else {
ref.file_name = "images/" + folder + "/unknown.png";
}
}
}
}
Initilizing the class with your own info
// Change Genre based upon game catagory
local genre = {
//filename : [ match1, match2 ]
"action": [ "action" ],
"adventure": [ "adventure" ],
"fighter": [ "fighting", "fighter", "beat'em up" ],
"platform": [ "platformer", "platform" ],
"puzzle": [ "puzzle" ],
"racing": [ "racing", "driving" ],
"rpg": [ "rpg", "role playing", "role playing game" ],
"shooter": [ "shooter", "shmup" ],
"sports": [ "sports", "boxing", "golf", "baseball", "football", "soccer" ],
"maze": [ "maze" ],
"strategy": [ "strategy"]
}
local genre_image = fe.add_image("images/genre/unknown.png");
genre_image.x = detailsNewX;
genre_image.y= DETAILS_BOTTOM_ALIGNMENT;
changingImage( genre_image, genre, "genre", Info.Category );