Clear the gameinfo cache on device lost.
This commit is contained in:
parent
ed1360a478
commit
b88f428a67
4 changed files with 28 additions and 3 deletions
|
@ -147,9 +147,7 @@ private:
|
|||
|
||||
|
||||
GameInfoCache::~GameInfoCache() {
|
||||
for (auto iter = info_.begin(); iter != info_.end(); iter++) {
|
||||
delete iter->second;
|
||||
}
|
||||
Clear();
|
||||
}
|
||||
|
||||
void GameInfoCache::Init() {
|
||||
|
@ -174,6 +172,27 @@ void GameInfoCache::Decimate() {
|
|||
// TODO
|
||||
}
|
||||
|
||||
void GameInfoCache::Clear() {
|
||||
gameInfoWQ_->Flush();
|
||||
for (auto iter = info_.begin(); iter != info_.end(); iter++) {
|
||||
lock_guard lock(iter->second->lock);
|
||||
if (!iter->second->pic0TextureData.empty()) {
|
||||
iter->second->pic0TextureData.clear();
|
||||
}
|
||||
if (iter->second->pic0Texture) {
|
||||
delete iter->second->pic0Texture;
|
||||
iter->second->pic0Texture = 0;
|
||||
}
|
||||
if (!iter->second->pic1TextureData.empty()) {
|
||||
iter->second->pic1TextureData.clear();
|
||||
}
|
||||
if (iter->second->pic1Texture) {
|
||||
delete iter->second->pic1Texture;
|
||||
iter->second->pic1Texture = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GameInfoCache::FlushBGs() {
|
||||
for (auto iter = info_.begin(); iter != info_.end(); iter++) {
|
||||
lock_guard lock(iter->second->lock);
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
// This creates a background worker thread!
|
||||
void Init();
|
||||
void Shutdown();
|
||||
void Clear();
|
||||
|
||||
// All data in GameInfo including iconTexture may be zero the first time you call this
|
||||
// but filled in later asynchronously in the background. So keep calling this,
|
||||
|
|
|
@ -245,7 +245,11 @@ void MenuScreen::render() {
|
|||
// TODO: Save when setting changes, rather than when we quit
|
||||
NativeShutdown();
|
||||
// TODO: Need a more elegant way to quit
|
||||
#ifdef _WIN32
|
||||
ExitProcess(0);
|
||||
#else
|
||||
exit(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (UIButton(GEN_ID, vlinear, w, 0, "www.ppsspp.org", ALIGN_RIGHT)) {
|
||||
|
|
|
@ -422,6 +422,7 @@ void NativeUpdate(InputState &input)
|
|||
|
||||
void NativeDeviceLost()
|
||||
{
|
||||
g_gameInfoCache.Clear();
|
||||
screenManager->deviceLost();
|
||||
gl_lost();
|
||||
glstate.Restore();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue