mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-27 00:35:38 +00:00
Improved some logging as well as handling of a missing es_systems.cfg file.
This commit is contained in:
parent
c9cc8494c9
commit
0b6d0bfcd6
|
@ -163,7 +163,7 @@ void CollectionSystemManager::saveCustomCollection(SystemData* sys)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG(LogError) << "Couldn't find collection to save! " << name;
|
LOG(LogError) << "Couldn't find collection to save: " << name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -888,10 +888,10 @@ void CollectionSystemManager::populateCustomCollection(CollectionSystemData* sys
|
||||||
std::string path = getCustomCollectionConfigPath(newSys->getName());
|
std::string path = getCustomCollectionConfigPath(newSys->getName());
|
||||||
|
|
||||||
if (!Utils::FileSystem::exists(path)) {
|
if (!Utils::FileSystem::exists(path)) {
|
||||||
LOG(LogInfo) << "Couldn't find custom collection config file at " << path;
|
LOG(LogInfo) << "Couldn't find custom collection config file \"" << path << "\"";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LOG(LogInfo) << "Loading custom collection config file at " << path;
|
LOG(LogInfo) << "Parsing custom collection file \"" << path << "\"...";
|
||||||
|
|
||||||
FileData* rootFolder = newSys->getRootFolder();
|
FileData* rootFolder = newSys->getRootFolder();
|
||||||
FileFilterIndex* index = newSys->getIndex();
|
FileFilterIndex* index = newSys->getIndex();
|
||||||
|
@ -928,8 +928,7 @@ void CollectionSystemManager::populateCustomCollection(CollectionSystemData* sys
|
||||||
index->addToIndex(newGame);
|
index->addToIndex(newGame);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG(LogInfo) << "Couldn't find game referenced at '" << gameKey <<
|
LOG(LogWarning) << "File \"" << gameKey << "\" does not exist, ignoring entry";
|
||||||
"' for system config '" << path << "'";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ FileData* findOrCreateFile(SystemData* system, const std::string& path, FileType
|
||||||
std::string relative = Utils::FileSystem::removeCommonPath(path, root->getPath(), contains);
|
std::string relative = Utils::FileSystem::removeCommonPath(path, root->getPath(), contains);
|
||||||
|
|
||||||
if (!contains) {
|
if (!contains) {
|
||||||
LOG(LogError) << "File path \"" << path << "\" is outside system path \"" <<
|
LOG(LogError) << "Path \"" << path << "\" is outside system path \"" <<
|
||||||
system->getStartPath() << "\"";
|
system->getStartPath() << "\"";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ FileData* findOrCreateFile(SystemData* system, const std::string& path, FileType
|
||||||
return treeNode;
|
return treeNode;
|
||||||
|
|
||||||
if (type == FOLDER) {
|
if (type == FOLDER) {
|
||||||
LOG(LogWarning) << "Gamelist: folder doesn't exist, won't create";
|
LOG(LogWarning) << "Gamelist: folder doesn't exist, won't create it";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ FileData* findOrCreateFile(SystemData* system, const std::string& path, FileType
|
||||||
// Don't create folders unless they're including any games.
|
// Don't create folders unless they're including any games.
|
||||||
// If the type is FOLDER it's going to be empty, so don't bother.
|
// If the type is FOLDER it's going to be empty, so don't bother.
|
||||||
if (type == FOLDER) {
|
if (type == FOLDER) {
|
||||||
LOG(LogWarning) << "Gamelist: folder doesn't exist, won't create";
|
LOG(LogWarning) << "Gamelist: folder doesn't exist, won't create it";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ void parseGamelist(SystemData* system)
|
||||||
if (!Utils::FileSystem::exists(xmlpath))
|
if (!Utils::FileSystem::exists(xmlpath))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LOG(LogInfo) << "Parsing XML file \"" << xmlpath << "\"...";
|
LOG(LogInfo) << "Parsing gamelist file \"" << xmlpath << "\"...";
|
||||||
|
|
||||||
pugi::xml_document doc;
|
pugi::xml_document doc;
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
|
@ -104,14 +104,14 @@ void parseGamelist(SystemData* system)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
LOG(LogError) << "Error parsing XML file \"" << xmlpath <<
|
LOG(LogError) << "Error parsing gamelist file \"" << xmlpath <<
|
||||||
"\"!\n " <<result.description();
|
"\": " << result.description();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pugi::xml_node root = doc.child("gameList");
|
pugi::xml_node root = doc.child("gameList");
|
||||||
if (!root) {
|
if (!root) {
|
||||||
LOG(LogError) << "Could not find <gameList> node in gamelist \"" << xmlpath << "\"!";
|
LOG(LogError) << "Could not find <gameList> node in gamelist \"" << xmlpath << "\"";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,8 @@ void parseGamelist(SystemData* system)
|
||||||
relativeTo, false);
|
relativeTo, false);
|
||||||
|
|
||||||
if (!trustGamelist && !Utils::FileSystem::exists(path)) {
|
if (!trustGamelist && !Utils::FileSystem::exists(path)) {
|
||||||
LOG(LogWarning) << "File \"" << path << "\" does not exist, ignoring.";
|
LOG(LogWarning) << (type == GAME ? "File \"" : "Folder \"") << path <<
|
||||||
|
"\" does not exist, ignoring entry";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,14 +139,15 @@ void parseGamelist(SystemData* system)
|
||||||
// it is located.
|
// it is located.
|
||||||
if (!showHiddenFiles && (Utils::FileSystem::isHidden(path) ||
|
if (!showHiddenFiles && (Utils::FileSystem::isHidden(path) ||
|
||||||
Utils::FileSystem::isHidden(Utils::FileSystem::getParent(path)))) {
|
Utils::FileSystem::isHidden(Utils::FileSystem::getParent(path)))) {
|
||||||
LOG(LogDebug) << "Gamelist::parseGamelist(): Skipping hidden file " << path;
|
LOG(LogDebug) << "Gamelist::parseGamelist(): Skipping hidden file \"" <<
|
||||||
|
path << "\"";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileData* file = findOrCreateFile(system, path, type);
|
FileData* file = findOrCreateFile(system, path, type);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
LOG(LogError) << "Error finding/creating FileData for \"" <<
|
LOG(LogError) << "Error finding/creating FileData for \"" <<
|
||||||
path << "\", skipping.";
|
path << "\", skipping entry";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (!file->isArcadeAsset()) {
|
else if (!file->isArcadeAsset()) {
|
||||||
|
@ -163,8 +165,9 @@ void parseGamelist(SystemData* system)
|
||||||
// but that is fine as the option to show hidden files is defined as requiring an
|
// but that is fine as the option to show hidden files is defined as requiring an
|
||||||
// application restart.
|
// application restart.
|
||||||
if (!Settings::getInstance()->getBool("ShowHiddenGames") && file->getHidden()) {
|
if (!Settings::getInstance()->getBool("ShowHiddenGames") && file->getHidden()) {
|
||||||
LOG(LogDebug) << "Gamelist::parseGamelist(): Skipping hidden entry '" <<
|
LOG(LogDebug) << "Gamelist::parseGamelist(): Skipping hidden " <<
|
||||||
file->getName() << "'" << " (" << file->getPath() << ").";
|
(type == GAME ? "file" : "folder") << " entry \"" <<
|
||||||
|
file->getName() << "\"" << " (\"" << file->getPath() << "\")";
|
||||||
delete file;
|
delete file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,7 +226,7 @@ void updateGamelist(SystemData* system)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
LOG(LogError) << "Error parsing XML file \"" << xmlReadPath << "\"!\n " <<
|
LOG(LogError) << "Error parsing gamelist file \"" << xmlReadPath << "\": " <<
|
||||||
result.description();
|
result.description();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -231,7 +234,7 @@ void updateGamelist(SystemData* system)
|
||||||
root = doc.child("gameList");
|
root = doc.child("gameList");
|
||||||
if (!root) {
|
if (!root) {
|
||||||
LOG(LogError) << "Could not find <gameList> node in gamelist \"" <<
|
LOG(LogError) << "Could not find <gameList> node in gamelist \"" <<
|
||||||
xmlReadPath << "\"!";
|
xmlReadPath << "\"";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,7 +266,7 @@ void updateGamelist(SystemData* system)
|
||||||
fileNode = fileNode.next_sibling(tag)) {
|
fileNode = fileNode.next_sibling(tag)) {
|
||||||
pugi::xml_node pathNode = fileNode.child("path");
|
pugi::xml_node pathNode = fileNode.child("path");
|
||||||
if (!pathNode) {
|
if (!pathNode) {
|
||||||
LOG(LogError) << "<" << tag << "> node contains no <path> child!";
|
LOG(LogError) << "<" << tag << "> node contains no <path> child";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +299,7 @@ void updateGamelist(SystemData* system)
|
||||||
Utils::FileSystem::createDirectory(Utils::FileSystem::getParent(xmlWritePath));
|
Utils::FileSystem::createDirectory(Utils::FileSystem::getParent(xmlWritePath));
|
||||||
|
|
||||||
LOG(LogDebug) << "Gamelist::updateGamelist(): Added/updated " << numUpdated <<
|
LOG(LogDebug) << "Gamelist::updateGamelist(): Added/updated " << numUpdated <<
|
||||||
(numUpdated == 1 ? " entity in '" : " entities in '") << xmlReadPath << "'";
|
(numUpdated == 1 ? " entity in '" : " entities in \"") << xmlReadPath << "\"";
|
||||||
|
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
if (!doc.save_file(Utils::String::stringToWideString(xmlWritePath).c_str())) {
|
if (!doc.save_file(Utils::String::stringToWideString(xmlWritePath).c_str())) {
|
||||||
|
@ -304,11 +307,11 @@ void updateGamelist(SystemData* system)
|
||||||
if (!doc.save_file(xmlWritePath.c_str())) {
|
if (!doc.save_file(xmlWritePath.c_str())) {
|
||||||
#endif
|
#endif
|
||||||
LOG(LogError) << "Error saving gamelist.xml to \"" <<
|
LOG(LogError) << "Error saving gamelist.xml to \"" <<
|
||||||
xmlWritePath << "\" (for system " << system->getName() << ")!";
|
xmlWritePath << "\" (for system " << system->getName() << ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG(LogError) << "Found no root folder for system \"" << system->getName() << "\"!";
|
LOG(LogError) << "Found no root folder for system \"" << system->getName() << "\"";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,12 +104,12 @@ bool SystemData::populateFolder(FileData* folder)
|
||||||
const std::string& folderPath = folder->getPath();
|
const std::string& folderPath = folder->getPath();
|
||||||
if (!Utils::FileSystem::exists(folderPath)) {
|
if (!Utils::FileSystem::exists(folderPath)) {
|
||||||
LOG(LogDebug) << "SystemData::populateFolder(): Folder with path \"" <<
|
LOG(LogDebug) << "SystemData::populateFolder(): Folder with path \"" <<
|
||||||
folderPath << "\" does not exist.";
|
folderPath << "\" does not exist";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Utils::FileSystem::isDirectory(folderPath)) {
|
if (!Utils::FileSystem::isDirectory(folderPath)) {
|
||||||
LOG(LogWarning) << "Folder with path \"" <<
|
LOG(LogWarning) << "Folder with path \"" <<
|
||||||
folderPath << "\" is not a directory.";
|
folderPath << "\" is not a directory";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,8 +139,12 @@ bool SystemData::populateFolder(FileData* folder)
|
||||||
filePath = *it;
|
filePath = *it;
|
||||||
|
|
||||||
// Skip hidden files and folders.
|
// Skip hidden files and folders.
|
||||||
if (!showHiddenFiles && Utils::FileSystem::isHidden(filePath))
|
if (!showHiddenFiles && Utils::FileSystem::isHidden(filePath)) {
|
||||||
|
LOG(LogDebug) << "SystemData::populateFolder(): Skipping hidden " <<
|
||||||
|
(Utils::FileSystem::isDirectory(filePath) ? "directory \"" : "file \"") <<
|
||||||
|
filePath << "\"";
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// This is a little complicated because we allow a list
|
// This is a little complicated because we allow a list
|
||||||
// of extensions to be defined (delimited with a space).
|
// of extensions to be defined (delimited with a space).
|
||||||
|
@ -223,15 +227,15 @@ bool SystemData::loadConfig()
|
||||||
std::string path = getConfigPath(false);
|
std::string path = getConfigPath(false);
|
||||||
const std::string rompath = FileData::getROMDirectory();
|
const std::string rompath = FileData::getROMDirectory();
|
||||||
|
|
||||||
LOG(LogInfo) << "Loading system configuration file " << path << "...";
|
|
||||||
|
|
||||||
if (!Utils::FileSystem::exists(path)) {
|
if (!Utils::FileSystem::exists(path)) {
|
||||||
LOG(LogWarning) << "es_systems.cfg does not exist.";
|
LOG(LogWarning) << "Systems configuration file does not exist";
|
||||||
if (copyConfigTemplate(getConfigPath(true)))
|
if (copyConfigTemplate(getConfigPath(true)))
|
||||||
return false;
|
return false;
|
||||||
path = getConfigPath(false);
|
path = getConfigPath(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG(LogInfo) << "Parsing systems configuration file \"" << path << "\"...";
|
||||||
|
|
||||||
pugi::xml_document doc;
|
pugi::xml_document doc;
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
pugi::xml_parse_result res = doc.load_file(Utils::String::stringToWideString(path).c_str());
|
pugi::xml_parse_result res = doc.load_file(Utils::String::stringToWideString(path).c_str());
|
||||||
|
@ -249,7 +253,7 @@ bool SystemData::loadConfig()
|
||||||
pugi::xml_node systemList = doc.child("systemList");
|
pugi::xml_node systemList = doc.child("systemList");
|
||||||
|
|
||||||
if (!systemList) {
|
if (!systemList) {
|
||||||
LOG(LogError) << "es_systems.cfg is missing the <systemList> tag.";
|
LOG(LogError) << "es_systems.cfg is missing the <systemList> tag";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +311,7 @@ bool SystemData::loadConfig()
|
||||||
// Validate.
|
// Validate.
|
||||||
if (name.empty() || path.empty() || extensions.empty() || cmd.empty()) {
|
if (name.empty() || path.empty() || extensions.empty() || cmd.empty()) {
|
||||||
LOG(LogError) << "System \"" << name <<
|
LOG(LogError) << "System \"" << name <<
|
||||||
"\" is missing name, path, extension, or command.";
|
"\" is missing name, path, extension, or command";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +353,7 @@ bool SystemData::loadConfig()
|
||||||
|
|
||||||
if (newSys->getRootFolder()->getChildrenByFilename().size() == 0 || onlyHidden) {
|
if (newSys->getRootFolder()->getChildrenByFilename().size() == 0 || onlyHidden) {
|
||||||
LOG(LogDebug) << "SystemData::loadConfig(): System \"" << name <<
|
LOG(LogDebug) << "SystemData::loadConfig(): System \"" << name <<
|
||||||
"\" has no games, ignoring it.";
|
"\" has no games, ignoring it";
|
||||||
delete newSys;
|
delete newSys;
|
||||||
delete envData;
|
delete envData;
|
||||||
}
|
}
|
||||||
|
@ -374,25 +378,30 @@ bool SystemData::copyConfigTemplate(const std::string& path)
|
||||||
{
|
{
|
||||||
std::string systemsTemplateFile;;
|
std::string systemsTemplateFile;;
|
||||||
|
|
||||||
LOG(LogInfo) << "Attempting to copy template es_systems.cfg file from the resources directory.";
|
LOG(LogInfo) <<
|
||||||
|
"Attempting to copy template es_systems.cfg file from the resources directory...";
|
||||||
|
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
systemsTemplateFile = ResourceManager::getInstance()->
|
systemsTemplateFile = ResourceManager::getInstance()->
|
||||||
getResourcePath(":/templates/es_systems.cfg_windows");
|
getResourcePath(":/templates/es_systems.cfg_windows", false);
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
systemsTemplateFile = ResourceManager::getInstance()->
|
systemsTemplateFile = ResourceManager::getInstance()->
|
||||||
getResourcePath(":/templates/es_systems.cfg_macos");
|
getResourcePath(":/templates/es_systems.cfg_macos", false);
|
||||||
#elif defined(__unix__)
|
#elif defined(__unix__)
|
||||||
systemsTemplateFile = ResourceManager::getInstance()->
|
systemsTemplateFile = ResourceManager::getInstance()->
|
||||||
getResourcePath(":/templates/es_systems.cfg_unix");
|
getResourcePath(":/templates/es_systems.cfg_unix", false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Utils::FileSystem::copyFile(systemsTemplateFile, path, false)) {
|
if (systemsTemplateFile == "") {
|
||||||
LOG(LogError) << "Copying of es_systems.cfg template file failed.";
|
LOG(LogError) << "Can't find the es_systems.cfg template file";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (Utils::FileSystem::copyFile(systemsTemplateFile, path, false)) {
|
||||||
|
LOG(LogError) << "Copying of es_systems.cfg template file failed";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(LogInfo) << "Template es_systems.cfg file copied successfully.";
|
LOG(LogInfo) << "Template es_systems.cfg file copied successfully";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,7 +361,7 @@ bool verifyHomeFolderExists()
|
||||||
returnCode loadSystemConfigFile(std::string& errorMsg)
|
returnCode loadSystemConfigFile(std::string& errorMsg)
|
||||||
{
|
{
|
||||||
if (!SystemData::loadConfig()) {
|
if (!SystemData::loadConfig()) {
|
||||||
LOG(LogError) << "Could not parse systems configuration file.";
|
LOG(LogError) << "Could not parse systems configuration file";
|
||||||
errorMsg = "COULDN'T FIND THE SYSTEMS CONFIGURATION FILE.\n"
|
errorMsg = "COULDN'T FIND THE SYSTEMS CONFIGURATION FILE.\n"
|
||||||
"ATTEMPTED TO COPY A TEMPLATE ES_SYSTEMS.CFG FILE\n"
|
"ATTEMPTED TO COPY A TEMPLATE ES_SYSTEMS.CFG FILE\n"
|
||||||
"FROM THE EMULATIONSTATION RESOURCES DIRECTORY,\n"
|
"FROM THE EMULATIONSTATION RESOURCES DIRECTORY,\n"
|
||||||
|
@ -373,7 +373,7 @@ returnCode loadSystemConfigFile(std::string& errorMsg)
|
||||||
|
|
||||||
if (SystemData::sSystemVector.size() == 0) {
|
if (SystemData::sSystemVector.size() == 0) {
|
||||||
LOG(LogError) << "No systems found, does at least one system have a game present? "
|
LOG(LogError) << "No systems found, does at least one system have a game present? "
|
||||||
"(Check that the file extensions are supported.)";
|
"(Check that the file extensions are supported)";
|
||||||
errorMsg = "THE SYSTEMS CONFIGURATION FILE EXISTS, BUT NO\n"
|
errorMsg = "THE SYSTEMS CONFIGURATION FILE EXISTS, BUT NO\n"
|
||||||
"GAME FILES WERE FOUND. EITHER PLACE YOUR GAMES\n"
|
"GAME FILES WERE FOUND. EITHER PLACE YOUR GAMES\n"
|
||||||
"IN THE CURRENTLY CONFIGURED ROM DIRECTORY OR\n"
|
"IN THE CURRENTLY CONFIGURED ROM DIRECTORY OR\n"
|
||||||
|
@ -462,7 +462,6 @@ int main(int argc, char* argv[])
|
||||||
PowerSaver::init();
|
PowerSaver::init();
|
||||||
ViewController::init(&window);
|
ViewController::init(&window);
|
||||||
CollectionSystemManager::init(&window);
|
CollectionSystemManager::init(&window);
|
||||||
MameNames::init();
|
|
||||||
window.pushGui(ViewController::get());
|
window.pushGui(ViewController::get());
|
||||||
|
|
||||||
bool splashScreen = Settings::getInstance()->getBool("SplashScreen");
|
bool splashScreen = Settings::getInstance()->getBool("SplashScreen");
|
||||||
|
@ -470,7 +469,7 @@ int main(int argc, char* argv[])
|
||||||
SDL_Event event {};
|
SDL_Event event {};
|
||||||
|
|
||||||
if (!window.init()) {
|
if (!window.init()) {
|
||||||
LOG(LogError) << "Window failed to initialize.";
|
LOG(LogError) << "Window failed to initialize";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,6 +477,7 @@ int main(int argc, char* argv[])
|
||||||
if (event.type == SDL_QUIT)
|
if (event.type == SDL_QUIT)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
MameNames::init();
|
||||||
|
|
||||||
if (splashScreen) {
|
if (splashScreen) {
|
||||||
std::string progressText = "Loading...";
|
std::string progressText = "Loading...";
|
||||||
|
@ -492,7 +492,7 @@ int main(int argc, char* argv[])
|
||||||
if (returnCodeValue) {
|
if (returnCodeValue) {
|
||||||
// Something went terribly wrong.
|
// Something went terribly wrong.
|
||||||
if (errorMsg == "") {
|
if (errorMsg == "") {
|
||||||
LOG(LogError) << "Unknown error occured while parsing system config file.";
|
LOG(LogError) << "Unknown error occured while parsing systems configuration file";
|
||||||
Renderer::deinit();
|
Renderer::deinit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -686,7 +686,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
processQuitMode();
|
processQuitMode();
|
||||||
|
|
||||||
LOG(LogInfo) << "EmulationStation cleanly shutting down.";
|
LOG(LogInfo) << "EmulationStation cleanly shutting down";
|
||||||
|
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
closeConsole();
|
closeConsole();
|
||||||
|
|
|
@ -50,7 +50,7 @@ MameNames::MameNames()
|
||||||
if (!Utils::FileSystem::exists(xmlpath))
|
if (!Utils::FileSystem::exists(xmlpath))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LOG(LogInfo) << "Parsing XML file \"" << xmlpath << "\"...";
|
LOG(LogInfo) << "Parsing MAME names file \"" << xmlpath << "\"...";
|
||||||
|
|
||||||
pugi::xml_document doc;
|
pugi::xml_document doc;
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
|
@ -61,7 +61,7 @@ MameNames::MameNames()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
LOG(LogError) << "Error parsing XML file \"" << xmlpath << "\"!\n "
|
LOG(LogError) << "Error parsing MAME names file \"" << xmlpath << "\": "
|
||||||
<< result.description();
|
<< result.description();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ MameNames::MameNames()
|
||||||
if (!Utils::FileSystem::exists(xmlpath))
|
if (!Utils::FileSystem::exists(xmlpath))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LOG(LogInfo) << "Parsing XML file \"" << xmlpath << "\"...";
|
LOG(LogInfo) << "Parsing MAME BIOSes file \"" << xmlpath << "\"...";
|
||||||
|
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
result = doc.load_file(Utils::String::stringToWideString(xmlpath).c_str());
|
result = doc.load_file(Utils::String::stringToWideString(xmlpath).c_str());
|
||||||
|
@ -90,7 +90,7 @@ MameNames::MameNames()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
LOG(LogError) << "Error parsing XML file \"" << xmlpath << "\"!\n "
|
LOG(LogError) << "Error parsing MAME BIOSes file \"" << xmlpath << "\": "
|
||||||
<< result.description();
|
<< result.description();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ MameNames::MameNames()
|
||||||
if (!Utils::FileSystem::exists(xmlpath))
|
if (!Utils::FileSystem::exists(xmlpath))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LOG(LogInfo) << "Parsing XML file \"" << xmlpath << "\"...";
|
LOG(LogInfo) << "Parsing MAME devices file \"" << xmlpath << "\"...";
|
||||||
|
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
result = doc.load_file(Utils::String::stringToWideString(xmlpath).c_str());
|
result = doc.load_file(Utils::String::stringToWideString(xmlpath).c_str());
|
||||||
|
@ -116,7 +116,7 @@ MameNames::MameNames()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
LOG(LogError) << "Error parsing XML file \"" << xmlpath << "\"!\n "
|
LOG(LogError) << "Error parsing MAME devices file \"" << xmlpath << "\": "
|
||||||
<< result.description();
|
<< result.description();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,16 +35,16 @@ std::shared_ptr<Sound> Sound::getFromTheme(const std::shared_ptr<ThemeData>& the
|
||||||
const std::string& view, const std::string& element)
|
const std::string& view, const std::string& element)
|
||||||
{
|
{
|
||||||
LOG(LogDebug) << "Sound::getFromTheme(): Looking for navigation sound tag <sound name=\"" <<
|
LOG(LogDebug) << "Sound::getFromTheme(): Looking for navigation sound tag <sound name=\"" <<
|
||||||
element << "\">.";
|
element << "\">";
|
||||||
|
|
||||||
const ThemeData::ThemeElement* elem = theme->getElement(view, element, "sound");
|
const ThemeData::ThemeElement* elem = theme->getElement(view, element, "sound");
|
||||||
if (!elem || !elem->has("path")) {
|
if (!elem || !elem->has("path")) {
|
||||||
LOG(LogDebug) << "Sound::getFromTheme(): " << "Tag not found, using fallback sound file.";
|
LOG(LogDebug) << "Sound::getFromTheme(): " << "Tag not found, using fallback sound file";
|
||||||
return get(ResourceManager::getInstance()->
|
return get(ResourceManager::getInstance()->
|
||||||
getResourcePath(":/sounds/" + element + ".wav"));
|
getResourcePath(":/sounds/" + element + ".wav"));
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(LogDebug) << "Sound::getFromTheme(): Tag found, ready to load theme sound file.";
|
LOG(LogDebug) << "Sound::getFromTheme(): Tag found, ready to load theme sound file";
|
||||||
return get(elem->get<std::string>("path"));
|
return get(elem->get<std::string>("path"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ void Sound::init()
|
||||||
// Convert buffer to stereo, 16bit, 44.1kHz.
|
// Convert buffer to stereo, 16bit, 44.1kHz.
|
||||||
if (SDL_ConvertAudio(&cvt) < 0) {
|
if (SDL_ConvertAudio(&cvt) < 0) {
|
||||||
LOG(LogError) << "Error converting sound \"" << mPath <<
|
LOG(LogError) << "Error converting sound \"" << mPath <<
|
||||||
"\" to 44.1kHz, 16bit, stereo format!\n" << " " << SDL_GetError();
|
"\" to 44.1kHz, 16bit, stereo format: " << SDL_GetError();
|
||||||
delete[] cvt.buf;
|
delete[] cvt.buf;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -34,7 +34,8 @@ std::shared_ptr<ResourceManager>& ResourceManager::getInstance()
|
||||||
return sInstance;
|
return sInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ResourceManager::getResourcePath(const std::string& path) const
|
std::string ResourceManager::getResourcePath(const std::string& path,
|
||||||
|
bool terminateOnFailure) const
|
||||||
{
|
{
|
||||||
// Check if this is a resource file.
|
// Check if this is a resource file.
|
||||||
if ((path[0] == ':') && (path[1] == '/')) {
|
if ((path[0] == ':') && (path[1] == '/')) {
|
||||||
|
@ -72,10 +73,11 @@ std::string ResourceManager::getResourcePath(const std::string& path) const
|
||||||
if (Utils::FileSystem::exists(testExePath)) {
|
if (Utils::FileSystem::exists(testExePath)) {
|
||||||
return testExePath;
|
return testExePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For missing resources, log an error and terminate the application. This should
|
// For missing resources, log an error and terminate the application. This should
|
||||||
// indicate that we have a broken EmulationStation installation.
|
// indicate that we have a broken EmulationStation installation. If the argument
|
||||||
|
// terminateOnFailure is set to false though, then skip this step.
|
||||||
else {
|
else {
|
||||||
|
if (terminateOnFailure) {
|
||||||
LOG(LogError) << "Program resource missing: " << path;
|
LOG(LogError) << "Program resource missing: " << path;
|
||||||
LOG(LogError) << "Tried to find the resource in the following locations:";
|
LOG(LogError) << "Tried to find the resource in the following locations:";
|
||||||
LOG(LogError) << testHome;
|
LOG(LogError) << testHome;
|
||||||
|
@ -89,6 +91,10 @@ std::string ResourceManager::getResourcePath(const std::string& path) const
|
||||||
Scripting::fireEvent("quit");
|
Scripting::fireEvent("quit");
|
||||||
emergencyShutdown();
|
emergencyShutdown();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not a resource, return unmodified path.
|
// Not a resource, return unmodified path.
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
void unloadAll();
|
void unloadAll();
|
||||||
void reloadAll();
|
void reloadAll();
|
||||||
|
|
||||||
std::string getResourcePath(const std::string& path) const;
|
std::string getResourcePath(const std::string& path, bool terminateOnFailure = true) const;
|
||||||
const ResourceData getFileData(const std::string& path) const;
|
const ResourceData getFileData(const std::string& path) const;
|
||||||
bool fileExists(const std::string& path) const;
|
bool fileExists(const std::string& path) const;
|
||||||
|
|
||||||
|
|
|
@ -566,7 +566,7 @@ namespace Utils
|
||||||
|
|
||||||
if (!_overwrite && exists(_destination_path)) {
|
if (!_overwrite && exists(_destination_path)) {
|
||||||
LOG(LogError) << "Destination file exists and the overwrite flag "
|
LOG(LogError) << "Destination file exists and the overwrite flag "
|
||||||
"has not been set.";
|
"has not been set";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,8 +578,8 @@ namespace Utils
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (sourceFile.fail()) {
|
if (sourceFile.fail()) {
|
||||||
LOG(LogError) << "Couldn't read from source file (" << _source_path <<
|
LOG(LogError) << "Couldn't read from source file \"" << _source_path <<
|
||||||
"), permission problems?";
|
"\", permission problems?";
|
||||||
sourceFile.close();
|
sourceFile.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -592,8 +592,8 @@ namespace Utils
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (targetFile.fail()) {
|
if (targetFile.fail()) {
|
||||||
LOG(LogError) << "Couldn't write to target file (" << _destination_path <<
|
LOG(LogError) << "Couldn't write to target file \"" << _destination_path <<
|
||||||
"), permission problems?";
|
"\", permission problems?";
|
||||||
targetFile.close();
|
targetFile.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -624,7 +624,7 @@ namespace Utils
|
||||||
|
|
||||||
if (!_overwrite && exists(_destination_path)) {
|
if (!_overwrite && exists(_destination_path)) {
|
||||||
LOG(LogError) << "Destination file exists and the overwrite flag "
|
LOG(LogError) << "Destination file exists and the overwrite flag "
|
||||||
"has not been set.";
|
"has not been set";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue