diff options
author | Zach Hilman <zachhilman@gmail.com> | 2019-06-25 01:17:13 +0200 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2019-06-25 01:17:13 +0200 |
commit | 5f8d2a2044842a0d0674d178e7bb98be2ee65be2 (patch) | |
tree | 6b7e462a839240ca305a22d82c9196af4609979f /src/core/hle/service/glue/manager.cpp | |
parent | registered_cache: Add getter to determine source slot in content provider union (diff) | |
download | yuzu-5f8d2a2044842a0d0674d178e7bb98be2ee65be2.tar yuzu-5f8d2a2044842a0d0674d178e7bb98be2ee65be2.tar.gz yuzu-5f8d2a2044842a0d0674d178e7bb98be2ee65be2.tar.bz2 yuzu-5f8d2a2044842a0d0674d178e7bb98be2ee65be2.tar.lz yuzu-5f8d2a2044842a0d0674d178e7bb98be2ee65be2.tar.xz yuzu-5f8d2a2044842a0d0674d178e7bb98be2ee65be2.tar.zst yuzu-5f8d2a2044842a0d0674d178e7bb98be2ee65be2.zip |
Diffstat (limited to 'src/core/hle/service/glue/manager.cpp')
-rw-r--r-- | src/core/hle/service/glue/manager.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/core/hle/service/glue/manager.cpp b/src/core/hle/service/glue/manager.cpp new file mode 100644 index 000000000..0d5bb4d50 --- /dev/null +++ b/src/core/hle/service/glue/manager.cpp @@ -0,0 +1,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 |