diff --git a/es-app/src/views/gamelist/DetailedGameListView.cpp b/es-app/src/views/gamelist/DetailedGameListView.cpp index c6bb5b5aa..c62eef1b1 100644 --- a/es-app/src/views/gamelist/DetailedGameListView.cpp +++ b/es-app/src/views/gamelist/DetailedGameListView.cpp @@ -389,6 +389,7 @@ void DetailedGameListView::updateInfoPanel() ss << (file->metadata.get("completed").compare("true") ? "" : "completed "); ss << (file->metadata.get("kidgame").compare("true") ? "" : "kidgame "); ss << (file->metadata.get("broken").compare("true") ? "" : "broken "); + ss << (file->metadata.get("altemulator").compare("") ? "altemu " : ""); std::string slots = ss.str(); if (!slots.empty()) slots.pop_back(); diff --git a/es-app/src/views/gamelist/VideoGameListView.cpp b/es-app/src/views/gamelist/VideoGameListView.cpp index a6a187e0a..49b25ddd1 100644 --- a/es-app/src/views/gamelist/VideoGameListView.cpp +++ b/es-app/src/views/gamelist/VideoGameListView.cpp @@ -451,6 +451,7 @@ void VideoGameListView::updateInfoPanel() ss << (file->metadata.get("completed").compare("true") ? "" : "completed "); ss << (file->metadata.get("kidgame").compare("true") ? "" : "kidgame "); ss << (file->metadata.get("broken").compare("true") ? "" : "broken "); + ss << (file->metadata.get("altemulator").compare("") ? "altemu " : ""); std::string slots = ss.str(); if (!slots.empty()) slots.pop_back(); diff --git a/es-core/src/components/BadgesComponent.cpp b/es-core/src/components/BadgesComponent.cpp index 5b0a569be..8adff44a1 100644 --- a/es-core/src/components/BadgesComponent.cpp +++ b/es-core/src/components/BadgesComponent.cpp @@ -14,7 +14,8 @@ #include "resources/TextureResource.h" // Available slot definitions. -const std::vector BadgesComponent::mSlots = {SLOT_FAVORITE, SLOT_COMPLETED, SLOT_KIDS, SLOT_BROKEN}; +const std::vector BadgesComponent::mSlots = {SLOT_FAVORITE, SLOT_COMPLETED, SLOT_KIDS, SLOT_BROKEN, + SLOT_ALTERNATIVE_EMULATOR}; std::map BadgesComponent::mBadgeIcons = std::map(); std::map BadgesComponent::mImageComponents = std::map(); @@ -25,6 +26,7 @@ BadgesComponent::BadgesComponent(Window *window) mBadgeIcons[SLOT_COMPLETED] = ":/graphics/badge_completed.svg"; mBadgeIcons[SLOT_KIDS] = ":/graphics/badge_kidgame.svg"; mBadgeIcons[SLOT_BROKEN] = ":/graphics/badge_broken.svg"; + mBadgeIcons[SLOT_ALTERNATIVE_EMULATOR] = ":/graphics/badge_altemu.svg"; } @@ -42,19 +44,26 @@ BadgesComponent::BadgesComponent(Window *window) ImageComponent mImageBroken = ImageComponent(window); mImageBroken.setImage(mBadgeIcons[SLOT_BROKEN], false, true); mImageComponents.insert({SLOT_BROKEN, mImageBroken}); + ImageComponent mImageAltEmu = ImageComponent(window); + mImageAltEmu.setImage(mBadgeIcons[SLOT_ALTERNATIVE_EMULATOR], false, true); + mImageComponents.insert({SLOT_ALTERNATIVE_EMULATOR, mImageAltEmu}); } - } -void BadgesComponent::setValue(const std::string& value) -{ +BadgesComponent::~BadgesComponent() { + mBadgeIcons.clear(); + mImageComponents.clear(); +} + + +void BadgesComponent::setValue(const std::string &value) { mChildren.clear(); if (!value.empty()) { std::string temp; std::istringstream ss(value); while (std::getline(ss, temp, ' ')) { if (!(temp == SLOT_FAVORITE || temp == SLOT_COMPLETED || temp == SLOT_KIDS || - temp == SLOT_BROKEN)) + temp == SLOT_BROKEN || temp == SLOT_ALTERNATIVE_EMULATOR)) LOG(LogError) << "Badge slot '" << temp << "' is invalid."; else mChildren.push_back(&mImageComponents.find(temp)->second); diff --git a/es-core/src/components/BadgesComponent.h b/es-core/src/components/BadgesComponent.h index 79b49fc8a..7da63e447 100644 --- a/es-core/src/components/BadgesComponent.h +++ b/es-core/src/components/BadgesComponent.h @@ -20,13 +20,16 @@ #define SLOT_COMPLETED "completed" #define SLOT_KIDS "kidgame" #define SLOT_BROKEN "broken" +#define SLOT_ALTERNATIVE_EMULATOR "altemu" class TextureResource; class BadgesComponent : public FlexboxComponent { public: - BadgesComponent(Window* window); + BadgesComponent(Window *window); + + ~BadgesComponent() noexcept; std::string getValue() const override; // Should be a list of strings. diff --git a/es-core/src/components/ImageComponent.h b/es-core/src/components/ImageComponent.h index ca537c62f..2d7b0c49d 100644 --- a/es-core/src/components/ImageComponent.h +++ b/es-core/src/components/ImageComponent.h @@ -14,21 +14,23 @@ class TextureResource; -class ImageComponent : public GuiComponent -{ +class ImageComponent : public GuiComponent { public: - ImageComponent(Window* window, bool forceLoad = false, bool dynamic = true); - virtual ~ImageComponent() {} + ImageComponent(Window *window, bool forceLoad = false, bool dynamic = true); + + virtual ~ImageComponent() noexcept {}; void setDefaultImage(std::string path) { mDefaultPath = path; } // Loads the image at the given filepath. Will tile if tile is true (retrieves texture // as tiling, creates vertices accordingly). void setImage(std::string path, bool tile = false, bool linearMagnify = false); + // Loads an image from memory. - void setImage(const char* data, size_t length, bool tile = false); + void setImage(const char *data, size_t length, bool tile = false); + // Use an already existing texture. - void setImage(const std::shared_ptr& texture); + void setImage(const std::shared_ptr &texture); void onSizeChanged() override { updateVertices(); }