blob: 0d5bb4d506f4f9a09f61d8666340ed02ab2e5166 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
// Copyright 2019 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/service/glue/errors.h"
#include "core/hle/service/glue/manager.h"
namespace Service::Glue {
ARPManager::ARPManager() = default;
ARPManager::~ARPManager() = default;
ResultVal<ApplicationLaunchProperty> ARPManager::GetLaunchProperty(u64 title_id) const {
if (title_id == 0) {
return ERR_TITLE_ID_ZERO;
}
const auto iter = entries.find(title_id);
if (iter == entries.end()) {
return ERR_NONEXISTENT;
}
return MakeResult<ApplicationLaunchProperty>(iter->second.launch);
}
ResultVal<std::vector<u8>> ARPManager::GetControlProperty(u64 title_id) const {
if (title_id == 0) {
return ERR_TITLE_ID_ZERO;
}
const auto iter = entries.find(title_id);
if (iter == entries.end()) {
return ERR_NONEXISTENT;
}
return MakeResult<std::vector<u8>>(iter->second.control);
}
ResultCode ARPManager::Register(u64 title_id, ApplicationLaunchProperty launch,
std::vector<u8> control) {
if (title_id == 0) {
return ERR_TITLE_ID_ZERO;
}
const auto iter = entries.find(title_id);
if (iter != entries.end()) {
return ERR_ALREADY_ISSUED;
}
entries.insert_or_assign(title_id, MapEntry{launch, std::move(control)});
return RESULT_SUCCESS;
}
ResultCode ARPManager::Unregister(u64 title_id) {
if (title_id == 0) {
return ERR_TITLE_ID_ZERO;
}
const auto iter = entries.find(title_id);
if (iter == entries.end()) {
return ERR_NONEXISTENT;
}
entries.erase(iter);
return RESULT_SUCCESS;
}
void ARPManager::ResetAll() {
entries.clear();
}
} // namespace Service::Glue
|