summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/ns/language.cpp (renamed from src/core/hle/service/ns/ns_language.cpp)71
-rw-r--r--src/core/hle/service/ns/language.h45
-rw-r--r--src/core/hle/service/ns/ns.cpp29
-rw-r--r--src/core/hle/service/ns/ns.h14
-rw-r--r--src/core/hle/service/ns/ns_language.h4
5 files changed, 118 insertions, 45 deletions
diff --git a/src/core/hle/service/ns/ns_language.cpp b/src/core/hle/service/ns/language.cpp
index fa95e75da..29c4a820c 100644
--- a/src/core/hle/service/ns/ns_language.cpp
+++ b/src/core/hle/service/ns/language.cpp
@@ -1,8 +1,9 @@
-// Copyright 2018 yuzu emulator team
+// Copyright 2019 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include "core/hle/service/ns/ns_language.h"
+#include "core/hle/service/ns/language.h"
+#include "core/hle/service/set/set.h"
namespace Service::NS {
@@ -277,7 +278,7 @@ constexpr ApplicationLanguagePriorityList priority_list_simplified_chinese = {{
}};
const ApplicationLanguagePriorityList* GetApplicationLanguagePriorityList(
- ApplicationLanguage lang) {
+ const ApplicationLanguage lang) {
switch (lang) {
case ApplicationLanguage::AmericanEnglish:
return &priority_list_american_english;
@@ -315,75 +316,75 @@ const ApplicationLanguagePriorityList* GetApplicationLanguagePriorityList(
}
std::optional<ApplicationLanguage> ConvertToApplicationLanguage(
- const Service::Set::LanguageCode language_code) {
+ const Set::LanguageCode language_code) {
switch (language_code) {
- case Service::Set::LanguageCode::EN_US:
+ case Set::LanguageCode::EN_US:
return ApplicationLanguage::AmericanEnglish;
- case Service::Set::LanguageCode::EN_GB:
+ case Set::LanguageCode::EN_GB:
return ApplicationLanguage::BritishEnglish;
- case Service::Set::LanguageCode::JA:
+ case Set::LanguageCode::JA:
return ApplicationLanguage::Japanese;
- case Service::Set::LanguageCode::FR:
+ case Set::LanguageCode::FR:
return ApplicationLanguage::French;
- case Service::Set::LanguageCode::DE:
+ case Set::LanguageCode::DE:
return ApplicationLanguage::German;
- case Service::Set::LanguageCode::ES_419:
+ case Set::LanguageCode::ES_419:
return ApplicationLanguage::LatinAmericanSpanish;
- case Service::Set::LanguageCode::ES:
+ case Set::LanguageCode::ES:
return ApplicationLanguage::Spanish;
- case Service::Set::LanguageCode::IT:
+ case Set::LanguageCode::IT:
return ApplicationLanguage::Italian;
- case Service::Set::LanguageCode::NL:
+ case Set::LanguageCode::NL:
return ApplicationLanguage::Dutch;
- case Service::Set::LanguageCode::FR_CA:
+ case Set::LanguageCode::FR_CA:
return ApplicationLanguage::CanadianFrench;
- case Service::Set::LanguageCode::PT:
+ case Set::LanguageCode::PT:
return ApplicationLanguage::Portuguese;
- case Service::Set::LanguageCode::RU:
+ case Set::LanguageCode::RU:
return ApplicationLanguage::Russian;
- case Service::Set::LanguageCode::KO:
+ case Set::LanguageCode::KO:
return ApplicationLanguage::Korean;
- case Service::Set::LanguageCode::ZH_HANT:
+ case Set::LanguageCode::ZH_HANT:
return ApplicationLanguage::TraditionalChinese;
- case Service::Set::LanguageCode::ZH_HANS:
+ case Set::LanguageCode::ZH_HANS:
return ApplicationLanguage::SimplifiedChinese;
default:
return std::nullopt;
}
}
-std::optional<Service::Set::LanguageCode> ConvertToLanguageCode(const ApplicationLanguage lang) {
+std::optional<Set::LanguageCode> ConvertToLanguageCode(const ApplicationLanguage lang) {
switch (lang) {
case ApplicationLanguage::AmericanEnglish:
- return Service::Set::LanguageCode::EN_US;
+ return Set::LanguageCode::EN_US;
case ApplicationLanguage::BritishEnglish:
- return Service::Set::LanguageCode::EN_GB;
+ return Set::LanguageCode::EN_GB;
case ApplicationLanguage::Japanese:
- return Service::Set::LanguageCode::JA;
+ return Set::LanguageCode::JA;
case ApplicationLanguage::French:
- return Service::Set::LanguageCode::FR;
+ return Set::LanguageCode::FR;
case ApplicationLanguage::German:
- return Service::Set::LanguageCode::DE;
+ return Set::LanguageCode::DE;
case ApplicationLanguage::LatinAmericanSpanish:
- return Service::Set::LanguageCode::ES_419;
+ return Set::LanguageCode::ES_419;
case ApplicationLanguage::Spanish:
- return Service::Set::LanguageCode::ES;
+ return Set::LanguageCode::ES;
case ApplicationLanguage::Italian:
- return Service::Set::LanguageCode::IT;
+ return Set::LanguageCode::IT;
case ApplicationLanguage::Dutch:
- return Service::Set::LanguageCode::NL;
+ return Set::LanguageCode::NL;
case ApplicationLanguage::CanadianFrench:
- return Service::Set::LanguageCode::FR_CA;
+ return Set::LanguageCode::FR_CA;
case ApplicationLanguage::Portuguese:
- return Service::Set::LanguageCode::PT;
+ return Set::LanguageCode::PT;
case ApplicationLanguage::Russian:
- return Service::Set::LanguageCode::RU;
+ return Set::LanguageCode::RU;
case ApplicationLanguage::Korean:
- return Service::Set::LanguageCode::KO;
+ return Set::LanguageCode::KO;
case ApplicationLanguage::TraditionalChinese:
- return Service::Set::LanguageCode::ZH_HANT;
+ return Set::LanguageCode::ZH_HANT;
case ApplicationLanguage::SimplifiedChinese:
- return Service::Set::LanguageCode::ZH_HANS;
+ return Set::LanguageCode::ZH_HANS;
default:
return std::nullopt;
}
diff --git a/src/core/hle/service/ns/language.h b/src/core/hle/service/ns/language.h
new file mode 100644
index 000000000..e9829f9d2
--- /dev/null
+++ b/src/core/hle/service/ns/language.h
@@ -0,0 +1,45 @@
+// Copyright 2019 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <optional>
+#include <string>
+#include "common/common_types.h"
+
+namespace Service::Set {
+enum class LanguageCode : u64;
+}
+
+namespace Service::NS {
+/// This is nn::ns::detail::ApplicationLanguage
+enum class ApplicationLanguage : u8 {
+ AmericanEnglish = 0,
+ BritishEnglish,
+ Japanese,
+ French,
+ German,
+ LatinAmericanSpanish,
+ Spanish,
+ Italian,
+ Dutch,
+ CanadianFrench,
+ Portuguese,
+ Russian,
+ Korean,
+ TraditionalChinese,
+ SimplifiedChinese,
+ Count
+};
+using ApplicationLanguagePriorityList =
+ const std::array<ApplicationLanguage, static_cast<std::size_t>(ApplicationLanguage::Count)>;
+
+constexpr u32 GetSupportedLanguageFlag(const ApplicationLanguage lang) {
+ return 1U << static_cast<u32>(lang);
+}
+
+const ApplicationLanguagePriorityList* GetApplicationLanguagePriorityList(ApplicationLanguage lang);
+std::optional<ApplicationLanguage> ConvertToApplicationLanguage(Set::LanguageCode language_code);
+std::optional<Set::LanguageCode> ConvertToLanguageCode(ApplicationLanguage lang);
+} // namespace Service::NS \ No newline at end of file
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp
index fa49b4293..e892b50f3 100644
--- a/src/core/hle/service/ns/ns.cpp
+++ b/src/core/hle/service/ns/ns.cpp
@@ -9,8 +9,9 @@
#include "core/hle/kernel/hle_ipc.h"
#include "core/hle/service/ns/errors.h"
#include "core/hle/service/ns/ns.h"
-#include "core/hle/service/ns/ns_language.h"
+#include "core/hle/service/ns/language.h"
#include "core/hle/service/ns/pl_u.h"
+#include "core/hle/service/set/set.h"
#include "core/settings.h"
namespace Service::NS {
@@ -25,6 +26,8 @@ IAccountProxyInterface::IAccountProxyInterface() : ServiceFramework{"IAccountPro
RegisterHandlers(functions);
}
+IAccountProxyInterface::~IAccountProxyInterface() = default;
+
IApplicationManagerInterface::IApplicationManagerInterface()
: ServiceFramework{"IApplicationManagerInterface"} {
// clang-format off
@@ -246,6 +249,8 @@ IApplicationManagerInterface::IApplicationManagerInterface()
RegisterHandlers(functions);
}
+IApplicationManagerInterface::~IApplicationManagerInterface() = default;
+
void IApplicationManagerInterface::GetApplicationControlData(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto flag = rp.PopRaw<u64>();
@@ -325,7 +330,7 @@ ResultVal<u8> IApplicationManagerInterface::GetApplicationDesiredLanguage(
// Get language code from settings
const auto language_code =
- Service::Set::GetLanguageCodeFromIndex(Settings::values.language_index);
+ Set::GetLanguageCodeFromIndex(Settings::values.language_index);
// Convert to application language, get priority list
const auto application_language = ConvertToApplicationLanguage(language_code);
@@ -342,7 +347,7 @@ ResultVal<u8> IApplicationManagerInterface::GetApplicationDesiredLanguage(
const auto supported_flag = GetSupportedLanguageFlag(lang);
if (supported_languages == 0 ||
(supported_languages & supported_flag) == supported_languages) {
- return ResultVal<u8>::WithCode(RESULT_SUCCESS, static_cast<u8>(lang));
+ return MakeResult(static_cast<u8>(lang));
}
}
@@ -373,7 +378,7 @@ ResultVal<u64> IApplicationManagerInterface::ConvertApplicationLanguageToLanguag
return ERR_APPLICATION_LANGUAGE_NOT_FOUND;
}
- return ResultVal<u64>::WithCode(RESULT_SUCCESS, static_cast<u64>(*language_code));
+ return MakeResult(static_cast<u64>(*language_code));
}
IApplicationVersionInterface::IApplicationVersionInterface()
@@ -395,6 +400,8 @@ IApplicationVersionInterface::IApplicationVersionInterface()
RegisterHandlers(functions);
}
+IApplicationVersionInterface::~IApplicationVersionInterface() = default;
+
IContentManagerInterface::IContentManagerInterface()
: ServiceFramework{"IContentManagerInterface"} {
// clang-format off
@@ -413,6 +420,8 @@ IContentManagerInterface::IContentManagerInterface()
RegisterHandlers(functions);
}
+IContentManagerInterface::~IContentManagerInterface() = default;
+
IDocumentInterface::IDocumentInterface() : ServiceFramework{"IDocumentInterface"} {
// clang-format off
static const FunctionInfo functions[] = {
@@ -425,6 +434,8 @@ IDocumentInterface::IDocumentInterface() : ServiceFramework{"IDocumentInterface"
RegisterHandlers(functions);
}
+IDocumentInterface::~IDocumentInterface() = default;
+
IDownloadTaskInterface::IDownloadTaskInterface() : ServiceFramework{"IDownloadTaskInterface"} {
// clang-format off
static const FunctionInfo functions[] = {
@@ -443,6 +454,8 @@ IDownloadTaskInterface::IDownloadTaskInterface() : ServiceFramework{"IDownloadTa
RegisterHandlers(functions);
}
+IDownloadTaskInterface::~IDownloadTaskInterface() = default;
+
IECommerceInterface::IECommerceInterface() : ServiceFramework{"IECommerceInterface"} {
// clang-format off
static const FunctionInfo functions[] = {
@@ -458,6 +471,8 @@ IECommerceInterface::IECommerceInterface() : ServiceFramework{"IECommerceInterfa
RegisterHandlers(functions);
}
+IECommerceInterface::~IECommerceInterface() = default;
+
IFactoryResetInterface::IFactoryResetInterface::IFactoryResetInterface()
: ServiceFramework{"IFactoryResetInterface"} {
// clang-format off
@@ -471,6 +486,8 @@ IFactoryResetInterface::IFactoryResetInterface::IFactoryResetInterface()
RegisterHandlers(functions);
}
+IFactoryResetInterface::~IFactoryResetInterface() = default;
+
NS::NS(const char* name) : ServiceFramework{name} {
// clang-format off
static const FunctionInfo functions[] = {
@@ -488,7 +505,9 @@ NS::NS(const char* name) : ServiceFramework{name} {
RegisterHandlers(functions);
}
-std::shared_ptr<IApplicationManagerInterface> NS::GetApplicationManagerInterface() {
+NS::~NS() = default;
+
+std::shared_ptr<IApplicationManagerInterface> NS::GetApplicationManagerInterface() const {
return GetInterface<IApplicationManagerInterface>();
}
diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h
index 155dd6831..0f4bab4cb 100644
--- a/src/core/hle/service/ns/ns.h
+++ b/src/core/hle/service/ns/ns.h
@@ -5,18 +5,19 @@
#pragma once
#include "core/hle/service/service.h"
-#include "core/hle/service/set/set.h"
namespace Service::NS {
class IAccountProxyInterface final : public ServiceFramework<IAccountProxyInterface> {
public:
explicit IAccountProxyInterface();
+ ~IAccountProxyInterface();
};
class IApplicationManagerInterface final : public ServiceFramework<IApplicationManagerInterface> {
public:
explicit IApplicationManagerInterface();
+ ~IApplicationManagerInterface();
ResultVal<u8> GetApplicationDesiredLanguage(u32 supported_languages);
ResultVal<u64> ConvertApplicationLanguageToLanguageCode(u8 application_language);
@@ -30,38 +31,45 @@ private:
class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> {
public:
explicit IApplicationVersionInterface();
+ ~IApplicationVersionInterface();
};
class IContentManagerInterface final : public ServiceFramework<IContentManagerInterface> {
public:
explicit IContentManagerInterface();
+ ~IContentManagerInterface();
};
class IDocumentInterface final : public ServiceFramework<IDocumentInterface> {
public:
explicit IDocumentInterface();
+ ~IDocumentInterface();
};
class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> {
public:
explicit IDownloadTaskInterface();
+ ~IDownloadTaskInterface();
};
class IECommerceInterface final : public ServiceFramework<IECommerceInterface> {
public:
explicit IECommerceInterface();
+ ~IECommerceInterface();
};
class IFactoryResetInterface final : public ServiceFramework<IFactoryResetInterface> {
public:
explicit IFactoryResetInterface();
+ ~IFactoryResetInterface();
};
class NS final : public ServiceFramework<NS> {
public:
explicit NS(const char* name);
+ ~NS();
- std::shared_ptr<IApplicationManagerInterface> GetApplicationManagerInterface();
+ std::shared_ptr<IApplicationManagerInterface> GetApplicationManagerInterface() const;
private:
template <typename T>
@@ -74,7 +82,7 @@ private:
}
template <typename T>
- std::shared_ptr<T> GetInterface() {
+ std::shared_ptr<T> GetInterface() const {
static_assert(std::is_base_of_v<Kernel::SessionRequestHandler, T>,
"Not a base of ServiceFrameworkBase");
diff --git a/src/core/hle/service/ns/ns_language.h b/src/core/hle/service/ns/ns_language.h
index 55d7b0bd2..59ac85a19 100644
--- a/src/core/hle/service/ns/ns_language.h
+++ b/src/core/hle/service/ns/ns_language.h
@@ -1,4 +1,4 @@
-// Copyright 2018 yuzu emulator team
+// Copyright 2019 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
@@ -32,7 +32,7 @@ using ApplicationLanguagePriorityList =
const std::array<ApplicationLanguage, static_cast<std::size_t>(ApplicationLanguage::Count)>;
constexpr u32 GetSupportedLanguageFlag(const ApplicationLanguage lang) {
- return 1u << static_cast<u32>(lang);
+ return 1U << static_cast<u32>(lang);
}
const ApplicationLanguagePriorityList* GetApplicationLanguagePriorityList(ApplicationLanguage lang);