Made the the text element emulator metadata property work with collections.

This commit is contained in:
Leon Styhre 2023-02-19 13:49:16 +01:00
parent ace7dde017
commit 6c3f5e70bd
3 changed files with 22 additions and 15 deletions

View file

@ -12,16 +12,14 @@
#define ES_APP_FILE_DATA_H #define ES_APP_FILE_DATA_H
#include "MetaData.h" #include "MetaData.h"
#include "SystemData.h"
#include "Window.h"
#include "utils/FileSystemUtil.h" #include "utils/FileSystemUtil.h"
#include "utils/StringUtil.h" #include "utils/StringUtil.h"
#include <functional> #include <functional>
#include <unordered_map> #include <unordered_map>
class SystemData;
class Window;
struct SystemEnvironmentData;
enum FileType { enum FileType {
GAME = 1, // Cannot have children. GAME = 1, // Cannot have children.
FOLDER = 2, FOLDER = 2,
@ -69,6 +67,10 @@ public:
const std::vector<FileData*>& getChildren() const { return mChildren; } const std::vector<FileData*>& getChildren() const { return mChildren; }
const std::vector<FileData*>& getFilteredChildren() const { return mFilteredChildren; } const std::vector<FileData*>& getFilteredChildren() const { return mFilteredChildren; }
SystemData* getSystem() const { return mSystem; } SystemData* getSystem() const { return mSystem; }
SystemData* getSourceSystem()
{
return (mSourceFileData != nullptr ? mSourceFileData->mSystem : mSystem);
}
SystemEnvironmentData* getSystemEnvData() const { return mEnvData; } SystemEnvironmentData* getSystemEnvData() const { return mEnvData; }
// These functions are used by GameSelectorComponent. // These functions are used by GameSelectorComponent.

View file

@ -895,14 +895,16 @@ void GamelistView::updateView(const CursorState& state)
else if (metadata == "altemulator") else if (metadata == "altemulator")
return file->metadata.get("altemulator"); return file->metadata.get("altemulator");
else if (metadata == "emulator") else if (metadata == "emulator")
return (file->metadata.get("altemulator") != "" ? return (file->getType() == FOLDER) ?
file->metadata.get("altemulator") : "" :
(file->getSystem()->getAlternativeEmulator() != "" ? (file->metadata.get("altemulator") != "" ?
file->getSystem()->getAlternativeEmulator() : file->metadata.get("altemulator") :
file->getSystem() (file->getSourceSystem()->getAlternativeEmulator() != "" ?
->getSystemEnvData() file->getSourceSystem()->getAlternativeEmulator() :
->mLaunchCommands.front() file->getSourceSystem()
.second)); ->getSystemEnvData()
->mLaunchCommands.front()
.second));
else if (metadata == "systemName") else if (metadata == "systemName")
return file->getSystem()->getName(); return file->getSystem()->getName();
else if (metadata == "systemFullname") else if (metadata == "systemFullname")

View file

@ -1300,10 +1300,13 @@ void SystemView::updateGameSelectors()
text->setValue( text->setValue(
games.at(gameSelectorEntry)->metadata.get("altemulator") != "" ? games.at(gameSelectorEntry)->metadata.get("altemulator") != "" ?
games.at(gameSelectorEntry)->metadata.get("altemulator") : games.at(gameSelectorEntry)->metadata.get("altemulator") :
(games.at(gameSelectorEntry)->getSystem()->getAlternativeEmulator() != "" ? (games.at(gameSelectorEntry)->getSourceSystem()->getAlternativeEmulator() !=
games.at(gameSelectorEntry)->getSystem()->getAlternativeEmulator() : "" ?
games.at(gameSelectorEntry) games.at(gameSelectorEntry)
->getSystem() ->getSourceSystem()
->getAlternativeEmulator() :
games.at(gameSelectorEntry)
->getSourceSystem()
->getSystemEnvData() ->getSystemEnvData()
->mLaunchCommands.front() ->mLaunchCommands.front()
.second)); .second));