From a1db3cb668bdb3eaf888a4794a15b56d7246337b Mon Sep 17 00:00:00 2001 From: niansa Date: Sat, 9 Mar 2024 04:23:16 +0100 Subject: [PATCH 01/23] Implemented some basic sleep functions --- .../service/am/service/global_state_controller.cpp | 12 +++++++++--- .../hle/service/am/service/global_state_controller.h | 1 + .../hle/service/am/service/home_menu_functions.cpp | 8 +++++++- .../hle/service/am/service/home_menu_functions.h | 1 + 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/core/hle/service/am/service/global_state_controller.cpp b/src/core/hle/service/am/service/global_state_controller.cpp index 3e3b61b0a0..a985b1925d 100644 --- a/src/core/hle/service/am/service/global_state_controller.cpp +++ b/src/core/hle/service/am/service/global_state_controller.cpp @@ -14,7 +14,7 @@ IGlobalStateController::IGlobalStateController(Core::System& system_) static const FunctionInfo functions[] = { {0, nullptr, "RequestToEnterSleep"}, {1, nullptr, "EnterSleep"}, - {2, nullptr, "StartSleepSequence"}, + {2, D<&IGlobalStateController::StartSleepSequence>, "StartSleepSequence"}, {3, D<&IGlobalStateController::StartShutdownSequence>, "StartShutdownSequence"}, {4, D<&IGlobalStateController::StartRebootSequence>, "StartRebootSequence"}, {9, nullptr, "IsAutoPowerDownRequested"}, @@ -31,6 +31,14 @@ IGlobalStateController::IGlobalStateController(Core::System& system_) RegisterHandlers(functions); } +IGlobalStateController::~IGlobalStateController() = default; + +Result IGlobalStateController::StartSleepSequence(u8 a) { + LOG_WARNING(Service_AM, "called, a={}", a); + system.Pause(); + R_SUCCEED(); +} + Result IGlobalStateController::StartShutdownSequence() { LOG_INFO(Service_AM, "called"); system.Exit(); @@ -43,8 +51,6 @@ Result IGlobalStateController::StartRebootSequence() { R_SUCCEED(); } -IGlobalStateController::~IGlobalStateController() = default; - Result IGlobalStateController::LoadAndApplyIdlePolicySettings() { LOG_WARNING(Service_AM, "(STUBBED) called"); R_SUCCEED(); diff --git a/src/core/hle/service/am/service/global_state_controller.h b/src/core/hle/service/am/service/global_state_controller.h index 83efb57dfc..e0f1d46cc1 100644 --- a/src/core/hle/service/am/service/global_state_controller.h +++ b/src/core/hle/service/am/service/global_state_controller.h @@ -18,6 +18,7 @@ public: ~IGlobalStateController() override; private: + Result StartSleepSequence(u8 a); Result StartShutdownSequence(); Result StartRebootSequence(); Result LoadAndApplyIdlePolicySettings(); diff --git a/src/core/hle/service/am/service/home_menu_functions.cpp b/src/core/hle/service/am/service/home_menu_functions.cpp index 25f78beb5a..47a10dceb3 100644 --- a/src/core/hle/service/am/service/home_menu_functions.cpp +++ b/src/core/hle/service/am/service/home_menu_functions.cpp @@ -23,7 +23,7 @@ IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_, std::shared_ptr, "GetPopFromGeneralChannelEvent"}, {30, nullptr, "GetHomeButtonWriterLockAccessor"}, {31, nullptr, "GetWriterLockAccessorEx"}, - {40, nullptr, "IsSleepEnabled"}, + {40, D<&IHomeMenuFunctions::IsSleepEnabled>, "IsSleepEnabled"}, {41, D<&IHomeMenuFunctions::IsRebootEnabled>, "IsRebootEnabled"}, {50, nullptr, "LaunchSystemApplet"}, {51, nullptr, "LaunchStarter"}, @@ -64,6 +64,12 @@ Result IHomeMenuFunctions::GetPopFromGeneralChannelEvent( R_SUCCEED(); } +Result IHomeMenuFunctions::IsSleepEnabled(Out out_is_sleep_enbaled) { + LOG_INFO(Service_AM, "called"); + *out_is_sleep_enbaled = true; + R_SUCCEED(); +} + Result IHomeMenuFunctions::IsRebootEnabled(Out out_is_reboot_enbaled) { LOG_INFO(Service_AM, "called"); *out_is_reboot_enbaled = true; diff --git a/src/core/hle/service/am/service/home_menu_functions.h b/src/core/hle/service/am/service/home_menu_functions.h index f56094aa9d..e393898e35 100644 --- a/src/core/hle/service/am/service/home_menu_functions.h +++ b/src/core/hle/service/am/service/home_menu_functions.h @@ -24,6 +24,7 @@ private: Result LockForeground(); Result UnlockForeground(); Result GetPopFromGeneralChannelEvent(OutCopyHandle out_event); + Result IsSleepEnabled(Out out_is_sleep_enbaled); Result IsRebootEnabled(Out out_is_reboot_enbaled); Result IsForceTerminateApplicationDisabledForDebug( Out out_is_force_terminate_application_disabled_for_debug); From 72d4d7b1b881631872fd47357c77e9fac489c573 Mon Sep 17 00:00:00 2001 From: niansa Date: Sat, 9 Mar 2024 17:06:00 +0100 Subject: [PATCH 02/23] Stub out StartSleepSequence --- src/core/hle/service/am/service/global_state_controller.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/hle/service/am/service/global_state_controller.cpp b/src/core/hle/service/am/service/global_state_controller.cpp index a985b1925d..aa8f852fea 100644 --- a/src/core/hle/service/am/service/global_state_controller.cpp +++ b/src/core/hle/service/am/service/global_state_controller.cpp @@ -34,8 +34,7 @@ IGlobalStateController::IGlobalStateController(Core::System& system_) IGlobalStateController::~IGlobalStateController() = default; Result IGlobalStateController::StartSleepSequence(u8 a) { - LOG_WARNING(Service_AM, "called, a={}", a); - system.Pause(); + LOG_WARNING(Service_AM, "(STUBBED) called, a={}", a); R_SUCCEED(); } From 8dae7d29d62abeb41f3504e5b0b33aa0f235b338 Mon Sep 17 00:00:00 2001 From: niansa Date: Sun, 10 Mar 2024 02:26:03 +0100 Subject: [PATCH 03/23] Implemented some stubs for Health & Safety and corrected GetGroupInfo behavior --- .../hle/service/am/service/common_state_getter.cpp | 14 +++++++++++++- .../hle/service/am/service/common_state_getter.h | 1 + src/core/hle/service/filesystem/fsp/fsp_srv.cpp | 10 +++++++++- src/core/hle/service/filesystem/fsp/fsp_srv.h | 1 + src/core/hle/service/ldn/sf_monitor_service.cpp | 4 ++-- src/core/hle/service/ldn/sf_monitor_service.h | 2 +- src/core/hle/service/nifm/nifm.cpp | 2 +- src/core/hle/service/set/settings_types.h | 8 ++++++++ .../hle/service/set/system_settings_server.cpp | 11 ++++++++++- src/core/hle/service/set/system_settings_server.h | 1 + 10 files changed, 47 insertions(+), 7 deletions(-) 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 f523bcd9e6..501837b531 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"}, @@ -159,6 +159,18 @@ Result ICommonStateGetter::GetBootMode(Out out_boot_mode) { R_SUCCEED(); } +Result ICommonStateGetter::GetCradleFwVersion(OutArray out_version) { + LOG_DEBUG(Service_AM, "(STUBBED) called"); + + out_version[0] = 0; + out_version[1] = 0; + out_version[2] = 0; + out_version[3] = 0; + + 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 59a46fa94f..8c80e5bdbb 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(OutArray out_version); 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/filesystem/fsp/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp index 60290f1a6e..2bc6361bb7 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"}, @@ -235,6 +235,14 @@ Result FSP_SRV::CreateSaveDataFileSystem(FileSys::SaveDataCreationInfo save_crea save_struct)); } +Result FSP_SRV::IsExFatSupported(Out out_is_supported) { + LOG_WARNING(Service_FS, "(STUBBED) called"); + + *out_is_supported = true; + + R_SUCCEED(); +} + Result FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId( FileSys::SaveDataAttribute save_struct, FileSys::SaveDataCreationInfo save_create_struct) { LOG_DEBUG(Service_FS, "called save_struct = {}", save_struct.DebugInfo()); diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.h b/src/core/hle/service/filesystem/fsp/fsp_srv.h index b565cace04..865fdae7c4 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.h +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.h @@ -53,6 +53,7 @@ private: Result OpenSdCardFileSystem(OutInterface out_interface); Result CreateSaveDataFileSystem(FileSys::SaveDataCreationInfo save_create_struct, FileSys::SaveDataAttribute save_struct, u128 uid); + Result IsExFatSupported(Out out_is_supported); Result CreateSaveDataFileSystemBySystemSaveDataId( FileSys::SaveDataAttribute save_struct, FileSys::SaveDataCreationInfo save_create_struct); Result OpenSaveDataFileSystem(OutInterface out_interface, diff --git a/src/core/hle/service/ldn/sf_monitor_service.cpp b/src/core/hle/service/ldn/sf_monitor_service.cpp index 9e6736ff2c..a5ff7a043c 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.cpp +++ b/src/core/hle/service/ldn/sf_monitor_service.cpp @@ -29,11 +29,11 @@ Result ISfMonitorService::Initialize(Out out_value) { R_SUCCEED(); } -Result ISfMonitorService::GetGroupInfo( +Result ISfMonitorService::GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info) { LOG_WARNING(Service_LDN, "(STUBBED) called"); - *out_group_info = GroupInfo{}; + memcpy(out_group_info, &in_group_info, sizeof(GroupInfo)); R_SUCCEED(); } diff --git a/src/core/hle/service/ldn/sf_monitor_service.h b/src/core/hle/service/ldn/sf_monitor_service.h index d021152010..50cceb25b0 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.h +++ b/src/core/hle/service/ldn/sf_monitor_service.h @@ -20,7 +20,7 @@ public: private: Result Initialize(Out out_value); - Result GetGroupInfo(OutLargeData out_group_info); + Result GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info); }; } // namespace Service::LDN diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 060fe86dd8..2202e3d899 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -507,7 +507,7 @@ void IGeneralService::GetCurrentIpConfigInfo(HLERequestContext& ctx) { } void IGeneralService::IsWirelessCommunicationEnabled(HLERequestContext& ctx) { - LOG_WARNING(Service_NIFM, "(STUBBED) called"); + LOG_WARNING(Service_NIFM, "called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); diff --git a/src/core/hle/service/set/settings_types.h b/src/core/hle/service/set/settings_types.h index 848722e196..bb268c3396 100644 --- a/src/core/hle/service/set/settings_types.h +++ b/src/core/hle/service/set/settings_types.h @@ -509,4 +509,12 @@ struct TvSettings { }; static_assert(sizeof(TvSettings) == 0x20, "TvSettings is an invalid size"); +/// This is nn::settings::system::RebootlessSystemUpdateVersion +struct RebootlessSystemUpdateVersion { + u32 version; + u8 reserved[0x1c]; + char display_version[0x20]; +}; +static_assert(sizeof(RebootlessSystemUpdateVersion) == 0x40, "RebootlessSystemUpdateVersion is an invalid size"); + } // namespace Service::Set diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp index 326b58266d..bf27eca6f0 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"}, @@ -1194,6 +1194,15 @@ Result ISystemSettingsServer::SetKeyboardLayout(KeyboardLayout keyboard_layout) R_SUCCEED(); } +Result ISystemSettingsServer::GetRebootlessSystemUpdateVersion(Out out_rebootless_system_update) { + LOG_INFO(Service_SET, "(STUBBED) called"); + + out_rebootless_system_update->version = 0; + strcpy(out_rebootless_system_update->display_version, "0.0.0"); + + 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 993e5de7d0..ccce4eb3d8 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(Out out_rebootless_system_update); Result GetDeviceTimeZoneLocationUpdatedTime( Out out_time_point); Result SetDeviceTimeZoneLocationUpdatedTime( From ad32b5371d7b41e9766e478374cbddb37f985f6b Mon Sep 17 00:00:00 2001 From: niansa Date: Sun, 10 Mar 2024 02:28:59 +0100 Subject: [PATCH 04/23] Apply GetGroupInfo fix to ISfServiceMonitor too --- src/core/hle/service/ldn/sf_service_monitor.cpp | 4 ++-- src/core/hle/service/ldn/sf_service_monitor.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/hle/service/ldn/sf_service_monitor.cpp b/src/core/hle/service/ldn/sf_service_monitor.cpp index 33e3c1d69a..853db48937 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.cpp +++ b/src/core/hle/service/ldn/sf_service_monitor.cpp @@ -39,11 +39,11 @@ Result ISfServiceMonitor::Initialize(Out out_value) { R_SUCCEED(); } -Result ISfServiceMonitor::GetGroupInfo( +Result ISfServiceMonitor::GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info) { LOG_WARNING(Service_LDN, "(STUBBED) called"); - *out_group_info = GroupInfo{}; + memcpy(out_group_info, &in_group_info, sizeof(GroupInfo)); R_SUCCEED(); } diff --git a/src/core/hle/service/ldn/sf_service_monitor.h b/src/core/hle/service/ldn/sf_service_monitor.h index 3cfc5005eb..08813ef5ae 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.h +++ b/src/core/hle/service/ldn/sf_service_monitor.h @@ -20,7 +20,7 @@ public: private: Result Initialize(Out out_value); - Result GetGroupInfo(OutLargeData out_group_info); + Result GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info); }; } // namespace Service::LDN From 9858de7fceedece0715ebd9f94a21a55d533b29e Mon Sep 17 00:00:00 2001 From: niansa Date: Sun, 10 Mar 2024 02:29:40 +0100 Subject: [PATCH 05/23] Run clang-format --- src/core/hle/service/am/service/common_state_getter.cpp | 1 - src/core/hle/service/ldn/sf_monitor_service.cpp | 4 ++-- src/core/hle/service/ldn/sf_monitor_service.h | 3 ++- src/core/hle/service/ldn/sf_service_monitor.cpp | 4 ++-- src/core/hle/service/ldn/sf_service_monitor.h | 3 ++- src/core/hle/service/set/settings_types.h | 3 ++- src/core/hle/service/set/system_settings_server.cpp | 3 ++- src/core/hle/service/set/system_settings_server.h | 3 ++- 8 files changed, 14 insertions(+), 10 deletions(-) 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 501837b531..f20071156e 100644 --- a/src/core/hle/service/am/service/common_state_getter.cpp +++ b/src/core/hle/service/am/service/common_state_getter.cpp @@ -170,7 +170,6 @@ Result ICommonStateGetter::GetCradleFwVersion(OutArray out_version) R_SUCCEED(); } - Result ICommonStateGetter::IsVrModeEnabled(Out out_is_vr_mode_enabled) { LOG_DEBUG(Service_AM, "called"); diff --git a/src/core/hle/service/ldn/sf_monitor_service.cpp b/src/core/hle/service/ldn/sf_monitor_service.cpp index a5ff7a043c..0a23d6b8ea 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.cpp +++ b/src/core/hle/service/ldn/sf_monitor_service.cpp @@ -29,8 +29,8 @@ Result ISfMonitorService::Initialize(Out out_value) { R_SUCCEED(); } -Result ISfMonitorService::GetGroupInfo(GroupInfo in_group_info, - OutLargeData out_group_info) { +Result ISfMonitorService::GetGroupInfo( + GroupInfo in_group_info, OutLargeData out_group_info) { LOG_WARNING(Service_LDN, "(STUBBED) called"); memcpy(out_group_info, &in_group_info, sizeof(GroupInfo)); diff --git a/src/core/hle/service/ldn/sf_monitor_service.h b/src/core/hle/service/ldn/sf_monitor_service.h index 50cceb25b0..5878b030c2 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.h +++ b/src/core/hle/service/ldn/sf_monitor_service.h @@ -20,7 +20,8 @@ public: private: Result Initialize(Out out_value); - Result GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info); + Result GetGroupInfo(GroupInfo in_group_info, + OutLargeData out_group_info); }; } // namespace Service::LDN diff --git a/src/core/hle/service/ldn/sf_service_monitor.cpp b/src/core/hle/service/ldn/sf_service_monitor.cpp index 853db48937..e35754d127 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.cpp +++ b/src/core/hle/service/ldn/sf_service_monitor.cpp @@ -39,8 +39,8 @@ Result ISfServiceMonitor::Initialize(Out out_value) { R_SUCCEED(); } -Result ISfServiceMonitor::GetGroupInfo(GroupInfo in_group_info, - OutLargeData out_group_info) { +Result ISfServiceMonitor::GetGroupInfo( + GroupInfo in_group_info, OutLargeData out_group_info) { LOG_WARNING(Service_LDN, "(STUBBED) called"); memcpy(out_group_info, &in_group_info, sizeof(GroupInfo)); diff --git a/src/core/hle/service/ldn/sf_service_monitor.h b/src/core/hle/service/ldn/sf_service_monitor.h index 08813ef5ae..90cdd5cdd4 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.h +++ b/src/core/hle/service/ldn/sf_service_monitor.h @@ -20,7 +20,8 @@ public: private: Result Initialize(Out out_value); - Result GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info); + Result GetGroupInfo(GroupInfo in_group_info, + OutLargeData out_group_info); }; } // namespace Service::LDN diff --git a/src/core/hle/service/set/settings_types.h b/src/core/hle/service/set/settings_types.h index bb268c3396..8cf34efc1a 100644 --- a/src/core/hle/service/set/settings_types.h +++ b/src/core/hle/service/set/settings_types.h @@ -515,6 +515,7 @@ struct RebootlessSystemUpdateVersion { u8 reserved[0x1c]; char display_version[0x20]; }; -static_assert(sizeof(RebootlessSystemUpdateVersion) == 0x40, "RebootlessSystemUpdateVersion is an invalid size"); +static_assert(sizeof(RebootlessSystemUpdateVersion) == 0x40, + "RebootlessSystemUpdateVersion is an invalid size"); } // namespace Service::Set diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp index bf27eca6f0..3aa7695ebd 100644 --- a/src/core/hle/service/set/system_settings_server.cpp +++ b/src/core/hle/service/set/system_settings_server.cpp @@ -1194,7 +1194,8 @@ Result ISystemSettingsServer::SetKeyboardLayout(KeyboardLayout keyboard_layout) R_SUCCEED(); } -Result ISystemSettingsServer::GetRebootlessSystemUpdateVersion(Out out_rebootless_system_update) { +Result ISystemSettingsServer::GetRebootlessSystemUpdateVersion( + Out out_rebootless_system_update) { LOG_INFO(Service_SET, "(STUBBED) called"); out_rebootless_system_update->version = 0; diff --git a/src/core/hle/service/set/system_settings_server.h b/src/core/hle/service/set/system_settings_server.h index ccce4eb3d8..7e16300c30 100644 --- a/src/core/hle/service/set/system_settings_server.h +++ b/src/core/hle/service/set/system_settings_server.h @@ -136,7 +136,8 @@ public: Result SetAppletLaunchFlags(u32 applet_launch_flag); Result GetKeyboardLayout(Out out_keyboard_layout); Result SetKeyboardLayout(KeyboardLayout keyboard_layout); - Result GetRebootlessSystemUpdateVersion(Out out_rebootless_system_update); + Result GetRebootlessSystemUpdateVersion( + Out out_rebootless_system_update); Result GetDeviceTimeZoneLocationUpdatedTime( Out out_time_point); Result SetDeviceTimeZoneLocationUpdatedTime( From 15b752d63e082f2cb204dd734405915cb0e8f66c Mon Sep 17 00:00:00 2001 From: Nicola Date: Sun, 17 Mar 2024 23:13:30 +0000 Subject: [PATCH 06/23] Corrected a Grammatical Error --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a5311ddf59..b9eee375ad 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,5 +5,5 @@ SPDX-License-Identifier: GPL-2.0-or-later Please check out the - * [Conributors's guide](https://gitlab.com/suyu-emu/suyu/-/wikis/Contributing). + * [Contributors's guide](https://gitlab.com/suyu-emu/suyu/-/wikis/Contributing). * [Merge request guidelines](https://gitlab.com/suyu-emu/suyu/-/wikis/Merge-requests) From 2a28c85ff91cae0323050a9d116b834204d12883 Mon Sep 17 00:00:00 2001 From: Nick Majkic <8842171-majkic65@users.noreply.gitlab.com> Date: Mon, 18 Mar 2024 00:47:18 +0000 Subject: [PATCH 07/23] Clean up CMAKE files for mac and xcode building --- CMakeLists.txt | 3 ++ src/video_core/CMakeLists.txt | 63 ++++++++++++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a3f5f97d7..b65adba582 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 3.22) +set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT OFF) +set(CMAKE_XCODE_EMIT_RELATIVE_PATH YES) + project(suyu) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 95e46eebf2..de28bf92ba 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt @@ -9,7 +9,7 @@ if(LIBVA_FOUND) list(APPEND FFmpeg_LIBRARIES ${LIBVA_LIBRARIES}) endif() -add_library(video_core STATIC +set(sources buffer_cache/buffer_base.h buffer_cache/buffer_cache_base.h buffer_cache/buffer_cache.cpp @@ -315,6 +315,67 @@ add_library(video_core STATIC vulkan_common/vulkan.h ) +if (APPLE) + list(REMOVE_ITEM sources + renderer_opengl/present/filters.cpp + renderer_opengl/present/filters.h + renderer_opengl/present/fsr.cpp + renderer_opengl/present/fsr.h + renderer_opengl/present/fxaa.cpp + renderer_opengl/present/fxaa.h + renderer_opengl/present/layer.cpp + renderer_opengl/present/layer.h + renderer_opengl/present/present_uniforms.h + renderer_opengl/present/smaa.cpp + renderer_opengl/present/smaa.h + renderer_opengl/present/util.h + renderer_opengl/present/window_adapt_pass.cpp + renderer_opengl/present/window_adapt_pass.h + renderer_opengl/blit_image.cpp + renderer_opengl/blit_image.h + renderer_opengl/gl_blit_screen.cpp + renderer_opengl/gl_blit_screen.h + renderer_opengl/gl_buffer_cache_base.cpp + renderer_opengl/gl_buffer_cache.cpp + renderer_opengl/gl_buffer_cache.h + renderer_opengl/gl_compute_pipeline.cpp + renderer_opengl/gl_compute_pipeline.h + renderer_opengl/gl_device.cpp + renderer_opengl/gl_device.h + renderer_opengl/gl_fence_manager.cpp + renderer_opengl/gl_fence_manager.h + renderer_opengl/gl_graphics_pipeline.cpp + renderer_opengl/gl_graphics_pipeline.h + renderer_opengl/gl_rasterizer.cpp + renderer_opengl/gl_rasterizer.h + renderer_opengl/gl_resource_manager.cpp + renderer_opengl/gl_resource_manager.h + renderer_opengl/gl_shader_cache.cpp + renderer_opengl/gl_shader_cache.h + renderer_opengl/gl_shader_manager.cpp + renderer_opengl/gl_shader_manager.h + renderer_opengl/gl_shader_context.h + renderer_opengl/gl_shader_util.cpp + renderer_opengl/gl_shader_util.h + renderer_opengl/gl_state_tracker.cpp + renderer_opengl/gl_state_tracker.h + renderer_opengl/gl_staging_buffer_pool.cpp + renderer_opengl/gl_staging_buffer_pool.h + renderer_opengl/gl_texture_cache.cpp + renderer_opengl/gl_texture_cache.h + renderer_opengl/gl_texture_cache_base.cpp + renderer_opengl/gl_query_cache.cpp + renderer_opengl/gl_query_cache.h + renderer_opengl/maxwell_to_gl.h + renderer_opengl/renderer_opengl.cpp + renderer_opengl/renderer_opengl.h + renderer_opengl/util_shaders.cpp + renderer_opengl/util_shaders.h + ) +endif() + +add_library(video_core STATIC ${sources}) + target_link_libraries(video_core PUBLIC common core) target_link_libraries(video_core PUBLIC glad shader_recompiler stb bc_decoder) From 19c2b08ab44a2755bc303412ae97097eb8564c42 Mon Sep 17 00:00:00 2001 From: Nick Majkic <8842171-majkic65@users.noreply.gitlab.com> Date: Mon, 18 Mar 2024 02:45:38 +0000 Subject: [PATCH 08/23] Macos moltenvk headers --- CMakeLists.txt | 2 +- src/video_core/video_core.cpp | 14 +++++++++++++- src/video_core/vulkan_common/vulkan.h | 4 ++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b65adba582..16f8074f0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,7 +71,7 @@ option(SUYU_ENABLE_PORTABLE "Allow suyu to enable portable mode if a user folder CMAKE_DEPENDENT_OPTION(SUYU_USE_FASTER_LD "Check if a faster linker is available" ON "NOT WIN32" OFF) -CMAKE_DEPENDENT_OPTION(USE_SYSTEM_MOLTENVK "Use the system MoltenVK lib (instead of the bundled one)" OFF "APPLE" OFF) +CMAKE_DEPENDENT_OPTION(USE_SYSTEM_MOLTENVK "Use the system MoltenVK lib (instead of the bundled one)" OFF "APPLE" ON) option(USE_CCACHE "Use CCache for faster building" ON) diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index fba258113d..1166dfb977 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -13,6 +13,7 @@ #include "video_core/renderer_vulkan/renderer_vulkan.h" #include "video_core/video_core.h" + namespace { std::unique_ptr CreateRenderer( @@ -21,9 +22,20 @@ std::unique_ptr CreateRenderer( auto& device_memory = system.Host1x().MemoryManager(); switch (Settings::values.renderer_backend.GetValue()) { - case Settings::RendererBackend::OpenGL: + #ifdef __APPLE__ + // do nothing for now, include metal in here at later date. + + + #else + + // openGL, not supported on Apple so not bothering to include if macos + case Settings::RendererBackend::OpenGL: return std::make_unique(emu_window, device_memory, gpu, std::move(context)); + + + #endif + case Settings::RendererBackend::Vulkan: return std::make_unique(emu_window, device_memory, gpu, std::move(context)); diff --git a/src/video_core/vulkan_common/vulkan.h b/src/video_core/vulkan_common/vulkan.h index 62aa132915..26b9054886 100644 --- a/src/video_core/vulkan_common/vulkan.h +++ b/src/video_core/vulkan_common/vulkan.h @@ -15,7 +15,11 @@ #define VK_USE_PLATFORM_WAYLAND_KHR #endif +#ifdef __APPLE__ +#include +#else #include +#endif // Sanitize macros #undef CreateEvent From 2ceae9a0c121fe6f71e2eee6dd8517c2a30f3f40 Mon Sep 17 00:00:00 2001 From: Nick Majkic <8842171-majkic65@users.noreply.gitlab.com> Date: Mon, 18 Mar 2024 03:47:40 +0000 Subject: [PATCH 09/23] Nmajkic/clang fix --- src/video_core/video_core.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index 1166dfb977..509ba8a5b4 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -13,7 +13,6 @@ #include "video_core/renderer_vulkan/renderer_vulkan.h" #include "video_core/video_core.h" - namespace { std::unique_ptr CreateRenderer( @@ -22,20 +21,15 @@ std::unique_ptr CreateRenderer( auto& device_memory = system.Host1x().MemoryManager(); switch (Settings::values.renderer_backend.GetValue()) { - #ifdef __APPLE__ +#ifdef __APPLE__ // do nothing for now, include metal in here at later date. - - - #else - +#else // openGL, not supported on Apple so not bothering to include if macos - case Settings::RendererBackend::OpenGL: + case Settings::RendererBackend::OpenGL: return std::make_unique(emu_window, device_memory, gpu, std::move(context)); - - - #endif - +#endif + // common renderers case Settings::RendererBackend::Vulkan: return std::make_unique(emu_window, device_memory, gpu, std::move(context)); From f085f7e91739e5f7ccb22a2e708e67808f508be8 Mon Sep 17 00:00:00 2001 From: JuanCStar Date: Mon, 18 Mar 2024 09:28:27 +0100 Subject: [PATCH 10/23] fix: typo error --- src/core/hle/service/am/service/home_menu_functions.cpp | 8 ++++---- src/core/hle/service/am/service/home_menu_functions.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/hle/service/am/service/home_menu_functions.cpp b/src/core/hle/service/am/service/home_menu_functions.cpp index 47a10dceb3..f17a8522fb 100644 --- a/src/core/hle/service/am/service/home_menu_functions.cpp +++ b/src/core/hle/service/am/service/home_menu_functions.cpp @@ -64,15 +64,15 @@ Result IHomeMenuFunctions::GetPopFromGeneralChannelEvent( R_SUCCEED(); } -Result IHomeMenuFunctions::IsSleepEnabled(Out out_is_sleep_enbaled) { +Result IHomeMenuFunctions::IsSleepEnabled(Out out_is_sleep_enabled) { LOG_INFO(Service_AM, "called"); - *out_is_sleep_enbaled = true; + *out_is_sleep_enabled = true; R_SUCCEED(); } -Result IHomeMenuFunctions::IsRebootEnabled(Out out_is_reboot_enbaled) { +Result IHomeMenuFunctions::IsRebootEnabled(Out out_is_reboot_enabled) { LOG_INFO(Service_AM, "called"); - *out_is_reboot_enbaled = true; + *out_is_reboot_enabled = true; R_SUCCEED(); } diff --git a/src/core/hle/service/am/service/home_menu_functions.h b/src/core/hle/service/am/service/home_menu_functions.h index e393898e35..28ed9bf0ec 100644 --- a/src/core/hle/service/am/service/home_menu_functions.h +++ b/src/core/hle/service/am/service/home_menu_functions.h @@ -24,8 +24,8 @@ private: Result LockForeground(); Result UnlockForeground(); Result GetPopFromGeneralChannelEvent(OutCopyHandle out_event); - Result IsSleepEnabled(Out out_is_sleep_enbaled); - Result IsRebootEnabled(Out out_is_reboot_enbaled); + Result IsSleepEnabled(Out out_is_sleep_enabled); + Result IsRebootEnabled(Out out_is_reboot_enabled); Result IsForceTerminateApplicationDisabledForDebug( Out out_is_force_terminate_application_disabled_for_debug); From 3075d740676ca9ceeb7e1c8e315af5a3e1e59c1b Mon Sep 17 00:00:00 2001 From: niansa Date: Sat, 9 Mar 2024 04:23:16 +0100 Subject: [PATCH 11/23] Implemented some basic sleep functions --- .../service/am/service/global_state_controller.cpp | 12 +++++++++--- .../hle/service/am/service/global_state_controller.h | 1 + .../hle/service/am/service/home_menu_functions.cpp | 8 +++++++- .../hle/service/am/service/home_menu_functions.h | 1 + 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/core/hle/service/am/service/global_state_controller.cpp b/src/core/hle/service/am/service/global_state_controller.cpp index 3e3b61b0a0..a985b1925d 100644 --- a/src/core/hle/service/am/service/global_state_controller.cpp +++ b/src/core/hle/service/am/service/global_state_controller.cpp @@ -14,7 +14,7 @@ IGlobalStateController::IGlobalStateController(Core::System& system_) static const FunctionInfo functions[] = { {0, nullptr, "RequestToEnterSleep"}, {1, nullptr, "EnterSleep"}, - {2, nullptr, "StartSleepSequence"}, + {2, D<&IGlobalStateController::StartSleepSequence>, "StartSleepSequence"}, {3, D<&IGlobalStateController::StartShutdownSequence>, "StartShutdownSequence"}, {4, D<&IGlobalStateController::StartRebootSequence>, "StartRebootSequence"}, {9, nullptr, "IsAutoPowerDownRequested"}, @@ -31,6 +31,14 @@ IGlobalStateController::IGlobalStateController(Core::System& system_) RegisterHandlers(functions); } +IGlobalStateController::~IGlobalStateController() = default; + +Result IGlobalStateController::StartSleepSequence(u8 a) { + LOG_WARNING(Service_AM, "called, a={}", a); + system.Pause(); + R_SUCCEED(); +} + Result IGlobalStateController::StartShutdownSequence() { LOG_INFO(Service_AM, "called"); system.Exit(); @@ -43,8 +51,6 @@ Result IGlobalStateController::StartRebootSequence() { R_SUCCEED(); } -IGlobalStateController::~IGlobalStateController() = default; - Result IGlobalStateController::LoadAndApplyIdlePolicySettings() { LOG_WARNING(Service_AM, "(STUBBED) called"); R_SUCCEED(); diff --git a/src/core/hle/service/am/service/global_state_controller.h b/src/core/hle/service/am/service/global_state_controller.h index 83efb57dfc..e0f1d46cc1 100644 --- a/src/core/hle/service/am/service/global_state_controller.h +++ b/src/core/hle/service/am/service/global_state_controller.h @@ -18,6 +18,7 @@ public: ~IGlobalStateController() override; private: + Result StartSleepSequence(u8 a); Result StartShutdownSequence(); Result StartRebootSequence(); Result LoadAndApplyIdlePolicySettings(); diff --git a/src/core/hle/service/am/service/home_menu_functions.cpp b/src/core/hle/service/am/service/home_menu_functions.cpp index 25f78beb5a..47a10dceb3 100644 --- a/src/core/hle/service/am/service/home_menu_functions.cpp +++ b/src/core/hle/service/am/service/home_menu_functions.cpp @@ -23,7 +23,7 @@ IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_, std::shared_ptr, "GetPopFromGeneralChannelEvent"}, {30, nullptr, "GetHomeButtonWriterLockAccessor"}, {31, nullptr, "GetWriterLockAccessorEx"}, - {40, nullptr, "IsSleepEnabled"}, + {40, D<&IHomeMenuFunctions::IsSleepEnabled>, "IsSleepEnabled"}, {41, D<&IHomeMenuFunctions::IsRebootEnabled>, "IsRebootEnabled"}, {50, nullptr, "LaunchSystemApplet"}, {51, nullptr, "LaunchStarter"}, @@ -64,6 +64,12 @@ Result IHomeMenuFunctions::GetPopFromGeneralChannelEvent( R_SUCCEED(); } +Result IHomeMenuFunctions::IsSleepEnabled(Out out_is_sleep_enbaled) { + LOG_INFO(Service_AM, "called"); + *out_is_sleep_enbaled = true; + R_SUCCEED(); +} + Result IHomeMenuFunctions::IsRebootEnabled(Out out_is_reboot_enbaled) { LOG_INFO(Service_AM, "called"); *out_is_reboot_enbaled = true; diff --git a/src/core/hle/service/am/service/home_menu_functions.h b/src/core/hle/service/am/service/home_menu_functions.h index f56094aa9d..e393898e35 100644 --- a/src/core/hle/service/am/service/home_menu_functions.h +++ b/src/core/hle/service/am/service/home_menu_functions.h @@ -24,6 +24,7 @@ private: Result LockForeground(); Result UnlockForeground(); Result GetPopFromGeneralChannelEvent(OutCopyHandle out_event); + Result IsSleepEnabled(Out out_is_sleep_enbaled); Result IsRebootEnabled(Out out_is_reboot_enbaled); Result IsForceTerminateApplicationDisabledForDebug( Out out_is_force_terminate_application_disabled_for_debug); From aaff9411ece615fb580ccd3d991fbc3503487d8c Mon Sep 17 00:00:00 2001 From: niansa Date: Sat, 9 Mar 2024 17:06:00 +0100 Subject: [PATCH 12/23] Stub out StartSleepSequence --- src/core/hle/service/am/service/global_state_controller.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/hle/service/am/service/global_state_controller.cpp b/src/core/hle/service/am/service/global_state_controller.cpp index a985b1925d..aa8f852fea 100644 --- a/src/core/hle/service/am/service/global_state_controller.cpp +++ b/src/core/hle/service/am/service/global_state_controller.cpp @@ -34,8 +34,7 @@ IGlobalStateController::IGlobalStateController(Core::System& system_) IGlobalStateController::~IGlobalStateController() = default; Result IGlobalStateController::StartSleepSequence(u8 a) { - LOG_WARNING(Service_AM, "called, a={}", a); - system.Pause(); + LOG_WARNING(Service_AM, "(STUBBED) called, a={}", a); R_SUCCEED(); } From 94251409c15ba3d54c6fb57493c794ad1dcc3f72 Mon Sep 17 00:00:00 2001 From: niansa Date: Sun, 10 Mar 2024 02:26:03 +0100 Subject: [PATCH 13/23] Implemented some stubs for Health & Safety and corrected GetGroupInfo behavior --- .../hle/service/am/service/common_state_getter.cpp | 14 +++++++++++++- .../hle/service/am/service/common_state_getter.h | 1 + src/core/hle/service/filesystem/fsp/fsp_srv.cpp | 10 +++++++++- src/core/hle/service/filesystem/fsp/fsp_srv.h | 1 + src/core/hle/service/ldn/sf_monitor_service.cpp | 4 ++-- src/core/hle/service/ldn/sf_monitor_service.h | 2 +- src/core/hle/service/nifm/nifm.cpp | 2 +- src/core/hle/service/set/settings_types.h | 8 ++++++++ .../hle/service/set/system_settings_server.cpp | 11 ++++++++++- src/core/hle/service/set/system_settings_server.h | 1 + 10 files changed, 47 insertions(+), 7 deletions(-) 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 f523bcd9e6..501837b531 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"}, @@ -159,6 +159,18 @@ Result ICommonStateGetter::GetBootMode(Out out_boot_mode) { R_SUCCEED(); } +Result ICommonStateGetter::GetCradleFwVersion(OutArray out_version) { + LOG_DEBUG(Service_AM, "(STUBBED) called"); + + out_version[0] = 0; + out_version[1] = 0; + out_version[2] = 0; + out_version[3] = 0; + + 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 59a46fa94f..8c80e5bdbb 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(OutArray out_version); 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/filesystem/fsp/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp index 60290f1a6e..2bc6361bb7 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"}, @@ -235,6 +235,14 @@ Result FSP_SRV::CreateSaveDataFileSystem(FileSys::SaveDataCreationInfo save_crea save_struct)); } +Result FSP_SRV::IsExFatSupported(Out out_is_supported) { + LOG_WARNING(Service_FS, "(STUBBED) called"); + + *out_is_supported = true; + + R_SUCCEED(); +} + Result FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId( FileSys::SaveDataAttribute save_struct, FileSys::SaveDataCreationInfo save_create_struct) { LOG_DEBUG(Service_FS, "called save_struct = {}", save_struct.DebugInfo()); diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.h b/src/core/hle/service/filesystem/fsp/fsp_srv.h index b565cace04..865fdae7c4 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.h +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.h @@ -53,6 +53,7 @@ private: Result OpenSdCardFileSystem(OutInterface out_interface); Result CreateSaveDataFileSystem(FileSys::SaveDataCreationInfo save_create_struct, FileSys::SaveDataAttribute save_struct, u128 uid); + Result IsExFatSupported(Out out_is_supported); Result CreateSaveDataFileSystemBySystemSaveDataId( FileSys::SaveDataAttribute save_struct, FileSys::SaveDataCreationInfo save_create_struct); Result OpenSaveDataFileSystem(OutInterface out_interface, diff --git a/src/core/hle/service/ldn/sf_monitor_service.cpp b/src/core/hle/service/ldn/sf_monitor_service.cpp index 9e6736ff2c..a5ff7a043c 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.cpp +++ b/src/core/hle/service/ldn/sf_monitor_service.cpp @@ -29,11 +29,11 @@ Result ISfMonitorService::Initialize(Out out_value) { R_SUCCEED(); } -Result ISfMonitorService::GetGroupInfo( +Result ISfMonitorService::GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info) { LOG_WARNING(Service_LDN, "(STUBBED) called"); - *out_group_info = GroupInfo{}; + memcpy(out_group_info, &in_group_info, sizeof(GroupInfo)); R_SUCCEED(); } diff --git a/src/core/hle/service/ldn/sf_monitor_service.h b/src/core/hle/service/ldn/sf_monitor_service.h index d021152010..50cceb25b0 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.h +++ b/src/core/hle/service/ldn/sf_monitor_service.h @@ -20,7 +20,7 @@ public: private: Result Initialize(Out out_value); - Result GetGroupInfo(OutLargeData out_group_info); + Result GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info); }; } // namespace Service::LDN diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 060fe86dd8..2202e3d899 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -507,7 +507,7 @@ void IGeneralService::GetCurrentIpConfigInfo(HLERequestContext& ctx) { } void IGeneralService::IsWirelessCommunicationEnabled(HLERequestContext& ctx) { - LOG_WARNING(Service_NIFM, "(STUBBED) called"); + LOG_WARNING(Service_NIFM, "called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); diff --git a/src/core/hle/service/set/settings_types.h b/src/core/hle/service/set/settings_types.h index 848722e196..bb268c3396 100644 --- a/src/core/hle/service/set/settings_types.h +++ b/src/core/hle/service/set/settings_types.h @@ -509,4 +509,12 @@ struct TvSettings { }; static_assert(sizeof(TvSettings) == 0x20, "TvSettings is an invalid size"); +/// This is nn::settings::system::RebootlessSystemUpdateVersion +struct RebootlessSystemUpdateVersion { + u32 version; + u8 reserved[0x1c]; + char display_version[0x20]; +}; +static_assert(sizeof(RebootlessSystemUpdateVersion) == 0x40, "RebootlessSystemUpdateVersion is an invalid size"); + } // namespace Service::Set diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp index a5a39fcc2b..635fd6df2f 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"}, @@ -1194,6 +1194,15 @@ Result ISystemSettingsServer::SetKeyboardLayout(KeyboardLayout keyboard_layout) R_SUCCEED(); } +Result ISystemSettingsServer::GetRebootlessSystemUpdateVersion(Out out_rebootless_system_update) { + LOG_INFO(Service_SET, "(STUBBED) called"); + + out_rebootless_system_update->version = 0; + strcpy(out_rebootless_system_update->display_version, "0.0.0"); + + 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 993e5de7d0..ccce4eb3d8 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(Out out_rebootless_system_update); Result GetDeviceTimeZoneLocationUpdatedTime( Out out_time_point); Result SetDeviceTimeZoneLocationUpdatedTime( From 7295a6c1adeb3513ccb6eaf17acd2298cab63041 Mon Sep 17 00:00:00 2001 From: niansa Date: Sun, 10 Mar 2024 02:28:59 +0100 Subject: [PATCH 14/23] Apply GetGroupInfo fix to ISfServiceMonitor too --- src/core/hle/service/ldn/sf_service_monitor.cpp | 4 ++-- src/core/hle/service/ldn/sf_service_monitor.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/hle/service/ldn/sf_service_monitor.cpp b/src/core/hle/service/ldn/sf_service_monitor.cpp index 33e3c1d69a..853db48937 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.cpp +++ b/src/core/hle/service/ldn/sf_service_monitor.cpp @@ -39,11 +39,11 @@ Result ISfServiceMonitor::Initialize(Out out_value) { R_SUCCEED(); } -Result ISfServiceMonitor::GetGroupInfo( +Result ISfServiceMonitor::GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info) { LOG_WARNING(Service_LDN, "(STUBBED) called"); - *out_group_info = GroupInfo{}; + memcpy(out_group_info, &in_group_info, sizeof(GroupInfo)); R_SUCCEED(); } diff --git a/src/core/hle/service/ldn/sf_service_monitor.h b/src/core/hle/service/ldn/sf_service_monitor.h index 3cfc5005eb..08813ef5ae 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.h +++ b/src/core/hle/service/ldn/sf_service_monitor.h @@ -20,7 +20,7 @@ public: private: Result Initialize(Out out_value); - Result GetGroupInfo(OutLargeData out_group_info); + Result GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info); }; } // namespace Service::LDN From c433758ed0083071f2a0d19ceaad16084b6da633 Mon Sep 17 00:00:00 2001 From: niansa Date: Sun, 10 Mar 2024 02:29:40 +0100 Subject: [PATCH 15/23] Run clang-format --- src/core/hle/service/am/service/common_state_getter.cpp | 1 - src/core/hle/service/ldn/sf_monitor_service.cpp | 4 ++-- src/core/hle/service/ldn/sf_monitor_service.h | 3 ++- src/core/hle/service/ldn/sf_service_monitor.cpp | 4 ++-- src/core/hle/service/ldn/sf_service_monitor.h | 3 ++- src/core/hle/service/set/settings_types.h | 3 ++- src/core/hle/service/set/system_settings_server.cpp | 3 ++- src/core/hle/service/set/system_settings_server.h | 3 ++- 8 files changed, 14 insertions(+), 10 deletions(-) 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 501837b531..f20071156e 100644 --- a/src/core/hle/service/am/service/common_state_getter.cpp +++ b/src/core/hle/service/am/service/common_state_getter.cpp @@ -170,7 +170,6 @@ Result ICommonStateGetter::GetCradleFwVersion(OutArray out_version) R_SUCCEED(); } - Result ICommonStateGetter::IsVrModeEnabled(Out out_is_vr_mode_enabled) { LOG_DEBUG(Service_AM, "called"); diff --git a/src/core/hle/service/ldn/sf_monitor_service.cpp b/src/core/hle/service/ldn/sf_monitor_service.cpp index a5ff7a043c..0a23d6b8ea 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.cpp +++ b/src/core/hle/service/ldn/sf_monitor_service.cpp @@ -29,8 +29,8 @@ Result ISfMonitorService::Initialize(Out out_value) { R_SUCCEED(); } -Result ISfMonitorService::GetGroupInfo(GroupInfo in_group_info, - OutLargeData out_group_info) { +Result ISfMonitorService::GetGroupInfo( + GroupInfo in_group_info, OutLargeData out_group_info) { LOG_WARNING(Service_LDN, "(STUBBED) called"); memcpy(out_group_info, &in_group_info, sizeof(GroupInfo)); diff --git a/src/core/hle/service/ldn/sf_monitor_service.h b/src/core/hle/service/ldn/sf_monitor_service.h index 50cceb25b0..5878b030c2 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.h +++ b/src/core/hle/service/ldn/sf_monitor_service.h @@ -20,7 +20,8 @@ public: private: Result Initialize(Out out_value); - Result GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info); + Result GetGroupInfo(GroupInfo in_group_info, + OutLargeData out_group_info); }; } // namespace Service::LDN diff --git a/src/core/hle/service/ldn/sf_service_monitor.cpp b/src/core/hle/service/ldn/sf_service_monitor.cpp index 853db48937..e35754d127 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.cpp +++ b/src/core/hle/service/ldn/sf_service_monitor.cpp @@ -39,8 +39,8 @@ Result ISfServiceMonitor::Initialize(Out out_value) { R_SUCCEED(); } -Result ISfServiceMonitor::GetGroupInfo(GroupInfo in_group_info, - OutLargeData out_group_info) { +Result ISfServiceMonitor::GetGroupInfo( + GroupInfo in_group_info, OutLargeData out_group_info) { LOG_WARNING(Service_LDN, "(STUBBED) called"); memcpy(out_group_info, &in_group_info, sizeof(GroupInfo)); diff --git a/src/core/hle/service/ldn/sf_service_monitor.h b/src/core/hle/service/ldn/sf_service_monitor.h index 08813ef5ae..90cdd5cdd4 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.h +++ b/src/core/hle/service/ldn/sf_service_monitor.h @@ -20,7 +20,8 @@ public: private: Result Initialize(Out out_value); - Result GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info); + Result GetGroupInfo(GroupInfo in_group_info, + OutLargeData out_group_info); }; } // namespace Service::LDN diff --git a/src/core/hle/service/set/settings_types.h b/src/core/hle/service/set/settings_types.h index bb268c3396..8cf34efc1a 100644 --- a/src/core/hle/service/set/settings_types.h +++ b/src/core/hle/service/set/settings_types.h @@ -515,6 +515,7 @@ struct RebootlessSystemUpdateVersion { u8 reserved[0x1c]; char display_version[0x20]; }; -static_assert(sizeof(RebootlessSystemUpdateVersion) == 0x40, "RebootlessSystemUpdateVersion is an invalid size"); +static_assert(sizeof(RebootlessSystemUpdateVersion) == 0x40, + "RebootlessSystemUpdateVersion is an invalid size"); } // namespace Service::Set diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp index 635fd6df2f..254fdd2e96 100644 --- a/src/core/hle/service/set/system_settings_server.cpp +++ b/src/core/hle/service/set/system_settings_server.cpp @@ -1194,7 +1194,8 @@ Result ISystemSettingsServer::SetKeyboardLayout(KeyboardLayout keyboard_layout) R_SUCCEED(); } -Result ISystemSettingsServer::GetRebootlessSystemUpdateVersion(Out out_rebootless_system_update) { +Result ISystemSettingsServer::GetRebootlessSystemUpdateVersion( + Out out_rebootless_system_update) { LOG_INFO(Service_SET, "(STUBBED) called"); out_rebootless_system_update->version = 0; diff --git a/src/core/hle/service/set/system_settings_server.h b/src/core/hle/service/set/system_settings_server.h index ccce4eb3d8..7e16300c30 100644 --- a/src/core/hle/service/set/system_settings_server.h +++ b/src/core/hle/service/set/system_settings_server.h @@ -136,7 +136,8 @@ public: Result SetAppletLaunchFlags(u32 applet_launch_flag); Result GetKeyboardLayout(Out out_keyboard_layout); Result SetKeyboardLayout(KeyboardLayout keyboard_layout); - Result GetRebootlessSystemUpdateVersion(Out out_rebootless_system_update); + Result GetRebootlessSystemUpdateVersion( + Out out_rebootless_system_update); Result GetDeviceTimeZoneLocationUpdatedTime( Out out_time_point); Result SetDeviceTimeZoneLocationUpdatedTime( From ee4fd3b2cee6e54f6825358ebf611cd9e0020ce1 Mon Sep 17 00:00:00 2001 From: JuanCStar Date: Mon, 18 Mar 2024 09:28:27 +0100 Subject: [PATCH 16/23] fix: typo error --- src/core/hle/service/am/service/home_menu_functions.cpp | 8 ++++---- src/core/hle/service/am/service/home_menu_functions.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/hle/service/am/service/home_menu_functions.cpp b/src/core/hle/service/am/service/home_menu_functions.cpp index 47a10dceb3..f17a8522fb 100644 --- a/src/core/hle/service/am/service/home_menu_functions.cpp +++ b/src/core/hle/service/am/service/home_menu_functions.cpp @@ -64,15 +64,15 @@ Result IHomeMenuFunctions::GetPopFromGeneralChannelEvent( R_SUCCEED(); } -Result IHomeMenuFunctions::IsSleepEnabled(Out out_is_sleep_enbaled) { +Result IHomeMenuFunctions::IsSleepEnabled(Out out_is_sleep_enabled) { LOG_INFO(Service_AM, "called"); - *out_is_sleep_enbaled = true; + *out_is_sleep_enabled = true; R_SUCCEED(); } -Result IHomeMenuFunctions::IsRebootEnabled(Out out_is_reboot_enbaled) { +Result IHomeMenuFunctions::IsRebootEnabled(Out out_is_reboot_enabled) { LOG_INFO(Service_AM, "called"); - *out_is_reboot_enbaled = true; + *out_is_reboot_enabled = true; R_SUCCEED(); } diff --git a/src/core/hle/service/am/service/home_menu_functions.h b/src/core/hle/service/am/service/home_menu_functions.h index e393898e35..28ed9bf0ec 100644 --- a/src/core/hle/service/am/service/home_menu_functions.h +++ b/src/core/hle/service/am/service/home_menu_functions.h @@ -24,8 +24,8 @@ private: Result LockForeground(); Result UnlockForeground(); Result GetPopFromGeneralChannelEvent(OutCopyHandle out_event); - Result IsSleepEnabled(Out out_is_sleep_enbaled); - Result IsRebootEnabled(Out out_is_reboot_enbaled); + Result IsSleepEnabled(Out out_is_sleep_enabled); + Result IsRebootEnabled(Out out_is_reboot_enabled); Result IsForceTerminateApplicationDisabledForDebug( Out out_is_force_terminate_application_disabled_for_debug); From a24ee4b6c1bb68b9932c5298143dc82de766f0d0 Mon Sep 17 00:00:00 2001 From: Crimson Hawk Date: Mon, 18 Mar 2024 09:16:46 +0000 Subject: [PATCH 17/23] Update format tag in format stage --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0a251e87b9..ff4469c5ff 100755 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,6 +31,7 @@ clang-format: # - Linux # - Windows - Parallelized + - Format #LINUX BUILD - BUILDS LINUX APPIMAGE build-linux: From 2a148c769900ad2f4583f4d08d18f048c4e32779 Mon Sep 17 00:00:00 2001 From: niansa Date: Sat, 9 Mar 2024 04:23:16 +0100 Subject: [PATCH 18/23] Implemented some basic sleep functions --- .../service/am/service/global_state_controller.cpp | 12 +++++++++--- .../hle/service/am/service/global_state_controller.h | 1 + .../hle/service/am/service/home_menu_functions.cpp | 8 +++++++- .../hle/service/am/service/home_menu_functions.h | 1 + 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/core/hle/service/am/service/global_state_controller.cpp b/src/core/hle/service/am/service/global_state_controller.cpp index 3e3b61b0a0..a985b1925d 100644 --- a/src/core/hle/service/am/service/global_state_controller.cpp +++ b/src/core/hle/service/am/service/global_state_controller.cpp @@ -14,7 +14,7 @@ IGlobalStateController::IGlobalStateController(Core::System& system_) static const FunctionInfo functions[] = { {0, nullptr, "RequestToEnterSleep"}, {1, nullptr, "EnterSleep"}, - {2, nullptr, "StartSleepSequence"}, + {2, D<&IGlobalStateController::StartSleepSequence>, "StartSleepSequence"}, {3, D<&IGlobalStateController::StartShutdownSequence>, "StartShutdownSequence"}, {4, D<&IGlobalStateController::StartRebootSequence>, "StartRebootSequence"}, {9, nullptr, "IsAutoPowerDownRequested"}, @@ -31,6 +31,14 @@ IGlobalStateController::IGlobalStateController(Core::System& system_) RegisterHandlers(functions); } +IGlobalStateController::~IGlobalStateController() = default; + +Result IGlobalStateController::StartSleepSequence(u8 a) { + LOG_WARNING(Service_AM, "called, a={}", a); + system.Pause(); + R_SUCCEED(); +} + Result IGlobalStateController::StartShutdownSequence() { LOG_INFO(Service_AM, "called"); system.Exit(); @@ -43,8 +51,6 @@ Result IGlobalStateController::StartRebootSequence() { R_SUCCEED(); } -IGlobalStateController::~IGlobalStateController() = default; - Result IGlobalStateController::LoadAndApplyIdlePolicySettings() { LOG_WARNING(Service_AM, "(STUBBED) called"); R_SUCCEED(); diff --git a/src/core/hle/service/am/service/global_state_controller.h b/src/core/hle/service/am/service/global_state_controller.h index 83efb57dfc..e0f1d46cc1 100644 --- a/src/core/hle/service/am/service/global_state_controller.h +++ b/src/core/hle/service/am/service/global_state_controller.h @@ -18,6 +18,7 @@ public: ~IGlobalStateController() override; private: + Result StartSleepSequence(u8 a); Result StartShutdownSequence(); Result StartRebootSequence(); Result LoadAndApplyIdlePolicySettings(); diff --git a/src/core/hle/service/am/service/home_menu_functions.cpp b/src/core/hle/service/am/service/home_menu_functions.cpp index 25f78beb5a..47a10dceb3 100644 --- a/src/core/hle/service/am/service/home_menu_functions.cpp +++ b/src/core/hle/service/am/service/home_menu_functions.cpp @@ -23,7 +23,7 @@ IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_, std::shared_ptr, "GetPopFromGeneralChannelEvent"}, {30, nullptr, "GetHomeButtonWriterLockAccessor"}, {31, nullptr, "GetWriterLockAccessorEx"}, - {40, nullptr, "IsSleepEnabled"}, + {40, D<&IHomeMenuFunctions::IsSleepEnabled>, "IsSleepEnabled"}, {41, D<&IHomeMenuFunctions::IsRebootEnabled>, "IsRebootEnabled"}, {50, nullptr, "LaunchSystemApplet"}, {51, nullptr, "LaunchStarter"}, @@ -64,6 +64,12 @@ Result IHomeMenuFunctions::GetPopFromGeneralChannelEvent( R_SUCCEED(); } +Result IHomeMenuFunctions::IsSleepEnabled(Out out_is_sleep_enbaled) { + LOG_INFO(Service_AM, "called"); + *out_is_sleep_enbaled = true; + R_SUCCEED(); +} + Result IHomeMenuFunctions::IsRebootEnabled(Out out_is_reboot_enbaled) { LOG_INFO(Service_AM, "called"); *out_is_reboot_enbaled = true; diff --git a/src/core/hle/service/am/service/home_menu_functions.h b/src/core/hle/service/am/service/home_menu_functions.h index f56094aa9d..e393898e35 100644 --- a/src/core/hle/service/am/service/home_menu_functions.h +++ b/src/core/hle/service/am/service/home_menu_functions.h @@ -24,6 +24,7 @@ private: Result LockForeground(); Result UnlockForeground(); Result GetPopFromGeneralChannelEvent(OutCopyHandle out_event); + Result IsSleepEnabled(Out out_is_sleep_enbaled); Result IsRebootEnabled(Out out_is_reboot_enbaled); Result IsForceTerminateApplicationDisabledForDebug( Out out_is_force_terminate_application_disabled_for_debug); From 796ca0243765cf56af83b459c200c4c62050fedd Mon Sep 17 00:00:00 2001 From: niansa Date: Sat, 9 Mar 2024 17:06:00 +0100 Subject: [PATCH 19/23] Stub out StartSleepSequence --- src/core/hle/service/am/service/global_state_controller.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/hle/service/am/service/global_state_controller.cpp b/src/core/hle/service/am/service/global_state_controller.cpp index a985b1925d..aa8f852fea 100644 --- a/src/core/hle/service/am/service/global_state_controller.cpp +++ b/src/core/hle/service/am/service/global_state_controller.cpp @@ -34,8 +34,7 @@ IGlobalStateController::IGlobalStateController(Core::System& system_) IGlobalStateController::~IGlobalStateController() = default; Result IGlobalStateController::StartSleepSequence(u8 a) { - LOG_WARNING(Service_AM, "called, a={}", a); - system.Pause(); + LOG_WARNING(Service_AM, "(STUBBED) called, a={}", a); R_SUCCEED(); } From 2ba2db779518e5daddaa425636e7bb1cafc10e22 Mon Sep 17 00:00:00 2001 From: niansa Date: Sun, 10 Mar 2024 02:26:03 +0100 Subject: [PATCH 20/23] Implemented some stubs for Health & Safety and corrected GetGroupInfo behavior --- .../hle/service/am/service/common_state_getter.cpp | 14 +++++++++++++- .../hle/service/am/service/common_state_getter.h | 1 + src/core/hle/service/filesystem/fsp/fsp_srv.cpp | 10 +++++++++- src/core/hle/service/filesystem/fsp/fsp_srv.h | 1 + src/core/hle/service/ldn/sf_monitor_service.cpp | 4 ++-- src/core/hle/service/ldn/sf_monitor_service.h | 2 +- src/core/hle/service/nifm/nifm.cpp | 2 +- src/core/hle/service/set/settings_types.h | 8 ++++++++ .../hle/service/set/system_settings_server.cpp | 11 ++++++++++- src/core/hle/service/set/system_settings_server.h | 1 + 10 files changed, 47 insertions(+), 7 deletions(-) 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 f523bcd9e6..501837b531 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"}, @@ -159,6 +159,18 @@ Result ICommonStateGetter::GetBootMode(Out out_boot_mode) { R_SUCCEED(); } +Result ICommonStateGetter::GetCradleFwVersion(OutArray out_version) { + LOG_DEBUG(Service_AM, "(STUBBED) called"); + + out_version[0] = 0; + out_version[1] = 0; + out_version[2] = 0; + out_version[3] = 0; + + 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 59a46fa94f..8c80e5bdbb 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(OutArray out_version); 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/filesystem/fsp/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp index 60290f1a6e..2bc6361bb7 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"}, @@ -235,6 +235,14 @@ Result FSP_SRV::CreateSaveDataFileSystem(FileSys::SaveDataCreationInfo save_crea save_struct)); } +Result FSP_SRV::IsExFatSupported(Out out_is_supported) { + LOG_WARNING(Service_FS, "(STUBBED) called"); + + *out_is_supported = true; + + R_SUCCEED(); +} + Result FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId( FileSys::SaveDataAttribute save_struct, FileSys::SaveDataCreationInfo save_create_struct) { LOG_DEBUG(Service_FS, "called save_struct = {}", save_struct.DebugInfo()); diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.h b/src/core/hle/service/filesystem/fsp/fsp_srv.h index b565cace04..865fdae7c4 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.h +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.h @@ -53,6 +53,7 @@ private: Result OpenSdCardFileSystem(OutInterface out_interface); Result CreateSaveDataFileSystem(FileSys::SaveDataCreationInfo save_create_struct, FileSys::SaveDataAttribute save_struct, u128 uid); + Result IsExFatSupported(Out out_is_supported); Result CreateSaveDataFileSystemBySystemSaveDataId( FileSys::SaveDataAttribute save_struct, FileSys::SaveDataCreationInfo save_create_struct); Result OpenSaveDataFileSystem(OutInterface out_interface, diff --git a/src/core/hle/service/ldn/sf_monitor_service.cpp b/src/core/hle/service/ldn/sf_monitor_service.cpp index 9e6736ff2c..a5ff7a043c 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.cpp +++ b/src/core/hle/service/ldn/sf_monitor_service.cpp @@ -29,11 +29,11 @@ Result ISfMonitorService::Initialize(Out out_value) { R_SUCCEED(); } -Result ISfMonitorService::GetGroupInfo( +Result ISfMonitorService::GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info) { LOG_WARNING(Service_LDN, "(STUBBED) called"); - *out_group_info = GroupInfo{}; + memcpy(out_group_info, &in_group_info, sizeof(GroupInfo)); R_SUCCEED(); } diff --git a/src/core/hle/service/ldn/sf_monitor_service.h b/src/core/hle/service/ldn/sf_monitor_service.h index d021152010..50cceb25b0 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.h +++ b/src/core/hle/service/ldn/sf_monitor_service.h @@ -20,7 +20,7 @@ public: private: Result Initialize(Out out_value); - Result GetGroupInfo(OutLargeData out_group_info); + Result GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info); }; } // namespace Service::LDN diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 060fe86dd8..2202e3d899 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -507,7 +507,7 @@ void IGeneralService::GetCurrentIpConfigInfo(HLERequestContext& ctx) { } void IGeneralService::IsWirelessCommunicationEnabled(HLERequestContext& ctx) { - LOG_WARNING(Service_NIFM, "(STUBBED) called"); + LOG_WARNING(Service_NIFM, "called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); diff --git a/src/core/hle/service/set/settings_types.h b/src/core/hle/service/set/settings_types.h index 848722e196..bb268c3396 100644 --- a/src/core/hle/service/set/settings_types.h +++ b/src/core/hle/service/set/settings_types.h @@ -509,4 +509,12 @@ struct TvSettings { }; static_assert(sizeof(TvSettings) == 0x20, "TvSettings is an invalid size"); +/// This is nn::settings::system::RebootlessSystemUpdateVersion +struct RebootlessSystemUpdateVersion { + u32 version; + u8 reserved[0x1c]; + char display_version[0x20]; +}; +static_assert(sizeof(RebootlessSystemUpdateVersion) == 0x40, "RebootlessSystemUpdateVersion is an invalid size"); + } // namespace Service::Set diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp index a5a39fcc2b..635fd6df2f 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"}, @@ -1194,6 +1194,15 @@ Result ISystemSettingsServer::SetKeyboardLayout(KeyboardLayout keyboard_layout) R_SUCCEED(); } +Result ISystemSettingsServer::GetRebootlessSystemUpdateVersion(Out out_rebootless_system_update) { + LOG_INFO(Service_SET, "(STUBBED) called"); + + out_rebootless_system_update->version = 0; + strcpy(out_rebootless_system_update->display_version, "0.0.0"); + + 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 993e5de7d0..ccce4eb3d8 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(Out out_rebootless_system_update); Result GetDeviceTimeZoneLocationUpdatedTime( Out out_time_point); Result SetDeviceTimeZoneLocationUpdatedTime( From 2682e7739a7dc99ccc7d97ac48b1b054a70d9ad0 Mon Sep 17 00:00:00 2001 From: niansa Date: Sun, 10 Mar 2024 02:28:59 +0100 Subject: [PATCH 21/23] Apply GetGroupInfo fix to ISfServiceMonitor too --- src/core/hle/service/ldn/sf_service_monitor.cpp | 4 ++-- src/core/hle/service/ldn/sf_service_monitor.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/hle/service/ldn/sf_service_monitor.cpp b/src/core/hle/service/ldn/sf_service_monitor.cpp index 33e3c1d69a..853db48937 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.cpp +++ b/src/core/hle/service/ldn/sf_service_monitor.cpp @@ -39,11 +39,11 @@ Result ISfServiceMonitor::Initialize(Out out_value) { R_SUCCEED(); } -Result ISfServiceMonitor::GetGroupInfo( +Result ISfServiceMonitor::GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info) { LOG_WARNING(Service_LDN, "(STUBBED) called"); - *out_group_info = GroupInfo{}; + memcpy(out_group_info, &in_group_info, sizeof(GroupInfo)); R_SUCCEED(); } diff --git a/src/core/hle/service/ldn/sf_service_monitor.h b/src/core/hle/service/ldn/sf_service_monitor.h index 3cfc5005eb..08813ef5ae 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.h +++ b/src/core/hle/service/ldn/sf_service_monitor.h @@ -20,7 +20,7 @@ public: private: Result Initialize(Out out_value); - Result GetGroupInfo(OutLargeData out_group_info); + Result GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info); }; } // namespace Service::LDN From b4163895330259a8d1fb36314c97021e313f72d1 Mon Sep 17 00:00:00 2001 From: niansa Date: Sun, 10 Mar 2024 02:29:40 +0100 Subject: [PATCH 22/23] Run clang-format --- src/core/hle/service/am/service/common_state_getter.cpp | 1 - src/core/hle/service/ldn/sf_monitor_service.cpp | 4 ++-- src/core/hle/service/ldn/sf_monitor_service.h | 3 ++- src/core/hle/service/ldn/sf_service_monitor.cpp | 4 ++-- src/core/hle/service/ldn/sf_service_monitor.h | 3 ++- src/core/hle/service/set/settings_types.h | 3 ++- src/core/hle/service/set/system_settings_server.cpp | 3 ++- src/core/hle/service/set/system_settings_server.h | 3 ++- 8 files changed, 14 insertions(+), 10 deletions(-) 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 501837b531..f20071156e 100644 --- a/src/core/hle/service/am/service/common_state_getter.cpp +++ b/src/core/hle/service/am/service/common_state_getter.cpp @@ -170,7 +170,6 @@ Result ICommonStateGetter::GetCradleFwVersion(OutArray out_version) R_SUCCEED(); } - Result ICommonStateGetter::IsVrModeEnabled(Out out_is_vr_mode_enabled) { LOG_DEBUG(Service_AM, "called"); diff --git a/src/core/hle/service/ldn/sf_monitor_service.cpp b/src/core/hle/service/ldn/sf_monitor_service.cpp index a5ff7a043c..0a23d6b8ea 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.cpp +++ b/src/core/hle/service/ldn/sf_monitor_service.cpp @@ -29,8 +29,8 @@ Result ISfMonitorService::Initialize(Out out_value) { R_SUCCEED(); } -Result ISfMonitorService::GetGroupInfo(GroupInfo in_group_info, - OutLargeData out_group_info) { +Result ISfMonitorService::GetGroupInfo( + GroupInfo in_group_info, OutLargeData out_group_info) { LOG_WARNING(Service_LDN, "(STUBBED) called"); memcpy(out_group_info, &in_group_info, sizeof(GroupInfo)); diff --git a/src/core/hle/service/ldn/sf_monitor_service.h b/src/core/hle/service/ldn/sf_monitor_service.h index 50cceb25b0..5878b030c2 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.h +++ b/src/core/hle/service/ldn/sf_monitor_service.h @@ -20,7 +20,8 @@ public: private: Result Initialize(Out out_value); - Result GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info); + Result GetGroupInfo(GroupInfo in_group_info, + OutLargeData out_group_info); }; } // namespace Service::LDN diff --git a/src/core/hle/service/ldn/sf_service_monitor.cpp b/src/core/hle/service/ldn/sf_service_monitor.cpp index 853db48937..e35754d127 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.cpp +++ b/src/core/hle/service/ldn/sf_service_monitor.cpp @@ -39,8 +39,8 @@ Result ISfServiceMonitor::Initialize(Out out_value) { R_SUCCEED(); } -Result ISfServiceMonitor::GetGroupInfo(GroupInfo in_group_info, - OutLargeData out_group_info) { +Result ISfServiceMonitor::GetGroupInfo( + GroupInfo in_group_info, OutLargeData out_group_info) { LOG_WARNING(Service_LDN, "(STUBBED) called"); memcpy(out_group_info, &in_group_info, sizeof(GroupInfo)); diff --git a/src/core/hle/service/ldn/sf_service_monitor.h b/src/core/hle/service/ldn/sf_service_monitor.h index 08813ef5ae..90cdd5cdd4 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.h +++ b/src/core/hle/service/ldn/sf_service_monitor.h @@ -20,7 +20,8 @@ public: private: Result Initialize(Out out_value); - Result GetGroupInfo(GroupInfo in_group_info, OutLargeData out_group_info); + Result GetGroupInfo(GroupInfo in_group_info, + OutLargeData out_group_info); }; } // namespace Service::LDN diff --git a/src/core/hle/service/set/settings_types.h b/src/core/hle/service/set/settings_types.h index bb268c3396..8cf34efc1a 100644 --- a/src/core/hle/service/set/settings_types.h +++ b/src/core/hle/service/set/settings_types.h @@ -515,6 +515,7 @@ struct RebootlessSystemUpdateVersion { u8 reserved[0x1c]; char display_version[0x20]; }; -static_assert(sizeof(RebootlessSystemUpdateVersion) == 0x40, "RebootlessSystemUpdateVersion is an invalid size"); +static_assert(sizeof(RebootlessSystemUpdateVersion) == 0x40, + "RebootlessSystemUpdateVersion is an invalid size"); } // namespace Service::Set diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp index 635fd6df2f..254fdd2e96 100644 --- a/src/core/hle/service/set/system_settings_server.cpp +++ b/src/core/hle/service/set/system_settings_server.cpp @@ -1194,7 +1194,8 @@ Result ISystemSettingsServer::SetKeyboardLayout(KeyboardLayout keyboard_layout) R_SUCCEED(); } -Result ISystemSettingsServer::GetRebootlessSystemUpdateVersion(Out out_rebootless_system_update) { +Result ISystemSettingsServer::GetRebootlessSystemUpdateVersion( + Out out_rebootless_system_update) { LOG_INFO(Service_SET, "(STUBBED) called"); out_rebootless_system_update->version = 0; diff --git a/src/core/hle/service/set/system_settings_server.h b/src/core/hle/service/set/system_settings_server.h index ccce4eb3d8..7e16300c30 100644 --- a/src/core/hle/service/set/system_settings_server.h +++ b/src/core/hle/service/set/system_settings_server.h @@ -136,7 +136,8 @@ public: Result SetAppletLaunchFlags(u32 applet_launch_flag); Result GetKeyboardLayout(Out out_keyboard_layout); Result SetKeyboardLayout(KeyboardLayout keyboard_layout); - Result GetRebootlessSystemUpdateVersion(Out out_rebootless_system_update); + Result GetRebootlessSystemUpdateVersion( + Out out_rebootless_system_update); Result GetDeviceTimeZoneLocationUpdatedTime( Out out_time_point); Result SetDeviceTimeZoneLocationUpdatedTime( From 5eaab8d69b3e80b0d37f15100c5f859436fa7fbf Mon Sep 17 00:00:00 2001 From: JuanCStar Date: Mon, 18 Mar 2024 09:28:27 +0100 Subject: [PATCH 23/23] fix: typo error --- src/core/hle/service/am/service/home_menu_functions.cpp | 8 ++++---- src/core/hle/service/am/service/home_menu_functions.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/hle/service/am/service/home_menu_functions.cpp b/src/core/hle/service/am/service/home_menu_functions.cpp index 47a10dceb3..f17a8522fb 100644 --- a/src/core/hle/service/am/service/home_menu_functions.cpp +++ b/src/core/hle/service/am/service/home_menu_functions.cpp @@ -64,15 +64,15 @@ Result IHomeMenuFunctions::GetPopFromGeneralChannelEvent( R_SUCCEED(); } -Result IHomeMenuFunctions::IsSleepEnabled(Out out_is_sleep_enbaled) { +Result IHomeMenuFunctions::IsSleepEnabled(Out out_is_sleep_enabled) { LOG_INFO(Service_AM, "called"); - *out_is_sleep_enbaled = true; + *out_is_sleep_enabled = true; R_SUCCEED(); } -Result IHomeMenuFunctions::IsRebootEnabled(Out out_is_reboot_enbaled) { +Result IHomeMenuFunctions::IsRebootEnabled(Out out_is_reboot_enabled) { LOG_INFO(Service_AM, "called"); - *out_is_reboot_enbaled = true; + *out_is_reboot_enabled = true; R_SUCCEED(); } diff --git a/src/core/hle/service/am/service/home_menu_functions.h b/src/core/hle/service/am/service/home_menu_functions.h index e393898e35..28ed9bf0ec 100644 --- a/src/core/hle/service/am/service/home_menu_functions.h +++ b/src/core/hle/service/am/service/home_menu_functions.h @@ -24,8 +24,8 @@ private: Result LockForeground(); Result UnlockForeground(); Result GetPopFromGeneralChannelEvent(OutCopyHandle out_event); - Result IsSleepEnabled(Out out_is_sleep_enbaled); - Result IsRebootEnabled(Out out_is_reboot_enbaled); + Result IsSleepEnabled(Out out_is_sleep_enabled); + Result IsRebootEnabled(Out out_is_reboot_enabled); Result IsForceTerminateApplicationDisabledForDebug( Out out_is_force_terminate_application_disabled_for_debug);