diff options
Diffstat (limited to 'src')
20 files changed, 494 insertions, 45 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index fa2d08da1..61969af2b 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -140,7 +140,7 @@ struct Values { | |||
| 140 | Category::LibraryApplet}; | 140 | Category::LibraryApplet}; |
| 141 | Setting<AppletMode> data_erase_applet_mode{linkage, AppletMode::HLE, "data_erase_applet_mode", | 141 | Setting<AppletMode> data_erase_applet_mode{linkage, AppletMode::HLE, "data_erase_applet_mode", |
| 142 | Category::LibraryApplet}; | 142 | Category::LibraryApplet}; |
| 143 | Setting<AppletMode> error_applet_mode{linkage, AppletMode::HLE, "error_applet_mode", | 143 | Setting<AppletMode> error_applet_mode{linkage, AppletMode::LLE, "error_applet_mode", |
| 144 | Category::LibraryApplet}; | 144 | Category::LibraryApplet}; |
| 145 | Setting<AppletMode> net_connect_applet_mode{linkage, AppletMode::HLE, "net_connect_applet_mode", | 145 | Setting<AppletMode> net_connect_applet_mode{linkage, AppletMode::HLE, "net_connect_applet_mode", |
| 146 | Category::LibraryApplet}; | 146 | Category::LibraryApplet}; |
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 1eb43d816..63a6da12e 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -1047,9 +1047,12 @@ add_library(core STATIC | |||
| 1047 | hle/service/spl/spl_module.h | 1047 | hle/service/spl/spl_module.h |
| 1048 | hle/service/spl/spl_results.h | 1048 | hle/service/spl/spl_results.h |
| 1049 | hle/service/spl/spl_types.h | 1049 | hle/service/spl/spl_types.h |
| 1050 | hle/service/ssl/cert_store.cpp | ||
| 1051 | hle/service/ssl/cert_store.h | ||
| 1050 | hle/service/ssl/ssl.cpp | 1052 | hle/service/ssl/ssl.cpp |
| 1051 | hle/service/ssl/ssl.h | 1053 | hle/service/ssl/ssl.h |
| 1052 | hle/service/ssl/ssl_backend.h | 1054 | hle/service/ssl/ssl_backend.h |
| 1055 | hle/service/ssl/ssl_types.h | ||
| 1053 | hle/service/usb/usb.cpp | 1056 | hle/service/usb/usb.cpp |
| 1054 | hle/service/usb/usb.h | 1057 | hle/service/usb/usb.h |
| 1055 | hle/service/vi/application_display_service.cpp | 1058 | hle/service/vi/application_display_service.cpp |
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index f21553644..fad111d44 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -25,8 +25,8 @@ | |||
| 25 | #include "core/hle/service/acc/async_context.h" | 25 | #include "core/hle/service/acc/async_context.h" |
| 26 | #include "core/hle/service/acc/errors.h" | 26 | #include "core/hle/service/acc/errors.h" |
| 27 | #include "core/hle/service/acc/profile_manager.h" | 27 | #include "core/hle/service/acc/profile_manager.h" |
| 28 | #include "core/hle/service/cmif_serialization.h" | ||
| 28 | #include "core/hle/service/glue/glue_manager.h" | 29 | #include "core/hle/service/glue/glue_manager.h" |
| 29 | #include "core/hle/service/ipc_helpers.h" | ||
| 30 | #include "core/hle/service/server_manager.h" | 30 | #include "core/hle/service/server_manager.h" |
| 31 | #include "core/loader/loader.h" | 31 | #include "core/loader/loader.h" |
| 32 | 32 | ||
| @@ -74,12 +74,12 @@ static void SanitizeJPEGImageSize(std::vector<u8>& image) { | |||
| 74 | 74 | ||
| 75 | class IManagerForSystemService final : public ServiceFramework<IManagerForSystemService> { | 75 | class IManagerForSystemService final : public ServiceFramework<IManagerForSystemService> { |
| 76 | public: | 76 | public: |
| 77 | explicit IManagerForSystemService(Core::System& system_, Common::UUID) | 77 | explicit IManagerForSystemService(Core::System& system_, Common::UUID uuid) |
| 78 | : ServiceFramework{system_, "IManagerForSystemService"} { | 78 | : ServiceFramework{system_, "IManagerForSystemService"}, account_id{uuid} { |
| 79 | // clang-format off | 79 | // clang-format off |
| 80 | static const FunctionInfo functions[] = { | 80 | static const FunctionInfo functions[] = { |
| 81 | {0, &IManagerForSystemService::CheckAvailability, "CheckAvailability"}, | 81 | {0, D<&IManagerForSystemService::CheckAvailability>, "CheckAvailability"}, |
| 82 | {1, nullptr, "GetAccountId"}, | 82 | {1, D<&IManagerForSystemService::GetAccountId>, "GetAccountId"}, |
| 83 | {2, nullptr, "EnsureIdTokenCacheAsync"}, | 83 | {2, nullptr, "EnsureIdTokenCacheAsync"}, |
| 84 | {3, nullptr, "LoadIdTokenCache"}, | 84 | {3, nullptr, "LoadIdTokenCache"}, |
| 85 | {100, nullptr, "SetSystemProgramIdentification"}, | 85 | {100, nullptr, "SetSystemProgramIdentification"}, |
| @@ -109,11 +109,18 @@ public: | |||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | private: | 111 | private: |
| 112 | void CheckAvailability(HLERequestContext& ctx) { | 112 | Result CheckAvailability() { |
| 113 | LOG_WARNING(Service_ACC, "(STUBBED) called"); | 113 | LOG_WARNING(Service_ACC, "(STUBBED) called"); |
| 114 | IPC::ResponseBuilder rb{ctx, 2}; | 114 | R_SUCCEED(); |
| 115 | rb.Push(ResultSuccess); | ||
| 116 | } | 115 | } |
| 116 | |||
| 117 | Result GetAccountId(Out<u64> out_account_id) { | ||
| 118 | LOG_WARNING(Service_ACC, "(STUBBED) called"); | ||
| 119 | *out_account_id = account_id.Hash(); | ||
| 120 | R_SUCCEED(); | ||
| 121 | } | ||
| 122 | |||
| 123 | Common::UUID account_id; | ||
| 117 | }; | 124 | }; |
| 118 | 125 | ||
| 119 | // 3.0.0+ | 126 | // 3.0.0+ |
diff --git a/src/core/hle/service/acc/acc_u1.cpp b/src/core/hle/service/acc/acc_u1.cpp index 92f704c2f..eecc94387 100644 --- a/src/core/hle/service/acc/acc_u1.cpp +++ b/src/core/hle/service/acc/acc_u1.cpp | |||
| @@ -23,7 +23,7 @@ ACC_U1::ACC_U1(std::shared_ptr<Module> module_, std::shared_ptr<ProfileManager> | |||
| 23 | {99, nullptr, "DebugActivateOpenContextRetention"}, | 23 | {99, nullptr, "DebugActivateOpenContextRetention"}, |
| 24 | {100, nullptr, "GetUserRegistrationNotifier"}, | 24 | {100, nullptr, "GetUserRegistrationNotifier"}, |
| 25 | {101, nullptr, "GetUserStateChangeNotifier"}, | 25 | {101, nullptr, "GetUserStateChangeNotifier"}, |
| 26 | {102, nullptr, "GetBaasAccountManagerForSystemService"}, | 26 | {102, &ACC_U1::GetBaasAccountManagerForSystemService, "GetBaasAccountManagerForSystemService"}, |
| 27 | {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, | 27 | {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, |
| 28 | {104, nullptr, "GetProfileUpdateNotifier"}, | 28 | {104, nullptr, "GetProfileUpdateNotifier"}, |
| 29 | {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, | 29 | {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, |
diff --git a/src/core/hle/service/am/am_types.h b/src/core/hle/service/am/am_types.h index 46afb3996..a14defb40 100644 --- a/src/core/hle/service/am/am_types.h +++ b/src/core/hle/service/am/am_types.h | |||
| @@ -48,11 +48,6 @@ enum class SystemButtonType { | |||
| 48 | CaptureButtonLongPressing, | 48 | CaptureButtonLongPressing, |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | enum class SysPlatformRegion : s32 { | ||
| 52 | Global = 1, | ||
| 53 | Terra = 2, | ||
| 54 | }; | ||
| 55 | |||
| 56 | struct AppletProcessLaunchReason { | 51 | struct AppletProcessLaunchReason { |
| 57 | u8 flag; | 52 | u8 flag; |
| 58 | INSERT_PADDING_BYTES(3); | 53 | INSERT_PADDING_BYTES(3); |
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 548498e83..a32855ffa 100644 --- a/src/core/hle/service/am/service/common_state_getter.cpp +++ b/src/core/hle/service/am/service/common_state_getter.cpp | |||
| @@ -260,9 +260,9 @@ Result ICommonStateGetter::GetAppletLaunchedHistory( | |||
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | Result ICommonStateGetter::GetSettingsPlatformRegion( | 262 | Result ICommonStateGetter::GetSettingsPlatformRegion( |
| 263 | Out<SysPlatformRegion> out_settings_platform_region) { | 263 | Out<Set::PlatformRegion> out_settings_platform_region) { |
| 264 | LOG_INFO(Service_AM, "called"); | 264 | LOG_INFO(Service_AM, "called"); |
| 265 | *out_settings_platform_region = SysPlatformRegion::Global; | 265 | *out_settings_platform_region = Set::PlatformRegion::Global; |
| 266 | R_SUCCEED(); | 266 | R_SUCCEED(); |
| 267 | } | 267 | } |
| 268 | 268 | ||
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 5a8dca3d6..59a46fa94 100644 --- a/src/core/hle/service/am/service/common_state_getter.h +++ b/src/core/hle/service/am/service/common_state_getter.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include "core/hle/service/cmif_types.h" | 8 | #include "core/hle/service/cmif_types.h" |
| 9 | #include "core/hle/service/pm/pm.h" | 9 | #include "core/hle/service/pm/pm.h" |
| 10 | #include "core/hle/service/service.h" | 10 | #include "core/hle/service/service.h" |
| 11 | #include "core/hle/service/set/settings_types.h" | ||
| 11 | 12 | ||
| 12 | namespace Kernel { | 13 | namespace Kernel { |
| 13 | class KReadableEvent; | 14 | class KReadableEvent; |
| @@ -50,7 +51,7 @@ private: | |||
| 50 | Result GetOperationModeSystemInfo(Out<u32> out_operation_mode_system_info); | 51 | Result GetOperationModeSystemInfo(Out<u32> out_operation_mode_system_info); |
| 51 | Result GetAppletLaunchedHistory(Out<s32> out_count, | 52 | Result GetAppletLaunchedHistory(Out<s32> out_count, |
| 52 | OutArray<AppletId, BufferAttr_HipcMapAlias> out_applet_ids); | 53 | OutArray<AppletId, BufferAttr_HipcMapAlias> out_applet_ids); |
| 53 | Result GetSettingsPlatformRegion(Out<SysPlatformRegion> out_settings_platform_region); | 54 | Result GetSettingsPlatformRegion(Out<Set::PlatformRegion> out_settings_platform_region); |
| 54 | Result SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(); | 55 | Result SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(); |
| 55 | 56 | ||
| 56 | void SetCpuBoostMode(HLERequestContext& ctx); | 57 | void SetCpuBoostMode(HLERequestContext& ctx); |
diff --git a/src/core/hle/service/erpt/erpt.cpp b/src/core/hle/service/erpt/erpt.cpp index 39ae3a723..6b7eab5ef 100644 --- a/src/core/hle/service/erpt/erpt.cpp +++ b/src/core/hle/service/erpt/erpt.cpp | |||
| @@ -18,7 +18,7 @@ public: | |||
| 18 | // clang-format off | 18 | // clang-format off |
| 19 | static const FunctionInfo functions[] = { | 19 | static const FunctionInfo functions[] = { |
| 20 | {0, C<&ErrorReportContext::SubmitContext>, "SubmitContext"}, | 20 | {0, C<&ErrorReportContext::SubmitContext>, "SubmitContext"}, |
| 21 | {1, nullptr, "CreateReportV0"}, | 21 | {1, C<&ErrorReportContext::CreateReportV0>, "CreateReportV0"}, |
| 22 | {2, nullptr, "SetInitialLaunchSettingsCompletionTime"}, | 22 | {2, nullptr, "SetInitialLaunchSettingsCompletionTime"}, |
| 23 | {3, nullptr, "ClearInitialLaunchSettingsCompletionTime"}, | 23 | {3, nullptr, "ClearInitialLaunchSettingsCompletionTime"}, |
| 24 | {4, nullptr, "UpdatePowerOnTime"}, | 24 | {4, nullptr, "UpdatePowerOnTime"}, |
| @@ -28,7 +28,8 @@ public: | |||
| 28 | {8, nullptr, "ClearApplicationLaunchTime"}, | 28 | {8, nullptr, "ClearApplicationLaunchTime"}, |
| 29 | {9, nullptr, "SubmitAttachment"}, | 29 | {9, nullptr, "SubmitAttachment"}, |
| 30 | {10, nullptr, "CreateReportWithAttachments"}, | 30 | {10, nullptr, "CreateReportWithAttachments"}, |
| 31 | {11, nullptr, "CreateReport"}, | 31 | {11, C<&ErrorReportContext::CreateReportV1>, "CreateReportV1"}, |
| 32 | {12, C<&ErrorReportContext::CreateReport>, "CreateReport"}, | ||
| 32 | {20, nullptr, "RegisterRunningApplet"}, | 33 | {20, nullptr, "RegisterRunningApplet"}, |
| 33 | {21, nullptr, "UnregisterRunningApplet"}, | 34 | {21, nullptr, "UnregisterRunningApplet"}, |
| 34 | {22, nullptr, "UpdateAppletSuspendedDuration"}, | 35 | {22, nullptr, "UpdateAppletSuspendedDuration"}, |
| @@ -40,10 +41,37 @@ public: | |||
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | private: | 43 | private: |
| 43 | Result SubmitContext(InBuffer<BufferAttr_HipcMapAlias> buffer_a, | 44 | Result SubmitContext(InBuffer<BufferAttr_HipcMapAlias> context_entry, |
| 44 | InBuffer<BufferAttr_HipcMapAlias> buffer_b) { | 45 | InBuffer<BufferAttr_HipcMapAlias> field_list) { |
| 45 | LOG_WARNING(Service_SET, "(STUBBED) called, buffer_a_size={}, buffer_b_size={}", | 46 | LOG_WARNING(Service_SET, "(STUBBED) called, context_entry_size={}, field_list_size={}", |
| 46 | buffer_a.size(), buffer_b.size()); | 47 | context_entry.size(), field_list.size()); |
| 48 | R_SUCCEED(); | ||
| 49 | } | ||
| 50 | |||
| 51 | Result CreateReportV0(u32 report_type, InBuffer<BufferAttr_HipcMapAlias> context_entry, | ||
| 52 | InBuffer<BufferAttr_HipcMapAlias> report_list, | ||
| 53 | InBuffer<BufferAttr_HipcMapAlias> report_meta_data) { | ||
| 54 | LOG_WARNING(Service_SET, "(STUBBED) called, report_type={:#x}", report_type); | ||
| 55 | R_SUCCEED(); | ||
| 56 | } | ||
| 57 | |||
| 58 | Result CreateReportV1(u32 report_type, u32 unknown, | ||
| 59 | InBuffer<BufferAttr_HipcMapAlias> context_entry, | ||
| 60 | InBuffer<BufferAttr_HipcMapAlias> report_list, | ||
| 61 | InBuffer<BufferAttr_HipcMapAlias> report_meta_data) { | ||
| 62 | LOG_WARNING(Service_SET, "(STUBBED) called, report_type={:#x}, unknown={:#x}", report_type, | ||
| 63 | unknown); | ||
| 64 | R_SUCCEED(); | ||
| 65 | } | ||
| 66 | |||
| 67 | Result CreateReport(u32 report_type, u32 unknown, u32 create_report_option_flag, | ||
| 68 | InBuffer<BufferAttr_HipcMapAlias> context_entry, | ||
| 69 | InBuffer<BufferAttr_HipcMapAlias> report_list, | ||
| 70 | InBuffer<BufferAttr_HipcMapAlias> report_meta_data) { | ||
| 71 | LOG_WARNING( | ||
| 72 | Service_SET, | ||
| 73 | "(STUBBED) called, report_type={:#x}, unknown={:#x}, create_report_option_flag={:#x}", | ||
| 74 | report_type, unknown, create_report_option_flag); | ||
| 47 | R_SUCCEED(); | 75 | R_SUCCEED(); |
| 48 | } | 76 | } |
| 49 | }; | 77 | }; |
diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp index 223284255..60290f1a6 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp | |||
| @@ -71,7 +71,7 @@ FSP_SRV::FSP_SRV(Core::System& system_) | |||
| 71 | {28, nullptr, "DeleteSaveDataFileSystemBySaveDataAttribute"}, | 71 | {28, nullptr, "DeleteSaveDataFileSystemBySaveDataAttribute"}, |
| 72 | {30, nullptr, "OpenGameCardStorage"}, | 72 | {30, nullptr, "OpenGameCardStorage"}, |
| 73 | {31, nullptr, "OpenGameCardFileSystem"}, | 73 | {31, nullptr, "OpenGameCardFileSystem"}, |
| 74 | {32, nullptr, "ExtendSaveDataFileSystem"}, | 74 | {32, D<&FSP_SRV::ExtendSaveDataFileSystem>, "ExtendSaveDataFileSystem"}, |
| 75 | {33, nullptr, "DeleteCacheStorage"}, | 75 | {33, nullptr, "DeleteCacheStorage"}, |
| 76 | {34, D<&FSP_SRV::GetCacheStorageSize>, "GetCacheStorageSize"}, | 76 | {34, D<&FSP_SRV::GetCacheStorageSize>, "GetCacheStorageSize"}, |
| 77 | {35, nullptr, "CreateSaveDataFileSystemByHashSalt"}, | 77 | {35, nullptr, "CreateSaveDataFileSystemByHashSalt"}, |
| @@ -79,9 +79,9 @@ FSP_SRV::FSP_SRV(Core::System& system_) | |||
| 79 | {51, D<&FSP_SRV::OpenSaveDataFileSystem>, "OpenSaveDataFileSystem"}, | 79 | {51, D<&FSP_SRV::OpenSaveDataFileSystem>, "OpenSaveDataFileSystem"}, |
| 80 | {52, D<&FSP_SRV::OpenSaveDataFileSystemBySystemSaveDataId>, "OpenSaveDataFileSystemBySystemSaveDataId"}, | 80 | {52, D<&FSP_SRV::OpenSaveDataFileSystemBySystemSaveDataId>, "OpenSaveDataFileSystemBySystemSaveDataId"}, |
| 81 | {53, D<&FSP_SRV::OpenReadOnlySaveDataFileSystem>, "OpenReadOnlySaveDataFileSystem"}, | 81 | {53, D<&FSP_SRV::OpenReadOnlySaveDataFileSystem>, "OpenReadOnlySaveDataFileSystem"}, |
| 82 | {57, nullptr, "ReadSaveDataFileSystemExtraDataBySaveDataSpaceId"}, | 82 | {57, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataSpaceId>, "ReadSaveDataFileSystemExtraDataBySaveDataSpaceId"}, |
| 83 | {58, nullptr, "ReadSaveDataFileSystemExtraData"}, | 83 | {58, D<&FSP_SRV::ReadSaveDataFileSystemExtraData>, "ReadSaveDataFileSystemExtraData"}, |
| 84 | {59, nullptr, "WriteSaveDataFileSystemExtraData"}, | 84 | {59, D<&FSP_SRV::WriteSaveDataFileSystemExtraData>, "WriteSaveDataFileSystemExtraData"}, |
| 85 | {60, nullptr, "OpenSaveDataInfoReader"}, | 85 | {60, nullptr, "OpenSaveDataInfoReader"}, |
| 86 | {61, D<&FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId>, "OpenSaveDataInfoReaderBySaveDataSpaceId"}, | 86 | {61, D<&FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId>, "OpenSaveDataInfoReaderBySaveDataSpaceId"}, |
| 87 | {62, D<&FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage>, "OpenSaveDataInfoReaderOnlyCacheStorage"}, | 87 | {62, D<&FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage>, "OpenSaveDataInfoReaderOnlyCacheStorage"}, |
| @@ -90,8 +90,8 @@ FSP_SRV::FSP_SRV(Core::System& system_) | |||
| 90 | {66, nullptr, "WriteSaveDataFileSystemExtraData2"}, | 90 | {66, nullptr, "WriteSaveDataFileSystemExtraData2"}, |
| 91 | {67, D<&FSP_SRV::FindSaveDataWithFilter>, "FindSaveDataWithFilter"}, | 91 | {67, D<&FSP_SRV::FindSaveDataWithFilter>, "FindSaveDataWithFilter"}, |
| 92 | {68, nullptr, "OpenSaveDataInfoReaderBySaveDataFilter"}, | 92 | {68, nullptr, "OpenSaveDataInfoReaderBySaveDataFilter"}, |
| 93 | {69, nullptr, "ReadSaveDataFileSystemExtraDataBySaveDataAttribute"}, | 93 | {69, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataBySaveDataAttribute"}, |
| 94 | {70, D<&FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute>, "WriteSaveDataFileSystemExtraDataBySaveDataAttribute"}, | 94 | {70, D<&FSP_SRV::WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"}, |
| 95 | {71, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"}, | 95 | {71, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"}, |
| 96 | {80, nullptr, "OpenSaveDataMetaFile"}, | 96 | {80, nullptr, "OpenSaveDataMetaFile"}, |
| 97 | {81, nullptr, "OpenSaveDataTransferManager"}, | 97 | {81, nullptr, "OpenSaveDataTransferManager"}, |
| @@ -317,9 +317,23 @@ Result FSP_SRV::FindSaveDataWithFilter(Out<s64> out_count, | |||
| 317 | R_THROW(FileSys::ResultTargetNotFound); | 317 | R_THROW(FileSys::ResultTargetNotFound); |
| 318 | } | 318 | } |
| 319 | 319 | ||
| 320 | Result FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute() { | 320 | Result FSP_SRV::WriteSaveDataFileSystemExtraData(InBuffer<BufferAttr_HipcMapAlias> buffer, |
| 321 | LOG_WARNING(Service_FS, "(STUBBED) called."); | 321 | FileSys::SaveDataSpaceId space_id, |
| 322 | u64 save_data_id) { | ||
| 323 | LOG_WARNING(Service_FS, "(STUBBED) called, space_id={}, save_data_id={:016X}", space_id, | ||
| 324 | save_data_id); | ||
| 325 | R_SUCCEED(); | ||
| 326 | } | ||
| 322 | 327 | ||
| 328 | Result FSP_SRV::WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( | ||
| 329 | InBuffer<BufferAttr_HipcMapAlias> buffer, InBuffer<BufferAttr_HipcMapAlias> mask_buffer, | ||
| 330 | FileSys::SaveDataSpaceId space_id, FileSys::SaveDataAttribute attribute) { | ||
| 331 | LOG_WARNING(Service_FS, | ||
| 332 | "(STUBBED) called, space_id={}, attribute.program_id={:016X}\n" | ||
| 333 | "attribute.user_id={:016X}{:016X}, attribute.save_id={:016X}\n" | ||
| 334 | "attribute.type={}, attribute.rank={}, attribute.index={}", | ||
| 335 | space_id, attribute.program_id, attribute.user_id[1], attribute.user_id[0], | ||
| 336 | attribute.system_save_data_id, attribute.type, attribute.rank, attribute.index); | ||
| 323 | R_SUCCEED(); | 337 | R_SUCCEED(); |
| 324 | } | 338 | } |
| 325 | 339 | ||
| @@ -341,6 +355,38 @@ Result FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( | |||
| 341 | R_SUCCEED(); | 355 | R_SUCCEED(); |
| 342 | } | 356 | } |
| 343 | 357 | ||
| 358 | Result FSP_SRV::ReadSaveDataFileSystemExtraData(OutBuffer<BufferAttr_HipcMapAlias> out_buffer, | ||
| 359 | u64 save_data_id) { | ||
| 360 | // Stub, backend needs an impl to read/write the SaveDataExtraData | ||
| 361 | LOG_WARNING(Service_FS, "(STUBBED) called, save_data_id={:016X}", save_data_id); | ||
| 362 | std::memset(out_buffer.data(), 0, out_buffer.size()); | ||
| 363 | R_SUCCEED(); | ||
| 364 | } | ||
| 365 | |||
| 366 | Result FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataAttribute( | ||
| 367 | OutBuffer<BufferAttr_HipcMapAlias> out_buffer, FileSys::SaveDataSpaceId space_id, | ||
| 368 | FileSys::SaveDataAttribute attribute) { | ||
| 369 | // Stub, backend needs an impl to read/write the SaveDataExtraData | ||
| 370 | LOG_WARNING(Service_FS, | ||
| 371 | "(STUBBED) called, space_id={}, attribute.program_id={:016X}\n" | ||
| 372 | "attribute.user_id={:016X}{:016X}, attribute.save_id={:016X}\n" | ||
| 373 | "attribute.type={}, attribute.rank={}, attribute.index={}", | ||
| 374 | space_id, attribute.program_id, attribute.user_id[1], attribute.user_id[0], | ||
| 375 | attribute.system_save_data_id, attribute.type, attribute.rank, attribute.index); | ||
| 376 | std::memset(out_buffer.data(), 0, out_buffer.size()); | ||
| 377 | R_SUCCEED(); | ||
| 378 | } | ||
| 379 | |||
| 380 | Result FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataSpaceId( | ||
| 381 | OutBuffer<BufferAttr_HipcMapAlias> out_buffer, FileSys::SaveDataSpaceId space_id, | ||
| 382 | u64 save_data_id) { | ||
| 383 | // Stub, backend needs an impl to read/write the SaveDataExtraData | ||
| 384 | LOG_WARNING(Service_FS, "(STUBBED) called, space_id={}, save_data_id={:016X}", space_id, | ||
| 385 | save_data_id); | ||
| 386 | std::memset(out_buffer.data(), 0, out_buffer.size()); | ||
| 387 | R_SUCCEED(); | ||
| 388 | } | ||
| 389 | |||
| 344 | Result FSP_SRV::OpenSaveDataTransferProhibiter( | 390 | Result FSP_SRV::OpenSaveDataTransferProhibiter( |
| 345 | OutInterface<ISaveDataTransferProhibiter> out_prohibiter, u64 id) { | 391 | OutInterface<ISaveDataTransferProhibiter> out_prohibiter, u64 id) { |
| 346 | LOG_WARNING(Service_FS, "(STUBBED) called, id={:016X}", id); | 392 | LOG_WARNING(Service_FS, "(STUBBED) called, id={:016X}", id); |
| @@ -476,6 +522,16 @@ Result FSP_SRV::FlushAccessLogOnSdCard() { | |||
| 476 | R_SUCCEED(); | 522 | R_SUCCEED(); |
| 477 | } | 523 | } |
| 478 | 524 | ||
| 525 | Result FSP_SRV::ExtendSaveDataFileSystem(FileSys::SaveDataSpaceId space_id, u64 save_data_id, | ||
| 526 | s64 available_size, s64 journal_size) { | ||
| 527 | // We don't have an index of save data ids, so we can't implement this. | ||
| 528 | LOG_WARNING(Service_FS, | ||
| 529 | "(STUBBED) called, space_id={}, save_data_id={:016X}, available_size={:#x}, " | ||
| 530 | "journal_size={:#x}", | ||
| 531 | space_id, save_data_id, available_size, journal_size); | ||
| 532 | R_SUCCEED(); | ||
| 533 | } | ||
| 534 | |||
| 479 | Result FSP_SRV::GetCacheStorageSize(s32 index, Out<s64> out_data_size, Out<s64> out_journal_size) { | 535 | Result FSP_SRV::GetCacheStorageSize(s32 index, Out<s64> out_data_size, Out<s64> out_journal_size) { |
| 480 | LOG_WARNING(Service_FS, "(STUBBED) called with index={}", index); | 536 | LOG_WARNING(Service_FS, "(STUBBED) called with index={}", index); |
| 481 | 537 | ||
diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.h b/src/core/hle/service/filesystem/fsp/fsp_srv.h index 83d9cb51c..b565cace0 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.h +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.h | |||
| @@ -70,7 +70,19 @@ private: | |||
| 70 | Result FindSaveDataWithFilter(Out<s64> out_count, OutBuffer<BufferAttr_HipcMapAlias> out_buffer, | 70 | Result FindSaveDataWithFilter(Out<s64> out_count, OutBuffer<BufferAttr_HipcMapAlias> out_buffer, |
| 71 | FileSys::SaveDataSpaceId space_id, | 71 | FileSys::SaveDataSpaceId space_id, |
| 72 | FileSys::SaveDataFilter filter); | 72 | FileSys::SaveDataFilter filter); |
| 73 | Result WriteSaveDataFileSystemExtraDataBySaveDataAttribute(); | 73 | Result WriteSaveDataFileSystemExtraData(InBuffer<BufferAttr_HipcMapAlias> buffer, |
| 74 | FileSys::SaveDataSpaceId space_id, u64 save_data_id); | ||
| 75 | Result WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( | ||
| 76 | InBuffer<BufferAttr_HipcMapAlias> buffer, InBuffer<BufferAttr_HipcMapAlias> mask_buffer, | ||
| 77 | FileSys::SaveDataSpaceId space_id, FileSys::SaveDataAttribute attribute); | ||
| 78 | Result ReadSaveDataFileSystemExtraData(OutBuffer<BufferAttr_HipcMapAlias> out_buffer, | ||
| 79 | u64 save_data_id); | ||
| 80 | Result ReadSaveDataFileSystemExtraDataBySaveDataAttribute( | ||
| 81 | OutBuffer<BufferAttr_HipcMapAlias> out_buffer, FileSys::SaveDataSpaceId space_id, | ||
| 82 | FileSys::SaveDataAttribute attribute); | ||
| 83 | Result ReadSaveDataFileSystemExtraDataBySaveDataSpaceId( | ||
| 84 | OutBuffer<BufferAttr_HipcMapAlias> out_buffer, FileSys::SaveDataSpaceId space_id, | ||
| 85 | u64 save_data_id); | ||
| 74 | Result ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( | 86 | Result ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( |
| 75 | FileSys::SaveDataSpaceId space_id, FileSys::SaveDataAttribute attribute, | 87 | FileSys::SaveDataSpaceId space_id, FileSys::SaveDataAttribute attribute, |
| 76 | InBuffer<BufferAttr_HipcMapAlias> mask_buffer, | 88 | InBuffer<BufferAttr_HipcMapAlias> mask_buffer, |
| @@ -91,6 +103,8 @@ private: | |||
| 91 | Result GetProgramIndexForAccessLog(Out<AccessLogVersion> out_access_log_version, | 103 | Result GetProgramIndexForAccessLog(Out<AccessLogVersion> out_access_log_version, |
| 92 | Out<u32> out_access_log_program_index); | 104 | Out<u32> out_access_log_program_index); |
| 93 | Result OpenMultiCommitManager(OutInterface<IMultiCommitManager> out_interface); | 105 | Result OpenMultiCommitManager(OutInterface<IMultiCommitManager> out_interface); |
| 106 | Result ExtendSaveDataFileSystem(FileSys::SaveDataSpaceId space_id, u64 save_data_id, | ||
| 107 | s64 available_size, s64 journal_size); | ||
| 94 | Result GetCacheStorageSize(s32 index, Out<s64> out_data_size, Out<s64> out_journal_size); | 108 | Result GetCacheStorageSize(s32 index, Out<s64> out_data_size, Out<s64> out_journal_size); |
| 95 | 109 | ||
| 96 | FileSystemController& fsc; | 110 | FileSystemController& fsc; |
diff --git a/src/core/hle/service/ldn/monitor_service.cpp b/src/core/hle/service/ldn/monitor_service.cpp index 3471f69da..ea6ac4d5d 100644 --- a/src/core/hle/service/ldn/monitor_service.cpp +++ b/src/core/hle/service/ldn/monitor_service.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | 2 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/hle/service/cmif_serialization.h" | 4 | #include "core/hle/service/cmif_serialization.h" |
| 5 | #include "core/hle/service/ldn/ldn_results.h" | ||
| 5 | #include "core/hle/service/ldn/monitor_service.h" | 6 | #include "core/hle/service/ldn/monitor_service.h" |
| 6 | 7 | ||
| 7 | namespace Service::LDN { | 8 | namespace Service::LDN { |
| @@ -17,7 +18,7 @@ IMonitorService::IMonitorService(Core::System& system_) | |||
| 17 | {4, nullptr, "GetSecurityParameterForMonitor"}, | 18 | {4, nullptr, "GetSecurityParameterForMonitor"}, |
| 18 | {5, nullptr, "GetNetworkConfigForMonitor"}, | 19 | {5, nullptr, "GetNetworkConfigForMonitor"}, |
| 19 | {100, C<&IMonitorService::InitializeMonitor>, "InitializeMonitor"}, | 20 | {100, C<&IMonitorService::InitializeMonitor>, "InitializeMonitor"}, |
| 20 | {101, nullptr, "FinalizeMonitor"}, | 21 | {101, C<&IMonitorService::FinalizeMonitor>, "FinalizeMonitor"}, |
| 21 | }; | 22 | }; |
| 22 | // clang-format on | 23 | // clang-format on |
| 23 | 24 | ||
| @@ -27,16 +28,18 @@ IMonitorService::IMonitorService(Core::System& system_) | |||
| 27 | IMonitorService::~IMonitorService() = default; | 28 | IMonitorService::~IMonitorService() = default; |
| 28 | 29 | ||
| 29 | Result IMonitorService::GetStateForMonitor(Out<State> out_state) { | 30 | Result IMonitorService::GetStateForMonitor(Out<State> out_state) { |
| 30 | LOG_INFO(Service_LDN, "called"); | 31 | LOG_WARNING(Service_LDN, "(STUBBED) called"); |
| 31 | 32 | *out_state = State::None; | |
| 32 | *out_state = state; | ||
| 33 | R_SUCCEED(); | 33 | R_SUCCEED(); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | Result IMonitorService::InitializeMonitor() { | 36 | Result IMonitorService::InitializeMonitor() { |
| 37 | LOG_INFO(Service_LDN, "called"); | 37 | LOG_INFO(Service_LDN, "called"); |
| 38 | R_SUCCEED(); | ||
| 39 | } | ||
| 38 | 40 | ||
| 39 | state = State::Initialized; | 41 | Result IMonitorService::FinalizeMonitor() { |
| 42 | LOG_INFO(Service_LDN, "called"); | ||
| 40 | R_SUCCEED(); | 43 | R_SUCCEED(); |
| 41 | } | 44 | } |
| 42 | 45 | ||
diff --git a/src/core/hle/service/ldn/monitor_service.h b/src/core/hle/service/ldn/monitor_service.h index 61aacef30..e663145b4 100644 --- a/src/core/hle/service/ldn/monitor_service.h +++ b/src/core/hle/service/ldn/monitor_service.h | |||
| @@ -21,6 +21,7 @@ public: | |||
| 21 | private: | 21 | private: |
| 22 | Result GetStateForMonitor(Out<State> out_state); | 22 | Result GetStateForMonitor(Out<State> out_state); |
| 23 | Result InitializeMonitor(); | 23 | Result InitializeMonitor(); |
| 24 | Result FinalizeMonitor(); | ||
| 24 | 25 | ||
| 25 | State state{State::None}; | 26 | State state{State::None}; |
| 26 | }; | 27 | }; |
diff --git a/src/core/hle/service/set/settings_types.h b/src/core/hle/service/set/settings_types.h index 4fd34f46b..92c2948b0 100644 --- a/src/core/hle/service/set/settings_types.h +++ b/src/core/hle/service/set/settings_types.h | |||
| @@ -243,6 +243,11 @@ enum class TvResolution : u32 { | |||
| 243 | Resolution480p, | 243 | Resolution480p, |
| 244 | }; | 244 | }; |
| 245 | 245 | ||
| 246 | enum class PlatformRegion : s32 { | ||
| 247 | Global = 1, | ||
| 248 | Terra = 2, | ||
| 249 | }; | ||
| 250 | |||
| 246 | constexpr std::array<LanguageCode, 18> available_language_codes = {{ | 251 | constexpr std::array<LanguageCode, 18> available_language_codes = {{ |
| 247 | LanguageCode::JA, | 252 | LanguageCode::JA, |
| 248 | LanguageCode::EN_US, | 253 | LanguageCode::EN_US, |
diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp index 900d5408f..0dc8db821 100644 --- a/src/core/hle/service/set/system_settings_server.cpp +++ b/src/core/hle/service/set/system_settings_server.cpp | |||
| @@ -272,8 +272,8 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_) | |||
| 272 | {180, nullptr, "SetZoomFlag"}, | 272 | {180, nullptr, "SetZoomFlag"}, |
| 273 | {181, nullptr, "GetT"}, | 273 | {181, nullptr, "GetT"}, |
| 274 | {182, nullptr, "SetT"}, | 274 | {182, nullptr, "SetT"}, |
| 275 | {183, nullptr, "GetPlatformRegion"}, | 275 | {183, C<&ISystemSettingsServer::GetPlatformRegion>, "GetPlatformRegion"}, |
| 276 | {184, nullptr, "SetPlatformRegion"}, | 276 | {184, C<&ISystemSettingsServer::SetPlatformRegion>, "SetPlatformRegion"}, |
| 277 | {185, C<&ISystemSettingsServer::GetHomeMenuSchemeModel>, "GetHomeMenuSchemeModel"}, | 277 | {185, C<&ISystemSettingsServer::GetHomeMenuSchemeModel>, "GetHomeMenuSchemeModel"}, |
| 278 | {186, nullptr, "GetMemoryUsageRateFlag"}, | 278 | {186, nullptr, "GetMemoryUsageRateFlag"}, |
| 279 | {187, C<&ISystemSettingsServer::GetTouchScreenMode>, "GetTouchScreenMode"}, | 279 | {187, C<&ISystemSettingsServer::GetTouchScreenMode>, "GetTouchScreenMode"}, |
| @@ -1250,6 +1250,18 @@ Result ISystemSettingsServer::GetHomeMenuScheme(Out<HomeMenuScheme> out_home_men | |||
| 1250 | R_SUCCEED(); | 1250 | R_SUCCEED(); |
| 1251 | } | 1251 | } |
| 1252 | 1252 | ||
| 1253 | Result ISystemSettingsServer::GetPlatformRegion(Out<PlatformRegion> out_platform_region) { | ||
| 1254 | LOG_WARNING(Service_SET, "(STUBBED) called"); | ||
| 1255 | |||
| 1256 | *out_platform_region = PlatformRegion::Global; | ||
| 1257 | R_SUCCEED(); | ||
| 1258 | } | ||
| 1259 | |||
| 1260 | Result ISystemSettingsServer::SetPlatformRegion(PlatformRegion platform_region) { | ||
| 1261 | LOG_WARNING(Service_SET, "(STUBBED) called"); | ||
| 1262 | R_SUCCEED(); | ||
| 1263 | } | ||
| 1264 | |||
| 1253 | Result ISystemSettingsServer::GetHomeMenuSchemeModel(Out<u32> out_home_menu_scheme_model) { | 1265 | Result ISystemSettingsServer::GetHomeMenuSchemeModel(Out<u32> out_home_menu_scheme_model) { |
| 1254 | LOG_WARNING(Service_SET, "(STUBBED) called"); | 1266 | LOG_WARNING(Service_SET, "(STUBBED) called"); |
| 1255 | 1267 | ||
diff --git a/src/core/hle/service/set/system_settings_server.h b/src/core/hle/service/set/system_settings_server.h index 9a1154ad6..993e5de7d 100644 --- a/src/core/hle/service/set/system_settings_server.h +++ b/src/core/hle/service/set/system_settings_server.h | |||
| @@ -149,6 +149,8 @@ public: | |||
| 149 | Result GetHomeMenuScheme(Out<HomeMenuScheme> out_home_menu_scheme); | 149 | Result GetHomeMenuScheme(Out<HomeMenuScheme> out_home_menu_scheme); |
| 150 | Result GetHomeMenuSchemeModel(Out<u32> out_home_menu_scheme_model); | 150 | Result GetHomeMenuSchemeModel(Out<u32> out_home_menu_scheme_model); |
| 151 | Result GetTouchScreenMode(Out<TouchScreenMode> out_touch_screen_mode); | 151 | Result GetTouchScreenMode(Out<TouchScreenMode> out_touch_screen_mode); |
| 152 | Result GetPlatformRegion(Out<PlatformRegion> out_platform_region); | ||
| 153 | Result SetPlatformRegion(PlatformRegion platform_region); | ||
| 152 | Result SetTouchScreenMode(TouchScreenMode touch_screen_mode); | 154 | Result SetTouchScreenMode(TouchScreenMode touch_screen_mode); |
| 153 | Result GetFieldTestingFlag(Out<bool> out_field_testing_flag); | 155 | Result GetFieldTestingFlag(Out<bool> out_field_testing_flag); |
| 154 | Result GetPanelCrcMode(Out<s32> out_panel_crc_mode); | 156 | Result GetPanelCrcMode(Out<s32> out_panel_crc_mode); |
diff --git a/src/core/hle/service/ssl/cert_store.cpp b/src/core/hle/service/ssl/cert_store.cpp new file mode 100644 index 000000000..b321e5d32 --- /dev/null +++ b/src/core/hle/service/ssl/cert_store.cpp | |||
| @@ -0,0 +1,156 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "common/alignment.h" | ||
| 5 | #include "core/core.h" | ||
| 6 | #include "core/file_sys/content_archive.h" | ||
| 7 | #include "core/file_sys/nca_metadata.h" | ||
| 8 | #include "core/file_sys/registered_cache.h" | ||
| 9 | #include "core/file_sys/romfs.h" | ||
| 10 | #include "core/hle/service/filesystem/filesystem.h" | ||
| 11 | #include "core/hle/service/ssl/cert_store.h" | ||
| 12 | |||
| 13 | namespace Service::SSL { | ||
| 14 | |||
| 15 | // https://switchbrew.org/wiki/SSL_services#CertStore | ||
| 16 | |||
| 17 | CertStore::CertStore(Core::System& system) { | ||
| 18 | constexpr u64 CertStoreDataId = 0x0100000000000800ULL; | ||
| 19 | |||
| 20 | auto& fsc = system.GetFileSystemController(); | ||
| 21 | |||
| 22 | // Attempt to load certificate data from storage | ||
| 23 | const auto nca = | ||
| 24 | fsc.GetSystemNANDContents()->GetEntry(CertStoreDataId, FileSys::ContentRecordType::Data); | ||
| 25 | if (!nca) { | ||
| 26 | return; | ||
| 27 | } | ||
| 28 | const auto romfs = nca->GetRomFS(); | ||
| 29 | if (!romfs) { | ||
| 30 | return; | ||
| 31 | } | ||
| 32 | const auto extracted = FileSys::ExtractRomFS(romfs); | ||
| 33 | if (!extracted) { | ||
| 34 | LOG_ERROR(Service_SSL, "CertStore could not be extracted, corrupt RomFS?"); | ||
| 35 | return; | ||
| 36 | } | ||
| 37 | const auto cert_store_file = extracted->GetFile("ssl_TrustedCerts.bdf"); | ||
| 38 | if (!cert_store_file) { | ||
| 39 | LOG_ERROR(Service_SSL, "Failed to find trusted certificates in CertStore"); | ||
| 40 | return; | ||
| 41 | } | ||
| 42 | |||
| 43 | // Read and verify the header. | ||
| 44 | CertStoreHeader header; | ||
| 45 | cert_store_file->ReadObject(std::addressof(header)); | ||
| 46 | |||
| 47 | if (header.magic != Common::MakeMagic('s', 's', 'l', 'T')) { | ||
| 48 | LOG_ERROR(Service_SSL, "Invalid certificate store magic"); | ||
| 49 | return; | ||
| 50 | } | ||
| 51 | |||
| 52 | // Ensure the file can contains the number of entries it says it does. | ||
| 53 | const u64 expected_size = sizeof(header) + sizeof(CertStoreEntry) * header.num_entries; | ||
| 54 | const u64 actual_size = cert_store_file->GetSize(); | ||
| 55 | if (actual_size < expected_size) { | ||
| 56 | LOG_ERROR(Service_SSL, "Size mismatch, expected at least {} bytes, got {}", expected_size, | ||
| 57 | actual_size); | ||
| 58 | return; | ||
| 59 | } | ||
| 60 | |||
| 61 | // Read entries. | ||
| 62 | std::vector<CertStoreEntry> entries(header.num_entries); | ||
| 63 | cert_store_file->ReadArray(entries.data(), header.num_entries, sizeof(header)); | ||
| 64 | |||
| 65 | // Insert into memory store. | ||
| 66 | for (const auto& entry : entries) { | ||
| 67 | m_certs.emplace(entry.certificate_id, | ||
| 68 | Certificate{ | ||
| 69 | .status = entry.certificate_status, | ||
| 70 | .der_data = cert_store_file->ReadBytes( | ||
| 71 | entry.der_size, entry.der_offset + sizeof(header)), | ||
| 72 | }); | ||
| 73 | } | ||
| 74 | } | ||
| 75 | |||
| 76 | CertStore::~CertStore() = default; | ||
| 77 | |||
| 78 | template <typename F> | ||
| 79 | void CertStore::ForEachCertificate(std::span<const CaCertificateId> certificate_ids, F&& f) { | ||
| 80 | if (certificate_ids.size() == 1 && certificate_ids.front() == CaCertificateId::All) { | ||
| 81 | for (const auto& entry : m_certs) { | ||
| 82 | f(entry); | ||
| 83 | } | ||
| 84 | } else { | ||
| 85 | for (const auto certificate_id : certificate_ids) { | ||
| 86 | const auto entry = m_certs.find(certificate_id); | ||
| 87 | if (entry == m_certs.end()) { | ||
| 88 | continue; | ||
| 89 | } | ||
| 90 | f(*entry); | ||
| 91 | } | ||
| 92 | } | ||
| 93 | } | ||
| 94 | |||
| 95 | Result CertStore::GetCertificates(u32* out_num_entries, std::span<u8> out_data, | ||
| 96 | std::span<const CaCertificateId> certificate_ids) { | ||
| 97 | // Ensure the buffer is large enough to hold the output. | ||
| 98 | u32 required_size; | ||
| 99 | R_TRY(this->GetCertificateBufSize(std::addressof(required_size), out_num_entries, | ||
| 100 | certificate_ids)); | ||
| 101 | R_UNLESS(out_data.size_bytes() >= required_size, ResultUnknown); | ||
| 102 | |||
| 103 | // Make parallel arrays. | ||
| 104 | std::vector<BuiltInCertificateInfo> cert_infos; | ||
| 105 | std::vector<u8> der_datas; | ||
| 106 | |||
| 107 | const u32 der_data_offset = (*out_num_entries + 1) * sizeof(BuiltInCertificateInfo); | ||
| 108 | u32 cur_der_offset = der_data_offset; | ||
| 109 | |||
| 110 | // Fill output. | ||
| 111 | this->ForEachCertificate(certificate_ids, [&](auto& entry) { | ||
| 112 | const auto& [status, cur_der_data] = entry.second; | ||
| 113 | BuiltInCertificateInfo cert_info{ | ||
| 114 | .cert_id = entry.first, | ||
| 115 | .status = status, | ||
| 116 | .der_size = cur_der_data.size(), | ||
| 117 | .der_offset = cur_der_offset, | ||
| 118 | }; | ||
| 119 | |||
| 120 | cert_infos.push_back(cert_info); | ||
| 121 | der_datas.insert(der_datas.end(), cur_der_data.begin(), cur_der_data.end()); | ||
| 122 | cur_der_offset += static_cast<u32>(cur_der_data.size()); | ||
| 123 | }); | ||
| 124 | |||
| 125 | // Append terminator entry. | ||
| 126 | cert_infos.push_back(BuiltInCertificateInfo{ | ||
| 127 | .cert_id = CaCertificateId::All, | ||
| 128 | .status = TrustedCertStatus::Invalid, | ||
| 129 | .der_size = 0, | ||
| 130 | .der_offset = 0, | ||
| 131 | }); | ||
| 132 | |||
| 133 | // Write to output span. | ||
| 134 | std::memcpy(out_data.data(), cert_infos.data(), | ||
| 135 | cert_infos.size() * sizeof(BuiltInCertificateInfo)); | ||
| 136 | std::memcpy(out_data.data() + der_data_offset, der_datas.data(), der_datas.size()); | ||
| 137 | |||
| 138 | R_SUCCEED(); | ||
| 139 | } | ||
| 140 | |||
| 141 | Result CertStore::GetCertificateBufSize(u32* out_size, u32* out_num_entries, | ||
| 142 | std::span<const CaCertificateId> certificate_ids) { | ||
| 143 | // Output size is at least the size of the terminator entry. | ||
| 144 | *out_size = sizeof(BuiltInCertificateInfo); | ||
| 145 | *out_num_entries = 0; | ||
| 146 | |||
| 147 | this->ForEachCertificate(certificate_ids, [&](auto& entry) { | ||
| 148 | *out_size += sizeof(BuiltInCertificateInfo); | ||
| 149 | *out_size += Common::AlignUp(static_cast<u32>(entry.second.der_data.size()), 4); | ||
| 150 | (*out_num_entries)++; | ||
| 151 | }); | ||
| 152 | |||
| 153 | R_SUCCEED(); | ||
| 154 | } | ||
| 155 | |||
| 156 | } // namespace Service::SSL | ||
diff --git a/src/core/hle/service/ssl/cert_store.h b/src/core/hle/service/ssl/cert_store.h new file mode 100644 index 000000000..613d7b02a --- /dev/null +++ b/src/core/hle/service/ssl/cert_store.h | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include <map> | ||
| 7 | #include <span> | ||
| 8 | #include <vector> | ||
| 9 | |||
| 10 | #include "core/hle/result.h" | ||
| 11 | #include "core/hle/service/ssl/ssl_types.h" | ||
| 12 | |||
| 13 | namespace Core { | ||
| 14 | class System; | ||
| 15 | } | ||
| 16 | |||
| 17 | namespace Service::SSL { | ||
| 18 | |||
| 19 | class CertStore { | ||
| 20 | public: | ||
| 21 | explicit CertStore(Core::System& system); | ||
| 22 | ~CertStore(); | ||
| 23 | |||
| 24 | Result GetCertificates(u32* out_num_entries, std::span<u8> out_data, | ||
| 25 | std::span<const CaCertificateId> certificate_ids); | ||
| 26 | Result GetCertificateBufSize(u32* out_size, u32* out_num_entries, | ||
| 27 | std::span<const CaCertificateId> certificate_ids); | ||
| 28 | |||
| 29 | private: | ||
| 30 | template <typename F> | ||
| 31 | void ForEachCertificate(std::span<const CaCertificateId> certs, F&& f); | ||
| 32 | |||
| 33 | private: | ||
| 34 | struct Certificate { | ||
| 35 | TrustedCertStatus status; | ||
| 36 | std::vector<u8> der_data; | ||
| 37 | }; | ||
| 38 | |||
| 39 | std::map<CaCertificateId, Certificate> m_certs; | ||
| 40 | }; | ||
| 41 | |||
| 42 | } // namespace Service::SSL | ||
diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index 0fbb43057..008ee4492 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp | |||
| @@ -5,11 +5,13 @@ | |||
| 5 | 5 | ||
| 6 | #include "core/core.h" | 6 | #include "core/core.h" |
| 7 | #include "core/hle/result.h" | 7 | #include "core/hle/result.h" |
| 8 | #include "core/hle/service/cmif_serialization.h" | ||
| 8 | #include "core/hle/service/ipc_helpers.h" | 9 | #include "core/hle/service/ipc_helpers.h" |
| 9 | #include "core/hle/service/server_manager.h" | 10 | #include "core/hle/service/server_manager.h" |
| 10 | #include "core/hle/service/service.h" | 11 | #include "core/hle/service/service.h" |
| 11 | #include "core/hle/service/sm/sm.h" | 12 | #include "core/hle/service/sm/sm.h" |
| 12 | #include "core/hle/service/sockets/bsd.h" | 13 | #include "core/hle/service/sockets/bsd.h" |
| 14 | #include "core/hle/service/ssl/cert_store.h" | ||
| 13 | #include "core/hle/service/ssl/ssl.h" | 15 | #include "core/hle/service/ssl/ssl.h" |
| 14 | #include "core/hle/service/ssl/ssl_backend.h" | 16 | #include "core/hle/service/ssl/ssl_backend.h" |
| 15 | #include "core/internal_network/network.h" | 17 | #include "core/internal_network/network.h" |
| @@ -492,13 +494,14 @@ private: | |||
| 492 | 494 | ||
| 493 | class ISslService final : public ServiceFramework<ISslService> { | 495 | class ISslService final : public ServiceFramework<ISslService> { |
| 494 | public: | 496 | public: |
| 495 | explicit ISslService(Core::System& system_) : ServiceFramework{system_, "ssl"} { | 497 | explicit ISslService(Core::System& system_) |
| 498 | : ServiceFramework{system_, "ssl"}, cert_store{system} { | ||
| 496 | // clang-format off | 499 | // clang-format off |
| 497 | static const FunctionInfo functions[] = { | 500 | static const FunctionInfo functions[] = { |
| 498 | {0, &ISslService::CreateContext, "CreateContext"}, | 501 | {0, &ISslService::CreateContext, "CreateContext"}, |
| 499 | {1, nullptr, "GetContextCount"}, | 502 | {1, nullptr, "GetContextCount"}, |
| 500 | {2, nullptr, "GetCertificates"}, | 503 | {2, D<&ISslService::GetCertificates>, "GetCertificates"}, |
| 501 | {3, nullptr, "GetCertificateBufSize"}, | 504 | {3, D<&ISslService::GetCertificateBufSize>, "GetCertificateBufSize"}, |
| 502 | {4, nullptr, "DebugIoctl"}, | 505 | {4, nullptr, "DebugIoctl"}, |
| 503 | {5, &ISslService::SetInterfaceVersion, "SetInterfaceVersion"}, | 506 | {5, &ISslService::SetInterfaceVersion, "SetInterfaceVersion"}, |
| 504 | {6, nullptr, "FlushSessionCache"}, | 507 | {6, nullptr, "FlushSessionCache"}, |
| @@ -540,6 +543,22 @@ private: | |||
| 540 | IPC::ResponseBuilder rb{ctx, 2}; | 543 | IPC::ResponseBuilder rb{ctx, 2}; |
| 541 | rb.Push(ResultSuccess); | 544 | rb.Push(ResultSuccess); |
| 542 | } | 545 | } |
| 546 | |||
| 547 | Result GetCertificateBufSize( | ||
| 548 | Out<u32> out_size, InArray<CaCertificateId, BufferAttr_HipcMapAlias> certificate_ids) { | ||
| 549 | LOG_INFO(Service_SSL, "called"); | ||
| 550 | u32 num_entries; | ||
| 551 | R_RETURN(cert_store.GetCertificateBufSize(out_size, &num_entries, certificate_ids)); | ||
| 552 | } | ||
| 553 | |||
| 554 | Result GetCertificates(Out<u32> out_num_entries, OutBuffer<BufferAttr_HipcMapAlias> out_buffer, | ||
| 555 | InArray<CaCertificateId, BufferAttr_HipcMapAlias> certificate_ids) { | ||
| 556 | LOG_INFO(Service_SSL, "called"); | ||
| 557 | R_RETURN(cert_store.GetCertificates(out_num_entries, out_buffer, certificate_ids)); | ||
| 558 | } | ||
| 559 | |||
| 560 | private: | ||
| 561 | CertStore cert_store; | ||
| 543 | }; | 562 | }; |
| 544 | 563 | ||
| 545 | void LoopProcess(Core::System& system) { | 564 | void LoopProcess(Core::System& system) { |
diff --git a/src/core/hle/service/ssl/ssl_types.h b/src/core/hle/service/ssl/ssl_types.h new file mode 100644 index 000000000..dbc3dbf64 --- /dev/null +++ b/src/core/hle/service/ssl/ssl_types.h | |||
| @@ -0,0 +1,107 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "common/common_types.h" | ||
| 7 | |||
| 8 | namespace Service::SSL { | ||
| 9 | |||
| 10 | enum class CaCertificateId : s32 { | ||
| 11 | All = -1, | ||
| 12 | NintendoCAG3 = 1, | ||
| 13 | NintendoClass2CAG3 = 2, | ||
| 14 | NintendoRootCAG4 = 3, | ||
| 15 | AmazonRootCA1 = 1000, | ||
| 16 | StarfieldServicesRootCertificateAuthorityG2 = 1001, | ||
| 17 | AddTrustExternalCARoot = 1002, | ||
| 18 | COMODOCertificationAuthority = 1003, | ||
| 19 | UTNDATACorpSGC = 1004, | ||
| 20 | UTNUSERFirstHardware = 1005, | ||
| 21 | BaltimoreCyberTrustRoot = 1006, | ||
| 22 | CybertrustGlobalRoot = 1007, | ||
| 23 | VerizonGlobalRootCA = 1008, | ||
| 24 | DigiCertAssuredIDRootCA = 1009, | ||
| 25 | DigiCertAssuredIDRootG2 = 1010, | ||
| 26 | DigiCertGlobalRootCA = 1011, | ||
| 27 | DigiCertGlobalRootG2 = 1012, | ||
| 28 | DigiCertHighAssuranceEVRootCA = 1013, | ||
| 29 | EntrustnetCertificationAuthority2048 = 1014, | ||
| 30 | EntrustRootCertificationAuthority = 1015, | ||
| 31 | EntrustRootCertificationAuthorityG2 = 1016, | ||
| 32 | GeoTrustGlobalCA2 = 1017, | ||
| 33 | GeoTrustGlobalCA = 1018, | ||
| 34 | GeoTrustPrimaryCertificationAuthorityG3 = 1019, | ||
| 35 | GeoTrustPrimaryCertificationAuthority = 1020, | ||
| 36 | GlobalSignRootCA = 1021, | ||
| 37 | GlobalSignRootCAR2 = 1022, | ||
| 38 | GlobalSignRootCAR3 = 1023, | ||
| 39 | GoDaddyClass2CertificationAuthority = 1024, | ||
| 40 | GoDaddyRootCertificateAuthorityG2 = 1025, | ||
| 41 | StarfieldClass2CertificationAuthority = 1026, | ||
| 42 | StarfieldRootCertificateAuthorityG2 = 1027, | ||
| 43 | thawtePrimaryRootCAG3 = 1028, | ||
| 44 | thawtePrimaryRootCA = 1029, | ||
| 45 | VeriSignClass3PublicPrimaryCertificationAuthorityG3 = 1030, | ||
| 46 | VeriSignClass3PublicPrimaryCertificationAuthorityG5 = 1031, | ||
| 47 | VeriSignUniversalRootCertificationAuthority = 1032, | ||
| 48 | DSTRootCAX3 = 1033, | ||
| 49 | USERTrustRsaCertificationAuthority = 1034, | ||
| 50 | ISRGRootX10 = 1035, | ||
| 51 | USERTrustEccCertificationAuthority = 1036, | ||
| 52 | COMODORsaCertificationAuthority = 1037, | ||
| 53 | COMODOEccCertificationAuthority = 1038, | ||
| 54 | AmazonRootCA2 = 1039, | ||
| 55 | AmazonRootCA3 = 1040, | ||
| 56 | AmazonRootCA4 = 1041, | ||
| 57 | DigiCertAssuredIDRootG3 = 1042, | ||
| 58 | DigiCertGlobalRootG3 = 1043, | ||
| 59 | DigiCertTrustedRootG4 = 1044, | ||
| 60 | EntrustRootCertificationAuthorityEC1 = 1045, | ||
| 61 | EntrustRootCertificationAuthorityG4 = 1046, | ||
| 62 | GlobalSignECCRootCAR4 = 1047, | ||
| 63 | GlobalSignECCRootCAR5 = 1048, | ||
| 64 | GlobalSignECCRootCAR6 = 1049, | ||
| 65 | GTSRootR1 = 1050, | ||
| 66 | GTSRootR2 = 1051, | ||
| 67 | GTSRootR3 = 1052, | ||
| 68 | GTSRootR4 = 1053, | ||
| 69 | SecurityCommunicationRootCA = 1054, | ||
| 70 | GlobalSignRootE4 = 1055, | ||
| 71 | GlobalSignRootR4 = 1056, | ||
| 72 | TTeleSecGlobalRootClass2 = 1057, | ||
| 73 | DigiCertTLSECCP384RootG5 = 1058, | ||
| 74 | DigiCertTLSRSA4096RootG5 = 1059, | ||
| 75 | }; | ||
| 76 | |||
| 77 | enum class TrustedCertStatus : s32 { | ||
| 78 | Invalid = -1, | ||
| 79 | Removed = 0, | ||
| 80 | EnabledTrusted = 1, | ||
| 81 | EnabledNotTrusted = 2, | ||
| 82 | Revoked = 3, | ||
| 83 | }; | ||
| 84 | |||
| 85 | struct BuiltInCertificateInfo { | ||
| 86 | CaCertificateId cert_id; | ||
| 87 | TrustedCertStatus status; | ||
| 88 | u64 der_size; | ||
| 89 | u64 der_offset; | ||
| 90 | }; | ||
| 91 | static_assert(sizeof(BuiltInCertificateInfo) == 0x18, "BuiltInCertificateInfo has incorrect size."); | ||
| 92 | |||
| 93 | struct CertStoreHeader { | ||
| 94 | u32 magic; | ||
| 95 | u32 num_entries; | ||
| 96 | }; | ||
| 97 | static_assert(sizeof(CertStoreHeader) == 0x8, "CertStoreHeader has incorrect size."); | ||
| 98 | |||
| 99 | struct CertStoreEntry { | ||
| 100 | CaCertificateId certificate_id; | ||
| 101 | TrustedCertStatus certificate_status; | ||
| 102 | u32 der_size; | ||
| 103 | u32 der_offset; | ||
| 104 | }; | ||
| 105 | static_assert(sizeof(CertStoreEntry) == 0x10, "CertStoreEntry has incorrect size."); | ||
| 106 | |||
| 107 | } // namespace Service::SSL | ||
diff --git a/src/yuzu/configuration/configure_applets.cpp b/src/yuzu/configuration/configure_applets.cpp index 513ecb548..139bfa9da 100644 --- a/src/yuzu/configuration/configure_applets.cpp +++ b/src/yuzu/configuration/configure_applets.cpp | |||
| @@ -59,9 +59,7 @@ void ConfigureApplets::Setup(const ConfigurationShared::Builder& builder) { | |||
| 59 | 59 | ||
| 60 | // Untested applets | 60 | // Untested applets |
| 61 | if (setting->Id() == Settings::values.data_erase_applet_mode.Id() || | 61 | if (setting->Id() == Settings::values.data_erase_applet_mode.Id() || |
| 62 | setting->Id() == Settings::values.error_applet_mode.Id() || | ||
| 63 | setting->Id() == Settings::values.net_connect_applet_mode.Id() || | 62 | setting->Id() == Settings::values.net_connect_applet_mode.Id() || |
| 64 | setting->Id() == Settings::values.web_applet_mode.Id() || | ||
| 65 | setting->Id() == Settings::values.shop_applet_mode.Id() || | 63 | setting->Id() == Settings::values.shop_applet_mode.Id() || |
| 66 | setting->Id() == Settings::values.login_share_applet_mode.Id() || | 64 | setting->Id() == Settings::values.login_share_applet_mode.Id() || |
| 67 | setting->Id() == Settings::values.wifi_web_auth_applet_mode.Id() || | 65 | setting->Id() == Settings::values.wifi_web_auth_applet_mode.Id() || |