Duckstation/src/frontend-common/cheevos.h

93 lines
1.8 KiB
C
Raw Normal View History

2021-02-26 14:44:53 +00:00
#pragma once
#include "core/types.h"
#include <functional>
#include <string>
class CDImage;
namespace Cheevos {
enum class AchievementCategory : u32
{
Local = 0,
Core = 3,
Unofficial = 5
};
2021-02-26 14:44:53 +00:00
struct Achievement
{
u32 id;
std::string title;
std::string description;
std::string memaddr;
std::string locked_badge_path;
std::string unlocked_badge_path;
u32 points;
bool locked;
bool active;
};
extern bool g_active;
2021-03-03 09:14:01 +00:00
extern bool g_challenge_mode;
2021-02-26 14:44:53 +00:00
extern u32 g_game_id;
ALWAYS_INLINE bool IsActive()
{
return g_active;
}
2021-03-03 09:14:01 +00:00
ALWAYS_INLINE bool IsChallengeModeEnabled()
{
return g_challenge_mode;
}
ALWAYS_INLINE bool IsChallengeModeActive()
{
return g_active && g_challenge_mode;
}
2021-02-26 14:44:53 +00:00
ALWAYS_INLINE bool HasActiveGame()
{
return g_game_id != 0;
}
ALWAYS_INLINE u32 GetGameID()
{
return g_game_id;
}
2021-03-03 09:14:01 +00:00
bool Initialize(bool test_mode, bool use_first_disc_from_playlist, bool enable_rich_presence, bool challenge_mode);
2021-02-26 14:44:53 +00:00
void Reset();
void Shutdown();
void Update();
bool IsLoggedIn();
bool IsTestModeActive();
bool IsUsingFirstDiscFromPlaylist();
bool IsRichPresenceEnabled();
const std::string& GetUsername();
const std::string& GetRichPresenceString();
bool LoginAsync(const char* username, const char* password);
bool Login(const char* username, const char* password);
void Logout();
bool HasActiveGame();
void GameChanged(const std::string& path, CDImage* image);
const std::string& GetGameTitle();
const std::string& GetGameDeveloper();
const std::string& GetGamePublisher();
const std::string& GetGameReleaseDate();
const std::string& GetGameIcon();
bool EnumerateAchievements(std::function<bool(const Achievement&)> callback);
u32 GetUnlockedAchiementCount();
u32 GetAchievementCount();
u32 GetMaximumPointsForGame();
u32 GetCurrentPointsForGame();
void UnlockAchievement(u32 achievement_id, bool add_notification = true);
} // namespace Cheevos