ReXGlue SDK
Toggle main menu visibility
Loading...
Searching...
No Matches
achievement_manager.h
Go to the documentation of this file.
1
16
17
#pragma once
18
19
#include <cstddef>
20
#include <memory>
21
#include <unordered_map>
22
#include <vector>
23
#include <format>
24
#include <string>
25
#include <filesystem>
26
#include <optional>
27
#include <string_view>
28
#include <functional>
29
30
#include <
rex/utility.h
>
31
#include <span>
32
33
#include <
rex/platform.h
>
34
#include <
rex/types.h
>
35
#include <
rex/memory.h
>
36
#include <
rex/kernel/types/status.h
>
37
#include <
rex/memory/stream.h
>
38
#include <
rex/kernel/types/content.h
>
39
#include <
rex/result.h
>
40
#include <
rex/filesystem/xdbf.h
>
41
#include <
rex/utility.h
>
42
#include <
rex/title.h
>
43
44
namespace
rex::xam {
45
46
struct
AchievementEvent
{
47
Achievement
achievement;
48
};
49
51
enum class
AchievementNotification
: u8 {
52
kShow,
53
kSuppress
,
54
};
55
56
enum class
AchievementUnlockResult : u8 {
57
kUnlocked,
58
kAlreadyUnlocked,
59
kUnknownAchievement,
60
};
61
62
using
AchievementCallback = std::function<void(
const
AchievementEvent&)>;
63
64
class
IAchievementManager
:
public
NonCopyable {
65
public
:
66
virtual
~IAchievementManager
() =
default
;
67
73
[[nodiscard]]
virtual
Result<void>
RegisterAchievement
(
Achievement
info) = 0;
74
81
[[nodiscard]]
virtual
Result<void>
RegisterAchievements
(
82
std::span<const Achievement> achievements) = 0;
83
89
virtual
void
ReplaceAchievements
(std::vector<Achievement> achievements) = 0;
90
96
[[nodiscard]]
virtual
Result<void>
LoadMetadataFile
(
const
std::filesystem::path& path) = 0;
97
103
[[nodiscard]]
virtual
std::vector<Achievement>
ListAchievements
()
const
= 0;
104
111
virtual
AchievementUnlockResult
UnlockAchievement
(
112
u32
id
,
AchievementNotification
notification =
AchievementNotification::kSuppress
) = 0;
113
114
[[nodiscard]]
virtual
bool
IsUnlocked(u32
id
)
const
= 0;
115
117
[[nodiscard]]
virtual
std::optional<u64>
GetUnlockTime
(u32
id
)
const
= 0;
118
125
[[nodiscard]]
virtual
ScopeGuard
RegisterNotificationCallback
(AchievementCallback callback) = 0;
126
127
virtual
void
SetUnlockSavePath(std::filesystem::path path) = 0;
128
129
virtual
void
LoadUnlockState() = 0;
130
132
virtual
void
LoadUnlockStateFrom
(
const
std::filesystem::path& user_root, u32 title_id) = 0;
133
134
virtual
void
SaveUnlockState()
const
= 0;
135
};
136
137
}
// namespace rex::xam
rex::xam::AchievementNotification
AchievementNotification
Definition
achievement_manager.h:51
rex::xam::AchievementNotification::kSuppress
@ kSuppress
Definition
achievement_manager.h:53
rex::ScopeGuard
Definition
utility.h:305
rex::xam::IAchievementManager
Definition
achievement_manager.h:64
rex::xam::IAchievementManager::RegisterNotificationCallback
virtual ScopeGuard RegisterNotificationCallback(AchievementCallback callback)=0
rex::xam::IAchievementManager::UnlockAchievement
virtual AchievementUnlockResult UnlockAchievement(u32 id, AchievementNotification notification=AchievementNotification::kSuppress)=0
rex::xam::IAchievementManager::LoadUnlockStateFrom
virtual void LoadUnlockStateFrom(const std::filesystem::path &user_root, u32 title_id)=0
rex::xam::IAchievementManager::LoadMetadataFile
virtual Result< void > LoadMetadataFile(const std::filesystem::path &path)=0
rex::xam::IAchievementManager::RegisterAchievement
virtual Result< void > RegisterAchievement(Achievement info)=0
rex::xam::IAchievementManager::ListAchievements
virtual std::vector< Achievement > ListAchievements() const =0
rex::xam::IAchievementManager::GetUnlockTime
virtual std::optional< u64 > GetUnlockTime(u32 id) const =0
rex::xam::IAchievementManager::RegisterAchievements
virtual Result< void > RegisterAchievements(std::span< const Achievement > achievements)=0
rex::xam::IAchievementManager::ReplaceAchievements
virtual void ReplaceAchievements(std::vector< Achievement > achievements)=0
content.h
Content package and language IDs.
memory.h
rex::Result
std::expected< T, Error > Result
Definition
result.h:98
platform.h
Platform flags, packing macros and export markers.
result.h
status.h
stream.h
Bit, byte and ring buffer streams over memory.
rex::Achievement
Definition
title.h:38
rex::xam::AchievementEvent
Definition
achievement_manager.h:46
title.h
types.h
Integer types, byte order wrappers and size literals.
utility.h
Move only function, const propagating pointer and scope guard.
xdbf.h
rex
xam
achievement_manager.h
Generated by
1.18.0