mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-15 19:28:53 +01:00
Cleaning up some accessors/mutators
This commit is contained in:
parent
297f3e2787
commit
3ea62b9c64
@ -45,35 +45,11 @@ CollectionInfo::~CollectionInfo()
|
||||
}
|
||||
}
|
||||
|
||||
std::string CollectionInfo::GetName() const
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
std::string CollectionInfo::GetSettingsPath() const
|
||||
{
|
||||
return Utils::CombinePath(Configuration::GetAbsolutePath(), "collections", GetName());
|
||||
return Utils::CombinePath(Configuration::AbsolutePath, "collections", Name);
|
||||
}
|
||||
|
||||
std::string CollectionInfo::GetListPath() const
|
||||
{
|
||||
return ListPath;
|
||||
}
|
||||
|
||||
std::string CollectionInfo::GetMetadataType() const
|
||||
{
|
||||
return MetadataType;
|
||||
}
|
||||
|
||||
std::string CollectionInfo::GetMetadataPath() const
|
||||
{
|
||||
return MetadataPath;
|
||||
}
|
||||
|
||||
std::string CollectionInfo::GetExtensions() const
|
||||
{
|
||||
return Extensions;
|
||||
}
|
||||
|
||||
void CollectionInfo::GetExtensions(std::vector<std::string> &extensions)
|
||||
{
|
||||
@ -85,14 +61,11 @@ void CollectionInfo::GetExtensions(std::vector<std::string> &extensions)
|
||||
extensions.push_back(token);
|
||||
}
|
||||
}
|
||||
std::vector<Item *> *CollectionInfo::GetItems()
|
||||
{
|
||||
return &Items;
|
||||
}
|
||||
|
||||
bool CollectionInfo::ItemIsLess(Item const *lhs, Item const *rhs)
|
||||
|
||||
bool CollectionInfo::ItemIsLess(Item *lhs, Item *rhs)
|
||||
{
|
||||
return lhs->GetLCFullTitle() < rhs->GetLCFullTitle();
|
||||
return lhs->LCFullTitle() < rhs->LCFullTitle();
|
||||
}
|
||||
|
||||
void CollectionInfo::SortItems()
|
||||
|
||||
@ -25,23 +25,17 @@ class CollectionInfo
|
||||
public:
|
||||
CollectionInfo(std::string name, std::string listPath, std::string extensions, std::string metadataType, std::string metadataPath);
|
||||
virtual ~CollectionInfo();
|
||||
std::string GetName() const;
|
||||
std::string GetSettingsPath() const;
|
||||
std::string GetListPath() const;
|
||||
std::string GetMetadataType() const;
|
||||
std::string GetMetadataPath() const;
|
||||
std::string GetExtensions() const;
|
||||
std::vector<Item *> *GetItems();
|
||||
void SortItems();
|
||||
void GetExtensions(std::vector<std::string> &extensions);
|
||||
|
||||
private:
|
||||
static bool ItemIsLess(Item const *lhs, Item const *rhs);
|
||||
|
||||
std::string Name;
|
||||
std::string ListPath;
|
||||
std::string Extensions;
|
||||
std::string MetadataType;
|
||||
std::string MetadataPath;
|
||||
std::vector<Item *> Items;
|
||||
|
||||
private:
|
||||
static bool ItemIsLess(Item *lhs, Item *rhs);
|
||||
|
||||
};
|
||||
|
||||
@ -47,7 +47,7 @@ CollectionInfoBuilder::~CollectionInfoBuilder()
|
||||
|
||||
bool CollectionInfoBuilder::CreateCollectionDirectory(std::string name)
|
||||
{
|
||||
std::string collectionPath = Utils::CombinePath(Configuration::GetAbsolutePath(), "collections", name);
|
||||
std::string collectionPath = Utils::CombinePath(Configuration::AbsolutePath, "collections", name);
|
||||
|
||||
std::vector<std::string> paths;
|
||||
paths.push_back(collectionPath);
|
||||
@ -215,11 +215,10 @@ bool CollectionInfoBuilder::ImportBasicList(CollectionInfo * /*info*/, std::stri
|
||||
|
||||
line.erase( std::remove(line.begin(), line.end(), '\r'), line.end() );
|
||||
|
||||
i->SetFullTitle(line);
|
||||
i->SetName(line);
|
||||
i->SetFullTitle(line);
|
||||
i->SetTitle(line);
|
||||
i->SetLauncher(launcher);
|
||||
i->FullTitle = line;
|
||||
i->Name = line;
|
||||
i->Title = line;
|
||||
i->Launcher = launcher;
|
||||
|
||||
list[line] = i;
|
||||
}
|
||||
@ -232,16 +231,16 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info)
|
||||
{
|
||||
DIR *dp;
|
||||
struct dirent *dirp;
|
||||
std::string path = info->GetListPath();
|
||||
std::string path = info->ListPath;
|
||||
std::map<std::string, Item *> includeFilter;
|
||||
std::map<std::string, Item *> excludeFilter;
|
||||
std::string includeFile = Utils::CombinePath(Configuration::GetAbsolutePath(), "collections", info->GetName(), "include.txt");
|
||||
std::string excludeFile = Utils::CombinePath(Configuration::GetAbsolutePath(), "collections", info->GetName(), "exclude.txt");
|
||||
std::string includeFile = Utils::CombinePath(Configuration::AbsolutePath, "collections", info->Name, "include.txt");
|
||||
std::string excludeFile = Utils::CombinePath(Configuration::AbsolutePath, "collections", info->Name, "exclude.txt");
|
||||
std::string launcher;
|
||||
bool showMissing = false;
|
||||
|
||||
(void)Conf.GetProperty("collections." + info->GetName() + ".launcher", launcher);
|
||||
(void)Conf.GetProperty("collections." + info->GetName() + ".list.includeMissingItems", showMissing);
|
||||
(void)Conf.GetProperty("collections." + info->Name + ".launcher", launcher);
|
||||
(void)Conf.GetProperty("collections." + info->Name + ".list.includeMissingItems", showMissing);
|
||||
|
||||
ImportBasicList(info, includeFile, launcher, includeFilter);
|
||||
ImportBasicList(info, excludeFile, launcher, excludeFilter);
|
||||
@ -267,7 +266,7 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info)
|
||||
{
|
||||
if(excludeFilter.find(it->first) == excludeFilter.end())
|
||||
{
|
||||
info->GetItems()->push_back(it->second);
|
||||
info->Items.push_back(it->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -295,11 +294,11 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info)
|
||||
if(file.compare(start, comparator.length(), *extensionsIt) == 0)
|
||||
{
|
||||
Item *i = new Item();
|
||||
i->SetName(basename);
|
||||
i->SetFullTitle(basename);
|
||||
i->SetTitle(basename);
|
||||
i->SetLauncher(launcher);
|
||||
info->GetItems()->push_back(i);
|
||||
i->Name = basename;
|
||||
i->FullTitle = basename;
|
||||
i->Title = basename;
|
||||
i->Launcher = launcher;
|
||||
info->Items.push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,142 +28,24 @@ Item::~Item()
|
||||
{
|
||||
}
|
||||
|
||||
const std::string Item::GetFileName() const
|
||||
std::string Item::FileName()
|
||||
{
|
||||
return Utils::GetFileName(FilePath);
|
||||
}
|
||||
|
||||
const std::string& Item::GetFilePath() const
|
||||
{
|
||||
return FilePath;
|
||||
}
|
||||
|
||||
void Item::SetFilePath(const std::string& filepath)
|
||||
{
|
||||
FilePath = filepath;
|
||||
}
|
||||
|
||||
const std::string& Item::GetLauncher() const
|
||||
{
|
||||
return Launcher;
|
||||
}
|
||||
|
||||
void Item::SetLauncher(const std::string& launcher)
|
||||
{
|
||||
Launcher = launcher;
|
||||
}
|
||||
|
||||
const std::string& Item::GetManufacturer() const
|
||||
{
|
||||
return Manufacturer;
|
||||
}
|
||||
|
||||
void Item::SetManufacturer(const std::string& manufacturer)
|
||||
{
|
||||
Manufacturer = manufacturer;
|
||||
}
|
||||
|
||||
const std::string& Item::GetGenre() const
|
||||
{
|
||||
return Genre;
|
||||
}
|
||||
|
||||
void Item::SetGenre(const std::string& genre)
|
||||
{
|
||||
Genre = genre;
|
||||
}
|
||||
|
||||
const std::string& Item::GetName() const
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
void Item::SetName(const std::string& name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
std::string Item::GetNumberButtons() const
|
||||
{
|
||||
return NumberButtons;
|
||||
}
|
||||
|
||||
|
||||
void Item::SetNumberButtons(std::string numberbuttons)
|
||||
std::string Item::LCTitle()
|
||||
{
|
||||
NumberButtons = numberbuttons;
|
||||
std::string lcstr = Title;
|
||||
std::transform(lcstr.begin(), lcstr.end(), lcstr.begin(), ::tolower);
|
||||
return lcstr;
|
||||
}
|
||||
|
||||
std::string Item::GetNumberPlayers() const
|
||||
std::string Item::LCFullTitle()
|
||||
{
|
||||
return NumberPlayers;
|
||||
std::string lcstr = FullTitle;
|
||||
std::transform(lcstr.begin(), lcstr.end(), lcstr.begin(), ::tolower);
|
||||
return lcstr;
|
||||
}
|
||||
|
||||
void Item::SetNumberPlayers(std::string numberplayers)
|
||||
{
|
||||
NumberPlayers = numberplayers;
|
||||
}
|
||||
|
||||
const std::string& Item::GetTitle() const
|
||||
{
|
||||
return Title;
|
||||
}
|
||||
|
||||
const std::string& Item::GetLCTitle() const
|
||||
{
|
||||
return LCTitle;
|
||||
}
|
||||
|
||||
const std::string& Item::GetLCFullTitle() const
|
||||
{
|
||||
return LCFullTitle;
|
||||
}
|
||||
|
||||
void Item::SetTitle(const std::string& title)
|
||||
{
|
||||
Title = title;
|
||||
LCTitle = Title;
|
||||
std::transform(LCTitle.begin(), LCTitle.end(), LCTitle.begin(), ::tolower);
|
||||
}
|
||||
|
||||
const std::string& Item::GetYear() const
|
||||
{
|
||||
return Year;
|
||||
}
|
||||
|
||||
void Item::SetYear(const std::string& year)
|
||||
{
|
||||
Year = year;
|
||||
}
|
||||
|
||||
bool Item::IsLeaf() const
|
||||
{
|
||||
return Leaf;
|
||||
}
|
||||
|
||||
void Item::SetIsLeaf(bool leaf)
|
||||
{
|
||||
Leaf = leaf;
|
||||
}
|
||||
|
||||
const std::string& Item::GetFullTitle() const
|
||||
{
|
||||
return FullTitle;
|
||||
}
|
||||
|
||||
void Item::SetFullTitle(const std::string& fulltitle)
|
||||
{
|
||||
FullTitle = fulltitle;
|
||||
LCFullTitle = fulltitle;
|
||||
std::transform(LCFullTitle.begin(), LCFullTitle.end(), LCFullTitle.begin(), ::tolower);
|
||||
}
|
||||
|
||||
const std::string& Item::GetCloneOf() const
|
||||
{
|
||||
return CloneOf;
|
||||
}
|
||||
|
||||
void Item::SetCloneOf(const std::string& cloneOf)
|
||||
{
|
||||
CloneOf = cloneOf;
|
||||
}
|
||||
|
||||
@ -22,42 +22,14 @@ class Item
|
||||
public:
|
||||
Item();
|
||||
virtual ~Item();
|
||||
const std::string GetFileName() const;
|
||||
const std::string& GetFilePath() const;
|
||||
void SetFilePath(const std::string& filepath);
|
||||
const std::string& GetLauncher() const;
|
||||
void SetLauncher(const std::string& launcher);
|
||||
const std::string& GetManufacturer() const;
|
||||
void SetManufacturer(const std::string& manufacturer);
|
||||
const std::string& GetGenre() const;
|
||||
void SetGenre(const std::string& genre);
|
||||
const std::string& GetName() const;
|
||||
void SetName(const std::string& name);
|
||||
void SetNumberButtons(std::string numberbuttons);
|
||||
std::string GetNumberButtons() const;
|
||||
void SetNumberPlayers(std::string numberplayers);
|
||||
std::string GetNumberPlayers() const;
|
||||
const std::string& GetTitle() const;
|
||||
const std::string& GetLCTitle() const;
|
||||
void SetTitle(const std::string& title);
|
||||
const std::string& GetYear() const;
|
||||
void SetYear(const std::string& year);
|
||||
bool IsLeaf() const;
|
||||
void SetIsLeaf(bool leaf);
|
||||
const std::string& GetFullTitle() const;
|
||||
const std::string& GetLCFullTitle() const;
|
||||
void SetFullTitle(const std::string& fulltitle);
|
||||
const std::string& GetCloneOf() const;
|
||||
void SetCloneOf(const std::string& cloneOf);
|
||||
|
||||
private:
|
||||
std::string FileName();
|
||||
std::string LCTitle() ;
|
||||
std::string LCFullTitle();
|
||||
std::string Name;
|
||||
std::string Launcher;
|
||||
std::string FilePath;
|
||||
std::string Name;
|
||||
std::string Title;
|
||||
std::string LCTitle;
|
||||
std::string FullTitle;
|
||||
std::string LCFullTitle;
|
||||
std::string Year;
|
||||
std::string Manufacturer;
|
||||
std::string Genre;
|
||||
|
||||
@ -26,9 +26,9 @@
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
bool VectorSort(const Item *d1, const Item *d2)
|
||||
bool VectorSort(Item *d1, Item *d2)
|
||||
{
|
||||
return d1->GetLCTitle() < d2->GetLCTitle();
|
||||
return d1->LCTitle() < d2->LCTitle();
|
||||
}
|
||||
|
||||
MenuParser::MenuParser()
|
||||
@ -44,7 +44,7 @@ bool MenuParser::GetMenuItems(CollectionInfo *collection)
|
||||
{
|
||||
bool retVal = false;
|
||||
//todo: magic string
|
||||
std::string menuFilename = Utils::CombinePath(Configuration::GetAbsolutePath(), "collections", collection->GetName(), "menu.xml");
|
||||
std::string menuFilename = Utils::CombinePath(Configuration::AbsolutePath, "collections", collection->Name, "menu.xml");
|
||||
rapidxml::xml_document<> doc;
|
||||
rapidxml::xml_node<> * rootNode;
|
||||
|
||||
@ -88,11 +88,11 @@ bool MenuParser::GetMenuItems(CollectionInfo *collection)
|
||||
//todo, check for empty string
|
||||
std::string title = collectionAttribute->value();
|
||||
Item *item = new Item();
|
||||
item->SetTitle(title);
|
||||
item->SetFullTitle(title);
|
||||
item->SetName(collectionAttribute->value());
|
||||
item->SetIsLeaf(false);
|
||||
collection->GetItems()->push_back(item);
|
||||
item->Title = title;
|
||||
item->FullTitle = title;
|
||||
item->Name = collectionAttribute->value();
|
||||
item->Leaf = false;
|
||||
collection->Items.push_back(item);
|
||||
|
||||
}
|
||||
else
|
||||
@ -106,7 +106,7 @@ bool MenuParser::GetMenuItems(CollectionInfo *collection)
|
||||
}
|
||||
|
||||
// todo: sorting should occur within the collection itself, not externally
|
||||
std::vector<Item *> *items = collection->GetItems();
|
||||
std::vector<Item *> *items = &collection->Items;
|
||||
std::sort( items->begin(), items->end(), VectorSort);
|
||||
|
||||
retVal = true;
|
||||
|
||||
@ -46,7 +46,7 @@ void Configuration::Initialize()
|
||||
if (environment != NULL)
|
||||
{
|
||||
environmentStr = environment;
|
||||
Configuration::SetAbsolutePath(environment);
|
||||
AbsolutePath = environment;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -66,7 +66,7 @@ void Configuration::Initialize()
|
||||
#endif
|
||||
|
||||
|
||||
Configuration::SetAbsolutePath(sPath);
|
||||
AbsolutePath = sPath;
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,8 +194,8 @@ bool Configuration::GetProperty(std::string key, std::string &value)
|
||||
{
|
||||
bool retVal = GetRawProperty(key, value);
|
||||
|
||||
std::string baseMediaPath = GetAbsolutePath();
|
||||
std::string baseItemPath = GetAbsolutePath();
|
||||
std::string baseMediaPath = AbsolutePath;
|
||||
std::string baseItemPath = AbsolutePath;
|
||||
std::string collectionName;
|
||||
|
||||
GetRawProperty("baseMediaPath", baseMediaPath);
|
||||
@ -328,7 +328,7 @@ bool Configuration::GetPropertyAbsolutePath(std::string key, std::string &value)
|
||||
|
||||
if(retVal)
|
||||
{
|
||||
value = ConvertToAbsolutePath(GetAbsolutePath(), value);
|
||||
value = ConvertToAbsolutePath(AbsolutePath, value);
|
||||
}
|
||||
|
||||
return retVal;
|
||||
@ -355,7 +355,7 @@ void Configuration::GetMediaPropertyAbsolutePath(std::string collectionName, std
|
||||
if(!GetPropertyAbsolutePath("baseMediaPath", baseMediaPath))
|
||||
{
|
||||
// base media path was not specified, assume media files are in the collection
|
||||
baseMediaPath = Utils::CombinePath(GetAbsolutePath(), "collections");
|
||||
baseMediaPath = Utils::CombinePath(AbsolutePath, "collections");
|
||||
}
|
||||
|
||||
if(mediaType == "manufacturer")
|
||||
@ -404,20 +404,10 @@ void Configuration::GetCollectionAbsolutePath(std::string collectionName, std::s
|
||||
return;
|
||||
}
|
||||
|
||||
value = Utils::CombinePath(GetAbsolutePath(), "collections", collectionName, "roms");
|
||||
value = Utils::CombinePath(AbsolutePath, "collections", collectionName, "roms");
|
||||
}
|
||||
|
||||
|
||||
void Configuration::SetAbsolutePath(std::string absolutePath)
|
||||
{
|
||||
AbsolutePath = absolutePath;
|
||||
}
|
||||
|
||||
std::string Configuration::GetAbsolutePath()
|
||||
{
|
||||
return AbsolutePath;
|
||||
}
|
||||
|
||||
bool Configuration::IsVerbose() const
|
||||
{
|
||||
return Verbose;
|
||||
|
||||
@ -25,8 +25,6 @@ public:
|
||||
Configuration();
|
||||
virtual ~Configuration();
|
||||
static void Initialize();
|
||||
static void SetAbsolutePath(std::string absolutePath);
|
||||
static std::string GetAbsolutePath();
|
||||
static std::string ConvertToAbsolutePath(std::string prefix, std::string path);
|
||||
void SetStatus(std::string status);
|
||||
std::string GetStatus();
|
||||
@ -47,6 +45,7 @@ public:
|
||||
void GetCollectionAbsolutePath(std::string collectionName, std::string &value);
|
||||
bool IsVerbose() const;
|
||||
void SetVerbose(bool verbose);
|
||||
static std::string AbsolutePath;
|
||||
|
||||
private:
|
||||
bool GetRawProperty(std::string key, std::string &value);
|
||||
@ -56,7 +55,6 @@ private:
|
||||
typedef std::pair<std::string, std::string> PropertiesPair;
|
||||
bool Verbose;
|
||||
|
||||
static std::string AbsolutePath;
|
||||
std::string CurrentCollection;
|
||||
PropertiesType Properties;
|
||||
std::string Status;
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
#include <fstream>
|
||||
|
||||
DB::DB(std::string dbFile)
|
||||
: Path(dbFile)
|
||||
, Handle(NULL)
|
||||
: Handle(NULL)
|
||||
, Path(dbFile)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -24,13 +24,9 @@ public:
|
||||
bool Initialize();
|
||||
void DeInitialize();
|
||||
virtual ~DB();
|
||||
sqlite3 *GetHandle()
|
||||
{
|
||||
return Handle;
|
||||
}
|
||||
sqlite3 *Handle;
|
||||
|
||||
private:
|
||||
std::string Path;
|
||||
sqlite3 *Handle;
|
||||
};
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ bool MetadataDatabase::ResetDatabase()
|
||||
{
|
||||
int rc;
|
||||
char *error = NULL;
|
||||
sqlite3 *handle = DBInstance.GetHandle();
|
||||
sqlite3 *handle = DBInstance.Handle;
|
||||
|
||||
Logger::Write(Logger::ZONE_INFO, "Metadata", "Erasing");
|
||||
|
||||
@ -72,7 +72,7 @@ bool MetadataDatabase::Initialize()
|
||||
{
|
||||
int rc;
|
||||
char *error = NULL;
|
||||
sqlite3 *handle = DBInstance.GetHandle();
|
||||
sqlite3 *handle = DBInstance.Handle;
|
||||
|
||||
std::string sql;
|
||||
sql.append("CREATE TABLE IF NOT EXISTS Meta(");
|
||||
@ -110,8 +110,8 @@ bool MetadataDatabase::ImportDirectory()
|
||||
{
|
||||
DIR *dp;
|
||||
struct dirent *dirp;
|
||||
std::string hyperListPath = Utils::CombinePath(Configuration::GetAbsolutePath(), "meta", "hyperlist");
|
||||
std::string mameListPath = Utils::CombinePath(Configuration::GetAbsolutePath(), "meta", "mamelist");
|
||||
std::string hyperListPath = Utils::CombinePath(Configuration::AbsolutePath, "meta", "hyperlist");
|
||||
std::string mameListPath = Utils::CombinePath(Configuration::AbsolutePath, "meta", "mamelist");
|
||||
|
||||
dp = opendir(hyperListPath.c_str());
|
||||
|
||||
@ -183,7 +183,7 @@ bool MetadataDatabase::ImportDirectory()
|
||||
|
||||
void MetadataDatabase::InjectMetadata(CollectionInfo *collection)
|
||||
{
|
||||
sqlite3 *handle = DBInstance.GetHandle();
|
||||
sqlite3 *handle = DBInstance.Handle;
|
||||
int rc;
|
||||
sqlite3_stmt *stmt;
|
||||
|
||||
@ -195,12 +195,12 @@ void MetadataDatabase::InjectMetadata(CollectionInfo *collection)
|
||||
|
||||
|
||||
// items into a hash to make it easily searchable
|
||||
std::vector<Item *> *items = collection->GetItems();
|
||||
std::vector<Item *> *items = &collection->Items;
|
||||
std::map<std::string, Item *> itemMap;
|
||||
|
||||
for(std::vector<Item *>::iterator it = items->begin(); it != items->end(); it++)
|
||||
{
|
||||
itemMap[(*it)->GetName()] = *it;
|
||||
itemMap[(*it)->Name] = *it;
|
||||
}
|
||||
|
||||
//todo: program crashes if this query fails
|
||||
@ -209,7 +209,7 @@ void MetadataDatabase::InjectMetadata(CollectionInfo *collection)
|
||||
"FROM Meta WHERE collectionName=? ORDER BY title ASC;",
|
||||
-1, &stmt, 0);
|
||||
|
||||
sqlite3_bind_text(stmt, 1, collection->GetMetadataType().c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(stmt, 1, collection->MetadataType.c_str(), -1, SQLITE_TRANSIENT);
|
||||
|
||||
rc = sqlite3_step(stmt);
|
||||
|
||||
@ -265,14 +265,14 @@ void MetadataDatabase::InjectMetadata(CollectionInfo *collection)
|
||||
if(it != itemMap.end())
|
||||
{
|
||||
Item *item = it->second;
|
||||
item->SetTitle(title);
|
||||
item->SetFullTitle(fullTitle);
|
||||
item->SetYear(year);
|
||||
item->SetManufacturer(manufacturer);
|
||||
item->SetGenre(genre);
|
||||
item->SetNumberPlayers(numberPlayers);
|
||||
item->SetNumberButtons(numberButtons);
|
||||
item->SetCloneOf(cloneOf);
|
||||
item->Title = title;
|
||||
item->FullTitle = fullTitle;
|
||||
item->Year = year;
|
||||
item->Manufacturer = manufacturer;
|
||||
item->Genre = genre;
|
||||
item->NumberPlayers = numberPlayers;
|
||||
item->NumberButtons = numberButtons;
|
||||
item->CloneOf = cloneOf;
|
||||
}
|
||||
rc = sqlite3_step(stmt);
|
||||
}
|
||||
@ -280,7 +280,7 @@ void MetadataDatabase::InjectMetadata(CollectionInfo *collection)
|
||||
|
||||
bool MetadataDatabase::NeedsRefresh()
|
||||
{
|
||||
sqlite3 *handle = DBInstance.GetHandle();
|
||||
sqlite3 *handle = DBInstance.Handle;
|
||||
sqlite3_stmt *stmt;
|
||||
|
||||
sqlite3_prepare_v2(handle,
|
||||
@ -323,7 +323,7 @@ bool MetadataDatabase::ImportHyperList(std::string hyperlistFile, std::string co
|
||||
Logger::Write(Logger::ZONE_ERROR, "Metadata", "Does not appear to be a HyperList file (missing <menu> tag)");
|
||||
return false;
|
||||
}
|
||||
sqlite3 *handle = DBInstance.GetHandle();
|
||||
sqlite3 *handle = DBInstance.Handle;
|
||||
sqlite3_exec(handle, "BEGIN IMMEDIATE TRANSACTION;", NULL, NULL, &error);
|
||||
for(rapidxml::xml_node<> *game = root->first_node("game"); game; game = game->next_sibling("game"))
|
||||
{
|
||||
@ -395,7 +395,7 @@ bool MetadataDatabase::ImportMameList(std::string filename, std::string collecti
|
||||
rapidxml::xml_document<> doc;
|
||||
rapidxml::xml_node<> * rootNode;
|
||||
char *error = NULL;
|
||||
sqlite3 *handle = DBInstance.GetHandle();
|
||||
sqlite3 *handle = DBInstance.Handle;
|
||||
|
||||
Config.SetStatus("Scraping data from \"" + filename + "\" (this will take a while)");
|
||||
|
||||
|
||||
@ -19,17 +19,13 @@
|
||||
#include <cstdlib>
|
||||
|
||||
AttractMode::AttractMode()
|
||||
: IsActive(false)
|
||||
: IdleTime(0)
|
||||
, IsActive(false)
|
||||
, ElapsedTime(0)
|
||||
, ActiveTime(0)
|
||||
, IdleTime(0)
|
||||
{
|
||||
}
|
||||
|
||||
void AttractMode::SetIdleTime(float time)
|
||||
{
|
||||
IdleTime = time;
|
||||
}
|
||||
void AttractMode::Reset()
|
||||
{
|
||||
ElapsedTime = 0;
|
||||
@ -60,4 +56,4 @@ void AttractMode::Update(float dt, Page &page)
|
||||
page.SetScrolling(Page::ScrollDirectionIdle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,14 +21,13 @@ class AttractMode
|
||||
{
|
||||
public:
|
||||
AttractMode();
|
||||
void SetIdleTime(float time);
|
||||
void Reset();
|
||||
void Update(float dt, Page &page);
|
||||
float IdleTime;
|
||||
|
||||
private:
|
||||
bool IsActive;
|
||||
float ElapsedTime;
|
||||
float ActiveTime;
|
||||
float IdleTime;
|
||||
|
||||
};
|
||||
|
||||
@ -38,7 +38,7 @@ Launcher::Launcher(RetroFE &p, Configuration &c)
|
||||
|
||||
bool Launcher::Run(std::string collection, Item *collectionItem)
|
||||
{
|
||||
std::string launcherName = collectionItem->GetLauncher();
|
||||
std::string launcherName = collectionItem->Launcher;
|
||||
std::string executablePath;
|
||||
std::string selectedItemsDirectory;
|
||||
std::string selectedItemsPath;
|
||||
@ -67,29 +67,29 @@ bool Launcher::Run(std::string collection, Item *collectionItem)
|
||||
Logger::Write(Logger::ZONE_ERROR, "Launcher", "No launcher arguments specified for launcher " + launcherName);
|
||||
return false;
|
||||
}
|
||||
if(!FindFile(selectedItemsPath, matchedExtension, selectedItemsDirectory, collectionItem->GetName(), extensions))
|
||||
if(!FindFile(selectedItemsPath, matchedExtension, selectedItemsDirectory, collectionItem->Name, extensions))
|
||||
{
|
||||
// FindFile() prints out diagnostic messages for us, no need to print anything here
|
||||
return false;
|
||||
}
|
||||
args = ReplaceVariables(args,
|
||||
selectedItemsPath,
|
||||
collectionItem->GetName(),
|
||||
collectionItem->GetFileName(),
|
||||
collectionItem->Name,
|
||||
collectionItem->FileName(),
|
||||
selectedItemsDirectory,
|
||||
collection);
|
||||
|
||||
executablePath = ReplaceVariables(executablePath,
|
||||
selectedItemsPath,
|
||||
collectionItem->GetName(),
|
||||
collectionItem->GetFileName(),
|
||||
collectionItem->Name,
|
||||
collectionItem->FileName(),
|
||||
selectedItemsDirectory,
|
||||
collection);
|
||||
|
||||
currentDirectory = ReplaceVariables(currentDirectory,
|
||||
selectedItemsPath,
|
||||
collectionItem->GetName(),
|
||||
collectionItem->GetFileName(),
|
||||
collectionItem->Name,
|
||||
collectionItem->FileName(),
|
||||
selectedItemsDirectory,
|
||||
collection);
|
||||
|
||||
@ -114,11 +114,11 @@ std::string Launcher::ReplaceVariables(std::string str,
|
||||
str = Utils::Replace(str, "%ITEM_FILENAME%", itemFilename);
|
||||
str = Utils::Replace(str, "%ITEM_DIRECTORY%", itemDirectory);
|
||||
str = Utils::Replace(str, "%ITEM_COLLECTION_NAME%", itemCollectionName);
|
||||
str = Utils::Replace(str, "%RETROFE_PATH%", Configuration::GetAbsolutePath());
|
||||
str = Utils::Replace(str, "%RETROFE_PATH%", Configuration::AbsolutePath);
|
||||
#ifdef WIN32
|
||||
str = Utils::Replace(str, "%RETROFE_EXEC_PATH%", Utils::CombinePath(Configuration::GetAbsolutePath(), "RetroFE.exe"));
|
||||
str = Utils::Replace(str, "%RETROFE_EXEC_PATH%", Utils::CombinePath(Configuration::AbsolutePath, "RetroFE.exe"));
|
||||
#else
|
||||
str = Utils::Replace(str, "%RETROFE_EXEC_PATH%", Utils::CombinePath(Configuration::GetAbsolutePath(), "RetroFE"));
|
||||
str = Utils::Replace(str, "%RETROFE_EXEC_PATH%", Utils::CombinePath(Configuration::AbsolutePath, "RetroFE"));
|
||||
#endif
|
||||
|
||||
return str;
|
||||
|
||||
@ -150,12 +150,12 @@ void ReloadableMedia::ReloadTexture()
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
|
||||
names.push_back(selectedItem->GetName());
|
||||
names.push_back(selectedItem->GetFullTitle());
|
||||
names.push_back(selectedItem->Name);
|
||||
names.push_back(selectedItem->FullTitle);
|
||||
|
||||
if(selectedItem->GetCloneOf().length() > 0)
|
||||
if(selectedItem->CloneOf.length() > 0)
|
||||
{
|
||||
names.push_back(selectedItem->GetCloneOf());
|
||||
names.push_back(selectedItem->CloneOf);
|
||||
}
|
||||
|
||||
for(unsigned int n = 0; n < names.size() && !found; ++n)
|
||||
@ -197,27 +197,27 @@ void ReloadableMedia::ReloadTexture()
|
||||
|
||||
if(typeLC == "numberButtons")
|
||||
{
|
||||
imageBasename = selectedItem->GetNumberButtons();
|
||||
imageBasename = selectedItem->NumberButtons;
|
||||
}
|
||||
else if(typeLC == "numberPlayers")
|
||||
{
|
||||
imageBasename = selectedItem->GetNumberPlayers();
|
||||
imageBasename = selectedItem->NumberPlayers;
|
||||
}
|
||||
else if(typeLC == "year")
|
||||
{
|
||||
imageBasename = selectedItem->GetYear();
|
||||
imageBasename = selectedItem->Year;
|
||||
}
|
||||
else if(typeLC == "title")
|
||||
{
|
||||
imageBasename = selectedItem->GetTitle();
|
||||
imageBasename = selectedItem->Title;
|
||||
}
|
||||
else if(typeLC == "manufacturer")
|
||||
{
|
||||
imageBasename = selectedItem->GetManufacturer();
|
||||
imageBasename = selectedItem->Manufacturer;
|
||||
}
|
||||
else if(typeLC == "genre")
|
||||
{
|
||||
imageBasename = selectedItem->GetGenre();
|
||||
imageBasename = selectedItem->Genre;
|
||||
}
|
||||
|
||||
Utils::ReplaceSlashesWithUnderscores(imageBasename);
|
||||
|
||||
@ -137,22 +137,22 @@ void ReloadableText::ReloadTexture()
|
||||
switch(Type)
|
||||
{
|
||||
case TextTypeNumberButtons:
|
||||
ss << selectedItem->GetNumberButtons();
|
||||
ss << selectedItem->NumberButtons;
|
||||
break;
|
||||
case TextTypeNumberPlayers:
|
||||
ss << selectedItem->GetNumberPlayers();
|
||||
ss << selectedItem->NumberPlayers;
|
||||
break;
|
||||
case TextTypeYear:
|
||||
ss << selectedItem->GetYear();
|
||||
ss << selectedItem->Year;
|
||||
break;
|
||||
case TextTypeTitle:
|
||||
ss << selectedItem->GetTitle();
|
||||
ss << selectedItem->Title;
|
||||
break;
|
||||
case TextTypeManufacturer:
|
||||
ss << selectedItem->GetManufacturer();
|
||||
ss << selectedItem->Manufacturer;
|
||||
break;
|
||||
case TextTypeGenre:
|
||||
ss << selectedItem->GetGenre();
|
||||
ss << selectedItem->Genre;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@ -409,7 +409,7 @@ void ScrollingList::LetterUp()
|
||||
// Select the previous item in the list in case we are at the top of all the items
|
||||
// for the currently selected letter.
|
||||
CircularDecrement(FirstSpriteIndex, SpriteList);
|
||||
std::string startname = GetSelectedCollectionItemSprite()->GetCollectionItem()->GetLCFullTitle();
|
||||
std::string startname = GetSelectedCollectionItemSprite()->GetCollectionItem()->LCFullTitle();
|
||||
++i;
|
||||
|
||||
bool done = false;
|
||||
@ -418,7 +418,7 @@ void ScrollingList::LetterUp()
|
||||
while(!done && i < SpriteList->size())
|
||||
{
|
||||
CircularDecrement(FirstSpriteIndex, SpriteList);
|
||||
std::string endname = GetSelectedCollectionItemSprite()->GetCollectionItem()->GetLCFullTitle();
|
||||
std::string endname = GetSelectedCollectionItemSprite()->GetCollectionItem()->LCFullTitle();
|
||||
++i;
|
||||
|
||||
// check if we are changing characters from a-z, or changing from alpha character to non-alpha character
|
||||
@ -450,7 +450,7 @@ void ScrollingList::LetterDown()
|
||||
if(SpriteList && ScrollPoints)
|
||||
{
|
||||
|
||||
std::string startname = GetSelectedCollectionItemSprite()->GetCollectionItem()->GetLCFullTitle();
|
||||
std::string startname = GetSelectedCollectionItemSprite()->GetCollectionItem()->LCFullTitle();
|
||||
std::string endname = startname;
|
||||
|
||||
unsigned int i = 0;
|
||||
@ -458,7 +458,7 @@ void ScrollingList::LetterDown()
|
||||
while(!done && i < SpriteList->size())
|
||||
{
|
||||
CircularIncrement(FirstSpriteIndex, SpriteList);
|
||||
endname = GetSelectedCollectionItemSprite()->GetCollectionItem()->GetLCFullTitle();
|
||||
endname = GetSelectedCollectionItemSprite()->GetCollectionItem()->LCFullTitle();
|
||||
++i;
|
||||
|
||||
// check if we are changing characters from a-z, or changing from alpha character to non-alpha character
|
||||
@ -792,21 +792,21 @@ bool ScrollingList::AllocateTexture(ComponentItemBinding *s)
|
||||
|
||||
ImageBuilder imageBuild;
|
||||
Config.GetMediaPropertyAbsolutePath(GetCollectionName(), ImageType, false, imagePath);
|
||||
t = imageBuild.CreateImage(imagePath, item->GetName(), ScaleX, ScaleY);
|
||||
t = imageBuild.CreateImage(imagePath, item->Name, ScaleX, ScaleY);
|
||||
|
||||
if(!t)
|
||||
{
|
||||
Config.GetMediaPropertyAbsolutePath(item->GetName(), ImageType, true, imagePath);
|
||||
Config.GetMediaPropertyAbsolutePath(item->Name, ImageType, true, imagePath);
|
||||
t = imageBuild.CreateImage(imagePath, ImageType, ScaleX, ScaleY);
|
||||
}
|
||||
|
||||
if(!t && item->GetTitle() != item->GetFullTitle())
|
||||
if(!t && item->Title != item->FullTitle)
|
||||
{
|
||||
t = imageBuild.CreateImage(imagePath, item->GetFullTitle(), ScaleX, ScaleY);
|
||||
t = imageBuild.CreateImage(imagePath, item->FullTitle, ScaleX, ScaleY);
|
||||
}
|
||||
if (!t)
|
||||
{
|
||||
t = new Text(item->GetTitle(), FontInst, ScaleX, ScaleY);
|
||||
t = new Text(item->Title, FontInst, ScaleX, ScaleY);
|
||||
}
|
||||
|
||||
if(t)
|
||||
|
||||
@ -411,7 +411,7 @@ void Page::LetterScroll(ScrollDirection direction)
|
||||
bool Page::PushCollection(CollectionInfo *collection)
|
||||
{
|
||||
Collections.push_back(collection);
|
||||
std::vector<ComponentItemBinding *> *sprites = ComponentItemBindingBuilder::BuildCollectionItems(collection->GetItems());
|
||||
std::vector<ComponentItemBinding *> *sprites = ComponentItemBindingBuilder::BuildCollectionItems(&collection->Items);
|
||||
|
||||
int menuExitIndex = -1;
|
||||
int menuEnterIndex = -1;
|
||||
@ -434,7 +434,7 @@ bool Page::PushCollection(CollectionInfo *collection)
|
||||
}
|
||||
|
||||
ActiveMenu = Menus[MenuDepth];
|
||||
ActiveMenu->SetCollectionName(collection->GetName());
|
||||
ActiveMenu->SetCollectionName(collection->Name);
|
||||
ActiveMenu->DestroyItems();
|
||||
ActiveMenu->SetItems(sprites);
|
||||
ActiveMenu->TriggerMenuEnterEvent();
|
||||
@ -449,7 +449,7 @@ bool Page::PushCollection(CollectionInfo *collection)
|
||||
{
|
||||
for(std::vector<Component *>::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it)
|
||||
{
|
||||
(*it)->SetCollectionName(collection->GetName());
|
||||
(*it)->SetCollectionName(collection->Name);
|
||||
if(menuEnterIndex >= 0)
|
||||
{
|
||||
(*it)->TriggerMenuEnterEvent(menuEnterIndex);
|
||||
@ -500,7 +500,7 @@ bool Page::PopCollection()
|
||||
{
|
||||
for(std::vector<Component *>::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it)
|
||||
{
|
||||
(*it)->SetCollectionName(collection->GetName());
|
||||
(*it)->SetCollectionName(collection->Name);
|
||||
|
||||
if(menuEnterIndex >= 0)
|
||||
{
|
||||
@ -571,7 +571,7 @@ std::string Page::GetCollectionName()
|
||||
|
||||
if(info)
|
||||
{
|
||||
return info->GetName();
|
||||
return info->Name;
|
||||
}
|
||||
|
||||
return "";
|
||||
|
||||
@ -77,7 +77,7 @@ Page *PageBuilder::BuildPage()
|
||||
std::string layoutFile;
|
||||
std::string layoutName = LayoutKey;
|
||||
|
||||
LayoutPath = Utils::CombinePath(Configuration::GetAbsolutePath(), "layouts", layoutName);
|
||||
LayoutPath = Utils::CombinePath(Configuration::AbsolutePath, "layouts", layoutName);
|
||||
layoutFile = Utils::CombinePath(LayoutPath, LayoutPage + ".xml");
|
||||
|
||||
Logger::Write(Logger::ZONE_INFO, "Layout", "Initializing " + layoutFile);
|
||||
@ -125,7 +125,7 @@ Page *PageBuilder::BuildPage()
|
||||
if(fontXml)
|
||||
{
|
||||
FontName = Config.ConvertToAbsolutePath(
|
||||
Utils::CombinePath(Config.GetAbsolutePath(), "layouts", LayoutKey, ""),
|
||||
Utils::CombinePath(Config.AbsolutePath, "layouts", LayoutKey, ""),
|
||||
fontXml->value());
|
||||
}
|
||||
|
||||
@ -503,7 +503,7 @@ Font *PageBuilder::AddFont(xml_node<> *component, xml_node<> *defaults)
|
||||
if(fontXml)
|
||||
{
|
||||
fontName = Config.ConvertToAbsolutePath(
|
||||
Utils::CombinePath(Config.GetAbsolutePath(), "layouts", LayoutKey,""),
|
||||
Utils::CombinePath(Config.AbsolutePath, "layouts", LayoutKey,""),
|
||||
fontXml->value());
|
||||
|
||||
Logger::Write(Logger::ZONE_DEBUG, "Layout", "loading font " + fontName );
|
||||
|
||||
@ -72,9 +72,9 @@ int main(int argc, char **argv)
|
||||
|
||||
bool ImportConfiguration(Configuration *c)
|
||||
{
|
||||
std::string configPath = Configuration::GetAbsolutePath();
|
||||
std::string launchersPath = Utils::CombinePath(Configuration::GetAbsolutePath(), "launchers");
|
||||
std::string collectionsPath = Utils::CombinePath(Configuration::GetAbsolutePath(), "collections");
|
||||
std::string configPath = Configuration::AbsolutePath;
|
||||
std::string launchersPath = Utils::CombinePath(Configuration::AbsolutePath, "launchers");
|
||||
std::string collectionsPath = Utils::CombinePath(Configuration::AbsolutePath, "collections");
|
||||
DIR *dp;
|
||||
struct dirent *dirp;
|
||||
|
||||
@ -162,7 +162,7 @@ bool ImportConfiguration(Configuration *c)
|
||||
|
||||
bool StartLogging()
|
||||
{
|
||||
std::string logFile = Utils::CombinePath(Configuration::GetAbsolutePath(), "log.txt");
|
||||
std::string logFile = Utils::CombinePath(Configuration::AbsolutePath, "log.txt");
|
||||
|
||||
if(!Logger::Initialize(logFile))
|
||||
{
|
||||
@ -178,7 +178,7 @@ bool StartLogging()
|
||||
Logger::Write(Logger::ZONE_INFO, "RetroFE", "OS: Linux");
|
||||
#endif
|
||||
|
||||
Logger::Write(Logger::ZONE_INFO, "RetroFE", "Absolute path: " + Configuration::GetAbsolutePath());
|
||||
Logger::Write(Logger::ZONE_INFO, "RetroFE", "Absolute path: " + Configuration::AbsolutePath);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ int RetroFE::Initialize(void *context)
|
||||
return -1;
|
||||
}
|
||||
|
||||
instance->Db = new DB(Utils::CombinePath(Configuration::GetAbsolutePath(), "meta.db"));
|
||||
instance->Db = new DB(Utils::CombinePath(Configuration::AbsolutePath, "meta.db"));
|
||||
|
||||
if(!instance->Db->Initialize())
|
||||
{
|
||||
@ -220,7 +220,7 @@ void RetroFE::Run()
|
||||
Config.GetProperty("attractModeTime", attractModeTime);
|
||||
Config.GetProperty("firstCollection", firstCollection);
|
||||
|
||||
Attract.SetIdleTime(static_cast<float>(attractModeTime));
|
||||
Attract.IdleTime = static_cast<float>(attractModeTime);
|
||||
|
||||
int initializeStatus = 0;
|
||||
|
||||
@ -452,22 +452,22 @@ RetroFE::RETROFE_STATE RetroFE::ProcessUserInput(Page *page)
|
||||
|
||||
if(NextPageItem)
|
||||
{
|
||||
if(NextPageItem->IsLeaf())
|
||||
if(NextPageItem->Leaf)
|
||||
{
|
||||
state = RETROFE_LAUNCH_REQUEST;
|
||||
}
|
||||
else
|
||||
{
|
||||
Config.SetCurrentCollection(NextPageItem->GetName());
|
||||
CollectionInfo *info = GetCollection(NextPageItem->GetName());
|
||||
Config.SetCurrentCollection(NextPageItem->Name);
|
||||
CollectionInfo *info = GetCollection(NextPageItem->Name);
|
||||
|
||||
MenuParser mp;
|
||||
mp.GetMenuItems(info);
|
||||
page->PushCollection(info);
|
||||
|
||||
if(rememberMenu && LastMenuOffsets.find(NextPageItem->GetName()) != LastMenuOffsets.end())
|
||||
if(rememberMenu && LastMenuOffsets.find(NextPageItem->Name) != LastMenuOffsets.end())
|
||||
{
|
||||
page->SetScrollOffsetIndex(LastMenuOffsets[NextPageItem->GetName()]);
|
||||
page->SetScrollOffsetIndex(LastMenuOffsets[NextPageItem->Name]);
|
||||
}
|
||||
|
||||
state = RETROFE_NEXT_PAGE_REQUEST;
|
||||
|
||||
@ -134,7 +134,7 @@ bool Utils::FindMatchingFile(std::string prefix, std::vector<std::string> &exten
|
||||
for(unsigned int i = 0; i < extensions.size(); ++i)
|
||||
{
|
||||
std::string temp = prefix + "." + extensions[i];
|
||||
temp = Configuration::ConvertToAbsolutePath(Configuration::GetAbsolutePath(), temp);
|
||||
temp = Configuration::ConvertToAbsolutePath(Configuration::AbsolutePath, temp);
|
||||
|
||||
std::ifstream f(temp.c_str());
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ bool GStreamerVideo::Initialize()
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string path = Utils::CombinePath(Configuration::GetAbsolutePath(), "Core");
|
||||
std::string path = Utils::CombinePath(Configuration::AbsolutePath, "Core");
|
||||
gst_init(NULL, NULL);
|
||||
|
||||
#ifdef WIN32
|
||||
@ -208,7 +208,7 @@ bool GStreamerVideo::Play(std::string file)
|
||||
}
|
||||
else
|
||||
{
|
||||
Configuration::ConvertToAbsolutePath(Configuration::GetAbsolutePath(), file);
|
||||
Configuration::ConvertToAbsolutePath(Configuration::AbsolutePath, file);
|
||||
file = uriFile;
|
||||
|
||||
if(!Playbin)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user