boxart: don't save database when pausing (android, uwp)
Avoids ANR on android. Unnecessary since database is now saved regularly.
This commit is contained in:
parent
72d9ad34dc
commit
2b83df86cd
|
@ -766,7 +766,6 @@ static int suspendEventFilter(void *userdata, SDL_Event *event)
|
|||
{
|
||||
if (event->type == SDL_APP_WILLENTERBACKGROUND)
|
||||
{
|
||||
gui_save();
|
||||
if (gameRunning)
|
||||
{
|
||||
try {
|
||||
|
|
|
@ -146,14 +146,12 @@ void Boxart::fetchBoxart()
|
|||
}
|
||||
}
|
||||
}
|
||||
saveDatabase(true);
|
||||
saveDatabase();
|
||||
});
|
||||
}
|
||||
|
||||
void Boxart::saveDatabase(bool internal)
|
||||
void Boxart::saveDatabase()
|
||||
{
|
||||
if (!internal && fetching.valid())
|
||||
fetching.get();
|
||||
if (!databaseDirty)
|
||||
return;
|
||||
std::string db_name = getSaveDirectory() + DB_NAME;
|
||||
|
@ -216,3 +214,9 @@ void Boxart::loadDatabase()
|
|||
WARN_LOG(COMMON, "Corrupted database file: %s", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
void Boxart::term()
|
||||
{
|
||||
if (fetching.valid())
|
||||
fetching.get();
|
||||
}
|
||||
|
|
|
@ -34,10 +34,11 @@ class Boxart
|
|||
public:
|
||||
GameBoxart getBoxartAndLoad(const GameMedia& media);
|
||||
GameBoxart getBoxart(const GameMedia& media);
|
||||
void saveDatabase(bool internal = false);
|
||||
void term();
|
||||
|
||||
private:
|
||||
void loadDatabase();
|
||||
void saveDatabase();
|
||||
std::string getSaveDirectory() const {
|
||||
return get_writable_data_path("/boxart/");
|
||||
}
|
||||
|
|
|
@ -3681,7 +3681,7 @@ void gui_term()
|
|||
EventManager::unlisten(Event::Resume, emuEventCallback);
|
||||
EventManager::unlisten(Event::Start, emuEventCallback);
|
||||
EventManager::unlisten(Event::Terminate, emuEventCallback);
|
||||
gui_save();
|
||||
boxart.term();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3717,11 +3717,6 @@ void gui_error(const std::string& what)
|
|||
error_msg = what;
|
||||
}
|
||||
|
||||
void gui_save()
|
||||
{
|
||||
boxart.saveDatabase();
|
||||
}
|
||||
|
||||
void gui_loadState()
|
||||
{
|
||||
const LockGuard lock(guiMutex);
|
||||
|
|
|
@ -47,7 +47,6 @@ void gui_stop_game(const std::string& message = "");
|
|||
void gui_start_game(const std::string& path);
|
||||
void gui_error(const std::string& what);
|
||||
void gui_setOnScreenKeyboardCallback(void (*callback)(bool show));
|
||||
void gui_save();
|
||||
void gui_loadState();
|
||||
void gui_saveState(bool stopRestart = true);
|
||||
std::string gui_getCurGameBoxartUrl();
|
||||
|
|
|
@ -290,7 +290,6 @@ extern "C" JNIEXPORT void JNICALL Java_com_flycast_emulator_emu_JNIdc_pause(JNIE
|
|||
if (config::AutoSaveState)
|
||||
dc_savestate(config::SavestateSlot);
|
||||
}
|
||||
gui_save();
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL Java_com_flycast_emulator_emu_JNIdc_resume(JNIEnv *env,jobject obj)
|
||||
|
|
|
@ -80,7 +80,6 @@ static bool emulatorRunning;
|
|||
{
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
gui_save();
|
||||
if (config::AutoSaveState && !settings.content.path.empty())
|
||||
dc_savestate(config::SavestateSlot);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue