diff options
| author | Morph <39850852+Morph1984@users.noreply.github.com> | 2021-07-14 00:52:17 -0400 |
|---|---|---|
| committer | Morph <39850852+Morph1984@users.noreply.github.com> | 2021-07-14 02:09:14 -0400 |
| commit | c6d7da88c7ab125279ea4ccad0e3e839632b2f7a (patch) | |
| tree | 8591def7815ce7cc9156d87e0d62567584db1a23 /src/core/hle/service/glue/glue_manager.cpp | |
| parent | 79824d7d1b69382571e5c05fe3e66485212d06f5 (diff) | |
service: Append service name prefix to common filenames
Diffstat (limited to 'src/core/hle/service/glue/glue_manager.cpp')
| -rw-r--r-- | src/core/hle/service/glue/glue_manager.cpp | 78 |
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 |
