From c6d7da88c7ab125279ea4ccad0e3e839632b2f7a Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Wed, 14 Jul 2021 00:52:17 -0400 Subject: service: Append service name prefix to common filenames --- src/core/hle/service/glue/arp.cpp | 2 +- src/core/hle/service/glue/glue_manager.cpp | 78 ++++++++++++++++++++++++++++++ src/core/hle/service/glue/glue_manager.h | 63 ++++++++++++++++++++++++ src/core/hle/service/glue/manager.cpp | 78 ------------------------------ src/core/hle/service/glue/manager.h | 63 ------------------------ 5 files changed, 142 insertions(+), 142 deletions(-) create mode 100644 src/core/hle/service/glue/glue_manager.cpp create mode 100644 src/core/hle/service/glue/glue_manager.h delete mode 100644 src/core/hle/service/glue/manager.cpp delete mode 100644 src/core/hle/service/glue/manager.h (limited to 'src/core/hle/service/glue') diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp index ca25df67e..5a3b54cc1 100644 --- a/src/core/hle/service/glue/arp.cpp +++ b/src/core/hle/service/glue/arp.cpp @@ -13,7 +13,7 @@ #include "core/hle/kernel/kernel.h" #include "core/hle/service/glue/arp.h" #include "core/hle/service/glue/errors.h" -#include "core/hle/service/glue/manager.h" +#include "core/hle/service/glue/glue_manager.h" #include "core/hle/service/service.h" namespace Service::Glue { 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 control; +}; + +ARPManager::ARPManager() = default; + +ARPManager::~ARPManager() = default; + +ResultVal 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(iter->second.launch); +} + +ResultVal> 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>(iter->second.control); +} + +ResultCode ARPManager::Register(u64 title_id, ApplicationLaunchProperty launch, + std::vector 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 diff --git a/src/core/hle/service/glue/glue_manager.h b/src/core/hle/service/glue/glue_manager.h new file mode 100644 index 000000000..a7f5ce3ee --- /dev/null +++ b/src/core/hle/service/glue/glue_manager.h @@ -0,0 +1,63 @@ +// Copyright 2019 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include +#include "common/common_types.h" +#include "core/file_sys/control_metadata.h" +#include "core/file_sys/romfs_factory.h" +#include "core/hle/result.h" + +namespace Service::Glue { + +struct ApplicationLaunchProperty { + u64 title_id; + u32 version; + FileSys::StorageId base_game_storage_id; + FileSys::StorageId update_storage_id; + u8 program_index; + u8 reserved; +}; +static_assert(sizeof(ApplicationLaunchProperty) == 0x10, + "ApplicationLaunchProperty has incorrect size."); + +// A class to manage state related to the arp:w and arp:r services, specifically the registration +// and unregistration of launch and control properties. +class ARPManager { +public: + ARPManager(); + ~ARPManager(); + + // Returns the ApplicationLaunchProperty corresponding to the provided title ID if it was + // previously registered, otherwise ERR_NOT_REGISTERED if it was never registered or + // ERR_INVALID_PROCESS_ID if the title ID is 0. + ResultVal GetLaunchProperty(u64 title_id) const; + + // Returns a vector of the raw bytes of NACP data (necessarily 0x4000 in size) corresponding to + // the provided title ID if it was previously registered, otherwise ERR_NOT_REGISTERED if it was + // never registered or ERR_INVALID_PROCESS_ID if the title ID is 0. + ResultVal> GetControlProperty(u64 title_id) const; + + // Adds a new entry to the internal database with the provided parameters, returning + // ERR_INVALID_ACCESS if attempting to re-register a title ID without an intermediate Unregister + // step, and ERR_INVALID_PROCESS_ID if the title ID is 0. + ResultCode Register(u64 title_id, ApplicationLaunchProperty launch, std::vector control); + + // Removes the registration for the provided title ID from the database, returning + // ERR_NOT_REGISTERED if it doesn't exist in the database and ERR_INVALID_PROCESS_ID if the + // title ID is 0. + ResultCode Unregister(u64 title_id); + + // Removes all entries from the database, always succeeds. Should only be used when resetting + // system state. + void ResetAll(); + +private: + struct MapEntry; + std::map entries; +}; + +} // namespace Service::Glue diff --git a/src/core/hle/service/glue/manager.cpp b/src/core/hle/service/glue/manager.cpp deleted file mode 100644 index 9b1754cf8..000000000 --- a/src/core/hle/service/glue/manager.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// 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 { - -struct ARPManager::MapEntry { - ApplicationLaunchProperty launch; - std::vector control; -}; - -ARPManager::ARPManager() = default; - -ARPManager::~ARPManager() = default; - -ResultVal 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(iter->second.launch); -} - -ResultVal> 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>(iter->second.control); -} - -ResultCode ARPManager::Register(u64 title_id, ApplicationLaunchProperty launch, - std::vector 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 diff --git a/src/core/hle/service/glue/manager.h b/src/core/hle/service/glue/manager.h deleted file mode 100644 index a7f5ce3ee..000000000 --- a/src/core/hle/service/glue/manager.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2019 yuzu emulator team -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#pragma once - -#include -#include -#include "common/common_types.h" -#include "core/file_sys/control_metadata.h" -#include "core/file_sys/romfs_factory.h" -#include "core/hle/result.h" - -namespace Service::Glue { - -struct ApplicationLaunchProperty { - u64 title_id; - u32 version; - FileSys::StorageId base_game_storage_id; - FileSys::StorageId update_storage_id; - u8 program_index; - u8 reserved; -}; -static_assert(sizeof(ApplicationLaunchProperty) == 0x10, - "ApplicationLaunchProperty has incorrect size."); - -// A class to manage state related to the arp:w and arp:r services, specifically the registration -// and unregistration of launch and control properties. -class ARPManager { -public: - ARPManager(); - ~ARPManager(); - - // Returns the ApplicationLaunchProperty corresponding to the provided title ID if it was - // previously registered, otherwise ERR_NOT_REGISTERED if it was never registered or - // ERR_INVALID_PROCESS_ID if the title ID is 0. - ResultVal GetLaunchProperty(u64 title_id) const; - - // Returns a vector of the raw bytes of NACP data (necessarily 0x4000 in size) corresponding to - // the provided title ID if it was previously registered, otherwise ERR_NOT_REGISTERED if it was - // never registered or ERR_INVALID_PROCESS_ID if the title ID is 0. - ResultVal> GetControlProperty(u64 title_id) const; - - // Adds a new entry to the internal database with the provided parameters, returning - // ERR_INVALID_ACCESS if attempting to re-register a title ID without an intermediate Unregister - // step, and ERR_INVALID_PROCESS_ID if the title ID is 0. - ResultCode Register(u64 title_id, ApplicationLaunchProperty launch, std::vector control); - - // Removes the registration for the provided title ID from the database, returning - // ERR_NOT_REGISTERED if it doesn't exist in the database and ERR_INVALID_PROCESS_ID if the - // title ID is 0. - ResultCode Unregister(u64 title_id); - - // Removes all entries from the database, always succeeds. Should only be used when resetting - // system state. - void ResetAll(); - -private: - struct MapEntry; - std::map entries; -}; - -} // namespace Service::Glue -- cgit v1.2.3