mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-01-27 02:05:06 +01:00
Added support for score and developer tags in the meta Hyperlist files, including printing as text and image.
If no developer tag is available, RetroFE will use the manufacturer tag in stead.
This commit is contained in:
parent
92026576f9
commit
46200f029d
@ -32,6 +32,7 @@ public:
|
||||
std::string fullTitle;
|
||||
std::string year;
|
||||
std::string manufacturer;
|
||||
std::string developer;
|
||||
std::string genre;
|
||||
std::string cloneof;
|
||||
std::string numberPlayers;
|
||||
@ -39,7 +40,7 @@ public:
|
||||
std::string ctrlType;
|
||||
std::string joyWays;
|
||||
std::string rating;
|
||||
std::string score;
|
||||
CollectionInfo *collectionInfo;
|
||||
bool leaf;
|
||||
};
|
||||
|
||||
|
||||
@ -81,13 +81,15 @@ bool MetadataDatabase::initialize()
|
||||
sql.append("title TEXT NOT NULL DEFAULT '',");
|
||||
sql.append("year TEXT NOT NULL DEFAULT '',");
|
||||
sql.append("manufacturer TEXT NOT NULL DEFAULT '',");
|
||||
sql.append("developer TEXT NOT NULL DEFAULT '',");
|
||||
sql.append("genre TEXT NOT NULL DEFAULT '',");
|
||||
sql.append("cloneOf TEXT NOT NULL DEFAULT '',");
|
||||
sql.append("players TEXT NOT NULL DEFAULT '',");
|
||||
sql.append("ctrltype TEXT NOT NULL DEFAULT '',");
|
||||
sql.append("buttons TEXT NOT NULL DEFAULT '',");
|
||||
sql.append("joyways TEXT NOT NULL DEFAULT '',");
|
||||
sql.append("rating TEXT NOT NULL DEFAULT '');");
|
||||
sql.append("rating TEXT NOT NULL DEFAULT '',");
|
||||
sql.append("score TEXT NOT NULL DEFAULT '');");
|
||||
sql.append("CREATE UNIQUE INDEX IF NOT EXISTS MetaUniqueId ON Meta(collectionName, name);");
|
||||
|
||||
rc = sqlite3_exec(handle, sql.c_str(), NULL, 0, &error);
|
||||
@ -208,7 +210,7 @@ void MetadataDatabase::injectMetadata(CollectionInfo *collection)
|
||||
|
||||
//todo: program crashes if this query fails
|
||||
sqlite3_prepare_v2(handle,
|
||||
"SELECT DISTINCT Meta.name, Meta.title, Meta.year, Meta.manufacturer, Meta.genre, Meta.players, Meta.ctrltype, Meta.buttons, Meta.joyways, Meta.cloneOf, Meta.rating "
|
||||
"SELECT DISTINCT Meta.name, Meta.title, Meta.year, Meta.manufacturer, Meta.developer, Meta.genre, Meta.players, Meta.ctrltype, Meta.buttons, Meta.joyways, Meta.cloneOf, Meta.rating, Meta.score "
|
||||
"FROM Meta WHERE collectionName=? ORDER BY title ASC;",
|
||||
-1, &stmt, 0);
|
||||
|
||||
@ -222,13 +224,15 @@ void MetadataDatabase::injectMetadata(CollectionInfo *collection)
|
||||
std::string fullTitle = (char *)sqlite3_column_text(stmt, 1);
|
||||
std::string year = (char *)sqlite3_column_text(stmt, 2);
|
||||
std::string manufacturer = (char *)sqlite3_column_text(stmt, 3);
|
||||
std::string genre = (char *)sqlite3_column_text(stmt, 4);
|
||||
std::string numberPlayers = (char *)sqlite3_column_text(stmt, 5);
|
||||
std::string ctrlType = (char *)sqlite3_column_text(stmt, 6);
|
||||
std::string numberButtons = (char *)sqlite3_column_text(stmt, 7);
|
||||
std::string joyWays = (char *)sqlite3_column_text(stmt, 8);
|
||||
std::string cloneOf = (char *)sqlite3_column_text(stmt, 9);
|
||||
std::string rating = (char *)sqlite3_column_text(stmt, 10);
|
||||
std::string developer = (char *)sqlite3_column_text(stmt, 4);
|
||||
std::string genre = (char *)sqlite3_column_text(stmt, 5);
|
||||
std::string numberPlayers = (char *)sqlite3_column_text(stmt, 6);
|
||||
std::string ctrlType = (char *)sqlite3_column_text(stmt, 7);
|
||||
std::string numberButtons = (char *)sqlite3_column_text(stmt, 8);
|
||||
std::string joyWays = (char *)sqlite3_column_text(stmt, 9);
|
||||
std::string cloneOf = (char *)sqlite3_column_text(stmt, 10);
|
||||
std::string rating = (char *)sqlite3_column_text(stmt, 11);
|
||||
std::string score = (char *)sqlite3_column_text(stmt, 12);
|
||||
std::string launcher;
|
||||
std::string title = fullTitle;
|
||||
|
||||
@ -275,6 +279,7 @@ void MetadataDatabase::injectMetadata(CollectionInfo *collection)
|
||||
item->fullTitle = fullTitle;
|
||||
item->year = year;
|
||||
item->manufacturer = manufacturer;
|
||||
item->developer = developer;
|
||||
item->genre = genre;
|
||||
item->numberPlayers = numberPlayers;
|
||||
item->numberButtons = numberButtons;
|
||||
@ -282,6 +287,7 @@ void MetadataDatabase::injectMetadata(CollectionInfo *collection)
|
||||
item->joyWays = joyWays;
|
||||
item->cloneof = cloneOf;
|
||||
item->rating = rating;
|
||||
item->score = score;
|
||||
}
|
||||
rc = sqlite3_step(stmt);
|
||||
}
|
||||
@ -341,9 +347,11 @@ bool MetadataDatabase::importHyperlist(std::string hyperlistFile, std::string co
|
||||
rapidxml::xml_node<> *cloneofXml = game->first_node("cloneof");
|
||||
rapidxml::xml_node<> *crcXml = game->first_node("crc");
|
||||
rapidxml::xml_node<> *manufacturerXml = game->first_node("manufacturer");
|
||||
rapidxml::xml_node<> *developerXml = game->first_node("developer");
|
||||
rapidxml::xml_node<> *yearXml = game->first_node("year");
|
||||
rapidxml::xml_node<> *genreXml = game->first_node("genre");
|
||||
rapidxml::xml_node<> *ratingXml = game->first_node("rating");
|
||||
rapidxml::xml_node<> *scoreXml = game->first_node("score");
|
||||
rapidxml::xml_node<> *numberPlayersXml = game->first_node("players");
|
||||
rapidxml::xml_node<> *ctrlTypeXml = game->first_node("ctrltype");
|
||||
rapidxml::xml_node<> *numberButtonsXml = game->first_node("buttons");
|
||||
@ -354,9 +362,11 @@ bool MetadataDatabase::importHyperlist(std::string hyperlistFile, std::string co
|
||||
std::string crc = (crcXml) ? crcXml->value() : "";
|
||||
std::string cloneOf = (cloneofXml) ? cloneofXml->value() : "";
|
||||
std::string manufacturer = (manufacturerXml) ? manufacturerXml->value() : "";
|
||||
std::string developer = (developerXml) ? developerXml->value() : "";
|
||||
std::string year = (yearXml) ? yearXml->value() : "";
|
||||
std::string genre = (genreXml) ? genreXml->value() : "";
|
||||
std::string rating = (ratingXml) ? ratingXml->value() : "";
|
||||
std::string score = (scoreXml) ? scoreXml->value() : "";
|
||||
std::string numberPlayers = (numberPlayersXml) ? numberPlayersXml->value() : "";
|
||||
std::string ctrlType = (ctrlTypeXml) ? ctrlTypeXml->value() : "";
|
||||
std::string numberButtons = (numberButtonsXml) ? numberButtonsXml->value() : "";
|
||||
@ -368,21 +378,23 @@ bool MetadataDatabase::importHyperlist(std::string hyperlistFile, std::string co
|
||||
sqlite3_stmt *stmt;
|
||||
|
||||
sqlite3_prepare_v2(handle,
|
||||
"INSERT OR REPLACE INTO Meta (name, title, year, manufacturer, genre, players, ctrltype, buttons, joyways, cloneOf, collectionName, rating) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
"INSERT OR REPLACE INTO Meta (name, title, year, manufacturer, developer, genre, players, ctrltype, buttons, joyways, cloneOf, collectionName, rating, score) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
-1, &stmt, 0);
|
||||
|
||||
sqlite3_bind_text(stmt, 1, name.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 2, description.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 3, year.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 4, manufacturer.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 5, genre.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 6, numberPlayers.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 7, ctrlType.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 8, numberButtons.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 9, numberJoyWays.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 10, cloneOf.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 11, collectionName.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 12, rating.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 5, developer.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 6, genre.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 7, numberPlayers.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 8, ctrlType.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 9, numberButtons.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 10, numberJoyWays.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 11, cloneOf.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 12, collectionName.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 13, rating.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 14, score.c_str(), -1, SQLITE_TRANSIENT);
|
||||
|
||||
sqlite3_step(stmt);
|
||||
sqlite3_finalize(stmt);
|
||||
|
||||
@ -240,6 +240,15 @@ void ReloadableMedia::reloadTexture()
|
||||
{
|
||||
basename = selectedItem->title;
|
||||
}
|
||||
else if(typeLC == "developer")
|
||||
{
|
||||
basename = selectedItem->developer;
|
||||
// Overwrite in case developer has not been specified
|
||||
if (basename == "")
|
||||
{
|
||||
basename = selectedItem->manufacturer;
|
||||
}
|
||||
}
|
||||
else if(typeLC == "manufacturer")
|
||||
{
|
||||
if ( selectedItem->leaf ) // item is a leaf
|
||||
@ -263,6 +272,10 @@ void ReloadableMedia::reloadTexture()
|
||||
{
|
||||
basename = selectedItem->rating;
|
||||
}
|
||||
else if(typeLC == "score")
|
||||
{
|
||||
basename = selectedItem->score;
|
||||
}
|
||||
|
||||
Utils::replaceSlashesWithUnderscores(basename);
|
||||
|
||||
|
||||
@ -136,6 +136,10 @@ void ReloadableText::ReloadTexture()
|
||||
{
|
||||
text = selectedItem->rating;
|
||||
}
|
||||
else if (type_ == "score")
|
||||
{
|
||||
text = selectedItem->score;
|
||||
}
|
||||
else if (type_ == "year")
|
||||
{
|
||||
if (selectedItem->leaf) // item is a leaf
|
||||
@ -147,6 +151,15 @@ void ReloadableText::ReloadTexture()
|
||||
{
|
||||
text = selectedItem->title;
|
||||
}
|
||||
else if(type_ == "developer")
|
||||
{
|
||||
text = selectedItem->developer;
|
||||
// Overwrite in case developer has not been specified
|
||||
if (text == "")
|
||||
{
|
||||
text = selectedItem->manufacturer;
|
||||
}
|
||||
}
|
||||
else if (type_ == "manufacturer")
|
||||
{
|
||||
if (selectedItem->leaf) // item is a leaf
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user