diff options
-rw-r--r-- | src/common/fiber.cpp | 2 | ||||
-rw-r--r-- | src/core/file_sys/system_archive/ng_word.cpp | 4 | ||||
-rw-r--r-- | src/core/file_sys/system_archive/system_version.cpp | 10 | ||||
-rw-r--r-- | src/core/hle/service/sockets/bsd.cpp | 8 | ||||
-rw-r--r-- | src/core/hle/service/spl/module.cpp | 5 | ||||
-rw-r--r-- | src/core/hle/service/spl/spl.cpp | 152 | ||||
-rw-r--r-- | src/core/hle/service/spl/spl.h | 30 | ||||
-rw-r--r-- | src/core/hle/service/vi/vi.cpp | 28 |
8 files changed, 219 insertions, 20 deletions
diff --git a/src/common/fiber.cpp b/src/common/fiber.cpp index 39532ff58..62010d762 100644 --- a/src/common/fiber.cpp +++ b/src/common/fiber.cpp @@ -11,7 +11,7 @@ namespace Common { -constexpr std::size_t default_stack_size = 256 * 1024; +constexpr std::size_t default_stack_size = 512 * 1024; struct Fiber::FiberImpl { FiberImpl() : stack{default_stack_size}, rewind_stack{default_stack_size} {} diff --git a/src/core/file_sys/system_archive/ng_word.cpp b/src/core/file_sys/system_archive/ng_word.cpp index 100d3c5db..8d86d563a 100644 --- a/src/core/file_sys/system_archive/ng_word.cpp +++ b/src/core/file_sys/system_archive/ng_word.cpp @@ -14,7 +14,7 @@ namespace NgWord1Data { constexpr std::size_t NUMBER_WORD_TXT_FILES = 0x10; // Should this archive replacement mysteriously not work on a future game, consider updating. -constexpr std::array<u8, 4> VERSION_DAT{0x0, 0x0, 0x0, 0x19}; // 5.1.0 System Version +constexpr std::array<u8, 4> VERSION_DAT{0x0, 0x0, 0x0, 0x20}; // 11.0.1 System Version constexpr std::array<u8, 30> WORD_TXT{ 0xFE, 0xFF, 0x00, 0x5E, 0x00, 0x76, 0x00, 0x65, 0x00, 0x72, 0x00, 0x79, 0x00, 0x62, 0x00, @@ -43,7 +43,7 @@ namespace NgWord2Data { constexpr std::size_t NUMBER_AC_NX_FILES = 0x10; // Should this archive replacement mysteriously not work on a future game, consider updating. -constexpr std::array<u8, 4> VERSION_DAT{0x0, 0x0, 0x0, 0x15}; // 5.1.0 System Version +constexpr std::array<u8, 4> VERSION_DAT{0x0, 0x0, 0x0, 0x1A}; // 11.0.1 System Version constexpr std::array<u8, 0x2C> AC_NX_DATA{ 0x1F, 0x8B, 0x08, 0x08, 0xD5, 0x2C, 0x09, 0x5C, 0x04, 0x00, 0x61, 0x63, 0x72, 0x61, 0x77, diff --git a/src/core/file_sys/system_archive/system_version.cpp b/src/core/file_sys/system_archive/system_version.cpp index 7bfbc9a67..54704105b 100644 --- a/src/core/file_sys/system_archive/system_version.cpp +++ b/src/core/file_sys/system_archive/system_version.cpp @@ -14,15 +14,15 @@ namespace SystemVersionData { constexpr u8 VERSION_MAJOR = 11; constexpr u8 VERSION_MINOR = 0; -constexpr u8 VERSION_MICRO = 0; +constexpr u8 VERSION_MICRO = 1; -constexpr u8 REVISION_MAJOR = 5; +constexpr u8 REVISION_MAJOR = 1; constexpr u8 REVISION_MINOR = 0; constexpr char PLATFORM_STRING[] = "NX"; -constexpr char VERSION_HASH[] = "34197eba8810e2edd5e9dfcfbde7b340882e856d"; -constexpr char DISPLAY_VERSION[] = "11.0.0"; -constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 11.0.0-5.0"; +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 diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index 78e9cd708..5fcd91f68 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp @@ -42,7 +42,9 @@ void BSD::PollWork::Execute(BSD* bsd) { } void BSD::PollWork::Response(Kernel::HLERequestContext& ctx) { - ctx.WriteBuffer(write_buffer); + if (write_buffer.size() > 0) { + ctx.WriteBuffer(write_buffer); + } IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); @@ -55,7 +57,9 @@ void BSD::AcceptWork::Execute(BSD* bsd) { } void BSD::AcceptWork::Response(Kernel::HLERequestContext& ctx) { - ctx.WriteBuffer(write_buffer); + if (write_buffer.size() > 0) { + ctx.WriteBuffer(write_buffer); + } IPC::ResponseBuilder rb{ctx, 5}; rb.Push(RESULT_SUCCESS); diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp index dea6b0fe0..6903dd534 100644 --- a/src/core/hle/service/spl/module.cpp +++ b/src/core/hle/service/spl/module.cpp @@ -43,6 +43,11 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system auto module = std::make_shared<Module>(); std::make_shared<CSRNG>(system, module)->InstallAsService(service_manager); std::make_shared<SPL>(system, module)->InstallAsService(service_manager); + std::make_shared<SPL_MIG>(system, module)->InstallAsService(service_manager); + std::make_shared<SPL_FS>(system, module)->InstallAsService(service_manager); + std::make_shared<SPL_SSL>(system, module)->InstallAsService(service_manager); + std::make_shared<SPL_ES>(system, module)->InstallAsService(service_manager); + std::make_shared<SPL_MANU>(system, module)->InstallAsService(service_manager); } } // namespace Service::SPL diff --git a/src/core/hle/service/spl/spl.cpp b/src/core/hle/service/spl/spl.cpp index 3fabc2c79..4e212610f 100644 --- a/src/core/hle/service/spl/spl.cpp +++ b/src/core/hle/service/spl/spl.cpp @@ -8,6 +8,24 @@ namespace Service::SPL { 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"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +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"}, @@ -15,19 +33,67 @@ SPL::SPL(Core::System& system_, std::shared_ptr<Module> module_) {3, nullptr, "LoadAesKey"}, {4, nullptr, "GenerateAesKey"}, {5, nullptr, "SetConfig"}, - {7, &SPL::GetRandomBytes, "GetRandomBytes"}, - {9, nullptr, "ImportLotusKey"}, - {10, nullptr, "DecryptLotusMessage"}, + {7, &SPL::GetRandomBytes, "GenerateRandomBytes"}, + {11, nullptr, "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"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +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"}, + {2, nullptr, "GenerateAesKek"}, + {3, nullptr, "LoadAesKey"}, + {4, nullptr, "GenerateAesKey"}, + {5, nullptr, "SetConfig"}, + {7, &SPL::GetRandomBytes, "GenerateRandomBytes"}, {11, nullptr, "IsDevelopment"}, {12, nullptr, "GenerateSpecificAesKey"}, - {13, nullptr, "DecryptDeviceUniqueData"}, {14, nullptr, "DecryptAesKey"}, {15, nullptr, "CryptAesCtr"}, {16, nullptr, "ComputeCmac"}, - {17, nullptr, "ImportEsKey"}, - {18, nullptr, "UnwrapTitleKey"}, {19, nullptr, "LoadTitleKey"}, - {20, nullptr, "PrepareEsCommonKey"}, + {21, nullptr, "AllocateAesKeyslot"}, + {22, nullptr, "DeallocateAesKeySlot"}, + {23, nullptr, "GetAesKeyslotAvailableEvent"}, + {24, nullptr, "SetBootReason"}, + {25, nullptr, "GetBootReason"}, + {31, nullptr, "GetPackage2Hash"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +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"}, + {2, nullptr, "GenerateAesKek"}, + {3, nullptr, "LoadAesKey"}, + {4, nullptr, "GenerateAesKey"}, + {5, nullptr, "SetConfig"}, + {7, &SPL::GetRandomBytes, "GetRandomBytes"}, + {11, nullptr, "IsDevelopment"}, + {13, nullptr, "DecryptDeviceUniqueData"}, + {14, nullptr, "DecryptAesKey"}, + {15, nullptr, "CryptAesCtr"}, + {16, nullptr, "ComputeCmac"}, {21, nullptr, "AllocateAesKeyslot"}, {22, nullptr, "DeallocateAesKeySlot"}, {23, nullptr, "GetAesKeyslotAvailableEvent"}, @@ -35,15 +101,83 @@ SPL::SPL(Core::System& system_, std::shared_ptr<Module> module_) {25, nullptr, "GetBootReason"}, {26, nullptr, "DecryptAndStoreSslClientCertKey"}, {27, nullptr, "ModularExponentiateWithSslClientCertKey"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +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"}, + {2, nullptr, "GenerateAesKek"}, + {3, nullptr, "LoadAesKey"}, + {4, nullptr, "GenerateAesKey"}, + {5, nullptr, "SetConfig"}, + {7, &SPL::GetRandomBytes, "GenerateRandomBytes"}, + {11, nullptr, "IsDevelopment"}, + {13, nullptr, "DecryptDeviceUniqueData"}, + {14, nullptr, "DecryptAesKey"}, + {15, nullptr, "CryptAesCtr"}, + {16, nullptr, "ComputeCmac"}, + {18, nullptr, "UnwrapTitleKey"}, + {20, nullptr, "PrepareEsCommonKey"}, + {21, nullptr, "AllocateAesKeyslot"}, + {22, nullptr, "DeallocateAesKeySlot"}, + {23, nullptr, "GetAesKeyslotAvailableEvent"}, + {24, nullptr, "SetBootReason"}, + {25, nullptr, "GetBootReason"}, {28, nullptr, "DecryptAndStoreDrmDeviceCertKey"}, {29, nullptr, "ModularExponentiateWithDrmDeviceCertKey"}, - {30, nullptr, "ReencryptDeviceUniqueData "}, - {31, nullptr, "PrepareEsArchiveKey"}, // This is also GetPackage2Hash? + {31, nullptr, "PrepareEsArchiveKey"}, {32, nullptr, "LoadPreparedAesKey"}, }; + // clang-format on + + RegisterHandlers(functions); +} + +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"}, + {2, nullptr, "GenerateAesKek"}, + {3, nullptr, "LoadAesKey"}, + {4, nullptr, "GenerateAesKey"}, + {5, nullptr, "SetConfig"}, + {7, &SPL::GetRandomBytes, "GetRandomBytes"}, + {11, nullptr, "IsDevelopment"}, + {13, nullptr, "DecryptDeviceUniqueData"}, + {14, nullptr, "DecryptAesKey"}, + {15, nullptr, "CryptAesCtr"}, + {16, nullptr, "ComputeCmac"}, + {21, nullptr, "AllocateAesKeyslot"}, + {22, nullptr, "DeallocateAesKeySlot"}, + {23, nullptr, "GetAesKeyslotAvailableEvent"}, + {24, nullptr, "SetBootReason"}, + {25, nullptr, "GetBootReason"}, + {30, nullptr, "ReencryptDeviceUniqueData"}, + }; + // clang-format on + RegisterHandlers(functions); } SPL::~SPL() = default; +SPL_MIG::~SPL_MIG() = default; + +SPL_FS::~SPL_FS() = default; + +SPL_SSL::~SPL_SSL() = default; + +SPL_ES::~SPL_ES() = default; + +SPL_MANU::~SPL_MANU() = default; + } // namespace Service::SPL diff --git a/src/core/hle/service/spl/spl.h b/src/core/hle/service/spl/spl.h index d27d16b86..9b35012ed 100644 --- a/src/core/hle/service/spl/spl.h +++ b/src/core/hle/service/spl/spl.h @@ -18,4 +18,34 @@ public: ~SPL() override; }; +class SPL_MIG final : public Module::Interface { +public: + explicit SPL_MIG(Core::System& system_, std::shared_ptr<Module> module_); + ~SPL_MIG() override; +}; + +class SPL_FS final : public Module::Interface { +public: + explicit SPL_FS(Core::System& system_, std::shared_ptr<Module> module_); + ~SPL_FS() override; +}; + +class SPL_SSL final : public Module::Interface { +public: + explicit SPL_SSL(Core::System& system_, std::shared_ptr<Module> module_); + ~SPL_SSL() override; +}; + +class SPL_ES final : public Module::Interface { +public: + explicit SPL_ES(Core::System& system_, std::shared_ptr<Module> module_); + ~SPL_ES() override; +}; + +class SPL_MANU final : public Module::Interface { +public: + explicit SPL_MANU(Core::System& system_, std::shared_ptr<Module> module_); + ~SPL_MANU() override; +}; + } // namespace Service::SPL diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 8661895ae..7423287ea 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -1217,6 +1217,32 @@ private: } } + void GetIndirectLayerImageMap(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto width = rp.Pop<s64>(); + const auto height = rp.Pop<s64>(); + const auto indirect_layer_consumer_handle = rp.Pop<u64>(); + const auto applet_resource_user_id = rp.Pop<u64>(); + + LOG_WARNING(Service_VI, + "(STUBBED) called, width={}, height={}, indirect_layer_consumer_handle={}, " + "applet_resource_user_id={}", + width, height, indirect_layer_consumer_handle, applet_resource_user_id); + + std::vector<u8> out_buffer(0x46); + ctx.WriteBuffer(out_buffer); + + // TODO: Figure out what these are + + constexpr s64 unknown_result_1 = 0; + constexpr s64 unknown_result_2 = 0; + + IPC::ResponseBuilder rb{ctx, 6}; + rb.Push(unknown_result_1); + rb.Push(unknown_result_2); + rb.Push(RESULT_SUCCESS); + } + void GetIndirectLayerImageRequiredMemoryInfo(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto width = rp.Pop<u64>(); @@ -1276,7 +1302,7 @@ IApplicationDisplayService::IApplicationDisplayService(Core::System& system_, {2031, &IApplicationDisplayService::DestroyStrayLayer, "DestroyStrayLayer"}, {2101, &IApplicationDisplayService::SetLayerScalingMode, "SetLayerScalingMode"}, {2102, &IApplicationDisplayService::ConvertScalingMode, "ConvertScalingMode"}, - {2450, nullptr, "GetIndirectLayerImageMap"}, + {2450, &IApplicationDisplayService::GetIndirectLayerImageMap, "GetIndirectLayerImageMap"}, {2451, nullptr, "GetIndirectLayerImageCropMap"}, {2460, &IApplicationDisplayService::GetIndirectLayerImageRequiredMemoryInfo, "GetIndirectLayerImageRequiredMemoryInfo"}, |