mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Fixed an issue where the game image would sometimes not refresh after scraping.
This commit is contained in:
parent
e5fcb51f57
commit
2b189f9d19
|
@ -464,18 +464,16 @@ void GuiMetaDataEd::close()
|
|||
|
||||
std::function<void()> closeFunc;
|
||||
closeFunc = [this] {
|
||||
ViewController::get()->onPauseVideo();
|
||||
delete this;
|
||||
};
|
||||
|
||||
std::function<void()> closeFuncReload;
|
||||
closeFuncReload = [this] {
|
||||
// Always reload the gamelist if media files were updated, even if the user
|
||||
// selected to not save any metadata changes.
|
||||
if (mMediaFilesUpdated) {
|
||||
// Always reload the gamelist if media files were updated, even if the user
|
||||
// chose to not save any metadata changes. Also manually unload the game image
|
||||
// and marquee, as otherwise they would not get updated until the user scrolls up
|
||||
// and down the gamelist.
|
||||
TextureResource::manualUnload(mScraperParams.game->getImagePath(), false);
|
||||
TextureResource::manualUnload(mScraperParams.game->getMarqueePath(), false);
|
||||
ViewController::get()->reloadGameListView(mScraperParams.system);
|
||||
ViewController::get()->onPauseVideo();
|
||||
}
|
||||
ViewController::get()->onPauseVideo();
|
||||
delete this;
|
||||
};
|
||||
|
||||
|
@ -484,7 +482,7 @@ void GuiMetaDataEd::close()
|
|||
mWindow->pushGui(new GuiMsgBox(mWindow, getHelpStyle(),
|
||||
"SAVE CHANGES?",
|
||||
"YES", [this, closeFunc] { save(); closeFunc(); },
|
||||
"NO", closeFuncReload
|
||||
"NO", closeFunc
|
||||
));
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -87,6 +87,18 @@ void TextureResource::initFromMemory(const char* data, size_t length)
|
|||
mSourceSize = Vector2f(mTextureData->sourceWidth(), mTextureData->sourceHeight());
|
||||
}
|
||||
|
||||
void TextureResource::manualUnload(std::string path, bool tile)
|
||||
{
|
||||
const std::string canonicalPath = Utils::FileSystem::getCanonicalPath(path);
|
||||
|
||||
TextureKeyType key(canonicalPath, tile);
|
||||
auto foundTexture = sTextureMap.find(key);
|
||||
|
||||
if (foundTexture != sTextureMap.cend()) {
|
||||
sTextureMap.erase(foundTexture);
|
||||
}
|
||||
}
|
||||
|
||||
const Vector2i TextureResource::getSize() const
|
||||
{
|
||||
return mSize;
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#ifndef ES_CORE_RESOURCES_TEXTURE_RESOURCE_H
|
||||
#define ES_CORE_RESOURCES_TEXTURE_RESOURCE_H
|
||||
|
||||
#include "math/Vector2i.h"
|
||||
#include "math/Vector2f.h"
|
||||
#include "math/Vector2i.h"
|
||||
#include "resources/ResourceManager.h"
|
||||
#include "resources/TextureDataManager.h"
|
||||
|
||||
|
@ -28,6 +28,7 @@ public:
|
|||
bool forceLoad = false, bool dynamic = true);
|
||||
void initFromPixels(const unsigned char* dataRGBA, size_t width, size_t height);
|
||||
virtual void initFromMemory(const char* data, size_t length);
|
||||
static void manualUnload(std::string path, bool tile);
|
||||
|
||||
// For scalable source images in textures we want to set the resolution to rasterize at.
|
||||
void rasterizeAt(size_t width, size_t height);
|
||||
|
@ -65,7 +66,7 @@ private:
|
|||
|
||||
typedef std::pair<std::string, bool> TextureKeyType;
|
||||
// Map of textures, used to prevent duplicate textures.
|
||||
static std::map< TextureKeyType, std::weak_ptr<TextureResource> > sTextureMap;
|
||||
static std::map<TextureKeyType, std::weak_ptr<TextureResource>> sTextureMap;
|
||||
// Set of all textures, used for memory management.
|
||||
static std::set<TextureResource*> sAllTextures;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue