mirror of
https://github.com/stenzek/duckstation.git
synced 2026-07-11 01:24:11 +02:00
Achievements: Populate saved credentials in ProcessStartup()
Avoids has_saved_credentials not being ready when game list is refreshing in parallel with core thread startup.
This commit is contained in:
@@ -591,7 +591,7 @@ const std::string& Achievements::GetRichPresenceString()
|
||||
return s_state.rich_presence_string;
|
||||
}
|
||||
|
||||
void Achievements::Initialize()
|
||||
void Achievements::ProcessStartup()
|
||||
{
|
||||
// Called on startup, no need to grab lock just to populate has saved credentials.
|
||||
{
|
||||
@@ -601,7 +601,10 @@ void Achievements::Initialize()
|
||||
s_state.has_saved_credentials = (si->LookupValue("Cheevos", "Username", &username) && !username.empty() &&
|
||||
si->LookupValue("Cheevos", "Token", &token) && !token.empty());
|
||||
}
|
||||
}
|
||||
|
||||
void Achievements::Initialize()
|
||||
{
|
||||
// No need to do anything else if we're not enabled.
|
||||
if (!g_settings.achievements_enabled)
|
||||
return;
|
||||
|
||||
@@ -74,6 +74,9 @@ const HashDatabaseEntry* LookupGameHash(const GameHash& hash);
|
||||
/// Converts a game hash to a string for display. If the hash is nullopt, returns "[NO HASH]".
|
||||
TinyString GameHashToString(const std::optional<GameHash>& hash);
|
||||
|
||||
/// Initializes global state.
|
||||
void ProcessStartup();
|
||||
|
||||
/// Initializes the RetroAchievments client.
|
||||
void Initialize();
|
||||
|
||||
|
||||
@@ -693,6 +693,11 @@ bool Core::ProcessStartup(Error* error)
|
||||
// Initialize rapidyaml before anything can use it.
|
||||
SetRymlCallbacks();
|
||||
|
||||
// Achievements needs to know whether credentials are saved, and whether it should load
|
||||
// the database/provide game icons. The refresh can happen in parallel with core init,
|
||||
// so we have to initialize it here.
|
||||
Achievements::ProcessStartup();
|
||||
|
||||
#ifdef __linux__
|
||||
// Running DuckStation out of /usr is not supported and makes no sense.
|
||||
if (std::memcmp(EmuFolders::AppRoot.data(), "/usr/", 5) == 0)
|
||||
|
||||
Reference in New Issue
Block a user