ReXGlue SDK
Loading...
Searching...
No Matches
rex::xam::IAchievementManager Class Referenceabstract
Inheritance diagram for rex::xam::IAchievementManager:
[legend]

Public Member Functions

virtual Result< void > RegisterAchievement (Achievement info)=0
virtual Result< void > RegisterAchievements (std::span< const Achievement > achievements)=0
virtual void ReplaceAchievements (std::vector< Achievement > achievements)=0
virtual Result< void > LoadMetadataFile (const std::filesystem::path &path)=0
virtual std::vector< Achievement > ListAchievements () const =0
virtual AchievementUnlockResult UnlockAchievement (u32 id, AchievementNotification notification=AchievementNotification::kSuppress)=0
virtual bool IsUnlocked (u32 id) const =0
virtual std::optional< u64 > GetUnlockTime (u32 id) const =0
virtual ScopeGuard RegisterNotificationCallback (AchievementCallback callback)=0
virtual void SetUnlockSavePath (std::filesystem::path path)=0
virtual void LoadUnlockState ()=0
virtual void LoadUnlockStateFrom (const std::filesystem::path &user_root, u32 title_id)=0
virtual void SaveUnlockState () const =0

Additional Inherited Members

Protected Member Functions inherited from rex::NonCopyable
 NonCopyable (const NonCopyable &)=delete
NonCopyable & operator= (const NonCopyable &)=delete

Member Function Documentation

◆ GetUnlockTime()

virtual std::optional< u64 > rex::xam::IAchievementManager::GetUnlockTime ( u32 id) const
nodiscardpure virtual

Returns when an achievement was unlocked, empty when it is locked.

◆ ListAchievements()

virtual std::vector< Achievement > rex::xam::IAchievementManager::ListAchievements ( ) const
nodiscardpure virtual

Lists the catalog.

Returns
The achievements in registration order.

◆ LoadMetadataFile()

virtual Result< void > rex::xam::IAchievementManager::LoadMetadataFile ( const std::filesystem::path & path)
nodiscardpure virtual

Loads and merges the achievement entries of a TOML file.

Returns
Ok, or a Format error when the file has no achievement entries or does not parse.

◆ LoadUnlockStateFrom()

virtual void rex::xam::IAchievementManager::LoadUnlockStateFrom ( const std::filesystem::path & user_root,
u32 title_id )
pure virtual

Sets the save path of a title under a user data root and reads the unlocks from it.

◆ RegisterAchievement()

virtual Result< void > rex::xam::IAchievementManager::RegisterAchievement ( Achievement info)
nodiscardpure virtual

Adds an achievement or replaces the one with the same ID.

Returns
Ok, or a Validation error for ID 0.

◆ RegisterAchievements()

virtual Result< void > rex::xam::IAchievementManager::RegisterAchievements ( std::span< const Achievement > achievements)
nodiscardpure virtual

Adds or replaces several achievements, all or none.

Parameters
achievementsThe entries to add or replace.
Returns
Ok, or a Validation error for an ID 0 entry, in which case nothing is registered.

◆ RegisterNotificationCallback()

virtual ScopeGuard rex::xam::IAchievementManager::RegisterNotificationCallback ( AchievementCallback callback)
nodiscardpure virtual

Registers a callback for every notification.

Parameters
callbackThe function that receives each notification.
Returns
The guard. Destroying it removes the callback. It does nothing for an empty callback.

◆ ReplaceAchievements()

virtual void rex::xam::IAchievementManager::ReplaceAchievements ( std::vector< Achievement > achievements)
pure virtual

Replaces the whole catalog.

Parameters
achievementsThe entries that replace the catalog.

◆ UnlockAchievement()

virtual AchievementUnlockResult rex::xam::IAchievementManager::UnlockAchievement ( u32 id,
AchievementNotification notification = AchievementNotification::kSuppress )
pure virtual

Unlocks an achievement and persists the unlock.

Parameters
notificationkShow to raise the notification callbacks too.
Returns
kUnlocked, kAlreadyUnlocked or kUnknownAchievement.

The documentation for this class was generated from the following file: