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

View file

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

View file

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