Achievements: Move init functions to private header

This commit is contained in:
Stenzek
2026-06-07 17:09:18 +10:00
parent 944beca2ce
commit cae25968fe
5 changed files with 46 additions and 23 deletions
+10 -10
View File
@@ -47,16 +47,16 @@
#include "util/ini_settings_interface.h"
#include "util/state_wrapper.h"
#include "IconsEmoji.h"
#include "IconsFontAwesome.h"
#include "IconsPromptFont.h"
#include "fmt/format.h"
#include "imgui.h"
#include "imgui_internal.h"
#include "rc_api_info.h"
#include "rc_api_runtime.h"
#include "rc_client.h"
#include "rc_consoles.h"
#include <IconsEmoji.h>
#include <IconsFontAwesome.h>
#include <IconsPromptFont.h>
#include <fmt/format.h>
#include <imgui.h>
#include <imgui_internal.h>
#include <rc_api_info.h>
#include <rc_api_runtime.h>
#include <rc_client.h>
#include <rc_consoles.h>
#include <algorithm>
#include <atomic>
-9
View File
@@ -74,18 +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();
/// Updates achievements settings.
void UpdateSettings(const Settings& old_config);
/// Shuts down the RetroAchievements client.
void Shutdown();
/// Call to refresh the all-progress database.
bool RefreshAllProgressDatabase(ProgressCallback* progress, Error* error);
+32 -2
View File
@@ -5,13 +5,16 @@
#include "achievements.h"
#include "rc_client.h"
#include <span>
#include <string>
#include <string_view>
#include <vector>
struct rc_client_t;
struct rc_client_achievement_t;
struct rc_client_subset_t;
struct rc_client_user_game_summary_t;
namespace Achievements {
inline constexpr float INDICATOR_FADE_IN_TIME = 0.2f;
@@ -51,19 +54,46 @@ struct PinnedAchievementIndicator
/// Returns the rc_client instance. Should have the lock held.
rc_client_t* GetClient();
/// Initializes global state.
void ProcessStartup();
/// Initializes the RetroAchievments client.
void Initialize();
/// Shuts down the RetroAchievements client.
void Shutdown();
/// Returns a summary of the user's points for the current game, including total points.
const rc_client_user_game_summary_t& GetGameSummary();
/// Returns the indicators for active leaderboard trackers. Should be called with the lock held.
std::vector<LeaderboardTrackerIndicator>& GetLeaderboardTrackerIndicators();
/// Returns the indicators for active challenges. Should be called with the lock held.
std::vector<ActiveChallengeIndicator>& GetActiveChallengeIndicators();
/// Returns the indicator for the achievement that has most recently had progress. Should be called with the lock held.
std::optional<AchievementProgressIndicator>& GetActiveProgressIndicator();
/// Returns the indicators for pinned achievements. Should be called with the lock held.
std::vector<PinnedAchievementIndicator>& GetPinnedAchievementIndicators();
/// Returns true if the specified achievement is pinned.
bool IsAchievementPinned(u32 achievement_id);
/// Pins or unpins the specified achievement.
void SetAchievementPinned(u32 achievement_id, bool pinned);
/// Returns the URL for the badge of the specified achievement, using the locked or unlocked version as appropriate.
std::string_view GetAchievementBadgeURL(const rc_client_achievement_t* achievement, bool locked);
/// Returns the URL for the badge of the specified achievement, using the locked or unlocked version as appropriate.
std::string_view GetLeaderboardFormatIcon(u32 format);
/// Returns the URL for the badge of the specified game, using the game ID.
std::string GetUserBadgeURL(const char* username);
/// Returns the URL for the badge of the specified subset, using the subset ID.
std::string GetSubsetBadgeURL(const rc_client_subset_t* subset);
} // namespace Achievements
+1
View File
@@ -3,6 +3,7 @@
#include "core.h"
#include "achievements.h"
#include "achievements_private.h"
#include "core_private.h"
#include "discord_presence.h"
#include "gdb_server.h"
+3 -2
View File
@@ -20,8 +20,9 @@
#include "common/time_helpers.h"
#include "common/timer.h"
#include "IconsEmoji.h"
#include "IconsPromptFont.h"
#include <IconsEmoji.h>
#include <IconsPromptFont.h>
#include <rc_client.h>
#include <bitset>