custom texture: stop loader thread before loading state

This commit is contained in:
Flyinghead 2020-03-13 18:01:33 +01:00
parent 4e73af0f94
commit e3313d27b2
4 changed files with 8 additions and 11 deletions

View File

@ -26,6 +26,7 @@
#include "hw/sh4/dyna/blockmanager.h"
#include "log/LogManager.h"
#include "cheats.h"
#include "rend/CustomTexture.h"
void FlushCache();
void LoadCustom();
@ -919,12 +920,6 @@ void LoadSettings(bool game_specific)
settings.dispmanx.Keep_Aspect = cfgLoadBool(game_specific ? cfgGetGameId() : "dispmanx", "maintain_aspect", settings.dispmanx.Keep_Aspect);
#endif
#if (HOST_OS != OS_LINUX || defined(__ANDROID__) || defined(TARGET_PANDORA))
settings.aica.BufferSize=2048;
#else
settings.aica.BufferSize=1024;
#endif
#if USE_OMX
settings.omx.Audio_Latency = cfgLoadInt(game_specific ? cfgGetGameId() : "omx", "audio_latency", settings.omx.Audio_Latency);
settings.omx.Audio_HDMI = cfgLoadBool(game_specific ? cfgGetGameId() : "omx", "audio_hdmi", settings.omx.Audio_HDMI);
@ -1218,6 +1213,7 @@ void dc_loadstate()
data_ptr = data ;
custom_texture.Terminate();
#if FEAT_AREC == DYNAREC_JIT
FlushCache();
#endif

View File

@ -30,6 +30,7 @@
// TODO Move this out of gles.cpp
u8* loadPNGData(const string& subpath, int &width, int &height);
CustomTexture custom_texture;
void CustomTexture::LoaderThread()
{

View File

@ -34,17 +34,17 @@ public:
u8* LoadCustomTexture(u32 hash, int& width, int& height);
void LoadCustomTextureAsync(BaseTextureCacheData *texture_data);
void DumpTexture(u32 hash, int w, int h, TextureType textype, void *temp_tex_buffer);
void Terminate();
private:
bool Init();
void Terminate();
void LoaderThread();
std::string GetGameId();
static void *loader_thread_func(void *param) { ((CustomTexture *)param)->LoaderThread(); return NULL; }
bool initialized;
bool custom_textures_available;
bool initialized = false;
bool custom_textures_available = false;
std::string textures_path;
std::set<u32> unknown_hashes;
#ifndef TARGET_NO_THREADS
@ -54,3 +54,5 @@ private:
std::vector<BaseTextureCacheData *> work_queue;
cMutex work_queue_mutex;
};
extern CustomTexture custom_texture;

View File

@ -438,8 +438,6 @@ static const TextureType PAL_TYPE[4] = {
TextureType::_5551, TextureType::_565, TextureType::_4444, TextureType::_8888
};
static CustomTexture custom_texture;
void BaseTextureCacheData::PrintTextureName()
{
char str[512];