From 0f2a1f3f04c2ca309030cffe70e9108f2f01a502 Mon Sep 17 00:00:00 2001 From: Jarrod Norwell Date: Fri, 12 Apr 2024 17:45:07 +0800 Subject: [PATCH] Added (incomplete) stubs to allow for booting the v18.0.0 firmware --- src/core/hle/kernel/k_page_table_base.cpp | 10 ++++++++ src/core/hle/kernel/k_page_table_base.h | 4 ++++ src/core/hle/kernel/k_process_page_table.h | 3 +++ src/core/hle/kernel/svc/svc_info.cpp | 7 +++++- src/core/hle/kernel/svc_types.h | 7 +++++- src/core/hle/service/acc/acc.cpp | 11 ++++++++- .../hle/service/am/common_state_getter.cpp | 9 ++++++- src/core/hle/service/am/common_state_getter.h | 1 + .../am/service/common_state_getter.cpp | 7 +++++- .../service/am/service/common_state_getter.h | 1 + .../hle/service/bcat/news/news_service.cpp | 7 +++++- src/core/hle/service/bcat/news/news_service.h | 2 ++ .../hle/service/filesystem/fsp/fsp_srv.cpp | 7 +++++- src/core/hle/service/filesystem/fsp/fsp_srv.h | 1 + src/core/hle/service/filesystem/fsp_srv.cpp | 10 +++++++- src/core/hle/service/filesystem/fsp_srv.h | 1 + src/core/hle/service/nifm/nifm.cpp | 21 ++++++++++++++-- src/core/hle/service/nifm/nifm.h | 2 ++ src/core/hle/service/npns/npns.cpp | 21 +++++++++++++--- src/core/hle/service/set/set_sys.cpp | 9 ++++++- .../service/set/system_settings_server.cpp | 7 +++++- .../hle/service/set/system_settings_server.h | 1 + src/sudachi/main.cpp | 24 +++++++++++++++++++ src/sudachi/main.h | 1 + src/sudachi/main.ui | 7 ++++++ 25 files changed, 166 insertions(+), 15 deletions(-) diff --git a/src/core/hle/kernel/k_page_table_base.cpp b/src/core/hle/kernel/k_page_table_base.cpp index 5800e4f..6e10d68 100644 --- a/src/core/hle/kernel/k_page_table_base.cpp +++ b/src/core/hle/kernel/k_page_table_base.cpp @@ -165,6 +165,7 @@ Result KPageTableBase::InitializeForKernel(bool is_64_bit, KVirtualAddress start m_kernel_map_region_end = 0; m_alias_code_region_start = 0; m_alias_code_region_end = 0; + m_reserved_region_extra_size = 0; m_code_region_start = 0; m_code_region_end = 0; m_max_heap_size = 0; @@ -253,6 +254,15 @@ Result KPageTableBase::InitializeForProcess(Svc::CreateProcessFlag as_type, bool m_alias_code_region_end = m_code_region_end; process_code_start = Common::AlignDown(GetInteger(code_address), RegionAlignment); process_code_end = Common::AlignUp(GetInteger(code_address) + code_size, RegionAlignment); + + // TODO: (jarrodnorwell) + // [switchbrew.org][0] Address space type must be 39-bit + // [switchbrew.org][1] System resource size must be > 0 + // [switchbrew.org][2] KTargetSystem::IsDebugMode() must be true + if (as_type == Svc::CreateProcessFlag::EnableReservedRegionExtraSize) { + m_reserved_region_extra_size = GetAddressSpaceSize() / 8; + alias_region_size += alias_region_size; + } } else { stack_region_size = 0; kernel_map_region_size = 0; diff --git a/src/core/hle/kernel/k_page_table_base.h b/src/core/hle/kernel/k_page_table_base.h index 92ecda8..99a8aa0 100644 --- a/src/core/hle/kernel/k_page_table_base.h +++ b/src/core/hle/kernel/k_page_table_base.h @@ -208,6 +208,7 @@ private: size_t m_mapped_unsafe_physical_memory{}; size_t m_mapped_insecure_memory{}; size_t m_mapped_ipc_server_memory{}; + size_t m_reserved_region_extra_size{}; mutable KLightLock m_general_lock; mutable KLightLock m_map_physical_memory_lock; KLightLock m_device_map_lock; @@ -694,6 +695,9 @@ public: size_t GetAliasCodeRegionSize() const { return m_alias_code_region_end - m_alias_code_region_start; } + size_t GetReservedRegionExtraSize() const { + return m_reserved_region_extra_size; + } size_t GetNormalMemorySize() const { // Lock the table. diff --git a/src/core/hle/kernel/k_process_page_table.h b/src/core/hle/kernel/k_process_page_table.h index 4d9cc12..ff571c5 100644 --- a/src/core/hle/kernel/k_process_page_table.h +++ b/src/core/hle/kernel/k_process_page_table.h @@ -422,6 +422,9 @@ public: size_t GetAliasCodeRegionSize() const { return m_page_table.GetAliasCodeRegionSize(); } + size_t GetReservedRegionExtraSize() const { + return m_page_table.GetReservedRegionExtraSize(); + } size_t GetNormalMemorySize() const { return m_page_table.GetNormalMemorySize(); diff --git a/src/core/hle/kernel/svc/svc_info.cpp b/src/core/hle/kernel/svc/svc_info.cpp index 89bac94..3ea6161 100644 --- a/src/core/hle/kernel/svc/svc_info.cpp +++ b/src/core/hle/kernel/svc/svc_info.cpp @@ -37,7 +37,8 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle case InfoType::TotalNonSystemMemorySize: case InfoType::UsedNonSystemMemorySize: case InfoType::IsApplication: - case InfoType::FreeThreadCount: { + case InfoType::FreeThreadCount: + case InfoType::ReservedRegionExtraSize: { R_UNLESS(info_sub_id == 0, ResultInvalidEnumValue); const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable(); @@ -134,6 +135,10 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle } R_SUCCEED(); + case InfoType::ReservedRegionExtraSize: + *result = process->GetPageTable().GetReservedRegionExtraSize(); + R_SUCCEED(); + default: break; } diff --git a/src/core/hle/kernel/svc_types.h b/src/core/hle/kernel/svc_types.h index 4825536..7b0d18d 100644 --- a/src/core/hle/kernel/svc_types.h +++ b/src/core/hle/kernel/svc_types.h @@ -153,6 +153,7 @@ enum class InfoType : u32 { ThreadTickCount = 25, IsSvcPermitted = 26, IoRegionHint = 27, + ReservedRegionExtraSize = 28, MesosphereMeta = 65000, MesosphereCurrentProcess = 65001, @@ -642,9 +643,13 @@ enum class CreateProcessFlag : u32 { // 11.x+ DisableDeviceAddressSpaceMerge. DisableDeviceAddressSpaceMerge = (1 << 12), + // 18.x+ EnableReservedRegionExtraSize. + EnableReservedRegionExtraSize = (1 << 13), + // Mask of all flags. All = Is64Bit | AddressSpaceMask | EnableDebug | EnableAslr | IsApplication | - PoolPartitionMask | OptimizeMemoryAllocation | DisableDeviceAddressSpaceMerge, + PoolPartitionMask | OptimizeMemoryAllocation | DisableDeviceAddressSpaceMerge | + EnableReservedRegionExtraSize, }; DECLARE_ENUM_FLAG_OPERATORS(CreateProcessFlag); diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 1eb4644..424cee9 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -99,6 +99,7 @@ public: {140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+ {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ + {143, nullptr, "GetNetworkServiceLicenseCacheEx"}, // 15.0.0+ {150, nullptr, "CreateAuthorizationRequest"}, {160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, {161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, @@ -326,7 +327,7 @@ public: {11, &IProfileCommon::LoadImage, "LoadImage"}, {20, nullptr, "GetLargeImageSize"}, // 18.0.0+ {21, nullptr, "LoadLargeImage"}, // 18.0.0+ - {30, nullptr, "GetImageId"} // 18.0.0+ + {30, &IProfileCommon::GetImageId, "GetImageId"} // 18.0.0+ }; // clang-format on @@ -405,6 +406,14 @@ protected: rb.Push(static_cast(buffer.size())); } + void GetImageId(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(0); + } + void GetImageSize(HLERequestContext& ctx) { LOG_DEBUG(Service_ACC, "called"); IPC::ResponseBuilder rb{ctx, 3}; diff --git a/src/core/hle/service/am/common_state_getter.cpp b/src/core/hle/service/am/common_state_getter.cpp index aa7be00..edfe1c7 100644 --- a/src/core/hle/service/am/common_state_getter.cpp +++ b/src/core/hle/service/am/common_state_getter.cpp @@ -38,7 +38,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, std::shared_ptrsleep_lock_event.GetHandle()); } +void ICommonStateGetter::GetCradleFwVersion(HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + void ICommonStateGetter::IsVrModeEnabled(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); diff --git a/src/core/hle/service/am/common_state_getter.h b/src/core/hle/service/am/common_state_getter.h index 72d3ace..504691b 100644 --- a/src/core/hle/service/am/common_state_getter.h +++ b/src/core/hle/service/am/common_state_getter.h @@ -58,6 +58,7 @@ private: void GetOperationMode(HLERequestContext& ctx); void GetPerformanceMode(HLERequestContext& ctx); void GetBootMode(HLERequestContext& ctx); + void GetCradleFwVersion(HLERequestContext& ctx); void IsVrModeEnabled(HLERequestContext& ctx); void SetVrModeEnabled(HLERequestContext& ctx); void SetLcdBacklighOffEnabled(HLERequestContext& ctx); diff --git a/src/core/hle/service/am/service/common_state_getter.cpp b/src/core/hle/service/am/service/common_state_getter.cpp index c99d7c3..c8563e9 100644 --- a/src/core/hle/service/am/service/common_state_getter.cpp +++ b/src/core/hle/service/am/service/common_state_getter.cpp @@ -38,7 +38,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, std::shared_ptr, "GetReaderLockAccessorEx"}, {32, D<&ICommonStateGetter::GetWriterLockAccessorEx>, "GetWriterLockAccessorEx"}, - {40, nullptr, "GetCradleFwVersion"}, + {40, D<&ICommonStateGetter::GetCradleFwVersion>, "GetCradleFwVersion"}, {50, D<&ICommonStateGetter::IsVrModeEnabled>, "IsVrModeEnabled"}, {51, D<&ICommonStateGetter::SetVrModeEnabled>, "SetVrModeEnabled"}, {52, D<&ICommonStateGetter::SetLcdBacklighOffEnabled>, "SetLcdBacklighOffEnabled"}, @@ -161,6 +161,11 @@ Result ICommonStateGetter::GetBootMode(Out out_boot_mode) { R_SUCCEED(); } +Result ICommonStateGetter::GetCradleFwVersion() { + LOG_WARNING(Service_AM, "(STUBBED) called"); + R_SUCCEED(); +} + Result ICommonStateGetter::IsVrModeEnabled(Out out_is_vr_mode_enabled) { LOG_DEBUG(Service_AM, "called"); diff --git a/src/core/hle/service/am/service/common_state_getter.h b/src/core/hle/service/am/service/common_state_getter.h index 4d8bbeb..32b96ce 100644 --- a/src/core/hle/service/am/service/common_state_getter.h +++ b/src/core/hle/service/am/service/common_state_getter.h @@ -38,6 +38,7 @@ private: Result GetOperationMode(Out out_operation_mode); Result GetPerformanceMode(Out out_performance_mode); Result GetBootMode(Out out_boot_mode); + Result GetCradleFwVersion(); Result IsVrModeEnabled(Out out_is_vr_mode_enabled); Result SetVrModeEnabled(bool is_vr_mode_enabled); Result SetLcdBacklighOffEnabled(bool is_lcd_backlight_off_enabled); diff --git a/src/core/hle/service/bcat/news/news_service.cpp b/src/core/hle/service/bcat/news/news_service.cpp index b3bcb13..45049d7 100644 --- a/src/core/hle/service/bcat/news/news_service.cpp +++ b/src/core/hle/service/bcat/news/news_service.cpp @@ -9,7 +9,7 @@ namespace Service::News { INewsService::INewsService(Core::System& system_) : ServiceFramework{system_, "INewsService"} { // clang-format off static const FunctionInfo functions[] = { - {10100, nullptr, "PostLocalNews"}, + {10100, D<&INewsService::PostLocalNews>, "PostLocalNews"}, {20100, nullptr, "SetPassphrase"}, {30100, D<&INewsService::GetSubscriptionStatus>, "GetSubscriptionStatus"}, {30101, nullptr, "GetTopicList"}, @@ -36,6 +36,11 @@ INewsService::INewsService(Core::System& system_) : ServiceFramework{system_, "I INewsService::~INewsService() = default; +Result INewsService::PostLocalNews() { + LOG_WARNING(Service_BCAT, "(STUBBED) called"); + R_SUCCEED(); +} + Result INewsService::GetSubscriptionStatus(Out out_status, InBuffer buffer_data) { LOG_WARNING(Service_BCAT, "(STUBBED) called, buffer_size={}", buffer_data.size()); diff --git a/src/core/hle/service/bcat/news/news_service.h b/src/core/hle/service/bcat/news/news_service.h index 2891bbc..46dbf0d 100644 --- a/src/core/hle/service/bcat/news/news_service.h +++ b/src/core/hle/service/bcat/news/news_service.h @@ -18,6 +18,8 @@ public: ~INewsService() override; private: + Result PostLocalNews(); + Result GetSubscriptionStatus(Out out_status, InBuffer buffer_data); Result IsSystemUpdateRequired(Out out_is_system_update_required); diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp index 3861467..af18a0b 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp @@ -67,7 +67,7 @@ FSP_SRV::FSP_SRV(Core::System& system_) {24, nullptr, "RegisterSaveDataFileSystemAtomicDeletion"}, {25, nullptr, "DeleteSaveDataFileSystemBySaveDataSpaceId"}, {26, nullptr, "FormatSdCardDryRun"}, - {27, nullptr, "IsExFatSupported"}, + {27, D<&FSP_SRV::IsExFatSupported>, "IsExFatSupported"}, {28, nullptr, "DeleteSaveDataFileSystemBySaveDataAttribute"}, {30, nullptr, "OpenGameCardStorage"}, {31, nullptr, "OpenGameCardFileSystem"}, @@ -247,6 +247,11 @@ Result FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId( save_struct)); } +Result FSP_SRV::IsExFatSupported(bool is_exfat_supported) { + LOG_INFO(Service_FS, "(STUBBED) called."); + R_SUCCEED(); +} + Result FSP_SRV::OpenSaveDataFileSystem(OutInterface out_interface, FileSys::SaveDataSpaceId space_id, FileSys::SaveDataAttribute attribute) { diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.h b/src/core/hle/service/filesystem/fsp/fsp_srv.h index 8eef0ad..4f39c53 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.h +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.h @@ -55,6 +55,7 @@ private: FileSys::SaveDataAttribute save_struct, u128 uid); Result CreateSaveDataFileSystemBySystemSaveDataId( FileSys::SaveDataAttribute save_struct, FileSys::SaveDataCreationInfo save_create_struct); + Result IsExFatSupported(bool is_exfat_supported); Result OpenSaveDataFileSystem(OutInterface out_interface, FileSys::SaveDataSpaceId space_id, FileSys::SaveDataAttribute attribute); diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 5750171..e6c9b25 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -756,7 +756,7 @@ FSP_SRV::FSP_SRV(Core::System& system_) {24, nullptr, "RegisterSaveDataFileSystemAtomicDeletion"}, {25, nullptr, "DeleteSaveDataFileSystemBySaveDataSpaceId"}, {26, nullptr, "FormatSdCardDryRun"}, - {27, nullptr, "IsExFatSupported"}, + {27, &FSP_SRV::IsExFatSupported, "IsExFatSupported"}, {28, nullptr, "DeleteSaveDataFileSystemBySaveDataAttribute"}, {30, nullptr, "OpenGameCardStorage"}, {31, nullptr, "OpenGameCardFileSystem"}, @@ -946,6 +946,14 @@ void FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId(HLERequestContext& ctx) rb.Push(ResultSuccess); } +void FSP_SRV::IsExFatSupported(HLERequestContext& ctx) { + LOG_INFO(Service_FS, "(STUBBED) called."); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(0); +} + void FSP_SRV::OpenSaveDataFileSystem(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; diff --git a/src/core/hle/service/filesystem/fsp_srv.h b/src/core/hle/service/filesystem/fsp_srv.h index 63fde35..dedf8c2 100644 --- a/src/core/hle/service/filesystem/fsp_srv.h +++ b/src/core/hle/service/filesystem/fsp_srv.h @@ -43,6 +43,7 @@ private: void OpenSdCardFileSystem(HLERequestContext& ctx); void CreateSaveDataFileSystem(HLERequestContext& ctx); void CreateSaveDataFileSystemBySystemSaveDataId(HLERequestContext& ctx); + void IsExFatSupported(HLERequestContext& ctx); void OpenSaveDataFileSystem(HLERequestContext& ctx); void OpenSaveDataFileSystemBySystemSaveDataId(HLERequestContext& ctx); void OpenReadOnlySaveDataFileSystem(HLERequestContext& ctx); diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index dba6b1f..b22760c 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -419,6 +419,14 @@ void IGeneralService::GetCurrentNetworkProfile(HLERequestContext& ctx) { rb.Push(ResultSuccess); } +void IGeneralService::EnumerateNetworkInterfaces(HLERequestContext& ctx) { + for (const auto& interface : Network::GetAvailableNetworkInterfaces()) + LOG_WARNING(Service_NIFM, "(STUBBED) called, interface={}", interface.name); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + void IGeneralService::RemoveNetworkProfile(HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); @@ -565,6 +573,15 @@ void IGeneralService::IsAnyForegroundRequestAccepted(HLERequestContext& ctx) { rb.Push(is_accepted); } +void IGeneralService::GetSsidListVersion(HLERequestContext& ctx) { + const u32 ssid = 1; + LOG_WARNING(Service_NIFM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(ssid); +} + IGeneralService::IGeneralService(Core::System& system_) : ServiceFramework{system_, "IGeneralService"}, network{system_.GetRoomNetwork()} { // clang-format off @@ -573,7 +590,7 @@ IGeneralService::IGeneralService(Core::System& system_) {2, &IGeneralService::CreateScanRequest, "CreateScanRequest"}, {4, &IGeneralService::CreateRequest, "CreateRequest"}, {5, &IGeneralService::GetCurrentNetworkProfile, "GetCurrentNetworkProfile"}, - {6, nullptr, "EnumerateNetworkInterfaces"}, + {6, &IGeneralService::EnumerateNetworkInterfaces, "EnumerateNetworkInterfaces"}, {7, nullptr, "EnumerateNetworkProfiles"}, {8, nullptr, "GetNetworkProfile"}, {9, nullptr, "SetNetworkProfile"}, @@ -592,7 +609,7 @@ IGeneralService::IGeneralService(Core::System& system_) {22, &IGeneralService::IsAnyForegroundRequestAccepted, "IsAnyForegroundRequestAccepted"}, {23, nullptr, "PutToSleep"}, {24, nullptr, "WakeUp"}, - {25, nullptr, "GetSsidListVersion"}, + {25, &IGeneralService::GetSsidListVersion, "GetSsidListVersion"}, {26, nullptr, "SetExclusiveClient"}, {27, nullptr, "GetDefaultIpSetting"}, {28, nullptr, "SetDefaultIpSetting"}, diff --git a/src/core/hle/service/nifm/nifm.h b/src/core/hle/service/nifm/nifm.h index 36f9861..6528e50 100644 --- a/src/core/hle/service/nifm/nifm.h +++ b/src/core/hle/service/nifm/nifm.h @@ -27,6 +27,7 @@ private: void CreateScanRequest(HLERequestContext& ctx); void CreateRequest(HLERequestContext& ctx); void GetCurrentNetworkProfile(HLERequestContext& ctx); + void EnumerateNetworkInterfaces(HLERequestContext& ctx); void RemoveNetworkProfile(HLERequestContext& ctx); void GetCurrentIpAddress(HLERequestContext& ctx); void CreateTemporaryNetworkProfile(HLERequestContext& ctx); @@ -36,6 +37,7 @@ private: void IsEthernetCommunicationEnabled(HLERequestContext& ctx); void IsAnyInternetRequestAccepted(HLERequestContext& ctx); void IsAnyForegroundRequestAccepted(HLERequestContext& ctx); + void GetSsidListVersion(HLERequestContext& ctx); Network::RoomNetwork& network; }; diff --git a/src/core/hle/service/npns/npns.cpp b/src/core/hle/service/npns/npns.cpp index 107eb39..b2902e9 100644 --- a/src/core/hle/service/npns/npns.cpp +++ b/src/core/hle/service/npns/npns.cpp @@ -25,7 +25,7 @@ public: {5, C<&INpnsSystem::GetReceiveEvent>, "GetReceiveEvent"}, {6, nullptr, "ListenUndelivered"}, {7, nullptr, "GetStateChangeEvent"}, - {8, nullptr, "ListenToByName"}, // 18.0.0+ + {8, C<&INpnsSystem::ListenToByName>, "ListenToByName"}, // 18.0.0+ {11, nullptr, "SubscribeTopic"}, {12, nullptr, "UnsubscribeTopic"}, {13, nullptr, "QueryIsTopicExist"}, @@ -57,10 +57,10 @@ public: {51, nullptr, "DeleteDigitalTwinKeyValue"}, // 18.0.0+ {101, nullptr, "Suspend"}, {102, nullptr, "Resume"}, - {103, nullptr, "GetState"}, + {103, C<&INpnsSystem::GetState>, "GetState"}, {104, nullptr, "GetStatistics"}, {105, nullptr, "GetPlayReportRequestEvent"}, - {106, nullptr, "GetLastNotifiedTime"}, // 18.0.0+ + {106, C<&INpnsSystem::GetLastNotifiedTime>, "GetLastNotifiedTime"}, // 18.0.0+ {107, nullptr, "SetLastNotifiedTime"}, // 18.0.0+ {111, nullptr, "GetJid"}, {112, nullptr, "CreateJid"}, @@ -109,6 +109,21 @@ private: R_SUCCEED(); } + Result ListenToByName() { + LOG_WARNING(Service_AM, "(STUBBED) called"); + R_SUCCEED(); + } + + Result GetState() { + LOG_WARNING(Service_AM, "(STUBBED) called"); + R_SUCCEED(); + } + + Result GetLastNotifiedTime() { + LOG_WARNING(Service_AM, "(STUBBED) called"); + R_SUCCEED(); + } + KernelHelpers::ServiceContext service_context; Kernel::KEvent* get_receive_event; }; diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp index 7fa34ff..264ed54 100644 --- a/src/core/hle/service/set/set_sys.cpp +++ b/src/core/hle/service/set/set_sys.cpp @@ -786,6 +786,13 @@ void SET_SYS::GetKeyboardLayout(HLERequestContext& ctx) { rb.Push(static_cast(selected_keyboard_layout)); } +void SET_SYS::GetRebootlessSystemUpdateVersion(HLERequestContext& ctx) { + LOG_WARNING(Service_SET, "(STUBBED) called."); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + void SET_SYS::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) { LOG_WARNING(Service_SET, "called."); @@ -1021,7 +1028,7 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"}, {146, nullptr, "SetConsoleSixAxisSensorAngularVelocityTimeBias"}, {147, nullptr, "GetConsoleSixAxisSensorAngularAcceleration"}, {148, nullptr, "SetConsoleSixAxisSensorAngularAcceleration"}, - {149, nullptr, "GetRebootlessSystemUpdateVersion"}, + {149, &SET_SYS::GetRebootlessSystemUpdateVersion, "GetRebootlessSystemUpdateVersion"}, {150, &SET_SYS::GetDeviceTimeZoneLocationUpdatedTime, "GetDeviceTimeZoneLocationUpdatedTime"}, {151, &SET_SYS::SetDeviceTimeZoneLocationUpdatedTime, "SetDeviceTimeZoneLocationUpdatedTime"}, {152, &SET_SYS::GetUserSystemClockAutomaticCorrectionUpdatedTime, "GetUserSystemClockAutomaticCorrectionUpdatedTime"}, diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp index 88ac659..93568c1 100644 --- a/src/core/hle/service/set/system_settings_server.cpp +++ b/src/core/hle/service/set/system_settings_server.cpp @@ -238,7 +238,7 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_) {146, nullptr, "SetConsoleSixAxisSensorAngularVelocityTimeBias"}, {147, nullptr, "GetConsoleSixAxisSensorAngularAcceleration"}, {148, nullptr, "SetConsoleSixAxisSensorAngularAcceleration"}, - {149, nullptr, "GetRebootlessSystemUpdateVersion"}, + {149, C<&ISystemSettingsServer::GetRebootlessSystemUpdateVersion>, "GetRebootlessSystemUpdateVersion"}, {150, C<&ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime>, "GetDeviceTimeZoneLocationUpdatedTime"}, {151, C<&ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime>, "SetDeviceTimeZoneLocationUpdatedTime"}, {152, C<&ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime>, "GetUserSystemClockAutomaticCorrectionUpdatedTime"}, @@ -1198,6 +1198,11 @@ Result ISystemSettingsServer::SetKeyboardLayout(KeyboardLayout keyboard_layout) R_SUCCEED(); } +Result ISystemSettingsServer::GetRebootlessSystemUpdateVersion() { + LOG_WARNING(Service_SET, "(STUBBED) called."); + R_SUCCEED(); +} + Result ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime( Out out_time_point) { LOG_INFO(Service_SET, "called"); diff --git a/src/core/hle/service/set/system_settings_server.h b/src/core/hle/service/set/system_settings_server.h index b25b3e1..8a7cd1b 100644 --- a/src/core/hle/service/set/system_settings_server.h +++ b/src/core/hle/service/set/system_settings_server.h @@ -136,6 +136,7 @@ public: Result SetAppletLaunchFlags(u32 applet_launch_flag); Result GetKeyboardLayout(Out out_keyboard_layout); Result SetKeyboardLayout(KeyboardLayout keyboard_layout); + Result GetRebootlessSystemUpdateVersion(); Result GetDeviceTimeZoneLocationUpdatedTime( Out out_time_point); Result SetDeviceTimeZoneLocationUpdatedTime( diff --git a/src/sudachi/main.cpp b/src/sudachi/main.cpp index 64a68e5..178e038 100644 --- a/src/sudachi/main.cpp +++ b/src/sudachi/main.cpp @@ -1593,6 +1593,7 @@ void GMainWindow::ConnectMenuEvents() { [this]() { OnCabinet(Service::NFP::CabinetMode::StartFormatter); }); connect_menu(ui->action_Load_Mii_Edit, &GMainWindow::OnMiiEdit); connect_menu(ui->action_Open_Controller_Menu, &GMainWindow::OnOpenControllerMenu); + connect_menu(ui->action_Load_Home_Menu, &GMainWindow::OnHomeMenu); connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot); // TAS @@ -4487,6 +4488,29 @@ void GMainWindow::OnOpenControllerMenu() { LibraryAppletParameters(ControllerAppletId, Service::AM::AppletId::Controller)); } +void GMainWindow::OnHomeMenu() { + constexpr u64 QLaunchId = static_cast(Service::AM::AppletProgramId::QLaunch); + auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); + if (!bis_system) { + QMessageBox::warning(this, tr("No firmware available"), + tr("Please install the firmware to use the Home Menu.")); + return; + } + + auto qlaunch_applet_nca = bis_system->GetEntry(QLaunchId, FileSys::ContentRecordType::Program); + if (!qlaunch_applet_nca) { + QMessageBox::warning(this, tr("Home Menu Applet"), + tr("Home Menu is not available. Please reinstall firmware.")); + return; + } + + system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::QLaunch); + + const auto filename = QString::fromStdString((qlaunch_applet_nca->GetFullPath())); + UISettings::values.roms_path = QFileInfo(filename).path().toStdString(); + BootGame(filename, LibraryAppletParameters(QLaunchId, Service::AM::AppletId::QLaunch)); +} + void GMainWindow::OnCaptureScreenshot() { if (emu_thread == nullptr || !emu_thread->IsRunning()) { return; diff --git a/src/sudachi/main.h b/src/sudachi/main.h index be14ae8..0ca4fc7 100644 --- a/src/sudachi/main.h +++ b/src/sudachi/main.h @@ -399,6 +399,7 @@ private slots: void OnCabinet(Service::NFP::CabinetMode mode); void OnMiiEdit(); void OnOpenControllerMenu(); + void OnHomeMenu(); void OnCaptureScreenshot(); void OnCheckFirmwareDecryption(); void OnLanguageChanged(const QString& locale); diff --git a/src/sudachi/main.ui b/src/sudachi/main.ui index cbbd02a..98eabde 100644 --- a/src/sudachi/main.ui +++ b/src/sudachi/main.ui @@ -174,6 +174,8 @@ + + @@ -475,6 +477,11 @@ Install Decryption Keys + + + Open Home Menu + +