mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 09:09:52 -06:00
RetroAchievements: Delay calling LoadApprovedList
0c14b0c8a7
made Dolphin load a file from
the Sys folder the first time AchievementManager::GetInstance() is
called. Because Android calls AchievementManager::GetInstance() from
setBackgroundExecutionAllowedNative, this had two negative consequences
on Android:
1. The first time setBackgroundExecutionAllowedNative gets called is
often before directory initialization is done. Getting the path of
the Sys folder before directory initialization is done causes a crash.
2. setBackgroundExecutionAllowedNative is called from the GUI thread,
and we don't want file I/O on the GUI thread for performance reasons.
This change makes us load the data from the Sys folder the first time
the data is needed instead. This also saves us from having to load the
data at all when hardcore mode is inactive.
This commit is contained in:
@ -29,6 +29,7 @@
|
||||
#include "Common/Event.h"
|
||||
#include "Common/HttpRequest.h"
|
||||
#include "Common/JsonUtil.h"
|
||||
#include "Common/Lazy.h"
|
||||
#include "Common/WorkQueueThread.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
#include "VideoCommon/Assets/CustomTextureData.h"
|
||||
@ -146,7 +147,7 @@ public:
|
||||
void Shutdown();
|
||||
|
||||
private:
|
||||
AchievementManager() { LoadApprovedList(); };
|
||||
AchievementManager() = default;
|
||||
|
||||
struct FilereaderState
|
||||
{
|
||||
@ -154,7 +155,7 @@ private:
|
||||
std::unique_ptr<DiscIO::Volume> volume;
|
||||
};
|
||||
|
||||
void LoadApprovedList();
|
||||
static picojson::value LoadApprovedList();
|
||||
|
||||
static void* FilereaderOpenByFilepath(const char* path_utf8);
|
||||
static void* FilereaderOpenByVolume(const char* path_utf8);
|
||||
@ -227,7 +228,7 @@ private:
|
||||
std::chrono::steady_clock::time_point m_last_rp_time = std::chrono::steady_clock::now();
|
||||
std::chrono::steady_clock::time_point m_last_progress_message = std::chrono::steady_clock::now();
|
||||
|
||||
picojson::value m_ini_root;
|
||||
Common::Lazy<picojson::value> m_ini_root{LoadApprovedList};
|
||||
std::string m_game_ini_id;
|
||||
|
||||
std::unordered_map<AchievementId, LeaderboardStatus> m_leaderboard_map;
|
||||
|
Reference in New Issue
Block a user