summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/CMakeLists.txt3
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_32.cpp10
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_64.cpp6
-rw-r--r--src/core/core.cpp5
-rw-r--r--src/core/crypto/key_manager.cpp2
-rw-r--r--src/core/file_sys/registered_cache.cpp13
-rw-r--r--src/core/file_sys/system_archive/system_version.cpp48
-rw-r--r--src/core/file_sys/vfs_real.cpp7
-rw-r--r--src/core/frontend/input.h1
-rw-r--r--src/core/hle/api_version.h40
-rw-r--r--src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp37
-rw-r--r--src/core/hle/kernel/k_address_space_info.cpp35
-rw-r--r--src/core/hle/kernel/k_memory_layout.board.nintendo_nx.cpp5
-rw-r--r--src/core/hle/kernel/k_memory_layout.h27
-rw-r--r--src/core/hle/kernel/k_page_table.cpp5
-rw-r--r--src/core/hle/kernel/k_resource_limit.cpp1
-rw-r--r--src/core/hle/kernel/k_trace.h6
-rw-r--r--src/core/hle/kernel/kernel.cpp17
-rw-r--r--src/core/hle/service/audio/audout_u.cpp10
-rw-r--r--src/core/hle/service/bcat/backend/boxcat.cpp4
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp4
-rw-r--r--src/core/hle/service/hid/controllers/npad.h4
-rw-r--r--src/core/hle/service/mii/manager.h2
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp3
-rw-r--r--src/core/hle/service/service.cpp6
-rw-r--r--src/core/hle/service/spl/csrng.cpp2
-rw-r--r--src/core/hle/service/spl/module.cpp124
-rw-r--r--src/core/hle/service/spl/module.h13
-rw-r--r--src/core/hle/service/spl/spl.cpp84
-rw-r--r--src/core/hle/service/spl/spl_results.h31
-rw-r--r--src/core/hle/service/spl/spl_types.h232
-rw-r--r--src/core/hle/service/time/time_zone_content_manager.cpp2
32 files changed, 628 insertions, 161 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index efb851f5a..83b5b7676 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -139,6 +139,7 @@ add_library(core STATIC
frontend/input.h
hardware_interrupt_manager.cpp
hardware_interrupt_manager.h
+ hle/api_version.h
hle/ipc.h
hle/ipc_helpers.h
hle/kernel/board/nintendo/nx/k_system_control.cpp
@@ -550,6 +551,8 @@ add_library(core STATIC
hle/service/spl/module.h
hle/service/spl/spl.cpp
hle/service/spl/spl.h
+ hle/service/spl/spl_results.h
+ hle/service/spl/spl_types.h
hle/service/ssl/ssl.cpp
hle/service/ssl/ssl.h
hle/service/time/clock_types.h
diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp
index c8f6dc765..77a44f862 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp
@@ -8,6 +8,7 @@
#include <dynarmic/interface/A32/config.h>
#include <dynarmic/interface/A32/context.h>
#include "common/assert.h"
+#include "common/literals.h"
#include "common/logging/log.h"
#include "common/page_table.h"
#include "common/settings.h"
@@ -22,6 +23,8 @@
namespace Core {
+using namespace Common::Literals;
+
class DynarmicCallbacks32 : public Dynarmic::A32::UserCallbacks {
public:
explicit DynarmicCallbacks32(ARM_Dynarmic_32& parent_)
@@ -143,8 +146,8 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable*
config.wall_clock_cntpct = uses_wall_clock;
// Code cache size
- config.code_cache_size = 512 * 1024 * 1024;
- config.far_code_offset = 400 * 1024 * 1024;
+ config.code_cache_size = 512_MiB;
+ config.far_code_offset = 400_MiB;
// Safe optimizations
if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) {
@@ -186,6 +189,9 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable*
if (Settings::values.cpuopt_unsafe_reduce_fp_error.GetValue()) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_ReducedErrorFP;
}
+ if (Settings::values.cpuopt_unsafe_ignore_standard_fpcr.GetValue()) {
+ config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_IgnoreStandardFPCRValue;
+ }
if (Settings::values.cpuopt_unsafe_inaccurate_nan.GetValue()) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN;
}
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp
index ba524cd05..75332e348 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp
@@ -7,6 +7,7 @@
#include <dynarmic/interface/A64/a64.h>
#include <dynarmic/interface/A64/config.h>
#include "common/assert.h"
+#include "common/literals.h"
#include "common/logging/log.h"
#include "common/page_table.h"
#include "common/settings.h"
@@ -24,6 +25,7 @@
namespace Core {
using Vector = Dynarmic::A64::Vector;
+using namespace Common::Literals;
class DynarmicCallbacks64 : public Dynarmic::A64::UserCallbacks {
public:
@@ -184,8 +186,8 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable*
config.wall_clock_cntpct = uses_wall_clock;
// Code cache size
- config.code_cache_size = 512 * 1024 * 1024;
- config.far_code_offset = 400 * 1024 * 1024;
+ config.code_cache_size = 512_MiB;
+ config.far_code_offset = 400_MiB;
// Safe optimizations
if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) {
diff --git a/src/core/core.cpp b/src/core/core.cpp
index c5004b7b4..e6f1aa0e7 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <array>
+#include <atomic>
#include <memory>
#include <utility>
@@ -377,7 +378,7 @@ struct System::Impl {
std::unique_ptr<Core::DeviceMemory> device_memory;
Core::Memory::Memory memory;
CpuManager cpu_manager;
- bool is_powered_on = false;
+ std::atomic_bool is_powered_on{};
bool exit_lock = false;
Reporter reporter;
@@ -463,7 +464,7 @@ System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::st
}
bool System::IsPoweredOn() const {
- return impl->is_powered_on;
+ return impl->is_powered_on.load(std::memory_order::relaxed);
}
void System::PrepareReschedule() {
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp
index fb451a423..a98daed89 100644
--- a/src/core/crypto/key_manager.cpp
+++ b/src/core/crypto/key_manager.cpp
@@ -835,7 +835,7 @@ void KeyManager::SetKey(S128KeyType id, Key128 key, u64 field1, u64 field2) {
"key_area_key_ocean_{:02X}",
"key_area_key_system_{:02X}",
};
- WriteKeyToFile(category, fmt::format(kak_names.at(field2), field1), key);
+ WriteKeyToFile(category, fmt::format(fmt::runtime(kak_names.at(field2)), field1), key);
} else if (id == S128KeyType::Master) {
WriteKeyToFile(category, fmt::format("master_key_{:02X}", field1), key);
} else if (id == S128KeyType::Package1) {
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp
index 066c6789a..7a646b5f1 100644
--- a/src/core/file_sys/registered_cache.cpp
+++ b/src/core/file_sys/registered_cache.cpp
@@ -58,14 +58,17 @@ static bool FollowsNcaIdFormat(std::string_view name) {
static std::string GetRelativePathFromNcaID(const std::array<u8, 16>& nca_id, bool second_hex_upper,
bool within_two_digit, bool cnmt_suffix) {
- if (!within_two_digit)
- return fmt::format(cnmt_suffix ? "{}.cnmt.nca" : "/{}.nca",
- Common::HexToString(nca_id, second_hex_upper));
+ if (!within_two_digit) {
+ const auto format_str = fmt::runtime(cnmt_suffix ? "{}.cnmt.nca" : "/{}.nca");
+ return fmt::format(format_str, Common::HexToString(nca_id, second_hex_upper));
+ }
Core::Crypto::SHA256Hash hash{};
mbedtls_sha256_ret(nca_id.data(), nca_id.size(), hash.data(), 0);
- return fmt::format(cnmt_suffix ? "/000000{:02X}/{}.cnmt.nca" : "/000000{:02X}/{}.nca", hash[0],
- Common::HexToString(nca_id, second_hex_upper));
+
+ const auto format_str =
+ fmt::runtime(cnmt_suffix ? "/000000{:02X}/{}.cnmt.nca" : "/000000{:02X}/{}.nca");
+ return fmt::format(format_str, hash[0], Common::HexToString(nca_id, second_hex_upper));
}
static std::string GetCNMTName(TitleType type, u64 title_id) {
diff --git a/src/core/file_sys/system_archive/system_version.cpp b/src/core/file_sys/system_archive/system_version.cpp
index 54704105b..9b76d007e 100644
--- a/src/core/file_sys/system_archive/system_version.cpp
+++ b/src/core/file_sys/system_archive/system_version.cpp
@@ -4,47 +4,29 @@
#include "core/file_sys/system_archive/system_version.h"
#include "core/file_sys/vfs_vector.h"
+#include "core/hle/api_version.h"
namespace FileSys::SystemArchive {
-namespace SystemVersionData {
-
-// This section should reflect the best system version to describe yuzu's HLE api.
-// TODO(DarkLordZach): Update when HLE gets better.
-
-constexpr u8 VERSION_MAJOR = 11;
-constexpr u8 VERSION_MINOR = 0;
-constexpr u8 VERSION_MICRO = 1;
-
-constexpr u8 REVISION_MAJOR = 1;
-constexpr u8 REVISION_MINOR = 0;
-
-constexpr char PLATFORM_STRING[] = "NX";
-constexpr char VERSION_HASH[] = "69103fcb2004dace877094c2f8c29e6113be5dbf";
-constexpr char DISPLAY_VERSION[] = "11.0.1";
-constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 11.0.1-1.0";
-
-} // namespace SystemVersionData
-
std::string GetLongDisplayVersion() {
- return SystemVersionData::DISPLAY_TITLE;
+ return HLE::ApiVersion::DISPLAY_TITLE;
}
VirtualDir SystemVersion() {
VirtualFile file = std::make_shared<VectorVfsFile>(std::vector<u8>(0x100), "file");
- file->WriteObject(SystemVersionData::VERSION_MAJOR, 0);
- file->WriteObject(SystemVersionData::VERSION_MINOR, 1);
- file->WriteObject(SystemVersionData::VERSION_MICRO, 2);
- file->WriteObject(SystemVersionData::REVISION_MAJOR, 4);
- file->WriteObject(SystemVersionData::REVISION_MINOR, 5);
- file->WriteArray(SystemVersionData::PLATFORM_STRING,
- std::min<u64>(sizeof(SystemVersionData::PLATFORM_STRING), 0x20ULL), 0x8);
- file->WriteArray(SystemVersionData::VERSION_HASH,
- std::min<u64>(sizeof(SystemVersionData::VERSION_HASH), 0x40ULL), 0x28);
- file->WriteArray(SystemVersionData::DISPLAY_VERSION,
- std::min<u64>(sizeof(SystemVersionData::DISPLAY_VERSION), 0x18ULL), 0x68);
- file->WriteArray(SystemVersionData::DISPLAY_TITLE,
- std::min<u64>(sizeof(SystemVersionData::DISPLAY_TITLE), 0x80ULL), 0x80);
+ file->WriteObject(HLE::ApiVersion::HOS_VERSION_MAJOR, 0);
+ file->WriteObject(HLE::ApiVersion::HOS_VERSION_MINOR, 1);
+ file->WriteObject(HLE::ApiVersion::HOS_VERSION_MICRO, 2);
+ file->WriteObject(HLE::ApiVersion::SDK_REVISION_MAJOR, 4);
+ file->WriteObject(HLE::ApiVersion::SDK_REVISION_MINOR, 5);
+ file->WriteArray(HLE::ApiVersion::PLATFORM_STRING,
+ std::min<u64>(sizeof(HLE::ApiVersion::PLATFORM_STRING), 0x20ULL), 0x8);
+ file->WriteArray(HLE::ApiVersion::VERSION_HASH,
+ std::min<u64>(sizeof(HLE::ApiVersion::VERSION_HASH), 0x40ULL), 0x28);
+ file->WriteArray(HLE::ApiVersion::DISPLAY_VERSION,
+ std::min<u64>(sizeof(HLE::ApiVersion::DISPLAY_VERSION), 0x18ULL), 0x68);
+ file->WriteArray(HLE::ApiVersion::DISPLAY_TITLE,
+ std::min<u64>(sizeof(HLE::ApiVersion::DISPLAY_TITLE), 0x80ULL), 0x80);
return std::make_shared<VectorVfsDirectory>(std::vector<VirtualFile>{file},
std::vector<VirtualDir>{}, "data");
}
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp
index d0b8fd046..3dad54f49 100644
--- a/src/core/file_sys/vfs_real.cpp
+++ b/src/core/file_sys/vfs_real.cpp
@@ -24,17 +24,12 @@ constexpr FS::FileAccessMode ModeFlagsToFileAccessMode(Mode mode) {
case Mode::Read:
return FS::FileAccessMode::Read;
case Mode::Write:
- return FS::FileAccessMode::Write;
case Mode::ReadWrite:
- return FS::FileAccessMode::ReadWrite;
case Mode::Append:
- return FS::FileAccessMode::Append;
case Mode::ReadAppend:
- return FS::FileAccessMode::ReadAppend;
case Mode::WriteAppend:
- return FS::FileAccessMode::Append;
case Mode::All:
- return FS::FileAccessMode::ReadAppend;
+ return FS::FileAccessMode::ReadWrite;
default:
return {};
}
diff --git a/src/core/frontend/input.h b/src/core/frontend/input.h
index 7a047803e..f1747c5b2 100644
--- a/src/core/frontend/input.h
+++ b/src/core/frontend/input.h
@@ -4,6 +4,7 @@
#pragma once
+#include <functional>
#include <memory>
#include <string>
#include <tuple>
diff --git a/src/core/hle/api_version.h b/src/core/hle/api_version.h
new file mode 100644
index 000000000..5e10a7ad9
--- /dev/null
+++ b/src/core/hle/api_version.h
@@ -0,0 +1,40 @@
+// Copyright 2021 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "common/common_types.h"
+
+// This file contains yuzu's HLE API version constants.
+
+namespace HLE::ApiVersion {
+
+// Horizon OS version constants.
+
+constexpr u8 HOS_VERSION_MAJOR = 11;
+constexpr u8 HOS_VERSION_MINOR = 0;
+constexpr u8 HOS_VERSION_MICRO = 1;
+
+// NintendoSDK version constants.
+
+constexpr u8 SDK_REVISION_MAJOR = 1;
+constexpr u8 SDK_REVISION_MINOR = 0;
+
+constexpr char PLATFORM_STRING[] = "NX";
+constexpr char VERSION_HASH[] = "69103fcb2004dace877094c2f8c29e6113be5dbf";
+constexpr char DISPLAY_VERSION[] = "11.0.1";
+constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 11.0.1-1.0";
+
+// Atmosphere version constants.
+
+constexpr u8 ATMOSPHERE_RELEASE_VERSION_MAJOR = 0;
+constexpr u8 ATMOSPHERE_RELEASE_VERSION_MINOR = 19;
+constexpr u8 ATMOSPHERE_RELEASE_VERSION_MICRO = 4;
+
+constexpr u32 GetTargetFirmware() {
+ return u32{HOS_VERSION_MAJOR} << 24 | u32{HOS_VERSION_MINOR} << 16 |
+ u32{HOS_VERSION_MICRO} << 8 | 0U;
+}
+
+} // namespace HLE::ApiVersion
diff --git a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp
index 86472b5ce..6f335c251 100644
--- a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp
+++ b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp
@@ -4,7 +4,8 @@
#include <random>
-#include "common/common_sizes.h"
+#include "common/literals.h"
+
#include "core/hle/kernel/board/nintendo/nx/k_system_control.h"
#include "core/hle/kernel/board/nintendo/nx/secure_monitor.h"
#include "core/hle/kernel/k_trace.h"
@@ -25,6 +26,8 @@ constexpr const std::size_t RequiredNonSecureSystemMemorySize =
namespace {
+using namespace Common::Literals;
+
u32 GetMemoryModeForInit() {
return 0x01;
}
@@ -57,11 +60,11 @@ size_t KSystemControl::Init::GetIntendedMemorySize() {
switch (GetMemorySizeForInit()) {
case Smc::MemorySize_4GB:
default: // All invalid modes should go to 4GB.
- return Common::Size_4_GB;
+ return 4_GiB;
case Smc::MemorySize_6GB:
- return Common::Size_6_GB;
+ return 6_GiB;
case Smc::MemorySize_8GB:
- return Common::Size_8_GB;
+ return 8_GiB;
}
}
@@ -79,17 +82,17 @@ std::size_t KSystemControl::Init::GetApplicationPoolSize() {
switch (GetMemoryArrangeForInit()) {
case Smc::MemoryArrangement_4GB:
default:
- return Common::Size_3285_MB;
+ return 3285_MiB;
case Smc::MemoryArrangement_4GBForAppletDev:
- return Common::Size_2048_MB;
+ return 2048_MiB;
case Smc::MemoryArrangement_4GBForSystemDev:
- return Common::Size_3285_MB;
+ return 3285_MiB;
case Smc::MemoryArrangement_6GB:
- return Common::Size_4916_MB;
+ return 4916_MiB;
case Smc::MemoryArrangement_6GBForAppletDev:
- return Common::Size_3285_MB;
+ return 3285_MiB;
case Smc::MemoryArrangement_8GB:
- return Common::Size_4916_MB;
+ return 4916_MiB;
}
}();
@@ -103,22 +106,22 @@ size_t KSystemControl::Init::GetAppletPoolSize() {
switch (GetMemoryArrangeForInit()) {
case Smc::MemoryArrangement_4GB:
default:
- return Common::Size_507_MB;
+ return 507_MiB;
case Smc::MemoryArrangement_4GBForAppletDev:
- return Common::Size_1554_MB;
+ return 1554_MiB;
case Smc::MemoryArrangement_4GBForSystemDev:
- return Common::Size_448_MB;
+ return 448_MiB;
case Smc::MemoryArrangement_6GB:
- return Common::Size_562_MB;
+ return 562_MiB;
case Smc::MemoryArrangement_6GBForAppletDev:
- return Common::Size_2193_MB;
+ return 2193_MiB;
case Smc::MemoryArrangement_8GB:
- return Common::Size_2193_MB;
+ return 2193_MiB;
}
}();
// Return (possibly) adjusted size.
- constexpr size_t ExtraSystemMemoryForAtmosphere = Common::Size_33_MB;
+ constexpr size_t ExtraSystemMemoryForAtmosphere = 33_MiB;
return base_pool_size - ExtraSystemMemoryForAtmosphere - KTraceBufferSize;
}
diff --git a/src/core/hle/kernel/k_address_space_info.cpp b/src/core/hle/kernel/k_address_space_info.cpp
index c7549f7a2..ca29edc88 100644
--- a/src/core/hle/kernel/k_address_space_info.cpp
+++ b/src/core/hle/kernel/k_address_space_info.cpp
@@ -5,34 +5,37 @@
#include <array>
#include "common/assert.h"
-#include "common/common_sizes.h"
+#include "common/literals.h"
#include "core/hle/kernel/k_address_space_info.h"
namespace Kernel {
namespace {
+using namespace Common::Literals;
+
+constexpr u64 Size_Invalid = UINT64_MAX;
+
// clang-format off
constexpr std::array<KAddressSpaceInfo, 13> AddressSpaceInfos{{
- { .bit_width = 32, .address = Common::Size_2_MB , .size = Common::Size_1_GB - Common::Size_2_MB , .type = KAddressSpaceInfo::Type::MapSmall, },
- { .bit_width = 32, .address = Common::Size_1_GB , .size = Common::Size_4_GB - Common::Size_1_GB , .type = KAddressSpaceInfo::Type::MapLarge, },
- { .bit_width = 32, .address = Common::Size_Invalid, .size = Common::Size_1_GB , .type = KAddressSpaceInfo::Type::Alias, },
- { .bit_width = 32, .address = Common::Size_Invalid, .size = Common::Size_1_GB , .type = KAddressSpaceInfo::Type::Heap, },
- { .bit_width = 36, .address = Common::Size_128_MB , .size = Common::Size_2_GB - Common::Size_128_MB, .type = KAddressSpaceInfo::Type::MapSmall, },
- { .bit_width = 36, .address = Common::Size_2_GB , .size = Common::Size_64_GB - Common::Size_2_GB , .type = KAddressSpaceInfo::Type::MapLarge, },
- { .bit_width = 36, .address = Common::Size_Invalid, .size = Common::Size_6_GB , .type = KAddressSpaceInfo::Type::Heap, },
- { .bit_width = 36, .address = Common::Size_Invalid, .size = Common::Size_6_GB , .type = KAddressSpaceInfo::Type::Alias, },
- { .bit_width = 39, .address = Common::Size_128_MB , .size = Common::Size_512_GB - Common::Size_128_MB, .type = KAddressSpaceInfo::Type::Map39Bit, },
- { .bit_width = 39, .address = Common::Size_Invalid, .size = Common::Size_64_GB , .type = KAddressSpaceInfo::Type::MapSmall },
- { .bit_width = 39, .address = Common::Size_Invalid, .size = Common::Size_6_GB , .type = KAddressSpaceInfo::Type::Heap, },
- { .bit_width = 39, .address = Common::Size_Invalid, .size = Common::Size_64_GB , .type = KAddressSpaceInfo::Type::Alias, },
- { .bit_width = 39, .address = Common::Size_Invalid, .size = Common::Size_2_GB , .type = KAddressSpaceInfo::Type::Stack, },
+ { .bit_width = 32, .address = 2_MiB , .size = 1_GiB - 2_MiB , .type = KAddressSpaceInfo::Type::MapSmall, },
+ { .bit_width = 32, .address = 1_GiB , .size = 4_GiB - 1_GiB , .type = KAddressSpaceInfo::Type::MapLarge, },
+ { .bit_width = 32, .address = Size_Invalid, .size = 1_GiB , .type = KAddressSpaceInfo::Type::Alias, },
+ { .bit_width = 32, .address = Size_Invalid, .size = 1_GiB , .type = KAddressSpaceInfo::Type::Heap, },
+ { .bit_width = 36, .address = 128_MiB , .size = 2_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::MapSmall, },
+ { .bit_width = 36, .address = 2_GiB , .size = 64_GiB - 2_GiB , .type = KAddressSpaceInfo::Type::MapLarge, },
+ { .bit_width = 36, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Heap, },
+ { .bit_width = 36, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Alias, },
+ { .bit_width = 39, .address = 128_MiB , .size = 512_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::Map39Bit, },
+ { .bit_width = 39, .address = Size_Invalid, .size = 64_GiB , .type = KAddressSpaceInfo::Type::MapSmall },
+ { .bit_width = 39, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Heap, },
+ { .bit_width = 39, .address = Size_Invalid, .size = 64_GiB , .type = KAddressSpaceInfo::Type::Alias, },
+ { .bit_width = 39, .address = Size_Invalid, .size = 2_GiB , .type = KAddressSpaceInfo::Type::Stack, },
}};
// clang-format on
constexpr bool IsAllowedIndexForAddress(std::size_t index) {
- return index < AddressSpaceInfos.size() &&
- AddressSpaceInfos[index].address != Common::Size_Invalid;
+ return index < AddressSpaceInfos.size() && AddressSpaceInfos[index].address != Size_Invalid;
}
using IndexArray =
diff --git a/src/core/hle/kernel/k_memory_layout.board.nintendo_nx.cpp b/src/core/hle/kernel/k_memory_layout.board.nintendo_nx.cpp
index a78551291..af652af58 100644
--- a/src/core/hle/kernel/k_memory_layout.board.nintendo_nx.cpp
+++ b/src/core/hle/kernel/k_memory_layout.board.nintendo_nx.cpp
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include "common/alignment.h"
+#include "common/literals.h"
#include "core/hle/kernel/k_memory_layout.h"
#include "core/hle/kernel/k_memory_manager.h"
#include "core/hle/kernel/k_system_control.h"
@@ -12,8 +13,10 @@ namespace Kernel {
namespace {
+using namespace Common::Literals;
+
constexpr size_t CarveoutAlignment = 0x20000;
-constexpr size_t CarveoutSizeMax = (512ULL * 1024 * 1024) - CarveoutAlignment;
+constexpr size_t CarveoutSizeMax = (512_MiB) - CarveoutAlignment;
bool SetupPowerManagementControllerMemoryRegion(KMemoryLayout& memory_layout) {
// Above firmware 2.0.0, the PMC is not mappable.
diff --git a/src/core/hle/kernel/k_memory_layout.h b/src/core/hle/kernel/k_memory_layout.h
index 288642d9a..57ff538cc 100644
--- a/src/core/hle/kernel/k_memory_layout.h
+++ b/src/core/hle/kernel/k_memory_layout.h
@@ -7,8 +7,7 @@
#include <utility>
#include "common/alignment.h"
-#include "common/common_sizes.h"
-#include "common/common_types.h"
+#include "common/literals.h"
#include "core/device_memory.h"
#include "core/hle/kernel/k_memory_region.h"
#include "core/hle/kernel/k_memory_region_type.h"
@@ -16,20 +15,22 @@
namespace Kernel {
-constexpr std::size_t L1BlockSize = Common::Size_1_GB;
-constexpr std::size_t L2BlockSize = Common::Size_2_MB;
+using namespace Common::Literals;
+
+constexpr std::size_t L1BlockSize = 1_GiB;
+constexpr std::size_t L2BlockSize = 2_MiB;
constexpr std::size_t GetMaximumOverheadSize(std::size_t size) {
return (Common::DivideUp(size, L1BlockSize) + Common::DivideUp(size, L2BlockSize)) * PageSize;
}
-constexpr std::size_t MainMemorySize = Common::Size_4_GB;
-constexpr std::size_t MainMemorySizeMax = Common::Size_8_GB;
+constexpr std::size_t MainMemorySize = 4_GiB;
+constexpr std::size_t MainMemorySizeMax = 8_GiB;
-constexpr std::size_t ReservedEarlyDramSize = 0x60000;
+constexpr std::size_t ReservedEarlyDramSize = 384_KiB;
constexpr std::size_t DramPhysicalAddress = 0x80000000;
-constexpr std::size_t KernelAslrAlignment = Common::Size_2_MB;
+constexpr std::size_t KernelAslrAlignment = 2_MiB;
constexpr std::size_t KernelVirtualAddressSpaceWidth = 1ULL << 39;
constexpr std::size_t KernelPhysicalAddressSpaceWidth = 1ULL << 48;
@@ -40,7 +41,7 @@ constexpr std::size_t KernelVirtualAddressSpaceLast = KernelVirtualAddressSpaceE
constexpr std::size_t KernelVirtualAddressSpaceSize =
KernelVirtualAddressSpaceEnd - KernelVirtualAddressSpaceBase;
constexpr std::size_t KernelVirtualAddressCodeBase = KernelVirtualAddressSpaceBase;
-constexpr std::size_t KernelVirtualAddressCodeSize = 0x62000;
+constexpr std::size_t KernelVirtualAddressCodeSize = 392_KiB;
constexpr std::size_t KernelVirtualAddressCodeEnd =
KernelVirtualAddressCodeBase + KernelVirtualAddressCodeSize;
@@ -53,14 +54,14 @@ constexpr std::size_t KernelPhysicalAddressSpaceSize =
constexpr std::size_t KernelPhysicalAddressCodeBase = DramPhysicalAddress + ReservedEarlyDramSize;
constexpr std::size_t KernelPageTableHeapSize = GetMaximumOverheadSize(MainMemorySizeMax);
-constexpr std::size_t KernelInitialPageHeapSize = Common::Size_128_KB;
+constexpr std::size_t KernelInitialPageHeapSize = 128_KiB;
-constexpr std::size_t KernelSlabHeapDataSize = Common::Size_5_MB;
-constexpr std::size_t KernelSlabHeapGapsSize = Common::Size_2_MB - Common::Size_64_KB;
+constexpr std::size_t KernelSlabHeapDataSize = 5_MiB;
+constexpr std::size_t KernelSlabHeapGapsSize = 2_MiB - 64_KiB;
constexpr std::size_t KernelSlabHeapSize = KernelSlabHeapDataSize + KernelSlabHeapGapsSize;
// NOTE: This is calculated from KThread slab counts, assuming KThread size <= 0x860.
-constexpr std::size_t KernelSlabHeapAdditionalSize = 0x68000ULL;
+constexpr std::size_t KernelSlabHeapAdditionalSize = 416_KiB;
constexpr std::size_t KernelResourceSize =
KernelPageTableHeapSize + KernelInitialPageHeapSize + KernelSlabHeapSize;
diff --git a/src/core/hle/kernel/k_page_table.cpp b/src/core/hle/kernel/k_page_table.cpp
index 66d260635..701268545 100644
--- a/src/core/hle/kernel/k_page_table.cpp
+++ b/src/core/hle/kernel/k_page_table.cpp
@@ -4,6 +4,7 @@
#include "common/alignment.h"
#include "common/assert.h"
+#include "common/literals.h"
#include "common/scope_exit.h"
#include "core/core.h"
#include "core/hle/kernel/k_address_space_info.h"
@@ -23,6 +24,8 @@ namespace Kernel {
namespace {
+using namespace Common::Literals;
+
constexpr std::size_t GetAddressSpaceWidthFromType(FileSys::ProgramAddressSpaceType as_type) {
switch (as_type) {
case FileSys::ProgramAddressSpaceType::Is32Bit:
@@ -89,7 +92,7 @@ ResultCode KPageTable::InitializeForProcess(FileSys::ProgramAddressSpaceType as_
}
// Set code regions and determine remaining
- constexpr std::size_t RegionAlignment{2 * 1024 * 1024};
+ constexpr std::size_t RegionAlignment{2_MiB};
VAddr process_code_start{};
VAddr process_code_end{};
std::size_t stack_region_size{};
diff --git a/src/core/hle/kernel/k_resource_limit.cpp b/src/core/hle/kernel/k_resource_limit.cpp
index da88f35bc..0c4bba66b 100644
--- a/src/core/hle/kernel/k_resource_limit.cpp
+++ b/src/core/hle/kernel/k_resource_limit.cpp
@@ -79,6 +79,7 @@ ResultCode KResourceLimit::SetLimitValue(LimitableResource which, s64 value) {
R_UNLESS(current_values[index] <= value, ResultInvalidState);
limit_values[index] = value;
+ peak_values[index] = current_values[index];
return ResultSuccess;
}
diff --git a/src/core/hle/kernel/k_trace.h b/src/core/hle/kernel/k_trace.h
index 91ebf9ab2..79391bccb 100644
--- a/src/core/hle/kernel/k_trace.h
+++ b/src/core/hle/kernel/k_trace.h
@@ -4,9 +4,13 @@
#pragma once
+#include "common/common_funcs.h"
+
namespace Kernel {
+using namespace Common::Literals;
+
constexpr bool IsKTraceEnabled = false;
-constexpr std::size_t KTraceBufferSize = IsKTraceEnabled ? 16 * 1024 * 1024 : 0;
+constexpr std::size_t KTraceBufferSize = IsKTraceEnabled ? 16_MiB : 0;
} // namespace Kernel
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 2ceeaeb5f..64bd0c494 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -12,7 +12,6 @@
#include <utility>
#include "common/assert.h"
-#include "common/common_sizes.h"
#include "common/logging/log.h"
#include "common/microprofile.h"
#include "common/thread.h"
@@ -180,7 +179,7 @@ struct KernelCore::Impl {
system_resource_limit->Reserve(LimitableResource::PhysicalMemory, kernel_size);
// Reserve secure applet memory, introduced in firmware 5.0.0
- constexpr u64 secure_applet_memory_size{Common::Size_4_MB};
+ constexpr u64 secure_applet_memory_size{4_MiB};
ASSERT(system_resource_limit->Reserve(LimitableResource::PhysicalMemory,
secure_applet_memory_size));
@@ -320,8 +319,8 @@ struct KernelCore::Impl {
const VAddr code_end_virt_addr = KernelVirtualAddressCodeEnd;
// Setup the containing kernel region.
- constexpr size_t KernelRegionSize = Common::Size_1_GB;
- constexpr size_t KernelRegionAlign = Common::Size_1_GB;
+ constexpr size_t KernelRegionSize = 1_GiB;
+ constexpr size_t KernelRegionAlign = 1_GiB;
constexpr VAddr kernel_region_start =
Common::AlignDown(code_start_virt_addr, KernelRegionAlign);
size_t kernel_region_size = KernelRegionSize;
@@ -368,7 +367,7 @@ struct KernelCore::Impl {
// Decide on the actual size for the misc region.
constexpr size_t MiscRegionAlign = KernelAslrAlignment;
- constexpr size_t MiscRegionMinimumSize = Common::Size_32_MB;
+ constexpr size_t MiscRegionMinimumSize = 32_MiB;
const size_t misc_region_size = Common::AlignUp(
std::max(misc_region_needed_size, MiscRegionMinimumSize), MiscRegionAlign);
ASSERT(misc_region_size > 0);
@@ -381,7 +380,7 @@ struct KernelCore::Impl {
misc_region_start, misc_region_size, KMemoryRegionType_KernelMisc));
// Setup the stack region.
- constexpr size_t StackRegionSize = Common::Size_14_MB;
+ constexpr size_t StackRegionSize = 14_MiB;
constexpr size_t StackRegionAlign = KernelAslrAlignment;
const VAddr stack_region_start =
memory_layout.GetVirtualMemoryRegionTree().GetRandomAlignedRegion(
@@ -414,7 +413,7 @@ struct KernelCore::Impl {
slab_region_start, slab_region_size, KMemoryRegionType_KernelSlab));
// Setup the temp region.
- constexpr size_t TempRegionSize = Common::Size_128_MB;
+ constexpr size_t TempRegionSize = 128_MiB;
constexpr size_t TempRegionAlign = KernelAslrAlignment;
const VAddr temp_region_start =
memory_layout.GetVirtualMemoryRegionTree().GetRandomAlignedRegion(
@@ -470,7 +469,7 @@ struct KernelCore::Impl {
// Determine size available for kernel page table heaps, requiring > 8 MB.
const PAddr resource_end_phys_addr = slab_start_phys_addr + resource_region_size;
const size_t page_table_heap_size = resource_end_phys_addr - slab_end_phys_addr;
- ASSERT(page_table_heap_size / Common::Size_4_MB > 2);
+ ASSERT(page_table_heap_size / 4_MiB > 2);
// Insert a physical region for the kernel page table heap region
ASSERT(memory_layout.GetPhysicalMemoryRegionTree().Insert(
@@ -495,7 +494,7 @@ struct KernelCore::Impl {
ASSERT(linear_extents.GetEndAddress() != 0);
// Setup the linear mapping region.
- constexpr size_t LinearRegionAlign = Common::Size_1_GB;
+ constexpr size_t LinearRegionAlign = 1_GiB;
const PAddr aligned_linear_phys_start =
Common::AlignDown(linear_extents.GetAddress(), LinearRegionAlign);
const size_t linear_region_size =
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp
index 804c6b10c..92d4510b1 100644
--- a/src/core/hle/service/audio/audout_u.cpp
+++ b/src/core/hle/service/audio/audout_u.cpp
@@ -58,7 +58,7 @@ public:
{7, &IAudioOut::AppendAudioOutBufferImpl, "AppendAudioOutBufferAuto"},
{8, &IAudioOut::GetReleasedAudioOutBufferImpl, "GetReleasedAudioOutBufferAuto"},
{9, &IAudioOut::GetAudioOutBufferCount, "GetAudioOutBufferCount"},
- {10, nullptr, "GetAudioOutPlayedSampleCount"},
+ {10, &IAudioOut::GetAudioOutPlayedSampleCount, "GetAudioOutPlayedSampleCount"},
{11, &IAudioOut::FlushAudioOutBuffers, "FlushAudioOutBuffers"},
{12, &IAudioOut::SetAudioOutVolume, "SetAudioOutVolume"},
{13, &IAudioOut::GetAudioOutVolume, "GetAudioOutVolume"},
@@ -186,6 +186,14 @@ private:
rb.Push(static_cast<u32>(stream->GetQueueSize()));
}
+ void GetAudioOutPlayedSampleCount(Kernel::HLERequestContext& ctx) {
+ LOG_DEBUG(Service_Audio, "called");
+
+ IPC::ResponseBuilder rb{ctx, 4};
+ rb.Push(ResultSuccess);
+ rb.Push(stream->GetPlayedSampleCount());
+ }
+
void FlushAudioOutBuffers(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_Audio, "called");
diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp
index a2844ea8c..dc15cf58b 100644
--- a/src/core/hle/service/bcat/backend/boxcat.cpp
+++ b/src/core/hle/service/bcat/backend/boxcat.cpp
@@ -313,7 +313,7 @@ void SynchronizeInternal(AM::Applets::AppletManager& applet_manager, DirectoryGe
LOG_ERROR(Service_BCAT, "Boxcat synchronization failed with error '{}'!", res);
if (res == DownloadResult::NoMatchBuildId || res == DownloadResult::NoMatchTitleId) {
- void(Common::FS::RemoveFile(zip_path));
+ Common::FS::RemoveFile(zip_path);
}
HandleDownloadDisplayResult(applet_manager, res);
@@ -445,7 +445,7 @@ std::optional<std::vector<u8>> Boxcat::GetLaunchParameter(TitleIDVersion title)
LOG_ERROR(Service_BCAT, "Boxcat synchronization failed with error '{}'!", res);
if (res == DownloadResult::NoMatchBuildId || res == DownloadResult::NoMatchTitleId) {
- void(Common::FS::RemoveFile(bin_file_path));
+ Common::FS::RemoveFile(bin_file_path);
}
HandleDownloadDisplayResult(applet_manager, res);
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 7acad3798..1eb02aee2 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -314,6 +314,8 @@ void Controller_NPad::OnInit() {
void Controller_NPad::OnLoadInputDevices() {
const auto& players = Settings::values.players.GetValue();
+
+ std::lock_guard lock{mutex};
for (std::size_t i = 0; i < players.size(); ++i) {
std::transform(players[i].buttons.begin() + Settings::NativeButton::BUTTON_HID_BEGIN,
players[i].buttons.begin() + Settings::NativeButton::BUTTON_HID_END,
@@ -348,6 +350,8 @@ void Controller_NPad::OnRelease() {
}
void Controller_NPad::RequestPadStateUpdate(u32 npad_id) {
+ std::lock_guard lock{mutex};
+
const auto controller_idx = NPadIdToIndex(npad_id);
const auto controller_type = connected_controllers[controller_idx].type;
if (!connected_controllers[controller_idx].is_connected) {
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index c050c9a44..1409d82a2 100644
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -6,6 +6,8 @@
#include <array>
#include <atomic>
+#include <mutex>
+
#include "common/bit_field.h"
#include "common/common_types.h"
#include "common/quaternion.h"
@@ -563,6 +565,8 @@ private:
using MotionArray = std::array<
std::array<std::unique_ptr<Input::MotionDevice>, Settings::NativeMotion::NUM_MOTIONS_HID>,
10>;
+
+ std::mutex mutex;
ButtonArray buttons;
StickArray sticks;
VibrationArray vibrations;
diff --git a/src/core/hle/service/mii/manager.h b/src/core/hle/service/mii/manager.h
index ec7efa5f7..8e048fc56 100644
--- a/src/core/hle/service/mii/manager.h
+++ b/src/core/hle/service/mii/manager.h
@@ -4,6 +4,8 @@
#pragma once
+#include <array>
+#include <vector>
#include "common/bit_field.h"
#include "common/common_funcs.h"
#include "common/uuid.h"
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index d1dbc659b..1d810562f 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -307,6 +307,9 @@ void NVFlinger::Compose() {
}
s64 NVFlinger::GetNextTicks() const {
+ if (Settings::values.disable_fps_limit.GetValue()) {
+ return 0;
+ }
constexpr s64 max_hertz = 120LL;
return (1000000000 * (1LL << swap_interval)) / max_hertz;
}
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 4e1541630..663b83cd3 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -149,10 +149,10 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(Kernel::HLERequestContext
std::string function_name = info == nullptr ? fmt::format("{}", ctx.GetCommand()) : info->name;
fmt::memory_buffer buf;
- fmt::format_to(buf, "function '{}': port='{}' cmd_buf={{[0]=0x{:X}", function_name,
- service_name, cmd_buf[0]);
+ fmt::format_to(std::back_inserter(buf), "function '{}': port='{}' cmd_buf={{[0]=0x{:X}",
+ function_name, service_name, cmd_buf[0]);
for (int i = 1; i <= 8; ++i) {
- fmt::format_to(buf, ", [{}]=0x{:X}", i, cmd_buf[i]);
+ fmt::format_to(std::back_inserter(buf), ", [{}]=0x{:X}", i, cmd_buf[i]);
}
buf.push_back('}');
diff --git a/src/core/hle/service/spl/csrng.cpp b/src/core/hle/service/spl/csrng.cpp
index 1beca417c..9c7f89475 100644
--- a/src/core/hle/service/spl/csrng.cpp
+++ b/src/core/hle/service/spl/csrng.cpp
@@ -9,7 +9,7 @@ namespace Service::SPL {
CSRNG::CSRNG(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "csrng") {
static const FunctionInfo functions[] = {
- {0, &CSRNG::GetRandomBytes, "GetRandomBytes"},
+ {0, &CSRNG::GenerateRandomBytes, "GenerateRandomBytes"},
};
RegisterHandlers(functions);
}
diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp
index 0b5e2b7c3..ebb179aa8 100644
--- a/src/core/hle/service/spl/module.cpp
+++ b/src/core/hle/service/spl/module.cpp
@@ -10,6 +10,7 @@
#include <vector>
#include "common/logging/log.h"
#include "common/settings.h"
+#include "core/hle/api_version.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/service/spl/csrng.h"
#include "core/hle/service/spl/module.h"
@@ -24,7 +25,46 @@ Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> modu
Module::Interface::~Interface() = default;
-void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) {
+void Module::Interface::GetConfig(Kernel::HLERequestContext& ctx) {
+ IPC::RequestParser rp{ctx};
+ const auto config_item = rp.PopEnum<ConfigItem>();
+
+ // This should call svcCallSecureMonitor with the appropriate args.
+ // Since we do not have it implemented yet, we will use this for now.
+ const auto smc_result = GetConfigImpl(config_item);
+ const auto result_code = smc_result.Code();
+
+ if (smc_result.Failed()) {
+ LOG_ERROR(Service_SPL, "called, config_item={}, result_code={}", config_item,
+ result_code.raw);
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(result_code);
+ }
+
+ LOG_DEBUG(Service_SPL, "called, config_item={}, result_code={}, smc_result={}", config_item,
+ result_code.raw, *smc_result);
+
+ IPC::ResponseBuilder rb{ctx, 4};
+ rb.Push(result_code);
+ rb.Push(*smc_result);
+}
+
+void Module::Interface::ModularExponentiate(Kernel::HLERequestContext& ctx) {
+ UNIMPLEMENTED_MSG("ModularExponentiate is not implemented!");
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ResultSecureMonitorNotImplemented);
+}
+
+void Module::Interface::SetConfig(Kernel::HLERequestContext& ctx) {
+ UNIMPLEMENTED_MSG("SetConfig is not implemented!");
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ResultSecureMonitorNotImplemented);
+}
+
+void Module::Interface::GenerateRandomBytes(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_SPL, "called");
const std::size_t size = ctx.GetWriteBufferSize();
@@ -39,6 +79,88 @@ void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) {
rb.Push(ResultSuccess);
}
+void Module::Interface::IsDevelopment(Kernel::HLERequestContext& ctx) {
+ UNIMPLEMENTED_MSG("IsDevelopment is not implemented!");
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ResultSecureMonitorNotImplemented);
+}
+
+void Module::Interface::SetBootReason(Kernel::HLERequestContext& ctx) {
+ UNIMPLEMENTED_MSG("SetBootReason is not implemented!");
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ResultSecureMonitorNotImplemented);
+}
+
+void Module::Interface::GetBootReason(Kernel::HLERequestContext& ctx) {
+ UNIMPLEMENTED_MSG("GetBootReason is not implemented!");
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ResultSecureMonitorNotImplemented);
+}
+
+ResultVal<u64> Module::Interface::GetConfigImpl(ConfigItem config_item) const {
+ switch (config_item) {
+ case ConfigItem::DisableProgramVerification:
+ case ConfigItem::DramId:
+ case ConfigItem::SecurityEngineInterruptNumber:
+ case ConfigItem::FuseVersion:
+ case ConfigItem::HardwareType:
+ case ConfigItem::HardwareState:
+ case ConfigItem::IsRecoveryBoot:
+ case ConfigItem::DeviceId:
+ case ConfigItem::BootReason:
+ case ConfigItem::MemoryMode:
+ case ConfigItem::IsDevelopmentFunctionEnabled:
+ case ConfigItem::KernelConfiguration:
+ case ConfigItem::IsChargerHiZModeEnabled:
+ case ConfigItem::QuestState:
+ case ConfigItem::RegulatorType:
+ case ConfigItem::DeviceUniqueKeyGeneration:
+ case ConfigItem::Package2Hash:
+ return ResultSecureMonitorNotImplemented;
+ case ConfigItem::ExosphereApiVersion:
+ // Get information about the current exosphere version.
+ return MakeResult((u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MAJOR} << 56) |
+ (u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MINOR} << 48) |
+ (u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MICRO} << 40) |
+ (static_cast<u64>(HLE::ApiVersion::GetTargetFirmware())));
+ case ConfigItem::ExosphereNeedsReboot:
+ // We are executing, so we aren't in the process of rebooting.
+ return MakeResult(u64{0});
+ case ConfigItem::ExosphereNeedsShutdown:
+ // We are executing, so we aren't in the process of shutting down.
+ return MakeResult(u64{0});
+ case ConfigItem::ExosphereGitCommitHash:
+ // Get information about the current exosphere git commit hash.
+ return MakeResult(u64{0});
+ case ConfigItem::ExosphereHasRcmBugPatch:
+ // Get information about whether this unit has the RCM bug patched.
+ return MakeResult(u64{0});
+ case ConfigItem::ExosphereBlankProdInfo:
+ // Get whether this unit should simulate a "blanked" PRODINFO.
+ return MakeResult(u64{0});
+ case ConfigItem::ExosphereAllowCalWrites:
+ // Get whether this unit should allow writing to the calibration partition.
+ return MakeResult(u64{0});
+ case ConfigItem::ExosphereEmummcType:
+ // Get what kind of emummc this unit has active.
+ return MakeResult(u64{0});
+ case ConfigItem::ExospherePayloadAddress:
+ // Gets the physical address of the reboot payload buffer, if one exists.
+ return ResultSecureMonitorNotInitialized;
+ case ConfigItem::ExosphereLogConfiguration:
+ // Get the log configuration.
+ return MakeResult(u64{0});
+ case ConfigItem::ExosphereForceEnableUsb30:
+ // Get whether usb 3.0 should be force-enabled.
+ return MakeResult(u64{0});
+ default:
+ return ResultSecureMonitorInvalidArgument;
+ }
+}
+
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
auto module = std::make_shared<Module>();
std::make_shared<CSRNG>(system, module)->InstallAsService(service_manager);
diff --git a/src/core/hle/service/spl/module.h b/src/core/hle/service/spl/module.h
index 71855c1bf..61630df80 100644
--- a/src/core/hle/service/spl/module.h
+++ b/src/core/hle/service/spl/module.h
@@ -6,6 +6,8 @@
#include <random>
#include "core/hle/service/service.h"
+#include "core/hle/service/spl/spl_results.h"
+#include "core/hle/service/spl/spl_types.h"
namespace Core {
class System;
@@ -21,12 +23,21 @@ public:
const char* name);
~Interface() override;
- void GetRandomBytes(Kernel::HLERequestContext& ctx);
+ // General
+ void GetConfig(Kernel::HLERequestContext& ctx);
+ void ModularExponentiate(Kernel::HLERequestContext& ctx);
+ void SetConfig(Kernel::HLERequestContext& ctx);
+ void GenerateRandomBytes(Kernel::HLERequestContext& ctx);
+ void IsDevelopment(Kernel::HLERequestContext& ctx);
+ void SetBootReason(Kernel::HLERequestContext& ctx);
+ void GetBootReason(Kernel::HLERequestContext& ctx);
protected:
std::shared_ptr<Module> module;
private:
+ ResultVal<u64> GetConfigImpl(ConfigItem config_item) const;
+
std::mt19937 rng;
};
};
diff --git a/src/core/hle/service/spl/spl.cpp b/src/core/hle/service/spl/spl.cpp
index fff3f3c42..20384042f 100644
--- a/src/core/hle/service/spl/spl.cpp
+++ b/src/core/hle/service/spl/spl.cpp
@@ -10,13 +10,13 @@ SPL::SPL(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:") {
// clang-format off
static const FunctionInfo functions[] = {
- {0, nullptr, "GetConfig"},
- {1, nullptr, "ModularExponentiate"},
- {5, nullptr, "SetConfig"},
- {7, &SPL::GetRandomBytes, "GetRandomBytes"},
- {11, nullptr, "IsDevelopment"},
- {24, nullptr, "SetBootReason"},
- {25, nullptr, "GetBootReason"},
+ {0, &SPL::GetConfig, "GetConfig"},
+ {1, &SPL::ModularExponentiate, "ModularExponentiate"},
+ {5, &SPL::SetConfig, "SetConfig"},
+ {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
+ {11, &SPL::IsDevelopment, "IsDevelopment"},
+ {24, &SPL::SetBootReason, "SetBootReason"},
+ {25, &SPL::GetBootReason, "GetBootReason"},
};
// clang-format on
@@ -27,22 +27,22 @@ SPL_MIG::SPL_MIG(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:mig") {
// clang-format off
static const FunctionInfo functions[] = {
- {0, nullptr, "GetConfig"},
- {1, nullptr, "ModularExponentiate"},
+ {0, &SPL::GetConfig, "GetConfig"},
+ {1, &SPL::ModularExponentiate, "ModularExponentiate"},
{2, nullptr, "GenerateAesKek"},
{3, nullptr, "LoadAesKey"},
{4, nullptr, "GenerateAesKey"},
- {5, nullptr, "SetConfig"},
- {7, &SPL::GetRandomBytes, "GenerateRandomBytes"},
- {11, nullptr, "IsDevelopment"},
+ {5, &SPL::SetConfig, "SetConfig"},
+ {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
+ {11, &SPL::IsDevelopment, "IsDevelopment"},
{14, nullptr, "DecryptAesKey"},
{15, nullptr, "CryptAesCtr"},
{16, nullptr, "ComputeCmac"},
{21, nullptr, "AllocateAesKeyslot"},
{22, nullptr, "DeallocateAesKeySlot"},
{23, nullptr, "GetAesKeyslotAvailableEvent"},
- {24, nullptr, "SetBootReason"},
- {25, nullptr, "GetBootReason"},
+ {24, &SPL::SetBootReason, "SetBootReason"},
+ {25, &SPL::GetBootReason, "GetBootReason"},
};
// clang-format on
@@ -53,16 +53,16 @@ SPL_FS::SPL_FS(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:fs") {
// clang-format off
static const FunctionInfo functions[] = {
- {0, nullptr, "GetConfig"},
- {1, nullptr, "ModularExponentiate"},
+ {0, &SPL::GetConfig, "GetConfig"},
+ {1, &SPL::ModularExponentiate, "ModularExponentiate"},
{2, nullptr, "GenerateAesKek"},
{3, nullptr, "LoadAesKey"},
{4, nullptr, "GenerateAesKey"},
- {5, nullptr, "SetConfig"},
- {7, &SPL::GetRandomBytes, "GenerateRandomBytes"},
+ {5, &SPL::SetConfig, "SetConfig"},
+ {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
{9, nullptr, "ImportLotusKey"},
{10, nullptr, "DecryptLotusMessage"},
- {11, nullptr, "IsDevelopment"},
+ {11, &SPL::IsDevelopment, "IsDevelopment"},
{12, nullptr, "GenerateSpecificAesKey"},
{14, nullptr, "DecryptAesKey"},
{15, nullptr, "CryptAesCtr"},
@@ -71,8 +71,8 @@ SPL_FS::SPL_FS(Core::System& system_, std::shared_ptr<Module> module_)
{21, nullptr, "AllocateAesKeyslot"},
{22, nullptr, "DeallocateAesKeySlot"},
{23, nullptr, "GetAesKeyslotAvailableEvent"},
- {24, nullptr, "SetBootReason"},
- {25, nullptr, "GetBootReason"},
+ {24, &SPL::SetBootReason, "SetBootReason"},
+ {25, &SPL::GetBootReason, "GetBootReason"},
{31, nullptr, "GetPackage2Hash"},
};
// clang-format on
@@ -84,14 +84,14 @@ SPL_SSL::SPL_SSL(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:ssl") {
// clang-format off
static const FunctionInfo functions[] = {
- {0, nullptr, "GetConfig"},
- {1, nullptr, "ModularExponentiate"},
+ {0, &SPL::GetConfig, "GetConfig"},
+ {1, &SPL::ModularExponentiate, "ModularExponentiate"},
{2, nullptr, "GenerateAesKek"},
{3, nullptr, "LoadAesKey"},
{4, nullptr, "GenerateAesKey"},
- {5, nullptr, "SetConfig"},
- {7, &SPL::GetRandomBytes, "GetRandomBytes"},
- {11, nullptr, "IsDevelopment"},
+ {5, &SPL::SetConfig, "SetConfig"},
+ {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
+ {11, &SPL::IsDevelopment, "IsDevelopment"},
{13, nullptr, "DecryptDeviceUniqueData"},
{14, nullptr, "DecryptAesKey"},
{15, nullptr, "CryptAesCtr"},
@@ -99,8 +99,8 @@ SPL_SSL::SPL_SSL(Core::System& system_, std::shared_ptr<Module> module_)
{21, nullptr, "AllocateAesKeyslot"},
{22, nullptr, "DeallocateAesKeySlot"},
{23, nullptr, "GetAesKeyslotAvailableEvent"},
- {24, nullptr, "SetBootReason"},
- {25, nullptr, "GetBootReason"},
+ {24, &SPL::SetBootReason, "SetBootReason"},
+ {25, &SPL::GetBootReason, "GetBootReason"},
{26, nullptr, "DecryptAndStoreSslClientCertKey"},
{27, nullptr, "ModularExponentiateWithSslClientCertKey"},
};
@@ -113,14 +113,14 @@ SPL_ES::SPL_ES(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:es") {
// clang-format off
static const FunctionInfo functions[] = {
- {0, nullptr, "GetConfig"},
- {1, nullptr, "ModularExponentiate"},
+ {0, &SPL::GetConfig, "GetConfig"},
+ {1, &SPL::ModularExponentiate, "ModularExponentiate"},
{2, nullptr, "GenerateAesKek"},
{3, nullptr, "LoadAesKey"},
{4, nullptr, "GenerateAesKey"},
- {5, nullptr, "SetConfig"},
- {7, &SPL::GetRandomBytes, "GenerateRandomBytes"},
- {11, nullptr, "IsDevelopment"},
+ {5, &SPL::SetConfig, "SetConfig"},
+ {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
+ {11, &SPL::IsDevelopment, "IsDevelopment"},
{13, nullptr, "DecryptDeviceUniqueData"},
{14, nullptr, "DecryptAesKey"},
{15, nullptr, "CryptAesCtr"},
@@ -131,8 +131,8 @@ SPL_ES::SPL_ES(Core::System& system_, std::shared_ptr<Module> module_)
{21, nullptr, "AllocateAesKeyslot"},
{22, nullptr, "DeallocateAesKeySlot"},
{23, nullptr, "GetAesKeyslotAvailableEvent"},
- {24, nullptr, "SetBootReason"},
- {25, nullptr, "GetBootReason"},
+ {24, &SPL::SetBootReason, "SetBootReason"},
+ {25, &SPL::GetBootReason, "GetBootReason"},
{28, nullptr, "DecryptAndStoreDrmDeviceCertKey"},
{29, nullptr, "ModularExponentiateWithDrmDeviceCertKey"},
{31, nullptr, "PrepareEsArchiveKey"},
@@ -147,14 +147,14 @@ SPL_MANU::SPL_MANU(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:manu") {
// clang-format off
static const FunctionInfo functions[] = {
- {0, nullptr, "GetConfig"},
- {1, nullptr, "ModularExponentiate"},
+ {0, &SPL::GetConfig, "GetConfig"},
+ {1, &SPL::ModularExponentiate, "ModularExponentiate"},
{2, nullptr, "GenerateAesKek"},
{3, nullptr, "LoadAesKey"},
{4, nullptr, "GenerateAesKey"},
- {5, nullptr, "SetConfig"},
- {7, &SPL::GetRandomBytes, "GetRandomBytes"},
- {11, nullptr, "IsDevelopment"},
+ {5, &SPL::SetConfig, "SetConfig"},
+ {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
+ {11, &SPL::IsDevelopment, "IsDevelopment"},
{13, nullptr, "DecryptDeviceUniqueData"},
{14, nullptr, "DecryptAesKey"},
{15, nullptr, "CryptAesCtr"},
@@ -162,8 +162,8 @@ SPL_MANU::SPL_MANU(Core::System& system_, std::shared_ptr<Module> module_)
{21, nullptr, "AllocateAesKeyslot"},
{22, nullptr, "DeallocateAesKeySlot"},
{23, nullptr, "GetAesKeyslotAvailableEvent"},
- {24, nullptr, "SetBootReason"},
- {25, nullptr, "GetBootReason"},
+ {24, &SPL::SetBootReason, "SetBootReason"},
+ {25, &SPL::GetBootReason, "GetBootReason"},
{30, nullptr, "ReencryptDeviceUniqueData"},
};
// clang-format on
diff --git a/src/core/hle/service/spl/spl_results.h b/src/core/hle/service/spl/spl_results.h
new file mode 100644
index 000000000..a07c61409
--- /dev/null
+++ b/src/core/hle/service/spl/spl_results.h
@@ -0,0 +1,31 @@
+// Copyright 2021 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "core/hle/result.h"
+
+namespace Service::SPL {
+
+// Description 0 - 99
+constexpr ResultCode ResultSecureMonitorError{ErrorModule::SPL, 0};
+constexpr ResultCode ResultSecureMonitorNotImplemented{ErrorModule::SPL, 1};
+constexpr ResultCode ResultSecureMonitorInvalidArgument{ErrorModule::SPL, 2};
+constexpr ResultCode ResultSecureMonitorBusy{ErrorModule::SPL, 3};
+constexpr ResultCode ResultSecureMonitorNoAsyncOperation{ErrorModule::SPL, 4};
+constexpr ResultCode ResultSecureMonitorInvalidAsyncOperation{ErrorModule::SPL, 5};
+constexpr ResultCode ResultSecureMonitorNotPermitted{ErrorModule::SPL, 6};
+constexpr ResultCode ResultSecureMonitorNotInitialized{ErrorModule::SPL, 7};
+
+constexpr ResultCode ResultInvalidSize{ErrorModule::SPL, 100};
+constexpr ResultCode ResultUnknownSecureMonitorError{ErrorModule::SPL, 101};
+constexpr ResultCode ResultDecryptionFailed{ErrorModule::SPL, 102};
+
+constexpr ResultCode ResultOutOfKeySlots{ErrorModule::SPL, 104};
+constexpr ResultCode ResultInvalidKeySlot{ErrorModule::SPL, 105};
+constexpr ResultCode ResultBootReasonAlreadySet{ErrorModule::SPL, 106};
+constexpr ResultCode ResultBootReasonNotSet{ErrorModule::SPL, 107};
+constexpr ResultCode ResultInvalidArgument{ErrorModule::SPL, 108};
+
+} // namespace Service::SPL
diff --git a/src/core/hle/service/spl/spl_types.h b/src/core/hle/service/spl/spl_types.h
new file mode 100644
index 000000000..a654e7556
--- /dev/null
+++ b/src/core/hle/service/spl/spl_types.h
@@ -0,0 +1,232 @@
+// Copyright 2021 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <span>
+
+#include "common/bit_field.h"
+#include "common/common_types.h"
+
+namespace Service::SPL {
+
+constexpr size_t AES_128_KEY_SIZE = 0x10;
+
+namespace Smc {
+
+enum class FunctionId : u32 {
+ SetConfig = 0xC3000401,
+ GetConfig = 0xC3000002,
+ GetResult = 0xC3000003,
+ GetResultData = 0xC3000404,
+ ModularExponentiate = 0xC3000E05,
+ GenerateRandomBytes = 0xC3000006,
+ GenerateAesKek = 0xC3000007,
+ LoadAesKey = 0xC3000008,
+ ComputeAes = 0xC3000009,
+ GenerateSpecificAesKey = 0xC300000A,
+ ComputeCmac = 0xC300040B,
+ ReencryptDeviceUniqueData = 0xC300D60C,
+ DecryptDeviceUniqueData = 0xC300100D,
+
+ ModularExponentiateWithStorageKey = 0xC300060F,
+ PrepareEsDeviceUniqueKey = 0xC3000610,
+ LoadPreparedAesKey = 0xC3000011,
+ PrepareCommonEsTitleKey = 0xC3000012,
+
+ // Deprecated functions.
+ LoadEsDeviceKey = 0xC300100C,
+ DecryptAndStoreGcKey = 0xC300100E,
+
+ // Atmosphere functions.
+ AtmosphereIramCopy = 0xF0000201,
+ AtmosphereReadWriteRegister = 0xF0000002,
+
+ AtmosphereGetEmummcConfig = 0xF0000404,
+};
+
+enum class CipherMode {
+ CbcEncrypt = 0,
+ CbcDecrypt = 1,
+ Ctr = 2,
+};
+
+enum class DeviceUniqueDataMode {
+ DecryptDeviceUniqueData = 0,
+ DecryptAndStoreGcKey = 1,
+ DecryptAndStoreEsDeviceKey = 2,
+ DecryptAndStoreSslKey = 3,
+ DecryptAndStoreDrmDeviceCertKey = 4,
+};
+
+enum class ModularExponentiateWithStorageKeyMode {
+ Gc = 0,
+ Ssl = 1,
+ DrmDeviceCert = 2,
+};
+
+enum class EsCommonKeyType {
+ TitleKey = 0,
+ ArchiveKey = 1,
+};
+
+struct AsyncOperationKey {
+ u64 value;
+};
+
+} // namespace Smc
+
+enum class HardwareType {
+ Icosa = 0,
+ Copper = 1,
+ Hoag = 2,
+ Iowa = 3,
+ Calcio = 4,
+ Aula = 5,
+};
+
+enum class SocType {
+ Erista = 0,
+ Mariko = 1,
+};
+
+enum class HardwareState {
+ Development = 0,
+ Production = 1,
+};
+
+enum class MemoryArrangement {
+ Standard = 0,
+ StandardForAppletDev = 1,
+ StandardForSystemDev = 2,
+ Expanded = 3,
+ ExpandedForAppletDev = 4,
+
+ // Note: Dynamic is not official.
+ // Atmosphere uses it to maintain compatibility with firmwares prior to 6.0.0,
+ // which removed the explicit retrieval of memory arrangement from PM.
+ Dynamic = 5,
+ Count,
+};
+
+enum class BootReason {
+ Unknown = 0,
+ AcOk = 1,
+ OnKey = 2,
+ RtcAlarm1 = 3,
+ RtcAlarm2 = 4,
+};
+
+struct BootReasonValue {
+ union {
+ u32 value{};
+
+ BitField<0, 8, u32> power_intr;
+ BitField<8, 8, u32> rtc_intr;
+ BitField<16, 8, u32> nv_erc;
+ BitField<24, 8, u32> boot_reason;
+ };
+};
+static_assert(sizeof(BootReasonValue) == sizeof(u32), "BootReasonValue definition!");
+
+struct AesKey {
+ std::array<u64, AES_128_KEY_SIZE / sizeof(u64)> data64{};
+
+ std::span<u8> AsBytes() {
+ return std::span{reinterpret_cast<u8*>(data64.data()), AES_128_KEY_SIZE};
+ }
+
+ std::span<const u8> AsBytes() const {
+ return std::span{reinterpret_cast<const u8*>(data64.data()), AES_128_KEY_SIZE};
+ }
+};
+static_assert(sizeof(AesKey) == AES_128_KEY_SIZE, "AesKey definition!");
+
+struct IvCtr {
+ std::array<u64, AES_128_KEY_SIZE / sizeof(u64)> data64{};
+
+ std::span<u8> AsBytes() {
+ return std::span{reinterpret_cast<u8*>(data64.data()), AES_128_KEY_SIZE};
+ }
+
+ std::span<const u8> AsBytes() const {
+ return std::span{reinterpret_cast<const u8*>(data64.data()), AES_128_KEY_SIZE};
+ }
+};
+static_assert(sizeof(AesKey) == AES_128_KEY_SIZE, "IvCtr definition!");
+
+struct Cmac {
+ std::array<u64, AES_128_KEY_SIZE / sizeof(u64)> data64{};
+
+ std::span<u8> AsBytes() {
+ return std::span{reinterpret_cast<u8*>(data64.data()), AES_128_KEY_SIZE};
+ }
+
+ std::span<const u8> AsBytes() const {
+ return std::span{reinterpret_cast<const u8*>(data64.data()), AES_128_KEY_SIZE};
+ }
+};
+static_assert(sizeof(AesKey) == AES_128_KEY_SIZE, "Cmac definition!");
+
+struct AccessKey {
+ std::array<u64, AES_128_KEY_SIZE / sizeof(u64)> data64{};
+
+ std::span<u8> AsBytes() {
+ return std::span{reinterpret_cast<u8*>(data64.data()), AES_128_KEY_SIZE};
+ }
+
+ std::span<const u8> AsBytes() const {
+ return std::span{reinterpret_cast<const u8*>(data64.data()), AES_128_KEY_SIZE};
+ }
+};
+static_assert(sizeof(AesKey) == AES_128_KEY_SIZE, "AccessKey definition!");
+
+struct KeySource {
+ std::array<u64, AES_128_KEY_SIZE / sizeof(u64)> data64{};
+
+ std::span<u8> AsBytes() {
+ return std::span{reinterpret_cast<u8*>(data64.data()), AES_128_KEY_SIZE};
+ }
+
+ std::span<const u8> AsBytes() const {
+ return std::span{reinterpret_cast<const u8*>(data64.data()), AES_128_KEY_SIZE};
+ }
+};
+static_assert(sizeof(AesKey) == AES_128_KEY_SIZE, "KeySource definition!");
+
+enum class ConfigItem : u32 {
+ // Standard config items.
+ DisableProgramVerification = 1,
+ DramId = 2,
+ SecurityEngineInterruptNumber = 3,
+ FuseVersion = 4,
+ HardwareType = 5,
+ HardwareState = 6,
+ IsRecoveryBoot = 7,
+ DeviceId = 8,
+ BootReason = 9,
+ MemoryMode = 10,
+ IsDevelopmentFunctionEnabled = 11,
+ KernelConfiguration = 12,
+ IsChargerHiZModeEnabled = 13,
+ QuestState = 14,
+ RegulatorType = 15,
+ DeviceUniqueKeyGeneration = 16,
+ Package2Hash = 17,
+
+ // Extension config items for exosphere.
+ ExosphereApiVersion = 65000,
+ ExosphereNeedsReboot = 65001,
+ ExosphereNeedsShutdown = 65002,
+ ExosphereGitCommitHash = 65003,
+ ExosphereHasRcmBugPatch = 65004,
+ ExosphereBlankProdInfo = 65005,
+ ExosphereAllowCalWrites = 65006,
+ ExosphereEmummcType = 65007,
+ ExospherePayloadAddress = 65008,
+ ExosphereLogConfiguration = 65009,
+ ExosphereForceEnableUsb30 = 65010,
+};
+
+} // namespace Service::SPL
diff --git a/src/core/hle/service/time/time_zone_content_manager.cpp b/src/core/hle/service/time/time_zone_content_manager.cpp
index bf4402308..c634b6abd 100644
--- a/src/core/hle/service/time/time_zone_content_manager.cpp
+++ b/src/core/hle/service/time/time_zone_content_manager.cpp
@@ -125,7 +125,7 @@ ResultCode TimeZoneContentManager::GetTimeZoneInfoFile(const std::string& locati
return ERROR_TIME_NOT_FOUND;
}
- vfs_file = zoneinfo_dir->GetFile(location_name);
+ vfs_file = zoneinfo_dir->GetFileRelative(location_name);
if (!vfs_file) {
LOG_ERROR(Service_Time, "{:016X} has no file \"{}\"! Using default timezone.",
time_zone_binary_titleid, location_name);