aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/service/glue/glue_manager.cpp
diff options
context:
space:
mode:
authorMai M <mathew1800@gmail.com>2021-07-14 22:19:05 -0400
committerGitHub <noreply@github.com>2021-07-14 22:19:05 -0400
commit05feddc2521ef667cf5d3817ef8e544a352b40ec (patch)
tree8591def7815ce7cc9156d87e0d62567584db1a23 /src/core/hle/service/glue/glue_manager.cpp
parentf2599534f8e096053bf7e8887ce729400a346e92 (diff)
parentc6d7da88c7ab125279ea4ccad0e3e839632b2f7a (diff)
Merge pull request #6639 from Morph1984/optimize-linker
general: Reduce compile time / linker usage on MSVC
Diffstat (limited to 'src/core/hle/service/glue/glue_manager.cpp')
-rw-r--r--src/core/hle/service/glue/glue_manager.cpp78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/core/hle/service/glue/glue_manager.cpp b/src/core/hle/service/glue/glue_manager.cpp
new file mode 100644
index 000000000..aa9d48c0c
--- /dev/null
+++ b/src/core/hle/service/glue/glue_manager.cpp
@@ -0,0 +1,78 @@
+// 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/glue_manager.h"
+
+namespace Service::Glue {
+
+struct ARPManager::MapEntry {
+ ApplicationLaunchProperty launch;
+ std::vector<u8> control;
+};
+
+ARPManager::ARPManager() = default;
+
+ARPManager::~ARPManager() = default;
+
+ResultVal<ApplicationLaunchProperty> ARPManager::GetLaunchProperty(u64 title_id) const {
+ if (title_id == 0) {
+ return ERR_INVALID_PROCESS_ID;
+ }
+
+ const auto iter = entries.find(title_id);
+ if (iter == entries.end()) {
+ return ERR_NOT_REGISTERED;
+ }
+
+ return MakeResult<ApplicationLaunchProperty>(iter->second.launch);
+}
+
+ResultVal<std::vector<u8>> ARPManager::GetControlProperty(u64 title_id) const {
+ if (title_id == 0) {
+ return ERR_INVALID_PROCESS_ID;
+ }
+
+ const auto iter = entries.find(title_id);
+ if (iter == entries.end()) {
+ return ERR_NOT_REGISTERED;
+ }
+
+ 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_INVALID_PROCESS_ID;
+ }
+
+ const auto iter = entries.find(title_id);
+ if (iter != entries.end()) {
+ return ERR_INVALID_ACCESS;
+ }
+
+ entries.insert_or_assign(title_id, MapEntry{launch, std::move(control)});
+ return ResultSuccess;
+}
+
+ResultCode ARPManager::Unregister(u64 title_id) {
+ if (title_id == 0) {
+ return ERR_INVALID_PROCESS_ID;
+ }
+
+ const auto iter = entries.find(title_id);
+ if (iter == entries.end()) {
+ return ERR_NOT_REGISTERED;
+ }
+
+ entries.erase(iter);
+ return ResultSuccess;
+}
+
+void ARPManager::ResetAll() {
+ entries.clear();
+}
+
+} // namespace Service::Glue