diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 44 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.h | 30 | ||||
| -rw-r--r-- | src/core/hle/service/am/applet_ae.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/service/audio/audctl.cpp | 46 | ||||
| -rw-r--r-- | src/core/hle/service/audio/audctl.h | 22 | ||||
| -rw-r--r-- | src/core/hle/service/olsc/olsc.cpp | 158 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/pctl_module.cpp | 152 | ||||
| -rw-r--r-- | src/core/hle/service/set/set.cpp | 60 | ||||
| -rw-r--r-- | src/core/hle/service/set/set.h | 61 | ||||
| -rw-r--r-- | src/core/hle/service/set/set_sys.cpp | 375 | ||||
| -rw-r--r-- | src/core/hle/service/set/set_sys.h | 322 | ||||
| -rw-r--r-- | src/shader_recompiler/environment.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 12 | ||||
| -rw-r--r-- | src/video_core/shader_cache.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/shader_cache.h | 2 | ||||
| -rw-r--r-- | src/video_core/shader_environment.cpp | 31 | ||||
| -rw-r--r-- | src/video_core/shader_environment.h | 6 |
18 files changed, 1170 insertions, 176 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 4f400d341..585675718 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -1317,6 +1317,50 @@ void ILibraryAppletCreator::CreateHandleStorage(HLERequestContext& ctx) { | |||
| 1317 | rb.PushIpcInterface<IStorage>(system, std::move(memory)); | 1317 | rb.PushIpcInterface<IStorage>(system, std::move(memory)); |
| 1318 | } | 1318 | } |
| 1319 | 1319 | ||
| 1320 | ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_) | ||
| 1321 | : ServiceFramework{system_, "ILibraryAppletSelfAccessor"} { | ||
| 1322 | static const FunctionInfo functions[] = { | ||
| 1323 | {0, nullptr, "PopInData"}, | ||
| 1324 | {1, nullptr, "PushOutData"}, | ||
| 1325 | {2, nullptr, "PopInteractiveInData"}, | ||
| 1326 | {3, nullptr, "PushInteractiveOutData"}, | ||
| 1327 | {5, nullptr, "GetPopInDataEvent"}, | ||
| 1328 | {6, nullptr, "GetPopInteractiveInDataEvent"}, | ||
| 1329 | {10, nullptr, "ExitProcessAndReturn"}, | ||
| 1330 | {11, nullptr, "GetLibraryAppletInfo"}, | ||
| 1331 | {12, nullptr, "GetMainAppletIdentityInfo"}, | ||
| 1332 | {13, nullptr, "CanUseApplicationCore"}, | ||
| 1333 | {14, nullptr, "GetCallerAppletIdentityInfo"}, | ||
| 1334 | {15, nullptr, "GetMainAppletApplicationControlProperty"}, | ||
| 1335 | {16, nullptr, "GetMainAppletStorageId"}, | ||
| 1336 | {17, nullptr, "GetCallerAppletIdentityInfoStack"}, | ||
| 1337 | {18, nullptr, "GetNextReturnDestinationAppletIdentityInfo"}, | ||
| 1338 | {19, nullptr, "GetDesirableKeyboardLayout"}, | ||
| 1339 | {20, nullptr, "PopExtraStorage"}, | ||
| 1340 | {25, nullptr, "GetPopExtraStorageEvent"}, | ||
| 1341 | {30, nullptr, "UnpopInData"}, | ||
| 1342 | {31, nullptr, "UnpopExtraStorage"}, | ||
| 1343 | {40, nullptr, "GetIndirectLayerProducerHandle"}, | ||
| 1344 | {50, nullptr, "ReportVisibleError"}, | ||
| 1345 | {51, nullptr, "ReportVisibleErrorWithErrorContext"}, | ||
| 1346 | {60, nullptr, "GetMainAppletApplicationDesiredLanguage"}, | ||
| 1347 | {70, nullptr, "GetCurrentApplicationId"}, | ||
| 1348 | {80, nullptr, "RequestExitToSelf"}, | ||
| 1349 | {90, nullptr, "CreateApplicationAndPushAndRequestToLaunch"}, | ||
| 1350 | {100, nullptr, "CreateGameMovieTrimmer"}, | ||
| 1351 | {101, nullptr, "ReserveResourceForMovieOperation"}, | ||
| 1352 | {102, nullptr, "UnreserveResourceForMovieOperation"}, | ||
| 1353 | {110, nullptr, "GetMainAppletAvailableUsers"}, | ||
| 1354 | {120, nullptr, "GetLaunchStorageInfoForDebug"}, | ||
| 1355 | {130, nullptr, "GetGpuErrorDetectedSystemEvent"}, | ||
| 1356 | {140, nullptr, "SetApplicationMemoryReservation"}, | ||
| 1357 | {150, nullptr, "ShouldSetGpuTimeSliceManually"}, | ||
| 1358 | }; | ||
| 1359 | RegisterHandlers(functions); | ||
| 1360 | } | ||
| 1361 | |||
| 1362 | ILibraryAppletSelfAccessor::~ILibraryAppletSelfAccessor() = default; | ||
| 1363 | |||
| 1320 | IApplicationFunctions::IApplicationFunctions(Core::System& system_) | 1364 | IApplicationFunctions::IApplicationFunctions(Core::System& system_) |
| 1321 | : ServiceFramework{system_, "IApplicationFunctions"}, service_context{system, | 1365 | : ServiceFramework{system_, "IApplicationFunctions"}, service_context{system, |
| 1322 | "IApplicationFunctions"} { | 1366 | "IApplicationFunctions"} { |
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index d4fd163da..d68998f04 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h | |||
| @@ -22,30 +22,6 @@ class Nvnflinger; | |||
| 22 | 22 | ||
| 23 | namespace Service::AM { | 23 | namespace Service::AM { |
| 24 | 24 | ||
| 25 | // This is nn::settings::Language | ||
| 26 | enum SystemLanguage { | ||
| 27 | Japanese = 0, | ||
| 28 | English = 1, // en-US | ||
| 29 | French = 2, | ||
| 30 | German = 3, | ||
| 31 | Italian = 4, | ||
| 32 | Spanish = 5, | ||
| 33 | Chinese = 6, | ||
| 34 | Korean = 7, | ||
| 35 | Dutch = 8, | ||
| 36 | Portuguese = 9, | ||
| 37 | Russian = 10, | ||
| 38 | Taiwanese = 11, | ||
| 39 | BritishEnglish = 12, // en-GB | ||
| 40 | CanadianFrench = 13, | ||
| 41 | LatinAmericanSpanish = 14, // es-419 | ||
| 42 | // 4.0.0+ | ||
| 43 | SimplifiedChinese = 15, | ||
| 44 | TraditionalChinese = 16, | ||
| 45 | // 10.1.0+ | ||
| 46 | BrazilianPortuguese = 17, | ||
| 47 | }; | ||
| 48 | |||
| 49 | class AppletMessageQueue { | 25 | class AppletMessageQueue { |
| 50 | public: | 26 | public: |
| 51 | // This is nn::am::AppletMessage | 27 | // This is nn::am::AppletMessage |
| @@ -314,6 +290,12 @@ private: | |||
| 314 | void CreateHandleStorage(HLERequestContext& ctx); | 290 | void CreateHandleStorage(HLERequestContext& ctx); |
| 315 | }; | 291 | }; |
| 316 | 292 | ||
| 293 | class ILibraryAppletSelfAccessor final : public ServiceFramework<ILibraryAppletSelfAccessor> { | ||
| 294 | public: | ||
| 295 | explicit ILibraryAppletSelfAccessor(Core::System& system_); | ||
| 296 | ~ILibraryAppletSelfAccessor() override; | ||
| 297 | }; | ||
| 298 | |||
| 317 | class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> { | 299 | class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> { |
| 318 | public: | 300 | public: |
| 319 | explicit IApplicationFunctions(Core::System& system_); | 301 | explicit IApplicationFunctions(Core::System& system_); |
diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp index 2764f7ceb..ee9d99a54 100644 --- a/src/core/hle/service/am/applet_ae.cpp +++ b/src/core/hle/service/am/applet_ae.cpp | |||
| @@ -26,8 +26,10 @@ public: | |||
| 26 | {4, &ILibraryAppletProxy::GetDisplayController, "GetDisplayController"}, | 26 | {4, &ILibraryAppletProxy::GetDisplayController, "GetDisplayController"}, |
| 27 | {10, &ILibraryAppletProxy::GetProcessWindingController, "GetProcessWindingController"}, | 27 | {10, &ILibraryAppletProxy::GetProcessWindingController, "GetProcessWindingController"}, |
| 28 | {11, &ILibraryAppletProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"}, | 28 | {11, &ILibraryAppletProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"}, |
| 29 | {20, &ILibraryAppletProxy::GetApplicationFunctions, "GetApplicationFunctions"}, | 29 | {20, &ILibraryAppletProxy::OpenLibraryAppletSelfAccessor, "OpenLibraryAppletSelfAccessor"}, |
| 30 | {21, nullptr, "GetAppletCommonFunctions"}, | 30 | {21, nullptr, "GetAppletCommonFunctions"}, |
| 31 | {22, nullptr, "GetHomeMenuFunctions"}, | ||
| 32 | {23, nullptr, "GetGlobalStateController"}, | ||
| 31 | {1000, &ILibraryAppletProxy::GetDebugFunctions, "GetDebugFunctions"}, | 33 | {1000, &ILibraryAppletProxy::GetDebugFunctions, "GetDebugFunctions"}, |
| 32 | }; | 34 | }; |
| 33 | // clang-format on | 35 | // clang-format on |
| @@ -100,12 +102,12 @@ private: | |||
| 100 | rb.PushIpcInterface<ILibraryAppletCreator>(system); | 102 | rb.PushIpcInterface<ILibraryAppletCreator>(system); |
| 101 | } | 103 | } |
| 102 | 104 | ||
| 103 | void GetApplicationFunctions(HLERequestContext& ctx) { | 105 | void OpenLibraryAppletSelfAccessor(HLERequestContext& ctx) { |
| 104 | LOG_DEBUG(Service_AM, "called"); | 106 | LOG_DEBUG(Service_AM, "called"); |
| 105 | 107 | ||
| 106 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 108 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 107 | rb.Push(ResultSuccess); | 109 | rb.Push(ResultSuccess); |
| 108 | rb.PushIpcInterface<IApplicationFunctions>(system); | 110 | rb.PushIpcInterface<ILibraryAppletSelfAccessor>(system); |
| 109 | } | 111 | } |
| 110 | 112 | ||
| 111 | Nvnflinger::Nvnflinger& nvnflinger; | 113 | Nvnflinger::Nvnflinger& nvnflinger; |
diff --git a/src/core/hle/service/audio/audctl.cpp b/src/core/hle/service/audio/audctl.cpp index 7ad93be6b..66dd64fd1 100644 --- a/src/core/hle/service/audio/audctl.cpp +++ b/src/core/hle/service/audio/audctl.cpp | |||
| @@ -22,13 +22,13 @@ AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} { | |||
| 22 | {9, nullptr, "GetAudioOutputMode"}, | 22 | {9, nullptr, "GetAudioOutputMode"}, |
| 23 | {10, nullptr, "SetAudioOutputMode"}, | 23 | {10, nullptr, "SetAudioOutputMode"}, |
| 24 | {11, nullptr, "SetForceMutePolicy"}, | 24 | {11, nullptr, "SetForceMutePolicy"}, |
| 25 | {12, nullptr, "GetForceMutePolicy"}, | 25 | {12, &AudCtl::GetForceMutePolicy, "GetForceMutePolicy"}, |
| 26 | {13, nullptr, "GetOutputModeSetting"}, | 26 | {13, &AudCtl::GetOutputModeSetting, "GetOutputModeSetting"}, |
| 27 | {14, nullptr, "SetOutputModeSetting"}, | 27 | {14, nullptr, "SetOutputModeSetting"}, |
| 28 | {15, nullptr, "SetOutputTarget"}, | 28 | {15, nullptr, "SetOutputTarget"}, |
| 29 | {16, nullptr, "SetInputTargetForceEnabled"}, | 29 | {16, nullptr, "SetInputTargetForceEnabled"}, |
| 30 | {17, nullptr, "SetHeadphoneOutputLevelMode"}, | 30 | {17, nullptr, "SetHeadphoneOutputLevelMode"}, |
| 31 | {18, nullptr, "GetHeadphoneOutputLevelMode"}, | 31 | {18, &AudCtl::GetHeadphoneOutputLevelMode, "GetHeadphoneOutputLevelMode"}, |
| 32 | {19, nullptr, "AcquireAudioVolumeUpdateEventForPlayReport"}, | 32 | {19, nullptr, "AcquireAudioVolumeUpdateEventForPlayReport"}, |
| 33 | {20, nullptr, "AcquireAudioOutputDeviceUpdateEventForPlayReport"}, | 33 | {20, nullptr, "AcquireAudioOutputDeviceUpdateEventForPlayReport"}, |
| 34 | {21, nullptr, "GetAudioOutputTargetForPlayReport"}, | 34 | {21, nullptr, "GetAudioOutputTargetForPlayReport"}, |
| @@ -41,7 +41,7 @@ AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} { | |||
| 41 | {28, nullptr, "GetAudioOutputChannelCountForPlayReport"}, | 41 | {28, nullptr, "GetAudioOutputChannelCountForPlayReport"}, |
| 42 | {29, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, | 42 | {29, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, |
| 43 | {30, nullptr, "SetSpeakerAutoMuteEnabled"}, | 43 | {30, nullptr, "SetSpeakerAutoMuteEnabled"}, |
| 44 | {31, nullptr, "IsSpeakerAutoMuteEnabled"}, | 44 | {31, &AudCtl::IsSpeakerAutoMuteEnabled, "IsSpeakerAutoMuteEnabled"}, |
| 45 | {32, nullptr, "GetActiveOutputTarget"}, | 45 | {32, nullptr, "GetActiveOutputTarget"}, |
| 46 | {33, nullptr, "GetTargetDeviceInfo"}, | 46 | {33, nullptr, "GetTargetDeviceInfo"}, |
| 47 | {34, nullptr, "AcquireTargetNotification"}, | 47 | {34, nullptr, "AcquireTargetNotification"}, |
| @@ -96,4 +96,42 @@ void AudCtl::GetTargetVolumeMax(HLERequestContext& ctx) { | |||
| 96 | rb.Push(target_max_volume); | 96 | rb.Push(target_max_volume); |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | void AudCtl::GetForceMutePolicy(HLERequestContext& ctx) { | ||
| 100 | LOG_WARNING(Audio, "(STUBBED) called"); | ||
| 101 | |||
| 102 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 103 | rb.Push(ResultSuccess); | ||
| 104 | rb.PushEnum(ForceMutePolicy::Disable); | ||
| 105 | } | ||
| 106 | |||
| 107 | void AudCtl::GetOutputModeSetting(HLERequestContext& ctx) { | ||
| 108 | IPC::RequestParser rp{ctx}; | ||
| 109 | const auto value = rp.Pop<u32>(); | ||
| 110 | |||
| 111 | LOG_WARNING(Audio, "(STUBBED) called, value={}", value); | ||
| 112 | |||
| 113 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 114 | rb.Push(ResultSuccess); | ||
| 115 | rb.PushEnum(AudioOutputMode::PcmAuto); | ||
| 116 | } | ||
| 117 | |||
| 118 | void AudCtl::GetHeadphoneOutputLevelMode(HLERequestContext& ctx) { | ||
| 119 | LOG_WARNING(Audio, "(STUBBED) called"); | ||
| 120 | |||
| 121 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 122 | rb.Push(ResultSuccess); | ||
| 123 | rb.PushEnum(HeadphoneOutputLevelMode::Normal); | ||
| 124 | } | ||
| 125 | |||
| 126 | void AudCtl::IsSpeakerAutoMuteEnabled(HLERequestContext& ctx) { | ||
| 127 | const bool is_speaker_auto_mute_enabled = false; | ||
| 128 | |||
| 129 | LOG_WARNING(Audio, "(STUBBED) called, is_speaker_auto_mute_enabled={}", | ||
| 130 | is_speaker_auto_mute_enabled); | ||
| 131 | |||
| 132 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 133 | rb.Push(ResultSuccess); | ||
| 134 | rb.Push<u8>(is_speaker_auto_mute_enabled); | ||
| 135 | } | ||
| 136 | |||
| 99 | } // namespace Service::Audio | 137 | } // namespace Service::Audio |
diff --git a/src/core/hle/service/audio/audctl.h b/src/core/hle/service/audio/audctl.h index 8e31ac237..d57abb383 100644 --- a/src/core/hle/service/audio/audctl.h +++ b/src/core/hle/service/audio/audctl.h | |||
| @@ -17,8 +17,30 @@ public: | |||
| 17 | ~AudCtl() override; | 17 | ~AudCtl() override; |
| 18 | 18 | ||
| 19 | private: | 19 | private: |
| 20 | enum class AudioOutputMode { | ||
| 21 | Invalid, | ||
| 22 | Pcm1ch, | ||
| 23 | Pcm2ch, | ||
| 24 | Pcm6ch, | ||
| 25 | PcmAuto, | ||
| 26 | }; | ||
| 27 | |||
| 28 | enum class ForceMutePolicy { | ||
| 29 | Disable, | ||
| 30 | SpeakerMuteOnHeadphoneUnplugged, | ||
| 31 | }; | ||
| 32 | |||
| 33 | enum class HeadphoneOutputLevelMode { | ||
| 34 | Normal, | ||
| 35 | HighPower, | ||
| 36 | }; | ||
| 37 | |||
| 20 | void GetTargetVolumeMin(HLERequestContext& ctx); | 38 | void GetTargetVolumeMin(HLERequestContext& ctx); |
| 21 | void GetTargetVolumeMax(HLERequestContext& ctx); | 39 | void GetTargetVolumeMax(HLERequestContext& ctx); |
| 40 | void GetForceMutePolicy(HLERequestContext& ctx); | ||
| 41 | void GetOutputModeSetting(HLERequestContext& ctx); | ||
| 42 | void GetHeadphoneOutputLevelMode(HLERequestContext& ctx); | ||
| 43 | void IsSpeakerAutoMuteEnabled(HLERequestContext& ctx); | ||
| 22 | }; | 44 | }; |
| 23 | 45 | ||
| 24 | } // namespace Service::Audio | 46 | } // namespace Service::Audio |
diff --git a/src/core/hle/service/olsc/olsc.cpp b/src/core/hle/service/olsc/olsc.cpp index 14ba67b4c..889f27c31 100644 --- a/src/core/hle/service/olsc/olsc.cpp +++ b/src/core/hle/service/olsc/olsc.cpp | |||
| @@ -8,15 +8,16 @@ | |||
| 8 | 8 | ||
| 9 | namespace Service::OLSC { | 9 | namespace Service::OLSC { |
| 10 | 10 | ||
| 11 | class OLSC final : public ServiceFramework<OLSC> { | 11 | class IOlscServiceForApplication final : public ServiceFramework<IOlscServiceForApplication> { |
| 12 | public: | 12 | public: |
| 13 | explicit OLSC(Core::System& system_) : ServiceFramework{system_, "olsc:u"} { | 13 | explicit IOlscServiceForApplication(Core::System& system_) |
| 14 | : ServiceFramework{system_, "olsc:u"} { | ||
| 14 | // clang-format off | 15 | // clang-format off |
| 15 | static const FunctionInfo functions[] = { | 16 | static const FunctionInfo functions[] = { |
| 16 | {0, &OLSC::Initialize, "Initialize"}, | 17 | {0, &IOlscServiceForApplication::Initialize, "Initialize"}, |
| 17 | {10, nullptr, "VerifySaveDataBackupLicenseAsync"}, | 18 | {10, nullptr, "VerifySaveDataBackupLicenseAsync"}, |
| 18 | {13, &OLSC::GetSaveDataBackupSetting, "GetSaveDataBackupSetting"}, | 19 | {13, &IOlscServiceForApplication::GetSaveDataBackupSetting, "GetSaveDataBackupSetting"}, |
| 19 | {14, &OLSC::SetSaveDataBackupSettingEnabled, "SetSaveDataBackupSettingEnabled"}, | 20 | {14, &IOlscServiceForApplication::SetSaveDataBackupSettingEnabled, "SetSaveDataBackupSettingEnabled"}, |
| 20 | {15, nullptr, "SetCustomData"}, | 21 | {15, nullptr, "SetCustomData"}, |
| 21 | {16, nullptr, "DeleteSaveDataBackupSetting"}, | 22 | {16, nullptr, "DeleteSaveDataBackupSetting"}, |
| 22 | {18, nullptr, "GetSaveDataBackupInfoCache"}, | 23 | {18, nullptr, "GetSaveDataBackupInfoCache"}, |
| @@ -72,10 +73,155 @@ private: | |||
| 72 | bool initialized{}; | 73 | bool initialized{}; |
| 73 | }; | 74 | }; |
| 74 | 75 | ||
| 76 | class INativeHandleHolder final : public ServiceFramework<INativeHandleHolder> { | ||
| 77 | public: | ||
| 78 | explicit INativeHandleHolder(Core::System& system_) | ||
| 79 | : ServiceFramework{system_, "INativeHandleHolder"} { | ||
| 80 | // clang-format off | ||
| 81 | static const FunctionInfo functions[] = { | ||
| 82 | {0, nullptr, "GetNativeHandle"}, | ||
| 83 | }; | ||
| 84 | // clang-format on | ||
| 85 | |||
| 86 | RegisterHandlers(functions); | ||
| 87 | } | ||
| 88 | }; | ||
| 89 | |||
| 90 | class ITransferTaskListController final : public ServiceFramework<ITransferTaskListController> { | ||
| 91 | public: | ||
| 92 | explicit ITransferTaskListController(Core::System& system_) | ||
| 93 | : ServiceFramework{system_, "ITransferTaskListController"} { | ||
| 94 | // clang-format off | ||
| 95 | static const FunctionInfo functions[] = { | ||
| 96 | {0, nullptr, "Unknown0"}, | ||
| 97 | {1, nullptr, "Unknown1"}, | ||
| 98 | {2, nullptr, "Unknown2"}, | ||
| 99 | {3, nullptr, "Unknown3"}, | ||
| 100 | {4, nullptr, "Unknown4"}, | ||
| 101 | {5, &ITransferTaskListController::GetNativeHandleHolder , "GetNativeHandleHolder"}, | ||
| 102 | {6, nullptr, "Unknown6"}, | ||
| 103 | {7, nullptr, "Unknown7"}, | ||
| 104 | {8, nullptr, "GetRemoteStorageController"}, | ||
| 105 | {9, &ITransferTaskListController::GetNativeHandleHolder, "GetNativeHandleHolder2"}, | ||
| 106 | {10, nullptr, "Unknown10"}, | ||
| 107 | {11, nullptr, "Unknown11"}, | ||
| 108 | {12, nullptr, "Unknown12"}, | ||
| 109 | {13, nullptr, "Unknown13"}, | ||
| 110 | {14, nullptr, "Unknown14"}, | ||
| 111 | {15, nullptr, "Unknown15"}, | ||
| 112 | {16, nullptr, "Unknown16"}, | ||
| 113 | {17, nullptr, "Unknown17"}, | ||
| 114 | {18, nullptr, "Unknown18"}, | ||
| 115 | {19, nullptr, "Unknown19"}, | ||
| 116 | {20, nullptr, "Unknown20"}, | ||
| 117 | {21, nullptr, "Unknown21"}, | ||
| 118 | {22, nullptr, "Unknown22"}, | ||
| 119 | {23, nullptr, "Unknown23"}, | ||
| 120 | {24, nullptr, "Unknown24"}, | ||
| 121 | {25, nullptr, "Unknown25"}, | ||
| 122 | }; | ||
| 123 | // clang-format on | ||
| 124 | |||
| 125 | RegisterHandlers(functions); | ||
| 126 | } | ||
| 127 | |||
| 128 | private: | ||
| 129 | void GetNativeHandleHolder(HLERequestContext& ctx) { | ||
| 130 | LOG_INFO(Service_OLSC, "called"); | ||
| 131 | |||
| 132 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 133 | rb.Push(ResultSuccess); | ||
| 134 | rb.PushIpcInterface<INativeHandleHolder>(system); | ||
| 135 | } | ||
| 136 | }; | ||
| 137 | |||
| 138 | class IOlscServiceForSystemService final : public ServiceFramework<IOlscServiceForSystemService> { | ||
| 139 | public: | ||
| 140 | explicit IOlscServiceForSystemService(Core::System& system_) | ||
| 141 | : ServiceFramework{system_, "olsc:s"} { | ||
| 142 | // clang-format off | ||
| 143 | static const FunctionInfo functions[] = { | ||
| 144 | {0, &IOlscServiceForSystemService::OpenTransferTaskListController, "OpenTransferTaskListController"}, | ||
| 145 | {1, nullptr, "OpenRemoteStorageController"}, | ||
| 146 | {2, nullptr, "OpenDaemonController"}, | ||
| 147 | {10, nullptr, "Unknown10"}, | ||
| 148 | {11, nullptr, "Unknown11"}, | ||
| 149 | {12, nullptr, "Unknown12"}, | ||
| 150 | {13, nullptr, "Unknown13"}, | ||
| 151 | {100, nullptr, "ListLastTransferTaskErrorInfo"}, | ||
| 152 | {101, nullptr, "GetLastErrorInfoCount"}, | ||
| 153 | {102, nullptr, "RemoveLastErrorInfoOld"}, | ||
| 154 | {103, nullptr, "GetLastErrorInfo"}, | ||
| 155 | {104, nullptr, "GetLastErrorEventHolder"}, | ||
| 156 | {105, nullptr, "GetLastTransferTaskErrorInfo"}, | ||
| 157 | {200, nullptr, "GetDataTransferPolicyInfo"}, | ||
| 158 | {201, nullptr, "RemoveDataTransferPolicyInfo"}, | ||
| 159 | {202, nullptr, "UpdateDataTransferPolicyOld"}, | ||
| 160 | {203, nullptr, "UpdateDataTransferPolicy"}, | ||
| 161 | {204, nullptr, "CleanupDataTransferPolicyInfo"}, | ||
| 162 | {205, nullptr, "RequestDataTransferPolicy"}, | ||
| 163 | {300, nullptr, "GetAutoTransferSeriesInfo"}, | ||
| 164 | {301, nullptr, "UpdateAutoTransferSeriesInfo"}, | ||
| 165 | {400, nullptr, "CleanupSaveDataArchiveInfoType1"}, | ||
| 166 | {900, nullptr, "CleanupTransferTask"}, | ||
| 167 | {902, nullptr, "CleanupSeriesInfoType0"}, | ||
| 168 | {903, nullptr, "CleanupSaveDataArchiveInfoType0"}, | ||
| 169 | {904, nullptr, "CleanupApplicationAutoTransferSetting"}, | ||
| 170 | {905, nullptr, "CleanupErrorHistory"}, | ||
| 171 | {906, nullptr, "SetLastError"}, | ||
| 172 | {907, nullptr, "AddSaveDataArchiveInfoType0"}, | ||
| 173 | {908, nullptr, "RemoveSeriesInfoType0"}, | ||
| 174 | {909, nullptr, "GetSeriesInfoType0"}, | ||
| 175 | {910, nullptr, "RemoveLastErrorInfo"}, | ||
| 176 | {911, nullptr, "CleanupSeriesInfoType1"}, | ||
| 177 | {912, nullptr, "RemoveSeriesInfoType1"}, | ||
| 178 | {913, nullptr, "GetSeriesInfoType1"}, | ||
| 179 | {1000, nullptr, "UpdateIssueOld"}, | ||
| 180 | {1010, nullptr, "Unknown1010"}, | ||
| 181 | {1011, nullptr, "ListIssueInfoOld"}, | ||
| 182 | {1012, nullptr, "GetIssueOld"}, | ||
| 183 | {1013, nullptr, "GetIssue2Old"}, | ||
| 184 | {1014, nullptr, "GetIssue3Old"}, | ||
| 185 | {1020, nullptr, "RepairIssueOld"}, | ||
| 186 | {1021, nullptr, "RepairIssueWithUserIdOld"}, | ||
| 187 | {1022, nullptr, "RepairIssue2Old"}, | ||
| 188 | {1023, nullptr, "RepairIssue3Old"}, | ||
| 189 | {1024, nullptr, "Unknown1024"}, | ||
| 190 | {1100, nullptr, "UpdateIssue"}, | ||
| 191 | {1110, nullptr, "Unknown1110"}, | ||
| 192 | {1111, nullptr, "ListIssueInfo"}, | ||
| 193 | {1112, nullptr, "GetIssue"}, | ||
| 194 | {1113, nullptr, "GetIssue2"}, | ||
| 195 | {1114, nullptr, "GetIssue3"}, | ||
| 196 | {1120, nullptr, "RepairIssue"}, | ||
| 197 | {1121, nullptr, "RepairIssueWithUserId"}, | ||
| 198 | {1122, nullptr, "RepairIssue2"}, | ||
| 199 | {1123, nullptr, "RepairIssue3"}, | ||
| 200 | {1124, nullptr, "Unknown1124"}, | ||
| 201 | }; | ||
| 202 | // clang-format on | ||
| 203 | |||
| 204 | RegisterHandlers(functions); | ||
| 205 | } | ||
| 206 | |||
| 207 | private: | ||
| 208 | void OpenTransferTaskListController(HLERequestContext& ctx) { | ||
| 209 | LOG_INFO(Service_OLSC, "called"); | ||
| 210 | |||
| 211 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 212 | rb.Push(ResultSuccess); | ||
| 213 | rb.PushIpcInterface<ITransferTaskListController>(system); | ||
| 214 | } | ||
| 215 | }; | ||
| 216 | |||
| 75 | void LoopProcess(Core::System& system) { | 217 | void LoopProcess(Core::System& system) { |
| 76 | auto server_manager = std::make_unique<ServerManager>(system); | 218 | auto server_manager = std::make_unique<ServerManager>(system); |
| 77 | 219 | ||
| 78 | server_manager->RegisterNamedService("olsc:u", std::make_shared<OLSC>(system)); | 220 | server_manager->RegisterNamedService("olsc:u", |
| 221 | std::make_shared<IOlscServiceForApplication>(system)); | ||
| 222 | server_manager->RegisterNamedService("olsc:s", | ||
| 223 | std::make_shared<IOlscServiceForSystemService>(system)); | ||
| 224 | |||
| 79 | ServerManager::RunServer(std::move(server_manager)); | 225 | ServerManager::RunServer(std::move(server_manager)); |
| 80 | } | 226 | } |
| 81 | 227 | ||
diff --git a/src/core/hle/service/pctl/pctl_module.cpp b/src/core/hle/service/pctl/pctl_module.cpp index f966c5c8b..7c8a539b8 100644 --- a/src/core/hle/service/pctl/pctl_module.cpp +++ b/src/core/hle/service/pctl/pctl_module.cpp | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include "core/file_sys/control_metadata.h" | 6 | #include "core/file_sys/control_metadata.h" |
| 7 | #include "core/file_sys/patch_manager.h" | 7 | #include "core/file_sys/patch_manager.h" |
| 8 | #include "core/hle/service/ipc_helpers.h" | 8 | #include "core/hle/service/ipc_helpers.h" |
| 9 | #include "core/hle/service/kernel_helpers.h" | ||
| 9 | #include "core/hle/service/pctl/pctl.h" | 10 | #include "core/hle/service/pctl/pctl.h" |
| 10 | #include "core/hle/service/pctl/pctl_module.h" | 11 | #include "core/hle/service/pctl/pctl_module.h" |
| 11 | #include "core/hle/service/server_manager.h" | 12 | #include "core/hle/service/server_manager.h" |
| @@ -24,7 +25,8 @@ constexpr Result ResultNoRestrictionEnabled{ErrorModule::PCTL, 181}; | |||
| 24 | class IParentalControlService final : public ServiceFramework<IParentalControlService> { | 25 | class IParentalControlService final : public ServiceFramework<IParentalControlService> { |
| 25 | public: | 26 | public: |
| 26 | explicit IParentalControlService(Core::System& system_, Capability capability_) | 27 | explicit IParentalControlService(Core::System& system_, Capability capability_) |
| 27 | : ServiceFramework{system_, "IParentalControlService"}, capability{capability_} { | 28 | : ServiceFramework{system_, "IParentalControlService"}, capability{capability_}, |
| 29 | service_context{system_, "IParentalControlService"} { | ||
| 28 | // clang-format off | 30 | // clang-format off |
| 29 | static const FunctionInfo functions[] = { | 31 | static const FunctionInfo functions[] = { |
| 30 | {1, &IParentalControlService::Initialize, "Initialize"}, | 32 | {1, &IParentalControlService::Initialize, "Initialize"}, |
| @@ -33,7 +35,7 @@ public: | |||
| 33 | {1003, nullptr, "ConfirmResumeApplicationPermission"}, | 35 | {1003, nullptr, "ConfirmResumeApplicationPermission"}, |
| 34 | {1004, nullptr, "ConfirmSnsPostPermission"}, | 36 | {1004, nullptr, "ConfirmSnsPostPermission"}, |
| 35 | {1005, nullptr, "ConfirmSystemSettingsPermission"}, | 37 | {1005, nullptr, "ConfirmSystemSettingsPermission"}, |
| 36 | {1006, nullptr, "IsRestrictionTemporaryUnlocked"}, | 38 | {1006, &IParentalControlService::IsRestrictionTemporaryUnlocked, "IsRestrictionTemporaryUnlocked"}, |
| 37 | {1007, nullptr, "RevertRestrictionTemporaryUnlocked"}, | 39 | {1007, nullptr, "RevertRestrictionTemporaryUnlocked"}, |
| 38 | {1008, nullptr, "EnterRestrictedSystemSettings"}, | 40 | {1008, nullptr, "EnterRestrictedSystemSettings"}, |
| 39 | {1009, nullptr, "LeaveRestrictedSystemSettings"}, | 41 | {1009, nullptr, "LeaveRestrictedSystemSettings"}, |
| @@ -47,14 +49,14 @@ public: | |||
| 47 | {1017, &IParentalControlService::EndFreeCommunication, "EndFreeCommunication"}, | 49 | {1017, &IParentalControlService::EndFreeCommunication, "EndFreeCommunication"}, |
| 48 | {1018, &IParentalControlService::IsFreeCommunicationAvailable, "IsFreeCommunicationAvailable"}, | 50 | {1018, &IParentalControlService::IsFreeCommunicationAvailable, "IsFreeCommunicationAvailable"}, |
| 49 | {1031, &IParentalControlService::IsRestrictionEnabled, "IsRestrictionEnabled"}, | 51 | {1031, &IParentalControlService::IsRestrictionEnabled, "IsRestrictionEnabled"}, |
| 50 | {1032, nullptr, "GetSafetyLevel"}, | 52 | {1032, &IParentalControlService::GetSafetyLevel, "GetSafetyLevel"}, |
| 51 | {1033, nullptr, "SetSafetyLevel"}, | 53 | {1033, nullptr, "SetSafetyLevel"}, |
| 52 | {1034, nullptr, "GetSafetyLevelSettings"}, | 54 | {1034, nullptr, "GetSafetyLevelSettings"}, |
| 53 | {1035, nullptr, "GetCurrentSettings"}, | 55 | {1035, &IParentalControlService::GetCurrentSettings, "GetCurrentSettings"}, |
| 54 | {1036, nullptr, "SetCustomSafetyLevelSettings"}, | 56 | {1036, nullptr, "SetCustomSafetyLevelSettings"}, |
| 55 | {1037, nullptr, "GetDefaultRatingOrganization"}, | 57 | {1037, nullptr, "GetDefaultRatingOrganization"}, |
| 56 | {1038, nullptr, "SetDefaultRatingOrganization"}, | 58 | {1038, nullptr, "SetDefaultRatingOrganization"}, |
| 57 | {1039, nullptr, "GetFreeCommunicationApplicationListCount"}, | 59 | {1039, &IParentalControlService::GetFreeCommunicationApplicationListCount, "GetFreeCommunicationApplicationListCount"}, |
| 58 | {1042, nullptr, "AddToFreeCommunicationApplicationList"}, | 60 | {1042, nullptr, "AddToFreeCommunicationApplicationList"}, |
| 59 | {1043, nullptr, "DeleteSettings"}, | 61 | {1043, nullptr, "DeleteSettings"}, |
| 60 | {1044, nullptr, "GetFreeCommunicationApplicationList"}, | 62 | {1044, nullptr, "GetFreeCommunicationApplicationList"}, |
| @@ -76,7 +78,7 @@ public: | |||
| 76 | {1206, nullptr, "GetPinCodeLength"}, | 78 | {1206, nullptr, "GetPinCodeLength"}, |
| 77 | {1207, nullptr, "GetPinCodeChangedEvent"}, | 79 | {1207, nullptr, "GetPinCodeChangedEvent"}, |
| 78 | {1208, nullptr, "GetPinCode"}, | 80 | {1208, nullptr, "GetPinCode"}, |
| 79 | {1403, nullptr, "IsPairingActive"}, | 81 | {1403, &IParentalControlService::IsPairingActive, "IsPairingActive"}, |
| 80 | {1406, nullptr, "GetSettingsLastUpdated"}, | 82 | {1406, nullptr, "GetSettingsLastUpdated"}, |
| 81 | {1411, nullptr, "GetPairingAccountInfo"}, | 83 | {1411, nullptr, "GetPairingAccountInfo"}, |
| 82 | {1421, nullptr, "GetAccountNickname"}, | 84 | {1421, nullptr, "GetAccountNickname"}, |
| @@ -84,18 +86,18 @@ public: | |||
| 84 | {1425, nullptr, "RequestPostEvents"}, | 86 | {1425, nullptr, "RequestPostEvents"}, |
| 85 | {1426, nullptr, "GetPostEventInterval"}, | 87 | {1426, nullptr, "GetPostEventInterval"}, |
| 86 | {1427, nullptr, "SetPostEventInterval"}, | 88 | {1427, nullptr, "SetPostEventInterval"}, |
| 87 | {1432, nullptr, "GetSynchronizationEvent"}, | 89 | {1432, &IParentalControlService::GetSynchronizationEvent, "GetSynchronizationEvent"}, |
| 88 | {1451, nullptr, "StartPlayTimer"}, | 90 | {1451, nullptr, "StartPlayTimer"}, |
| 89 | {1452, nullptr, "StopPlayTimer"}, | 91 | {1452, nullptr, "StopPlayTimer"}, |
| 90 | {1453, nullptr, "IsPlayTimerEnabled"}, | 92 | {1453, nullptr, "IsPlayTimerEnabled"}, |
| 91 | {1454, nullptr, "GetPlayTimerRemainingTime"}, | 93 | {1454, nullptr, "GetPlayTimerRemainingTime"}, |
| 92 | {1455, nullptr, "IsRestrictedByPlayTimer"}, | 94 | {1455, nullptr, "IsRestrictedByPlayTimer"}, |
| 93 | {1456, nullptr, "GetPlayTimerSettings"}, | 95 | {1456, &IParentalControlService::GetPlayTimerSettings, "GetPlayTimerSettings"}, |
| 94 | {1457, nullptr, "GetPlayTimerEventToRequestSuspension"}, | 96 | {1457, &IParentalControlService::GetPlayTimerEventToRequestSuspension, "GetPlayTimerEventToRequestSuspension"}, |
| 95 | {1458, nullptr, "IsPlayTimerAlarmDisabled"}, | 97 | {1458, &IParentalControlService::IsPlayTimerAlarmDisabled, "IsPlayTimerAlarmDisabled"}, |
| 96 | {1471, nullptr, "NotifyWrongPinCodeInputManyTimes"}, | 98 | {1471, nullptr, "NotifyWrongPinCodeInputManyTimes"}, |
| 97 | {1472, nullptr, "CancelNetworkRequest"}, | 99 | {1472, nullptr, "CancelNetworkRequest"}, |
| 98 | {1473, nullptr, "GetUnlinkedEvent"}, | 100 | {1473, &IParentalControlService::GetUnlinkedEvent, "GetUnlinkedEvent"}, |
| 99 | {1474, nullptr, "ClearUnlinkedEvent"}, | 101 | {1474, nullptr, "ClearUnlinkedEvent"}, |
| 100 | {1601, nullptr, "DisableAllFeatures"}, | 102 | {1601, nullptr, "DisableAllFeatures"}, |
| 101 | {1602, nullptr, "PostEnableAllFeatures"}, | 103 | {1602, nullptr, "PostEnableAllFeatures"}, |
| @@ -131,6 +133,12 @@ public: | |||
| 131 | }; | 133 | }; |
| 132 | // clang-format on | 134 | // clang-format on |
| 133 | RegisterHandlers(functions); | 135 | RegisterHandlers(functions); |
| 136 | |||
| 137 | synchronization_event = | ||
| 138 | service_context.CreateEvent("IParentalControlService::SynchronizationEvent"); | ||
| 139 | unlinked_event = service_context.CreateEvent("IParentalControlService::UnlinkedEvent"); | ||
| 140 | request_suspension_event = | ||
| 141 | service_context.CreateEvent("IParentalControlService::RequestSuspensionEvent"); | ||
| 134 | } | 142 | } |
| 135 | 143 | ||
| 136 | private: | 144 | private: |
| @@ -144,7 +152,7 @@ private: | |||
| 144 | if (pin_code[0] == '\0') { | 152 | if (pin_code[0] == '\0') { |
| 145 | return true; | 153 | return true; |
| 146 | } | 154 | } |
| 147 | if (!settings.is_free_communication_default_on) { | 155 | if (!restriction_settings.is_free_communication_default_on) { |
| 148 | return true; | 156 | return true; |
| 149 | } | 157 | } |
| 150 | // TODO(ogniK): Check for blacklisted/exempted applications. Return false can happen here | 158 | // TODO(ogniK): Check for blacklisted/exempted applications. Return false can happen here |
| @@ -160,21 +168,21 @@ private: | |||
| 160 | if (pin_code[0] == '\0') { | 168 | if (pin_code[0] == '\0') { |
| 161 | return true; | 169 | return true; |
| 162 | } | 170 | } |
| 163 | if (!settings.is_stero_vision_restricted) { | 171 | if (!restriction_settings.is_stero_vision_restricted) { |
| 164 | return false; | 172 | return false; |
| 165 | } | 173 | } |
| 166 | return true; | 174 | return true; |
| 167 | } | 175 | } |
| 168 | 176 | ||
| 169 | void SetStereoVisionRestrictionImpl(bool is_restricted) { | 177 | void SetStereoVisionRestrictionImpl(bool is_restricted) { |
| 170 | if (settings.disabled) { | 178 | if (restriction_settings.disabled) { |
| 171 | return; | 179 | return; |
| 172 | } | 180 | } |
| 173 | 181 | ||
| 174 | if (pin_code[0] == '\0') { | 182 | if (pin_code[0] == '\0') { |
| 175 | return; | 183 | return; |
| 176 | } | 184 | } |
| 177 | settings.is_stero_vision_restricted = is_restricted; | 185 | restriction_settings.is_stero_vision_restricted = is_restricted; |
| 178 | } | 186 | } |
| 179 | 187 | ||
| 180 | void Initialize(HLERequestContext& ctx) { | 188 | void Initialize(HLERequestContext& ctx) { |
| @@ -228,6 +236,17 @@ private: | |||
| 228 | states.free_communication = true; | 236 | states.free_communication = true; |
| 229 | } | 237 | } |
| 230 | 238 | ||
| 239 | void IsRestrictionTemporaryUnlocked(HLERequestContext& ctx) { | ||
| 240 | const bool is_temporary_unlocked = false; | ||
| 241 | |||
| 242 | LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}", | ||
| 243 | is_temporary_unlocked); | ||
| 244 | |||
| 245 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 246 | rb.Push(ResultSuccess); | ||
| 247 | rb.Push<u8>(is_temporary_unlocked); | ||
| 248 | } | ||
| 249 | |||
| 231 | void ConfirmStereoVisionPermission(HLERequestContext& ctx) { | 250 | void ConfirmStereoVisionPermission(HLERequestContext& ctx) { |
| 232 | LOG_DEBUG(Service_PCTL, "called"); | 251 | LOG_DEBUG(Service_PCTL, "called"); |
| 233 | states.stereo_vision = true; | 252 | states.stereo_vision = true; |
| @@ -268,6 +287,34 @@ private: | |||
| 268 | rb.Push(pin_code[0] != '\0'); | 287 | rb.Push(pin_code[0] != '\0'); |
| 269 | } | 288 | } |
| 270 | 289 | ||
| 290 | void GetSafetyLevel(HLERequestContext& ctx) { | ||
| 291 | const u32 safety_level = 0; | ||
| 292 | |||
| 293 | LOG_WARNING(Service_PCTL, "(STUBBED) called, safety_level={}", safety_level); | ||
| 294 | |||
| 295 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 296 | rb.Push(ResultSuccess); | ||
| 297 | rb.Push(safety_level); | ||
| 298 | } | ||
| 299 | |||
| 300 | void GetCurrentSettings(HLERequestContext& ctx) { | ||
| 301 | LOG_INFO(Service_PCTL, "called"); | ||
| 302 | |||
| 303 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 304 | rb.Push(ResultSuccess); | ||
| 305 | rb.PushRaw(restriction_settings); | ||
| 306 | } | ||
| 307 | |||
| 308 | void GetFreeCommunicationApplicationListCount(HLERequestContext& ctx) { | ||
| 309 | const u32 count = 4; | ||
| 310 | |||
| 311 | LOG_WARNING(Service_PCTL, "(STUBBED) called, count={}", count); | ||
| 312 | |||
| 313 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 314 | rb.Push(ResultSuccess); | ||
| 315 | rb.Push(count); | ||
| 316 | } | ||
| 317 | |||
| 271 | void ConfirmStereoVisionRestrictionConfigurable(HLERequestContext& ctx) { | 318 | void ConfirmStereoVisionRestrictionConfigurable(HLERequestContext& ctx) { |
| 272 | LOG_DEBUG(Service_PCTL, "called"); | 319 | LOG_DEBUG(Service_PCTL, "called"); |
| 273 | 320 | ||
| @@ -300,6 +347,61 @@ private: | |||
| 300 | } | 347 | } |
| 301 | } | 348 | } |
| 302 | 349 | ||
| 350 | void IsPairingActive(HLERequestContext& ctx) { | ||
| 351 | const bool is_pairing_active = false; | ||
| 352 | |||
| 353 | LOG_WARNING(Service_PCTL, "(STUBBED) called, is_pairing_active={}", is_pairing_active); | ||
| 354 | |||
| 355 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 356 | rb.Push(ResultSuccess); | ||
| 357 | rb.Push<u8>(is_pairing_active); | ||
| 358 | } | ||
| 359 | |||
| 360 | void GetSynchronizationEvent(HLERequestContext& ctx) { | ||
| 361 | LOG_INFO(Service_PCTL, "called"); | ||
| 362 | |||
| 363 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 364 | rb.Push(ResultSuccess); | ||
| 365 | rb.PushCopyObjects(synchronization_event->GetReadableEvent()); | ||
| 366 | } | ||
| 367 | |||
| 368 | void GetPlayTimerSettings(HLERequestContext& ctx) { | ||
| 369 | LOG_WARNING(Service_PCTL, "(STUBBED) called"); | ||
| 370 | |||
| 371 | const PlayTimerSettings timer_settings{}; | ||
| 372 | |||
| 373 | IPC::ResponseBuilder rb{ctx, 15}; | ||
| 374 | rb.Push(ResultSuccess); | ||
| 375 | rb.PushRaw(timer_settings); | ||
| 376 | } | ||
| 377 | |||
| 378 | void GetPlayTimerEventToRequestSuspension(HLERequestContext& ctx) { | ||
| 379 | LOG_INFO(Service_PCTL, "called"); | ||
| 380 | |||
| 381 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 382 | rb.Push(ResultSuccess); | ||
| 383 | rb.PushCopyObjects(request_suspension_event->GetReadableEvent()); | ||
| 384 | } | ||
| 385 | |||
| 386 | void IsPlayTimerAlarmDisabled(HLERequestContext& ctx) { | ||
| 387 | const bool is_play_timer_alarm_disabled = false; | ||
| 388 | |||
| 389 | LOG_INFO(Service_PCTL, "called, is_play_timer_alarm_disabled={}", | ||
| 390 | is_play_timer_alarm_disabled); | ||
| 391 | |||
| 392 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 393 | rb.Push(ResultSuccess); | ||
| 394 | rb.Push<u8>(is_play_timer_alarm_disabled); | ||
| 395 | } | ||
| 396 | |||
| 397 | void GetUnlinkedEvent(HLERequestContext& ctx) { | ||
| 398 | LOG_INFO(Service_PCTL, "called"); | ||
| 399 | |||
| 400 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 401 | rb.Push(ResultSuccess); | ||
| 402 | rb.PushCopyObjects(unlinked_event->GetReadableEvent()); | ||
| 403 | } | ||
| 404 | |||
| 303 | void SetStereoVisionRestriction(HLERequestContext& ctx) { | 405 | void SetStereoVisionRestriction(HLERequestContext& ctx) { |
| 304 | IPC::RequestParser rp{ctx}; | 406 | IPC::RequestParser rp{ctx}; |
| 305 | const auto can_use = rp.Pop<bool>(); | 407 | const auto can_use = rp.Pop<bool>(); |
| @@ -328,7 +430,7 @@ private: | |||
| 328 | } | 430 | } |
| 329 | 431 | ||
| 330 | rb.Push(ResultSuccess); | 432 | rb.Push(ResultSuccess); |
| 331 | rb.Push(settings.is_stero_vision_restricted); | 433 | rb.Push(restriction_settings.is_stero_vision_restricted); |
| 332 | } | 434 | } |
| 333 | 435 | ||
| 334 | void ResetConfirmedStereoVisionPermission(HLERequestContext& ctx) { | 436 | void ResetConfirmedStereoVisionPermission(HLERequestContext& ctx) { |
| @@ -358,16 +460,30 @@ private: | |||
| 358 | bool stereo_vision{}; | 460 | bool stereo_vision{}; |
| 359 | }; | 461 | }; |
| 360 | 462 | ||
| 361 | struct ParentalControlSettings { | 463 | // This is nn::pctl::RestrictionSettings |
| 464 | struct RestrictionSettings { | ||
| 362 | bool is_stero_vision_restricted{}; | 465 | bool is_stero_vision_restricted{}; |
| 363 | bool is_free_communication_default_on{}; | 466 | bool is_free_communication_default_on{}; |
| 364 | bool disabled{}; | 467 | bool disabled{}; |
| 365 | }; | 468 | }; |
| 469 | static_assert(sizeof(RestrictionSettings) == 0x3, "RestrictionSettings has incorrect size."); | ||
| 470 | |||
| 471 | // This is nn::pctl::PlayTimerSettings | ||
| 472 | struct PlayTimerSettings { | ||
| 473 | // TODO: RE the actual contents of this struct | ||
| 474 | std::array<u8, 0x34> settings; | ||
| 475 | }; | ||
| 476 | static_assert(sizeof(PlayTimerSettings) == 0x34, "PlayTimerSettings has incorrect size."); | ||
| 366 | 477 | ||
| 367 | States states{}; | 478 | States states{}; |
| 368 | ParentalControlSettings settings{}; | 479 | RestrictionSettings restriction_settings{}; |
| 369 | std::array<char, 8> pin_code{}; | 480 | std::array<char, 8> pin_code{}; |
| 370 | Capability capability{}; | 481 | Capability capability{}; |
| 482 | |||
| 483 | Kernel::KEvent* synchronization_event; | ||
| 484 | Kernel::KEvent* unlinked_event; | ||
| 485 | Kernel::KEvent* request_suspension_event; | ||
| 486 | KernelHelpers::ServiceContext service_context; | ||
| 371 | }; | 487 | }; |
| 372 | 488 | ||
| 373 | void Module::Interface::CreateService(HLERequestContext& ctx) { | 489 | void Module::Interface::CreateService(HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index 83f888c54..2082b8ef7 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp | |||
| @@ -11,66 +11,6 @@ | |||
| 11 | 11 | ||
| 12 | namespace Service::Set { | 12 | namespace Service::Set { |
| 13 | namespace { | 13 | namespace { |
| 14 | constexpr std::array<LanguageCode, 18> available_language_codes = {{ | ||
| 15 | LanguageCode::JA, | ||
| 16 | LanguageCode::EN_US, | ||
| 17 | LanguageCode::FR, | ||
| 18 | LanguageCode::DE, | ||
| 19 | LanguageCode::IT, | ||
| 20 | LanguageCode::ES, | ||
| 21 | LanguageCode::ZH_CN, | ||
| 22 | LanguageCode::KO, | ||
| 23 | LanguageCode::NL, | ||
| 24 | LanguageCode::PT, | ||
| 25 | LanguageCode::RU, | ||
| 26 | LanguageCode::ZH_TW, | ||
| 27 | LanguageCode::EN_GB, | ||
| 28 | LanguageCode::FR_CA, | ||
| 29 | LanguageCode::ES_419, | ||
| 30 | LanguageCode::ZH_HANS, | ||
| 31 | LanguageCode::ZH_HANT, | ||
| 32 | LanguageCode::PT_BR, | ||
| 33 | }}; | ||
| 34 | |||
| 35 | enum class KeyboardLayout : u64 { | ||
| 36 | Japanese = 0, | ||
| 37 | EnglishUs = 1, | ||
| 38 | EnglishUsInternational = 2, | ||
| 39 | EnglishUk = 3, | ||
| 40 | French = 4, | ||
| 41 | FrenchCa = 5, | ||
| 42 | Spanish = 6, | ||
| 43 | SpanishLatin = 7, | ||
| 44 | German = 8, | ||
| 45 | Italian = 9, | ||
| 46 | Portuguese = 10, | ||
| 47 | Russian = 11, | ||
| 48 | Korean = 12, | ||
| 49 | ChineseSimplified = 13, | ||
| 50 | ChineseTraditional = 14, | ||
| 51 | }; | ||
| 52 | |||
| 53 | constexpr std::array<std::pair<LanguageCode, KeyboardLayout>, 18> language_to_layout{{ | ||
| 54 | {LanguageCode::JA, KeyboardLayout::Japanese}, | ||
| 55 | {LanguageCode::EN_US, KeyboardLayout::EnglishUs}, | ||
| 56 | {LanguageCode::FR, KeyboardLayout::French}, | ||
| 57 | {LanguageCode::DE, KeyboardLayout::German}, | ||
| 58 | {LanguageCode::IT, KeyboardLayout::Italian}, | ||
| 59 | {LanguageCode::ES, KeyboardLayout::Spanish}, | ||
| 60 | {LanguageCode::ZH_CN, KeyboardLayout::ChineseSimplified}, | ||
| 61 | {LanguageCode::KO, KeyboardLayout::Korean}, | ||
| 62 | {LanguageCode::NL, KeyboardLayout::EnglishUsInternational}, | ||
| 63 | {LanguageCode::PT, KeyboardLayout::Portuguese}, | ||
| 64 | {LanguageCode::RU, KeyboardLayout::Russian}, | ||
| 65 | {LanguageCode::ZH_TW, KeyboardLayout::ChineseTraditional}, | ||
| 66 | {LanguageCode::EN_GB, KeyboardLayout::EnglishUk}, | ||
| 67 | {LanguageCode::FR_CA, KeyboardLayout::FrenchCa}, | ||
| 68 | {LanguageCode::ES_419, KeyboardLayout::SpanishLatin}, | ||
| 69 | {LanguageCode::ZH_HANS, KeyboardLayout::ChineseSimplified}, | ||
| 70 | {LanguageCode::ZH_HANT, KeyboardLayout::ChineseTraditional}, | ||
| 71 | {LanguageCode::PT_BR, KeyboardLayout::Portuguese}, | ||
| 72 | }}; | ||
| 73 | |||
| 74 | constexpr std::size_t PRE_4_0_0_MAX_ENTRIES = 0xF; | 14 | constexpr std::size_t PRE_4_0_0_MAX_ENTRIES = 0xF; |
| 75 | constexpr std::size_t POST_4_0_0_MAX_ENTRIES = 0x40; | 15 | constexpr std::size_t POST_4_0_0_MAX_ENTRIES = 0x40; |
| 76 | 16 | ||
diff --git a/src/core/hle/service/set/set.h b/src/core/hle/service/set/set.h index 7fd3a7654..b61a3560d 100644 --- a/src/core/hle/service/set/set.h +++ b/src/core/hle/service/set/set.h | |||
| @@ -32,6 +32,67 @@ enum class LanguageCode : u64 { | |||
| 32 | ZH_HANT = 0x00746E61482D687A, | 32 | ZH_HANT = 0x00746E61482D687A, |
| 33 | PT_BR = 0x00000052422D7470, | 33 | PT_BR = 0x00000052422D7470, |
| 34 | }; | 34 | }; |
| 35 | |||
| 36 | enum class KeyboardLayout : u64 { | ||
| 37 | Japanese = 0, | ||
| 38 | EnglishUs = 1, | ||
| 39 | EnglishUsInternational = 2, | ||
| 40 | EnglishUk = 3, | ||
| 41 | French = 4, | ||
| 42 | FrenchCa = 5, | ||
| 43 | Spanish = 6, | ||
| 44 | SpanishLatin = 7, | ||
| 45 | German = 8, | ||
| 46 | Italian = 9, | ||
| 47 | Portuguese = 10, | ||
| 48 | Russian = 11, | ||
| 49 | Korean = 12, | ||
| 50 | ChineseSimplified = 13, | ||
| 51 | ChineseTraditional = 14, | ||
| 52 | }; | ||
| 53 | |||
| 54 | constexpr std::array<LanguageCode, 18> available_language_codes = {{ | ||
| 55 | LanguageCode::JA, | ||
| 56 | LanguageCode::EN_US, | ||
| 57 | LanguageCode::FR, | ||
| 58 | LanguageCode::DE, | ||
| 59 | LanguageCode::IT, | ||
| 60 | LanguageCode::ES, | ||
| 61 | LanguageCode::ZH_CN, | ||
| 62 | LanguageCode::KO, | ||
| 63 | LanguageCode::NL, | ||
| 64 | LanguageCode::PT, | ||
| 65 | LanguageCode::RU, | ||
| 66 | LanguageCode::ZH_TW, | ||
| 67 | LanguageCode::EN_GB, | ||
| 68 | LanguageCode::FR_CA, | ||
| 69 | LanguageCode::ES_419, | ||
| 70 | LanguageCode::ZH_HANS, | ||
| 71 | LanguageCode::ZH_HANT, | ||
| 72 | LanguageCode::PT_BR, | ||
| 73 | }}; | ||
| 74 | |||
| 75 | static constexpr std::array<std::pair<LanguageCode, KeyboardLayout>, 18> language_to_layout{{ | ||
| 76 | {LanguageCode::JA, KeyboardLayout::Japanese}, | ||
| 77 | {LanguageCode::EN_US, KeyboardLayout::EnglishUs}, | ||
| 78 | {LanguageCode::FR, KeyboardLayout::French}, | ||
| 79 | {LanguageCode::DE, KeyboardLayout::German}, | ||
| 80 | {LanguageCode::IT, KeyboardLayout::Italian}, | ||
| 81 | {LanguageCode::ES, KeyboardLayout::Spanish}, | ||
| 82 | {LanguageCode::ZH_CN, KeyboardLayout::ChineseSimplified}, | ||
| 83 | {LanguageCode::KO, KeyboardLayout::Korean}, | ||
| 84 | {LanguageCode::NL, KeyboardLayout::EnglishUsInternational}, | ||
| 85 | {LanguageCode::PT, KeyboardLayout::Portuguese}, | ||
| 86 | {LanguageCode::RU, KeyboardLayout::Russian}, | ||
| 87 | {LanguageCode::ZH_TW, KeyboardLayout::ChineseTraditional}, | ||
| 88 | {LanguageCode::EN_GB, KeyboardLayout::EnglishUk}, | ||
| 89 | {LanguageCode::FR_CA, KeyboardLayout::FrenchCa}, | ||
| 90 | {LanguageCode::ES_419, KeyboardLayout::SpanishLatin}, | ||
| 91 | {LanguageCode::ZH_HANS, KeyboardLayout::ChineseSimplified}, | ||
| 92 | {LanguageCode::ZH_HANT, KeyboardLayout::ChineseTraditional}, | ||
| 93 | {LanguageCode::PT_BR, KeyboardLayout::Portuguese}, | ||
| 94 | }}; | ||
| 95 | |||
| 35 | LanguageCode GetLanguageCodeFromIndex(std::size_t idx); | 96 | LanguageCode GetLanguageCodeFromIndex(std::size_t idx); |
| 36 | 97 | ||
| 37 | class SET final : public ServiceFramework<SET> { | 98 | class SET final : public ServiceFramework<SET> { |
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp index 2e38d1cfc..165b97dad 100644 --- a/src/core/hle/service/set/set_sys.cpp +++ b/src/core/hle/service/set/set_sys.cpp | |||
| @@ -4,10 +4,12 @@ | |||
| 4 | #include "common/assert.h" | 4 | #include "common/assert.h" |
| 5 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 6 | #include "common/settings.h" | 6 | #include "common/settings.h" |
| 7 | #include "common/string_util.h" | ||
| 7 | #include "core/file_sys/errors.h" | 8 | #include "core/file_sys/errors.h" |
| 8 | #include "core/file_sys/system_archive/system_version.h" | 9 | #include "core/file_sys/system_archive/system_version.h" |
| 9 | #include "core/hle/service/filesystem/filesystem.h" | 10 | #include "core/hle/service/filesystem/filesystem.h" |
| 10 | #include "core/hle/service/ipc_helpers.h" | 11 | #include "core/hle/service/ipc_helpers.h" |
| 12 | #include "core/hle/service/set/set.h" | ||
| 11 | #include "core/hle/service/set/set_sys.h" | 13 | #include "core/hle/service/set/set_sys.h" |
| 12 | 14 | ||
| 13 | namespace Service::Set { | 15 | namespace Service::Set { |
| @@ -73,6 +75,16 @@ void GetFirmwareVersionImpl(HLERequestContext& ctx, GetFirmwareVersionType type) | |||
| 73 | } | 75 | } |
| 74 | } // Anonymous namespace | 76 | } // Anonymous namespace |
| 75 | 77 | ||
| 78 | void SET_SYS::SetLanguageCode(HLERequestContext& ctx) { | ||
| 79 | IPC::RequestParser rp{ctx}; | ||
| 80 | language_code_setting = rp.PopEnum<LanguageCode>(); | ||
| 81 | |||
| 82 | LOG_INFO(Service_SET, "called, language_code={}", language_code_setting); | ||
| 83 | |||
| 84 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 85 | rb.Push(ResultSuccess); | ||
| 86 | } | ||
| 87 | |||
| 76 | void SET_SYS::GetFirmwareVersion(HLERequestContext& ctx) { | 88 | void SET_SYS::GetFirmwareVersion(HLERequestContext& ctx) { |
| 77 | LOG_DEBUG(Service_SET, "called"); | 89 | LOG_DEBUG(Service_SET, "called"); |
| 78 | GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version1); | 90 | GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version1); |
| @@ -83,21 +95,113 @@ void SET_SYS::GetFirmwareVersion2(HLERequestContext& ctx) { | |||
| 83 | GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version2); | 95 | GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version2); |
| 84 | } | 96 | } |
| 85 | 97 | ||
| 98 | void SET_SYS::GetAccountSettings(HLERequestContext& ctx) { | ||
| 99 | LOG_INFO(Service_SET, "called"); | ||
| 100 | |||
| 101 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 102 | rb.Push(ResultSuccess); | ||
| 103 | rb.PushRaw(account_settings); | ||
| 104 | } | ||
| 105 | |||
| 106 | void SET_SYS::SetAccountSettings(HLERequestContext& ctx) { | ||
| 107 | IPC::RequestParser rp{ctx}; | ||
| 108 | account_settings = rp.PopRaw<AccountSettings>(); | ||
| 109 | |||
| 110 | LOG_INFO(Service_SET, "called, account_settings_flags={}", account_settings.flags); | ||
| 111 | |||
| 112 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 113 | rb.Push(ResultSuccess); | ||
| 114 | } | ||
| 115 | |||
| 116 | void SET_SYS::GetEulaVersions(HLERequestContext& ctx) { | ||
| 117 | LOG_INFO(Service_SET, "called"); | ||
| 118 | |||
| 119 | ctx.WriteBuffer(eula_versions); | ||
| 120 | |||
| 121 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 122 | rb.Push(ResultSuccess); | ||
| 123 | rb.Push(static_cast<u32>(eula_versions.size())); | ||
| 124 | } | ||
| 125 | |||
| 126 | void SET_SYS::SetEulaVersions(HLERequestContext& ctx) { | ||
| 127 | const auto elements = ctx.GetReadBufferNumElements<EulaVersion>(); | ||
| 128 | const auto buffer_data = ctx.ReadBuffer(); | ||
| 129 | |||
| 130 | LOG_INFO(Service_SET, "called, elements={}", elements); | ||
| 131 | |||
| 132 | eula_versions.resize(elements); | ||
| 133 | for (std::size_t index = 0; index < elements; index++) { | ||
| 134 | const std::size_t start_index = index * sizeof(EulaVersion); | ||
| 135 | memcpy(eula_versions.data() + start_index, buffer_data.data() + start_index, | ||
| 136 | sizeof(EulaVersion)); | ||
| 137 | } | ||
| 138 | |||
| 139 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 140 | rb.Push(ResultSuccess); | ||
| 141 | } | ||
| 142 | |||
| 86 | void SET_SYS::GetColorSetId(HLERequestContext& ctx) { | 143 | void SET_SYS::GetColorSetId(HLERequestContext& ctx) { |
| 87 | LOG_DEBUG(Service_SET, "called"); | 144 | LOG_DEBUG(Service_SET, "called"); |
| 88 | 145 | ||
| 89 | IPC::ResponseBuilder rb{ctx, 3}; | 146 | IPC::ResponseBuilder rb{ctx, 3}; |
| 90 | |||
| 91 | rb.Push(ResultSuccess); | 147 | rb.Push(ResultSuccess); |
| 92 | rb.PushEnum(color_set); | 148 | rb.PushEnum(color_set); |
| 93 | } | 149 | } |
| 94 | 150 | ||
| 95 | void SET_SYS::SetColorSetId(HLERequestContext& ctx) { | 151 | void SET_SYS::SetColorSetId(HLERequestContext& ctx) { |
| 96 | LOG_DEBUG(Service_SET, "called"); | ||
| 97 | |||
| 98 | IPC::RequestParser rp{ctx}; | 152 | IPC::RequestParser rp{ctx}; |
| 99 | color_set = rp.PopEnum<ColorSet>(); | 153 | color_set = rp.PopEnum<ColorSet>(); |
| 100 | 154 | ||
| 155 | LOG_DEBUG(Service_SET, "called, color_set={}", color_set); | ||
| 156 | |||
| 157 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 158 | rb.Push(ResultSuccess); | ||
| 159 | } | ||
| 160 | |||
| 161 | void SET_SYS::GetNotificationSettings(HLERequestContext& ctx) { | ||
| 162 | LOG_INFO(Service_SET, "called"); | ||
| 163 | |||
| 164 | IPC::ResponseBuilder rb{ctx, 8}; | ||
| 165 | rb.Push(ResultSuccess); | ||
| 166 | rb.PushRaw(notification_settings); | ||
| 167 | } | ||
| 168 | |||
| 169 | void SET_SYS::SetNotificationSettings(HLERequestContext& ctx) { | ||
| 170 | IPC::RequestParser rp{ctx}; | ||
| 171 | notification_settings = rp.PopRaw<NotificationSettings>(); | ||
| 172 | |||
| 173 | LOG_INFO(Service_SET, "called, flags={}, volume={}, head_time={}:{}, tailt_time={}:{}", | ||
| 174 | notification_settings.flags.raw, notification_settings.volume, | ||
| 175 | notification_settings.start_time.hour, notification_settings.start_time.minute, | ||
| 176 | notification_settings.stop_time.hour, notification_settings.stop_time.minute); | ||
| 177 | |||
| 178 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 179 | rb.Push(ResultSuccess); | ||
| 180 | } | ||
| 181 | |||
| 182 | void SET_SYS::GetAccountNotificationSettings(HLERequestContext& ctx) { | ||
| 183 | LOG_INFO(Service_SET, "called"); | ||
| 184 | |||
| 185 | ctx.WriteBuffer(account_notifications); | ||
| 186 | |||
| 187 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 188 | rb.Push(ResultSuccess); | ||
| 189 | rb.Push(static_cast<u32>(account_notifications.size())); | ||
| 190 | } | ||
| 191 | |||
| 192 | void SET_SYS::SetAccountNotificationSettings(HLERequestContext& ctx) { | ||
| 193 | const auto elements = ctx.GetReadBufferNumElements<AccountNotificationSettings>(); | ||
| 194 | const auto buffer_data = ctx.ReadBuffer(); | ||
| 195 | |||
| 196 | LOG_INFO(Service_SET, "called, elements={}", elements); | ||
| 197 | |||
| 198 | account_notifications.resize(elements); | ||
| 199 | for (std::size_t index = 0; index < elements; index++) { | ||
| 200 | const std::size_t start_index = index * sizeof(AccountNotificationSettings); | ||
| 201 | memcpy(account_notifications.data() + start_index, buffer_data.data() + start_index, | ||
| 202 | sizeof(AccountNotificationSettings)); | ||
| 203 | } | ||
| 204 | |||
| 101 | IPC::ResponseBuilder rb{ctx, 2}; | 205 | IPC::ResponseBuilder rb{ctx, 2}; |
| 102 | rb.Push(ResultSuccess); | 206 | rb.Push(ResultSuccess); |
| 103 | } | 207 | } |
| @@ -177,17 +281,218 @@ void SET_SYS::GetSettingsItemValue(HLERequestContext& ctx) { | |||
| 177 | rb.Push(response); | 281 | rb.Push(response); |
| 178 | } | 282 | } |
| 179 | 283 | ||
| 284 | void SET_SYS::GetTvSettings(HLERequestContext& ctx) { | ||
| 285 | LOG_INFO(Service_SET, "called"); | ||
| 286 | |||
| 287 | IPC::ResponseBuilder rb{ctx, 10}; | ||
| 288 | rb.Push(ResultSuccess); | ||
| 289 | rb.PushRaw(tv_settings); | ||
| 290 | } | ||
| 291 | |||
| 292 | void SET_SYS::SetTvSettings(HLERequestContext& ctx) { | ||
| 293 | IPC::RequestParser rp{ctx}; | ||
| 294 | tv_settings = rp.PopRaw<TvSettings>(); | ||
| 295 | |||
| 296 | LOG_INFO(Service_SET, | ||
| 297 | "called, flags={}, cmu_mode={}, constrast_ratio={}, hdmi_content_type={}, " | ||
| 298 | "rgb_range={}, tv_gama={}, tv_resolution={}, tv_underscan={}", | ||
| 299 | tv_settings.flags.raw, tv_settings.cmu_mode, tv_settings.constrast_ratio, | ||
| 300 | tv_settings.hdmi_content_type, tv_settings.rgb_range, tv_settings.tv_gama, | ||
| 301 | tv_settings.tv_resolution, tv_settings.tv_underscan); | ||
| 302 | |||
| 303 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 304 | rb.Push(ResultSuccess); | ||
| 305 | } | ||
| 306 | |||
| 307 | void SET_SYS::GetQuestFlag(HLERequestContext& ctx) { | ||
| 308 | LOG_WARNING(Service_SET, "(STUBBED) called"); | ||
| 309 | |||
| 310 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 311 | rb.Push(ResultSuccess); | ||
| 312 | rb.PushEnum(QuestFlag::Retail); | ||
| 313 | } | ||
| 314 | |||
| 315 | void SET_SYS::SetRegionCode(HLERequestContext& ctx) { | ||
| 316 | IPC::RequestParser rp{ctx}; | ||
| 317 | region_code = rp.PopEnum<RegionCode>(); | ||
| 318 | |||
| 319 | LOG_INFO(Service_SET, "called, region_code={}", region_code); | ||
| 320 | |||
| 321 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 322 | rb.Push(ResultSuccess); | ||
| 323 | } | ||
| 324 | |||
| 325 | void SET_SYS::GetPrimaryAlbumStorage(HLERequestContext& ctx) { | ||
| 326 | LOG_WARNING(Service_SET, "(STUBBED) called"); | ||
| 327 | |||
| 328 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 329 | rb.Push(ResultSuccess); | ||
| 330 | rb.PushEnum(PrimaryAlbumStorage::SdCard); | ||
| 331 | } | ||
| 332 | |||
| 333 | void SET_SYS::GetSleepSettings(HLERequestContext& ctx) { | ||
| 334 | LOG_INFO(Service_SET, "called"); | ||
| 335 | |||
| 336 | IPC::ResponseBuilder rb{ctx, 5}; | ||
| 337 | rb.Push(ResultSuccess); | ||
| 338 | rb.PushRaw(sleep_settings); | ||
| 339 | } | ||
| 340 | |||
| 341 | void SET_SYS::SetSleepSettings(HLERequestContext& ctx) { | ||
| 342 | IPC::RequestParser rp{ctx}; | ||
| 343 | sleep_settings = rp.PopRaw<SleepSettings>(); | ||
| 344 | |||
| 345 | LOG_INFO(Service_SET, "called, flags={}, handheld_sleep_plan={}, console_sleep_plan={}", | ||
| 346 | sleep_settings.flags.raw, sleep_settings.handheld_sleep_plan, | ||
| 347 | sleep_settings.console_sleep_plan); | ||
| 348 | |||
| 349 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 350 | rb.Push(ResultSuccess); | ||
| 351 | } | ||
| 352 | |||
| 353 | void SET_SYS::GetInitialLaunchSettings(HLERequestContext& ctx) { | ||
| 354 | LOG_INFO(Service_SET, "called"); | ||
| 355 | IPC::ResponseBuilder rb{ctx, 10}; | ||
| 356 | rb.Push(ResultSuccess); | ||
| 357 | rb.PushRaw(launch_settings); | ||
| 358 | } | ||
| 359 | |||
| 360 | void SET_SYS::SetInitialLaunchSettings(HLERequestContext& ctx) { | ||
| 361 | IPC::RequestParser rp{ctx}; | ||
| 362 | launch_settings = rp.PopRaw<InitialLaunchSettings>(); | ||
| 363 | |||
| 364 | LOG_INFO(Service_SET, "called, flags={}, timestamp={}", launch_settings.flags.raw, | ||
| 365 | launch_settings.timestamp.time_point); | ||
| 366 | |||
| 367 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 368 | rb.Push(ResultSuccess); | ||
| 369 | } | ||
| 370 | |||
| 180 | void SET_SYS::GetDeviceNickName(HLERequestContext& ctx) { | 371 | void SET_SYS::GetDeviceNickName(HLERequestContext& ctx) { |
| 181 | LOG_DEBUG(Service_SET, "called"); | 372 | LOG_DEBUG(Service_SET, "called"); |
| 373 | |||
| 374 | ctx.WriteBuffer(::Settings::values.device_name.GetValue()); | ||
| 375 | |||
| 182 | IPC::ResponseBuilder rb{ctx, 2}; | 376 | IPC::ResponseBuilder rb{ctx, 2}; |
| 183 | rb.Push(ResultSuccess); | 377 | rb.Push(ResultSuccess); |
| 184 | ctx.WriteBuffer(::Settings::values.device_name.GetValue()); | 378 | } |
| 379 | |||
| 380 | void SET_SYS::SetDeviceNickName(HLERequestContext& ctx) { | ||
| 381 | const std::string device_name = Common::StringFromBuffer(ctx.ReadBuffer()); | ||
| 382 | |||
| 383 | LOG_INFO(Service_SET, "called, device_name={}", device_name); | ||
| 384 | |||
| 385 | ::Settings::values.device_name = device_name; | ||
| 386 | |||
| 387 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 388 | rb.Push(ResultSuccess); | ||
| 389 | } | ||
| 390 | |||
| 391 | void SET_SYS::GetProductModel(HLERequestContext& ctx) { | ||
| 392 | const u32 product_model = 1; | ||
| 393 | |||
| 394 | LOG_WARNING(Service_SET, "(STUBBED) called, product_model={}", product_model); | ||
| 395 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 396 | rb.Push(ResultSuccess); | ||
| 397 | rb.Push(product_model); | ||
| 398 | } | ||
| 399 | |||
| 400 | void SET_SYS::GetMiiAuthorId(HLERequestContext& ctx) { | ||
| 401 | const auto author_id = Common::UUID::MakeDefault(); | ||
| 402 | |||
| 403 | LOG_WARNING(Service_SET, "(STUBBED) called, author_id={}", author_id.FormattedString()); | ||
| 404 | |||
| 405 | IPC::ResponseBuilder rb{ctx, 6}; | ||
| 406 | rb.Push(ResultSuccess); | ||
| 407 | rb.PushRaw(author_id); | ||
| 408 | } | ||
| 409 | |||
| 410 | void SET_SYS::GetAutoUpdateEnableFlag(HLERequestContext& ctx) { | ||
| 411 | u8 auto_update_flag{}; | ||
| 412 | |||
| 413 | LOG_WARNING(Service_SET, "(STUBBED) called, auto_update_flag={}", auto_update_flag); | ||
| 414 | |||
| 415 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 416 | rb.Push(ResultSuccess); | ||
| 417 | rb.Push(auto_update_flag); | ||
| 418 | } | ||
| 419 | |||
| 420 | void SET_SYS::GetBatteryPercentageFlag(HLERequestContext& ctx) { | ||
| 421 | u8 battery_percentage_flag{1}; | ||
| 422 | |||
| 423 | LOG_WARNING(Service_SET, "(STUBBED) called, battery_percentage_flag={}", | ||
| 424 | battery_percentage_flag); | ||
| 425 | |||
| 426 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 427 | rb.Push(ResultSuccess); | ||
| 428 | rb.Push(battery_percentage_flag); | ||
| 429 | } | ||
| 430 | |||
| 431 | void SET_SYS::GetErrorReportSharePermission(HLERequestContext& ctx) { | ||
| 432 | LOG_WARNING(Service_SET, "(STUBBED) called"); | ||
| 433 | |||
| 434 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 435 | rb.Push(ResultSuccess); | ||
| 436 | rb.PushEnum(ErrorReportSharePermission::Denied); | ||
| 437 | } | ||
| 438 | |||
| 439 | void SET_SYS::GetAppletLaunchFlags(HLERequestContext& ctx) { | ||
| 440 | LOG_INFO(Service_SET, "called, applet_launch_flag={}", applet_launch_flag); | ||
| 441 | |||
| 442 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 443 | rb.Push(ResultSuccess); | ||
| 444 | rb.Push(applet_launch_flag); | ||
| 445 | } | ||
| 446 | |||
| 447 | void SET_SYS::SetAppletLaunchFlags(HLERequestContext& ctx) { | ||
| 448 | IPC::RequestParser rp{ctx}; | ||
| 449 | applet_launch_flag = rp.Pop<u32>(); | ||
| 450 | |||
| 451 | LOG_INFO(Service_SET, "called, applet_launch_flag={}", applet_launch_flag); | ||
| 452 | |||
| 453 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 454 | rb.Push(ResultSuccess); | ||
| 455 | } | ||
| 456 | |||
| 457 | void SET_SYS::GetKeyboardLayout(HLERequestContext& ctx) { | ||
| 458 | const auto language_code = | ||
| 459 | available_language_codes[static_cast<s32>(::Settings::values.language_index.GetValue())]; | ||
| 460 | const auto key_code = | ||
| 461 | std::find_if(language_to_layout.cbegin(), language_to_layout.cend(), | ||
| 462 | [=](const auto& element) { return element.first == language_code; }); | ||
| 463 | |||
| 464 | KeyboardLayout selected_keyboard_layout = KeyboardLayout::EnglishUs; | ||
| 465 | if (key_code != language_to_layout.end()) { | ||
| 466 | selected_keyboard_layout = key_code->second; | ||
| 467 | } | ||
| 468 | |||
| 469 | LOG_INFO(Service_SET, "called, selected_keyboard_layout={}", selected_keyboard_layout); | ||
| 470 | |||
| 471 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 472 | rb.Push(ResultSuccess); | ||
| 473 | rb.Push(static_cast<u32>(selected_keyboard_layout)); | ||
| 474 | } | ||
| 475 | |||
| 476 | void SET_SYS::GetChineseTraditionalInputMethod(HLERequestContext& ctx) { | ||
| 477 | LOG_WARNING(Service_SET, "(STUBBED) called"); | ||
| 478 | |||
| 479 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 480 | rb.Push(ResultSuccess); | ||
| 481 | rb.PushEnum(ChineseTraditionalInputMethod::Unknown0); | ||
| 482 | } | ||
| 483 | |||
| 484 | void SET_SYS::GetFieldTestingFlag(HLERequestContext& ctx) { | ||
| 485 | LOG_WARNING(Service_SET, "(STUBBED) called"); | ||
| 486 | |||
| 487 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 488 | rb.Push(ResultSuccess); | ||
| 489 | rb.Push<u8>(false); | ||
| 185 | } | 490 | } |
| 186 | 491 | ||
| 187 | SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | 492 | SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { |
| 188 | // clang-format off | 493 | // clang-format off |
| 189 | static const FunctionInfo functions[] = { | 494 | static const FunctionInfo functions[] = { |
| 190 | {0, nullptr, "SetLanguageCode"}, | 495 | {0, &SET_SYS::SetLanguageCode, "SetLanguageCode"}, |
| 191 | {1, nullptr, "SetNetworkSettings"}, | 496 | {1, nullptr, "SetNetworkSettings"}, |
| 192 | {2, nullptr, "GetNetworkSettings"}, | 497 | {2, nullptr, "GetNetworkSettings"}, |
| 193 | {3, &SET_SYS::GetFirmwareVersion, "GetFirmwareVersion"}, | 498 | {3, &SET_SYS::GetFirmwareVersion, "GetFirmwareVersion"}, |
| @@ -203,35 +508,35 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 203 | {14, nullptr, "SetExternalSteadyClockSourceId"}, | 508 | {14, nullptr, "SetExternalSteadyClockSourceId"}, |
| 204 | {15, nullptr, "GetUserSystemClockContext"}, | 509 | {15, nullptr, "GetUserSystemClockContext"}, |
| 205 | {16, nullptr, "SetUserSystemClockContext"}, | 510 | {16, nullptr, "SetUserSystemClockContext"}, |
| 206 | {17, nullptr, "GetAccountSettings"}, | 511 | {17, &SET_SYS::GetAccountSettings, "GetAccountSettings"}, |
| 207 | {18, nullptr, "SetAccountSettings"}, | 512 | {18, &SET_SYS::SetAccountSettings, "SetAccountSettings"}, |
| 208 | {19, nullptr, "GetAudioVolume"}, | 513 | {19, nullptr, "GetAudioVolume"}, |
| 209 | {20, nullptr, "SetAudioVolume"}, | 514 | {20, nullptr, "SetAudioVolume"}, |
| 210 | {21, nullptr, "GetEulaVersions"}, | 515 | {21, &SET_SYS::GetEulaVersions, "GetEulaVersions"}, |
| 211 | {22, nullptr, "SetEulaVersions"}, | 516 | {22, &SET_SYS::SetEulaVersions, "SetEulaVersions"}, |
| 212 | {23, &SET_SYS::GetColorSetId, "GetColorSetId"}, | 517 | {23, &SET_SYS::GetColorSetId, "GetColorSetId"}, |
| 213 | {24, &SET_SYS::SetColorSetId, "SetColorSetId"}, | 518 | {24, &SET_SYS::SetColorSetId, "SetColorSetId"}, |
| 214 | {25, nullptr, "GetConsoleInformationUploadFlag"}, | 519 | {25, nullptr, "GetConsoleInformationUploadFlag"}, |
| 215 | {26, nullptr, "SetConsoleInformationUploadFlag"}, | 520 | {26, nullptr, "SetConsoleInformationUploadFlag"}, |
| 216 | {27, nullptr, "GetAutomaticApplicationDownloadFlag"}, | 521 | {27, nullptr, "GetAutomaticApplicationDownloadFlag"}, |
| 217 | {28, nullptr, "SetAutomaticApplicationDownloadFlag"}, | 522 | {28, nullptr, "SetAutomaticApplicationDownloadFlag"}, |
| 218 | {29, nullptr, "GetNotificationSettings"}, | 523 | {29, &SET_SYS::GetNotificationSettings, "GetNotificationSettings"}, |
| 219 | {30, nullptr, "SetNotificationSettings"}, | 524 | {30, &SET_SYS::SetNotificationSettings, "SetNotificationSettings"}, |
| 220 | {31, nullptr, "GetAccountNotificationSettings"}, | 525 | {31, &SET_SYS::GetAccountNotificationSettings, "GetAccountNotificationSettings"}, |
| 221 | {32, nullptr, "SetAccountNotificationSettings"}, | 526 | {32, &SET_SYS::SetAccountNotificationSettings, "SetAccountNotificationSettings"}, |
| 222 | {35, nullptr, "GetVibrationMasterVolume"}, | 527 | {35, nullptr, "GetVibrationMasterVolume"}, |
| 223 | {36, nullptr, "SetVibrationMasterVolume"}, | 528 | {36, nullptr, "SetVibrationMasterVolume"}, |
| 224 | {37, &SET_SYS::GetSettingsItemValueSize, "GetSettingsItemValueSize"}, | 529 | {37, &SET_SYS::GetSettingsItemValueSize, "GetSettingsItemValueSize"}, |
| 225 | {38, &SET_SYS::GetSettingsItemValue, "GetSettingsItemValue"}, | 530 | {38, &SET_SYS::GetSettingsItemValue, "GetSettingsItemValue"}, |
| 226 | {39, nullptr, "GetTvSettings"}, | 531 | {39, &SET_SYS::GetTvSettings, "GetTvSettings"}, |
| 227 | {40, nullptr, "SetTvSettings"}, | 532 | {40, &SET_SYS::SetTvSettings, "SetTvSettings"}, |
| 228 | {41, nullptr, "GetEdid"}, | 533 | {41, nullptr, "GetEdid"}, |
| 229 | {42, nullptr, "SetEdid"}, | 534 | {42, nullptr, "SetEdid"}, |
| 230 | {43, nullptr, "GetAudioOutputMode"}, | 535 | {43, nullptr, "GetAudioOutputMode"}, |
| 231 | {44, nullptr, "SetAudioOutputMode"}, | 536 | {44, nullptr, "SetAudioOutputMode"}, |
| 232 | {45, nullptr, "IsForceMuteOnHeadphoneRemoved"}, | 537 | {45, nullptr, "IsForceMuteOnHeadphoneRemoved"}, |
| 233 | {46, nullptr, "SetForceMuteOnHeadphoneRemoved"}, | 538 | {46, nullptr, "SetForceMuteOnHeadphoneRemoved"}, |
| 234 | {47, nullptr, "GetQuestFlag"}, | 539 | {47, &SET_SYS::GetQuestFlag, "GetQuestFlag"}, |
| 235 | {48, nullptr, "SetQuestFlag"}, | 540 | {48, nullptr, "SetQuestFlag"}, |
| 236 | {49, nullptr, "GetDataDeletionSettings"}, | 541 | {49, nullptr, "GetDataDeletionSettings"}, |
| 237 | {50, nullptr, "SetDataDeletionSettings"}, | 542 | {50, nullptr, "SetDataDeletionSettings"}, |
| @@ -241,13 +546,13 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 241 | {54, nullptr, "SetDeviceTimeZoneLocationName"}, | 546 | {54, nullptr, "SetDeviceTimeZoneLocationName"}, |
| 242 | {55, nullptr, "GetWirelessCertificationFileSize"}, | 547 | {55, nullptr, "GetWirelessCertificationFileSize"}, |
| 243 | {56, nullptr, "GetWirelessCertificationFile"}, | 548 | {56, nullptr, "GetWirelessCertificationFile"}, |
| 244 | {57, nullptr, "SetRegionCode"}, | 549 | {57, &SET_SYS::SetRegionCode, "SetRegionCode"}, |
| 245 | {58, nullptr, "GetNetworkSystemClockContext"}, | 550 | {58, nullptr, "GetNetworkSystemClockContext"}, |
| 246 | {59, nullptr, "SetNetworkSystemClockContext"}, | 551 | {59, nullptr, "SetNetworkSystemClockContext"}, |
| 247 | {60, nullptr, "IsUserSystemClockAutomaticCorrectionEnabled"}, | 552 | {60, nullptr, "IsUserSystemClockAutomaticCorrectionEnabled"}, |
| 248 | {61, nullptr, "SetUserSystemClockAutomaticCorrectionEnabled"}, | 553 | {61, nullptr, "SetUserSystemClockAutomaticCorrectionEnabled"}, |
| 249 | {62, nullptr, "GetDebugModeFlag"}, | 554 | {62, nullptr, "GetDebugModeFlag"}, |
| 250 | {63, nullptr, "GetPrimaryAlbumStorage"}, | 555 | {63, &SET_SYS::GetPrimaryAlbumStorage, "GetPrimaryAlbumStorage"}, |
| 251 | {64, nullptr, "SetPrimaryAlbumStorage"}, | 556 | {64, nullptr, "SetPrimaryAlbumStorage"}, |
| 252 | {65, nullptr, "GetUsb30EnableFlag"}, | 557 | {65, nullptr, "GetUsb30EnableFlag"}, |
| 253 | {66, nullptr, "SetUsb30EnableFlag"}, | 558 | {66, nullptr, "SetUsb30EnableFlag"}, |
| @@ -255,15 +560,15 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 255 | {68, nullptr, "GetSerialNumber"}, | 560 | {68, nullptr, "GetSerialNumber"}, |
| 256 | {69, nullptr, "GetNfcEnableFlag"}, | 561 | {69, nullptr, "GetNfcEnableFlag"}, |
| 257 | {70, nullptr, "SetNfcEnableFlag"}, | 562 | {70, nullptr, "SetNfcEnableFlag"}, |
| 258 | {71, nullptr, "GetSleepSettings"}, | 563 | {71, &SET_SYS::GetSleepSettings, "GetSleepSettings"}, |
| 259 | {72, nullptr, "SetSleepSettings"}, | 564 | {72, &SET_SYS::SetSleepSettings, "SetSleepSettings"}, |
| 260 | {73, nullptr, "GetWirelessLanEnableFlag"}, | 565 | {73, nullptr, "GetWirelessLanEnableFlag"}, |
| 261 | {74, nullptr, "SetWirelessLanEnableFlag"}, | 566 | {74, nullptr, "SetWirelessLanEnableFlag"}, |
| 262 | {75, nullptr, "GetInitialLaunchSettings"}, | 567 | {75, &SET_SYS::GetInitialLaunchSettings, "GetInitialLaunchSettings"}, |
| 263 | {76, nullptr, "SetInitialLaunchSettings"}, | 568 | {76, &SET_SYS::SetInitialLaunchSettings, "SetInitialLaunchSettings"}, |
| 264 | {77, &SET_SYS::GetDeviceNickName, "GetDeviceNickName"}, | 569 | {77, &SET_SYS::GetDeviceNickName, "GetDeviceNickName"}, |
| 265 | {78, nullptr, "SetDeviceNickName"}, | 570 | {78, &SET_SYS::SetDeviceNickName, "SetDeviceNickName"}, |
| 266 | {79, nullptr, "GetProductModel"}, | 571 | {79, &SET_SYS::GetProductModel, "GetProductModel"}, |
| 267 | {80, nullptr, "GetLdnChannel"}, | 572 | {80, nullptr, "GetLdnChannel"}, |
| 268 | {81, nullptr, "SetLdnChannel"}, | 573 | {81, nullptr, "SetLdnChannel"}, |
| 269 | {82, nullptr, "AcquireTelemetryDirtyFlagEventHandle"}, | 574 | {82, nullptr, "AcquireTelemetryDirtyFlagEventHandle"}, |
| @@ -274,16 +579,16 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 274 | {87, nullptr, "SetPtmFuelGaugeParameter"}, | 579 | {87, nullptr, "SetPtmFuelGaugeParameter"}, |
| 275 | {88, nullptr, "GetBluetoothEnableFlag"}, | 580 | {88, nullptr, "GetBluetoothEnableFlag"}, |
| 276 | {89, nullptr, "SetBluetoothEnableFlag"}, | 581 | {89, nullptr, "SetBluetoothEnableFlag"}, |
| 277 | {90, nullptr, "GetMiiAuthorId"}, | 582 | {90, &SET_SYS::GetMiiAuthorId, "GetMiiAuthorId"}, |
| 278 | {91, nullptr, "SetShutdownRtcValue"}, | 583 | {91, nullptr, "SetShutdownRtcValue"}, |
| 279 | {92, nullptr, "GetShutdownRtcValue"}, | 584 | {92, nullptr, "GetShutdownRtcValue"}, |
| 280 | {93, nullptr, "AcquireFatalDirtyFlagEventHandle"}, | 585 | {93, nullptr, "AcquireFatalDirtyFlagEventHandle"}, |
| 281 | {94, nullptr, "GetFatalDirtyFlags"}, | 586 | {94, nullptr, "GetFatalDirtyFlags"}, |
| 282 | {95, nullptr, "GetAutoUpdateEnableFlag"}, | 587 | {95, &SET_SYS::GetAutoUpdateEnableFlag, "GetAutoUpdateEnableFlag"}, |
| 283 | {96, nullptr, "SetAutoUpdateEnableFlag"}, | 588 | {96, nullptr, "SetAutoUpdateEnableFlag"}, |
| 284 | {97, nullptr, "GetNxControllerSettings"}, | 589 | {97, nullptr, "GetNxControllerSettings"}, |
| 285 | {98, nullptr, "SetNxControllerSettings"}, | 590 | {98, nullptr, "SetNxControllerSettings"}, |
| 286 | {99, nullptr, "GetBatteryPercentageFlag"}, | 591 | {99, &SET_SYS::GetBatteryPercentageFlag, "GetBatteryPercentageFlag"}, |
| 287 | {100, nullptr, "SetBatteryPercentageFlag"}, | 592 | {100, nullptr, "SetBatteryPercentageFlag"}, |
| 288 | {101, nullptr, "GetExternalRtcResetFlag"}, | 593 | {101, nullptr, "GetExternalRtcResetFlag"}, |
| 289 | {102, nullptr, "SetExternalRtcResetFlag"}, | 594 | {102, nullptr, "SetExternalRtcResetFlag"}, |
| @@ -308,10 +613,10 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 308 | {121, nullptr, "SetPushNotificationActivityModeOnSleep"}, | 613 | {121, nullptr, "SetPushNotificationActivityModeOnSleep"}, |
| 309 | {122, nullptr, "GetServiceDiscoveryControlSettings"}, | 614 | {122, nullptr, "GetServiceDiscoveryControlSettings"}, |
| 310 | {123, nullptr, "SetServiceDiscoveryControlSettings"}, | 615 | {123, nullptr, "SetServiceDiscoveryControlSettings"}, |
| 311 | {124, nullptr, "GetErrorReportSharePermission"}, | 616 | {124, &SET_SYS::GetErrorReportSharePermission, "GetErrorReportSharePermission"}, |
| 312 | {125, nullptr, "SetErrorReportSharePermission"}, | 617 | {125, nullptr, "SetErrorReportSharePermission"}, |
| 313 | {126, nullptr, "GetAppletLaunchFlags"}, | 618 | {126, &SET_SYS::GetAppletLaunchFlags, "GetAppletLaunchFlags"}, |
| 314 | {127, nullptr, "SetAppletLaunchFlags"}, | 619 | {127, &SET_SYS::SetAppletLaunchFlags, "SetAppletLaunchFlags"}, |
| 315 | {128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"}, | 620 | {128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"}, |
| 316 | {129, nullptr, "SetConsoleSixAxisSensorAccelerationBias"}, | 621 | {129, nullptr, "SetConsoleSixAxisSensorAccelerationBias"}, |
| 317 | {130, nullptr, "GetConsoleSixAxisSensorAngularVelocityBias"}, | 622 | {130, nullptr, "GetConsoleSixAxisSensorAngularVelocityBias"}, |
| @@ -320,7 +625,7 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 320 | {133, nullptr, "SetConsoleSixAxisSensorAccelerationGain"}, | 625 | {133, nullptr, "SetConsoleSixAxisSensorAccelerationGain"}, |
| 321 | {134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"}, | 626 | {134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"}, |
| 322 | {135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"}, | 627 | {135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"}, |
| 323 | {136, nullptr, "GetKeyboardLayout"}, | 628 | {136, &SET_SYS::GetKeyboardLayout, "GetKeyboardLayout"}, |
| 324 | {137, nullptr, "SetKeyboardLayout"}, | 629 | {137, nullptr, "SetKeyboardLayout"}, |
| 325 | {138, nullptr, "GetWebInspectorFlag"}, | 630 | {138, nullptr, "GetWebInspectorFlag"}, |
| 326 | {139, nullptr, "GetAllowedSslHosts"}, | 631 | {139, nullptr, "GetAllowedSslHosts"}, |
| @@ -354,7 +659,7 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 354 | {167, nullptr, "SetUsb30DeviceEnableFlag"}, | 659 | {167, nullptr, "SetUsb30DeviceEnableFlag"}, |
| 355 | {168, nullptr, "GetThemeId"}, | 660 | {168, nullptr, "GetThemeId"}, |
| 356 | {169, nullptr, "SetThemeId"}, | 661 | {169, nullptr, "SetThemeId"}, |
| 357 | {170, nullptr, "GetChineseTraditionalInputMethod"}, | 662 | {170, &SET_SYS::GetChineseTraditionalInputMethod, "GetChineseTraditionalInputMethod"}, |
| 358 | {171, nullptr, "SetChineseTraditionalInputMethod"}, | 663 | {171, nullptr, "SetChineseTraditionalInputMethod"}, |
| 359 | {172, nullptr, "GetPtmCycleCountReliability"}, | 664 | {172, nullptr, "GetPtmCycleCountReliability"}, |
| 360 | {173, nullptr, "SetPtmCycleCountReliability"}, | 665 | {173, nullptr, "SetPtmCycleCountReliability"}, |
| @@ -385,12 +690,16 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 385 | {198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"}, | 690 | {198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"}, |
| 386 | {199, nullptr, "GetButtonConfigRegisteredSettings"}, | 691 | {199, nullptr, "GetButtonConfigRegisteredSettings"}, |
| 387 | {200, nullptr, "SetButtonConfigRegisteredSettings"}, | 692 | {200, nullptr, "SetButtonConfigRegisteredSettings"}, |
| 388 | {201, nullptr, "GetFieldTestingFlag"}, | 693 | {201, &SET_SYS::GetFieldTestingFlag, "GetFieldTestingFlag"}, |
| 389 | {202, nullptr, "SetFieldTestingFlag"}, | 694 | {202, nullptr, "SetFieldTestingFlag"}, |
| 390 | {203, nullptr, "GetPanelCrcMode"}, | 695 | {203, nullptr, "GetPanelCrcMode"}, |
| 391 | {204, nullptr, "SetPanelCrcMode"}, | 696 | {204, nullptr, "SetPanelCrcMode"}, |
| 392 | {205, nullptr, "GetNxControllerSettingsEx"}, | 697 | {205, nullptr, "GetNxControllerSettingsEx"}, |
| 393 | {206, nullptr, "SetNxControllerSettingsEx"}, | 698 | {206, nullptr, "SetNxControllerSettingsEx"}, |
| 699 | {207, nullptr, "GetHearingProtectionSafeguardFlag"}, | ||
| 700 | {208, nullptr, "SetHearingProtectionSafeguardFlag"}, | ||
| 701 | {209, nullptr, "GetHearingProtectionSafeguardRemainingTime"}, | ||
| 702 | {210, nullptr, "SetHearingProtectionSafeguardRemainingTime"}, | ||
| 394 | }; | 703 | }; |
| 395 | // clang-format on | 704 | // clang-format on |
| 396 | 705 | ||
diff --git a/src/core/hle/service/set/set_sys.h b/src/core/hle/service/set/set_sys.h index 1efbcc97a..c7dba2a9e 100644 --- a/src/core/hle/service/set/set_sys.h +++ b/src/core/hle/service/set/set_sys.h | |||
| @@ -3,7 +3,9 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include "common/uuid.h" | ||
| 6 | #include "core/hle/service/service.h" | 7 | #include "core/hle/service/service.h" |
| 8 | #include "core/hle/service/time/clock_types.h" | ||
| 7 | 9 | ||
| 8 | namespace Core { | 10 | namespace Core { |
| 9 | class System; | 11 | class System; |
| @@ -23,15 +25,331 @@ private: | |||
| 23 | BasicBlack = 1, | 25 | BasicBlack = 1, |
| 24 | }; | 26 | }; |
| 25 | 27 | ||
| 26 | void GetSettingsItemValueSize(HLERequestContext& ctx); | 28 | /// Indicates the current console is a retail or kiosk unit |
| 27 | void GetSettingsItemValue(HLERequestContext& ctx); | 29 | enum class QuestFlag : u8 { |
| 30 | Retail = 0, | ||
| 31 | Kiosk = 1, | ||
| 32 | }; | ||
| 33 | |||
| 34 | /// This is nn::settings::system::TvResolution | ||
| 35 | enum class TvResolution : u32 { | ||
| 36 | Auto, | ||
| 37 | Resolution1080p, | ||
| 38 | Resolution720p, | ||
| 39 | Resolution480p, | ||
| 40 | }; | ||
| 41 | |||
| 42 | /// This is nn::settings::system::HdmiContentType | ||
| 43 | enum class HdmiContentType : u32 { | ||
| 44 | None, | ||
| 45 | Graphics, | ||
| 46 | Cinema, | ||
| 47 | Photo, | ||
| 48 | Game, | ||
| 49 | }; | ||
| 50 | |||
| 51 | /// This is nn::settings::system::RgbRange | ||
| 52 | enum class RgbRange : u32 { | ||
| 53 | Auto, | ||
| 54 | Full, | ||
| 55 | Limited, | ||
| 56 | }; | ||
| 57 | |||
| 58 | /// This is nn::settings::system::CmuMode | ||
| 59 | enum class CmuMode : u32 { | ||
| 60 | None, | ||
| 61 | ColorInvert, | ||
| 62 | HighContrast, | ||
| 63 | GrayScale, | ||
| 64 | }; | ||
| 65 | |||
| 66 | /// This is nn::settings::system::PrimaryAlbumStorage | ||
| 67 | enum class PrimaryAlbumStorage : u32 { | ||
| 68 | Nand, | ||
| 69 | SdCard, | ||
| 70 | }; | ||
| 71 | |||
| 72 | /// This is nn::settings::system::NotificationVolume | ||
| 73 | enum class NotificationVolume : u32 { | ||
| 74 | Mute, | ||
| 75 | Low, | ||
| 76 | High, | ||
| 77 | }; | ||
| 78 | |||
| 79 | /// This is nn::settings::system::ChineseTraditionalInputMethod | ||
| 80 | enum class ChineseTraditionalInputMethod : u32 { | ||
| 81 | Unknown0 = 0, | ||
| 82 | Unknown1 = 1, | ||
| 83 | Unknown2 = 2, | ||
| 84 | }; | ||
| 85 | |||
| 86 | /// This is nn::settings::system::ErrorReportSharePermission | ||
| 87 | enum class ErrorReportSharePermission : u32 { | ||
| 88 | NotConfirmed, | ||
| 89 | Granted, | ||
| 90 | Denied, | ||
| 91 | }; | ||
| 92 | |||
| 93 | /// This is nn::settings::system::FriendPresenceOverlayPermission | ||
| 94 | enum class FriendPresenceOverlayPermission : u8 { | ||
| 95 | NotConfirmed, | ||
| 96 | NoDisplay, | ||
| 97 | FavoriteFriends, | ||
| 98 | Friends, | ||
| 99 | }; | ||
| 100 | |||
| 101 | /// This is nn::settings::system::HandheldSleepPlan | ||
| 102 | enum class HandheldSleepPlan : u32 { | ||
| 103 | Sleep1Min, | ||
| 104 | Sleep3Min, | ||
| 105 | Sleep5Min, | ||
| 106 | Sleep10Min, | ||
| 107 | Sleep30Min, | ||
| 108 | Never, | ||
| 109 | }; | ||
| 110 | |||
| 111 | /// This is nn::settings::system::ConsoleSleepPlan | ||
| 112 | enum class ConsoleSleepPlan : u32 { | ||
| 113 | Sleep1Hour, | ||
| 114 | Sleep2Hour, | ||
| 115 | Sleep3Hour, | ||
| 116 | Sleep6Hour, | ||
| 117 | Sleep12Hour, | ||
| 118 | Never, | ||
| 119 | }; | ||
| 120 | |||
| 121 | /// This is nn::settings::system::RegionCode | ||
| 122 | enum class RegionCode : u32 { | ||
| 123 | Japan, | ||
| 124 | Usa, | ||
| 125 | Europe, | ||
| 126 | Australia, | ||
| 127 | HongKongTaiwanKorea, | ||
| 128 | China, | ||
| 129 | }; | ||
| 130 | |||
| 131 | /// This is nn::settings::system::EulaVersionClockType | ||
| 132 | enum class EulaVersionClockType : u32 { | ||
| 133 | NetworkSystemClock, | ||
| 134 | SteadyClock, | ||
| 135 | }; | ||
| 136 | |||
| 137 | /// This is nn::settings::system::SleepFlag | ||
| 138 | struct SleepFlag { | ||
| 139 | union { | ||
| 140 | u32 raw{}; | ||
| 141 | |||
| 142 | BitField<0, 1, u32> SleepsWhilePlayingMedia; | ||
| 143 | BitField<1, 1, u32> WakesAtPowerStateChange; | ||
| 144 | }; | ||
| 145 | }; | ||
| 146 | static_assert(sizeof(SleepFlag) == 4, "TvFlag is an invalid size"); | ||
| 147 | |||
| 148 | /// This is nn::settings::system::TvFlag | ||
| 149 | struct TvFlag { | ||
| 150 | union { | ||
| 151 | u32 raw{}; | ||
| 152 | |||
| 153 | BitField<0, 1, u32> Allows4k; | ||
| 154 | BitField<1, 1, u32> Allows3d; | ||
| 155 | BitField<2, 1, u32> AllowsCec; | ||
| 156 | BitField<3, 1, u32> PreventsScreenBurnIn; | ||
| 157 | }; | ||
| 158 | }; | ||
| 159 | static_assert(sizeof(TvFlag) == 4, "TvFlag is an invalid size"); | ||
| 160 | |||
| 161 | /// This is nn::settings::system::InitialLaunchFlag | ||
| 162 | struct InitialLaunchFlag { | ||
| 163 | union { | ||
| 164 | u32 raw{}; | ||
| 165 | |||
| 166 | BitField<0, 1, u32> InitialLaunchCompletionFlag; | ||
| 167 | BitField<8, 1, u32> InitialLaunchUserAdditionFlag; | ||
| 168 | BitField<16, 1, u32> InitialLaunchTimestampFlag; | ||
| 169 | }; | ||
| 170 | }; | ||
| 171 | static_assert(sizeof(InitialLaunchFlag) == 4, "InitialLaunchFlag is an invalid size"); | ||
| 172 | |||
| 173 | /// This is nn::settings::system::NotificationFlag | ||
| 174 | struct NotificationFlag { | ||
| 175 | union { | ||
| 176 | u32 raw{}; | ||
| 177 | |||
| 178 | BitField<0, 1, u32> RingtoneFlag; | ||
| 179 | BitField<1, 1, u32> DownloadCompletionFlag; | ||
| 180 | BitField<8, 1, u32> EnablesNews; | ||
| 181 | BitField<9, 1, u32> IncomingLampFlag; | ||
| 182 | }; | ||
| 183 | }; | ||
| 184 | static_assert(sizeof(NotificationFlag) == 4, "NotificationFlag is an invalid size"); | ||
| 185 | |||
| 186 | /// This is nn::settings::system::AccountNotificationFlag | ||
| 187 | struct AccountNotificationFlag { | ||
| 188 | union { | ||
| 189 | u32 raw{}; | ||
| 190 | |||
| 191 | BitField<0, 1, u32> FriendOnlineFlag; | ||
| 192 | BitField<1, 1, u32> FriendRequestFlag; | ||
| 193 | BitField<8, 1, u32> CoralInvitationFlag; | ||
| 194 | }; | ||
| 195 | }; | ||
| 196 | static_assert(sizeof(AccountNotificationFlag) == 4, | ||
| 197 | "AccountNotificationFlag is an invalid size"); | ||
| 198 | |||
| 199 | /// This is nn::settings::system::TvSettings | ||
| 200 | struct TvSettings { | ||
| 201 | TvFlag flags; | ||
| 202 | TvResolution tv_resolution; | ||
| 203 | HdmiContentType hdmi_content_type; | ||
| 204 | RgbRange rgb_range; | ||
| 205 | CmuMode cmu_mode; | ||
| 206 | u32 tv_underscan; | ||
| 207 | f32 tv_gama; | ||
| 208 | f32 constrast_ratio; | ||
| 209 | }; | ||
| 210 | static_assert(sizeof(TvSettings) == 0x20, "TvSettings is an invalid size"); | ||
| 211 | |||
| 212 | /// This is nn::settings::system::NotificationTime | ||
| 213 | struct NotificationTime { | ||
| 214 | u32 hour; | ||
| 215 | u32 minute; | ||
| 216 | }; | ||
| 217 | static_assert(sizeof(NotificationTime) == 0x8, "NotificationTime is an invalid size"); | ||
| 218 | |||
| 219 | /// This is nn::settings::system::NotificationSettings | ||
| 220 | struct NotificationSettings { | ||
| 221 | NotificationFlag flags; | ||
| 222 | NotificationVolume volume; | ||
| 223 | NotificationTime start_time; | ||
| 224 | NotificationTime stop_time; | ||
| 225 | }; | ||
| 226 | static_assert(sizeof(NotificationSettings) == 0x18, "NotificationSettings is an invalid size"); | ||
| 227 | |||
| 228 | /// This is nn::settings::system::AccountSettings | ||
| 229 | struct AccountSettings { | ||
| 230 | u32 flags; | ||
| 231 | }; | ||
| 232 | static_assert(sizeof(AccountSettings) == 0x4, "AccountSettings is an invalid size"); | ||
| 233 | |||
| 234 | /// This is nn::settings::system::AccountNotificationSettings | ||
| 235 | struct AccountNotificationSettings { | ||
| 236 | Common::UUID uid; | ||
| 237 | AccountNotificationFlag flags; | ||
| 238 | FriendPresenceOverlayPermission friend_presence_permission; | ||
| 239 | FriendPresenceOverlayPermission friend_invitation_permission; | ||
| 240 | INSERT_PADDING_BYTES(0x2); | ||
| 241 | }; | ||
| 242 | static_assert(sizeof(AccountNotificationSettings) == 0x18, | ||
| 243 | "AccountNotificationSettings is an invalid size"); | ||
| 244 | |||
| 245 | /// This is nn::settings::system::InitialLaunchSettings | ||
| 246 | struct SleepSettings { | ||
| 247 | SleepFlag flags; | ||
| 248 | HandheldSleepPlan handheld_sleep_plan; | ||
| 249 | ConsoleSleepPlan console_sleep_plan; | ||
| 250 | }; | ||
| 251 | static_assert(sizeof(SleepSettings) == 0xc, "SleepSettings is incorrect size"); | ||
| 252 | |||
| 253 | /// This is nn::settings::system::InitialLaunchSettings | ||
| 254 | struct InitialLaunchSettings { | ||
| 255 | InitialLaunchFlag flags; | ||
| 256 | INSERT_PADDING_BYTES(0x4); | ||
| 257 | Time::Clock::SteadyClockTimePoint timestamp; | ||
| 258 | }; | ||
| 259 | static_assert(sizeof(InitialLaunchSettings) == 0x20, "InitialLaunchSettings is incorrect size"); | ||
| 260 | |||
| 261 | /// This is nn::settings::system::InitialLaunchSettings | ||
| 262 | struct EulaVersion { | ||
| 263 | u32 version; | ||
| 264 | RegionCode region_code; | ||
| 265 | EulaVersionClockType clock_type; | ||
| 266 | INSERT_PADDING_BYTES(0x4); | ||
| 267 | s64 posix_time; | ||
| 268 | Time::Clock::SteadyClockTimePoint timestamp; | ||
| 269 | }; | ||
| 270 | static_assert(sizeof(EulaVersion) == 0x30, "EulaVersion is incorrect size"); | ||
| 271 | |||
| 272 | void SetLanguageCode(HLERequestContext& ctx); | ||
| 28 | void GetFirmwareVersion(HLERequestContext& ctx); | 273 | void GetFirmwareVersion(HLERequestContext& ctx); |
| 29 | void GetFirmwareVersion2(HLERequestContext& ctx); | 274 | void GetFirmwareVersion2(HLERequestContext& ctx); |
| 275 | void GetAccountSettings(HLERequestContext& ctx); | ||
| 276 | void SetAccountSettings(HLERequestContext& ctx); | ||
| 277 | void GetEulaVersions(HLERequestContext& ctx); | ||
| 278 | void SetEulaVersions(HLERequestContext& ctx); | ||
| 30 | void GetColorSetId(HLERequestContext& ctx); | 279 | void GetColorSetId(HLERequestContext& ctx); |
| 31 | void SetColorSetId(HLERequestContext& ctx); | 280 | void SetColorSetId(HLERequestContext& ctx); |
| 281 | void GetNotificationSettings(HLERequestContext& ctx); | ||
| 282 | void SetNotificationSettings(HLERequestContext& ctx); | ||
| 283 | void GetAccountNotificationSettings(HLERequestContext& ctx); | ||
| 284 | void SetAccountNotificationSettings(HLERequestContext& ctx); | ||
| 285 | void GetSettingsItemValueSize(HLERequestContext& ctx); | ||
| 286 | void GetSettingsItemValue(HLERequestContext& ctx); | ||
| 287 | void GetTvSettings(HLERequestContext& ctx); | ||
| 288 | void SetTvSettings(HLERequestContext& ctx); | ||
| 289 | void GetQuestFlag(HLERequestContext& ctx); | ||
| 290 | void SetRegionCode(HLERequestContext& ctx); | ||
| 291 | void GetPrimaryAlbumStorage(HLERequestContext& ctx); | ||
| 292 | void GetSleepSettings(HLERequestContext& ctx); | ||
| 293 | void SetSleepSettings(HLERequestContext& ctx); | ||
| 294 | void GetInitialLaunchSettings(HLERequestContext& ctx); | ||
| 295 | void SetInitialLaunchSettings(HLERequestContext& ctx); | ||
| 32 | void GetDeviceNickName(HLERequestContext& ctx); | 296 | void GetDeviceNickName(HLERequestContext& ctx); |
| 297 | void SetDeviceNickName(HLERequestContext& ctx); | ||
| 298 | void GetProductModel(HLERequestContext& ctx); | ||
| 299 | void GetMiiAuthorId(HLERequestContext& ctx); | ||
| 300 | void GetAutoUpdateEnableFlag(HLERequestContext& ctx); | ||
| 301 | void GetBatteryPercentageFlag(HLERequestContext& ctx); | ||
| 302 | void GetErrorReportSharePermission(HLERequestContext& ctx); | ||
| 303 | void GetAppletLaunchFlags(HLERequestContext& ctx); | ||
| 304 | void SetAppletLaunchFlags(HLERequestContext& ctx); | ||
| 305 | void GetKeyboardLayout(HLERequestContext& ctx); | ||
| 306 | void GetChineseTraditionalInputMethod(HLERequestContext& ctx); | ||
| 307 | void GetFieldTestingFlag(HLERequestContext& ctx); | ||
| 308 | |||
| 309 | AccountSettings account_settings{ | ||
| 310 | .flags = {}, | ||
| 311 | }; | ||
| 33 | 312 | ||
| 34 | ColorSet color_set = ColorSet::BasicWhite; | 313 | ColorSet color_set = ColorSet::BasicWhite; |
| 314 | |||
| 315 | NotificationSettings notification_settings{ | ||
| 316 | .flags = {0x300}, | ||
| 317 | .volume = NotificationVolume::High, | ||
| 318 | .start_time = {.hour = 9, .minute = 0}, | ||
| 319 | .stop_time = {.hour = 21, .minute = 0}, | ||
| 320 | }; | ||
| 321 | |||
| 322 | std::vector<AccountNotificationSettings> account_notifications{}; | ||
| 323 | |||
| 324 | TvSettings tv_settings{ | ||
| 325 | .flags = {0xc}, | ||
| 326 | .tv_resolution = TvResolution::Auto, | ||
| 327 | .hdmi_content_type = HdmiContentType::Game, | ||
| 328 | .rgb_range = RgbRange::Auto, | ||
| 329 | .cmu_mode = CmuMode::None, | ||
| 330 | .tv_underscan = {}, | ||
| 331 | .tv_gama = 1.0f, | ||
| 332 | .constrast_ratio = 0.5f, | ||
| 333 | }; | ||
| 334 | |||
| 335 | InitialLaunchSettings launch_settings{ | ||
| 336 | .flags = {0x10001}, | ||
| 337 | .timestamp = {}, | ||
| 338 | }; | ||
| 339 | |||
| 340 | SleepSettings sleep_settings{ | ||
| 341 | .flags = {0x3}, | ||
| 342 | .handheld_sleep_plan = HandheldSleepPlan::Sleep10Min, | ||
| 343 | .console_sleep_plan = ConsoleSleepPlan::Sleep1Hour, | ||
| 344 | }; | ||
| 345 | |||
| 346 | u32 applet_launch_flag{}; | ||
| 347 | |||
| 348 | std::vector<EulaVersion> eula_versions{}; | ||
| 349 | |||
| 350 | RegionCode region_code; | ||
| 351 | |||
| 352 | LanguageCode language_code_setting; | ||
| 35 | }; | 353 | }; |
| 36 | 354 | ||
| 37 | } // namespace Service::Set | 355 | } // namespace Service::Set |
diff --git a/src/shader_recompiler/environment.h b/src/shader_recompiler/environment.h index 26e8307c1..15285ab0a 100644 --- a/src/shader_recompiler/environment.h +++ b/src/shader_recompiler/environment.h | |||
| @@ -39,7 +39,7 @@ public: | |||
| 39 | [[nodiscard]] virtual std::optional<ReplaceConstant> GetReplaceConstBuffer(u32 bank, | 39 | [[nodiscard]] virtual std::optional<ReplaceConstant> GetReplaceConstBuffer(u32 bank, |
| 40 | u32 offset) = 0; | 40 | u32 offset) = 0; |
| 41 | 41 | ||
| 42 | virtual void Dump(u64 hash) = 0; | 42 | virtual void Dump(u64 pipeline_hash, u64 shader_hash) = 0; |
| 43 | 43 | ||
| 44 | [[nodiscard]] const ProgramHeader& SPH() const noexcept { | 44 | [[nodiscard]] const ProgramHeader& SPH() const noexcept { |
| 45 | return sph; | 45 | return sph; |
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index 618cb6354..2888e0238 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp | |||
| @@ -445,7 +445,8 @@ std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline( | |||
| 445 | ShaderContext::ShaderPools& pools, const GraphicsPipelineKey& key, | 445 | ShaderContext::ShaderPools& pools, const GraphicsPipelineKey& key, |
| 446 | std::span<Shader::Environment* const> envs, bool use_shader_workers, | 446 | std::span<Shader::Environment* const> envs, bool use_shader_workers, |
| 447 | bool force_context_flush) try { | 447 | bool force_context_flush) try { |
| 448 | LOG_INFO(Render_OpenGL, "0x{:016x}", key.Hash()); | 448 | auto hash = key.Hash(); |
| 449 | LOG_INFO(Render_OpenGL, "0x{:016x}", hash); | ||
| 449 | size_t env_index{}; | 450 | size_t env_index{}; |
| 450 | u32 total_storage_buffers{}; | 451 | u32 total_storage_buffers{}; |
| 451 | std::array<Shader::IR::Program, Maxwell::MaxShaderProgram> programs; | 452 | std::array<Shader::IR::Program, Maxwell::MaxShaderProgram> programs; |
| @@ -474,7 +475,7 @@ std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline( | |||
| 474 | Shader::Maxwell::Flow::CFG cfg(env, pools.flow_block, cfg_offset, index == 0); | 475 | Shader::Maxwell::Flow::CFG cfg(env, pools.flow_block, cfg_offset, index == 0); |
| 475 | 476 | ||
| 476 | if (Settings::values.dump_shaders) { | 477 | if (Settings::values.dump_shaders) { |
| 477 | env.Dump(key.unique_hashes[index]); | 478 | env.Dump(hash, key.unique_hashes[index]); |
| 478 | } | 479 | } |
| 479 | 480 | ||
| 480 | if (!uses_vertex_a || index != 1) { | 481 | if (!uses_vertex_a || index != 1) { |
| @@ -566,12 +567,13 @@ std::unique_ptr<ComputePipeline> ShaderCache::CreateComputePipeline( | |||
| 566 | std::unique_ptr<ComputePipeline> ShaderCache::CreateComputePipeline( | 567 | std::unique_ptr<ComputePipeline> ShaderCache::CreateComputePipeline( |
| 567 | ShaderContext::ShaderPools& pools, const ComputePipelineKey& key, Shader::Environment& env, | 568 | ShaderContext::ShaderPools& pools, const ComputePipelineKey& key, Shader::Environment& env, |
| 568 | bool force_context_flush) try { | 569 | bool force_context_flush) try { |
| 569 | LOG_INFO(Render_OpenGL, "0x{:016x}", key.Hash()); | 570 | auto hash = key.Hash(); |
| 571 | LOG_INFO(Render_OpenGL, "0x{:016x}", hash); | ||
| 570 | 572 | ||
| 571 | Shader::Maxwell::Flow::CFG cfg{env, pools.flow_block, env.StartAddress()}; | 573 | Shader::Maxwell::Flow::CFG cfg{env, pools.flow_block, env.StartAddress()}; |
| 572 | 574 | ||
| 573 | if (Settings::values.dump_shaders) { | 575 | if (Settings::values.dump_shaders) { |
| 574 | env.Dump(key.Hash()); | 576 | env.Dump(hash, key.unique_hash); |
| 575 | } | 577 | } |
| 576 | 578 | ||
| 577 | auto program{TranslateProgram(pools.inst, pools.block, env, cfg, host_info)}; | 579 | auto program{TranslateProgram(pools.inst, pools.block, env, cfg, host_info)}; |
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 4f84d8497..c1314ca99 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | |||
| @@ -584,7 +584,8 @@ std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline( | |||
| 584 | ShaderPools& pools, const GraphicsPipelineCacheKey& key, | 584 | ShaderPools& pools, const GraphicsPipelineCacheKey& key, |
| 585 | std::span<Shader::Environment* const> envs, PipelineStatistics* statistics, | 585 | std::span<Shader::Environment* const> envs, PipelineStatistics* statistics, |
| 586 | bool build_in_parallel) try { | 586 | bool build_in_parallel) try { |
| 587 | LOG_INFO(Render_Vulkan, "0x{:016x}", key.Hash()); | 587 | auto hash = key.Hash(); |
| 588 | LOG_INFO(Render_Vulkan, "0x{:016x}", hash); | ||
| 588 | size_t env_index{0}; | 589 | size_t env_index{0}; |
| 589 | std::array<Shader::IR::Program, Maxwell::MaxShaderProgram> programs; | 590 | std::array<Shader::IR::Program, Maxwell::MaxShaderProgram> programs; |
| 590 | const bool uses_vertex_a{key.unique_hashes[0] != 0}; | 591 | const bool uses_vertex_a{key.unique_hashes[0] != 0}; |
| @@ -611,7 +612,7 @@ std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline( | |||
| 611 | const u32 cfg_offset{static_cast<u32>(env.StartAddress() + sizeof(Shader::ProgramHeader))}; | 612 | const u32 cfg_offset{static_cast<u32>(env.StartAddress() + sizeof(Shader::ProgramHeader))}; |
| 612 | Shader::Maxwell::Flow::CFG cfg(env, pools.flow_block, cfg_offset, index == 0); | 613 | Shader::Maxwell::Flow::CFG cfg(env, pools.flow_block, cfg_offset, index == 0); |
| 613 | if (Settings::values.dump_shaders) { | 614 | if (Settings::values.dump_shaders) { |
| 614 | env.Dump(key.unique_hashes[index]); | 615 | env.Dump(hash, key.unique_hashes[index]); |
| 615 | } | 616 | } |
| 616 | if (!uses_vertex_a || index != 1) { | 617 | if (!uses_vertex_a || index != 1) { |
| 617 | // Normal path | 618 | // Normal path |
| @@ -712,18 +713,19 @@ std::unique_ptr<ComputePipeline> PipelineCache::CreateComputePipeline( | |||
| 712 | std::unique_ptr<ComputePipeline> PipelineCache::CreateComputePipeline( | 713 | std::unique_ptr<ComputePipeline> PipelineCache::CreateComputePipeline( |
| 713 | ShaderPools& pools, const ComputePipelineCacheKey& key, Shader::Environment& env, | 714 | ShaderPools& pools, const ComputePipelineCacheKey& key, Shader::Environment& env, |
| 714 | PipelineStatistics* statistics, bool build_in_parallel) try { | 715 | PipelineStatistics* statistics, bool build_in_parallel) try { |
| 716 | auto hash = key.Hash(); | ||
| 715 | if (device.HasBrokenCompute()) { | 717 | if (device.HasBrokenCompute()) { |
| 716 | LOG_ERROR(Render_Vulkan, "Skipping 0x{:016x}", key.Hash()); | 718 | LOG_ERROR(Render_Vulkan, "Skipping 0x{:016x}", hash); |
| 717 | return nullptr; | 719 | return nullptr; |
| 718 | } | 720 | } |
| 719 | 721 | ||
| 720 | LOG_INFO(Render_Vulkan, "0x{:016x}", key.Hash()); | 722 | LOG_INFO(Render_Vulkan, "0x{:016x}", hash); |
| 721 | 723 | ||
| 722 | Shader::Maxwell::Flow::CFG cfg{env, pools.flow_block, env.StartAddress()}; | 724 | Shader::Maxwell::Flow::CFG cfg{env, pools.flow_block, env.StartAddress()}; |
| 723 | 725 | ||
| 724 | // Dump it before error. | 726 | // Dump it before error. |
| 725 | if (Settings::values.dump_shaders) { | 727 | if (Settings::values.dump_shaders) { |
| 726 | env.Dump(key.Hash()); | 728 | env.Dump(hash, key.unique_hash); |
| 727 | } | 729 | } |
| 728 | 730 | ||
| 729 | auto program{TranslateProgram(pools.inst, pools.block, env, cfg, host_info)}; | 731 | auto program{TranslateProgram(pools.inst, pools.block, env, cfg, host_info)}; |
diff --git a/src/video_core/shader_cache.cpp b/src/video_core/shader_cache.cpp index 01701201d..e81cd031b 100644 --- a/src/video_core/shader_cache.cpp +++ b/src/video_core/shader_cache.cpp | |||
| @@ -51,6 +51,11 @@ bool ShaderCache::RefreshStages(std::array<u64, 6>& unique_hashes) { | |||
| 51 | } | 51 | } |
| 52 | const auto& shader_config{maxwell3d->regs.pipelines[index]}; | 52 | const auto& shader_config{maxwell3d->regs.pipelines[index]}; |
| 53 | const auto program{static_cast<Tegra::Engines::Maxwell3D::Regs::ShaderType>(index)}; | 53 | const auto program{static_cast<Tegra::Engines::Maxwell3D::Regs::ShaderType>(index)}; |
| 54 | if (program == Tegra::Engines::Maxwell3D::Regs::ShaderType::Pixel && | ||
| 55 | !maxwell3d->regs.rasterize_enable) { | ||
| 56 | unique_hashes[index] = 0; | ||
| 57 | continue; | ||
| 58 | } | ||
| 54 | const GPUVAddr shader_addr{base_addr + shader_config.offset}; | 59 | const GPUVAddr shader_addr{base_addr + shader_config.offset}; |
| 55 | const std::optional<VAddr> cpu_shader_addr{gpu_memory->GpuToCpuAddress(shader_addr)}; | 60 | const std::optional<VAddr> cpu_shader_addr{gpu_memory->GpuToCpuAddress(shader_addr)}; |
| 56 | if (!cpu_shader_addr) { | 61 | if (!cpu_shader_addr) { |
diff --git a/src/video_core/shader_cache.h b/src/video_core/shader_cache.h index de8e08002..a76896620 100644 --- a/src/video_core/shader_cache.h +++ b/src/video_core/shader_cache.h | |||
| @@ -70,7 +70,7 @@ public: | |||
| 70 | protected: | 70 | protected: |
| 71 | struct GraphicsEnvironments { | 71 | struct GraphicsEnvironments { |
| 72 | std::array<GraphicsEnvironment, NUM_PROGRAMS> envs; | 72 | std::array<GraphicsEnvironment, NUM_PROGRAMS> envs; |
| 73 | std::array<Shader::Environment*, NUM_PROGRAMS> env_ptrs; | 73 | std::array<Shader::Environment*, NUM_PROGRAMS> env_ptrs{}; |
| 74 | 74 | ||
| 75 | std::span<Shader::Environment* const> Span() const noexcept { | 75 | std::span<Shader::Environment* const> Span() const noexcept { |
| 76 | return std::span(env_ptrs.begin(), std::ranges::find(env_ptrs, nullptr)); | 76 | return std::span(env_ptrs.begin(), std::ranges::find(env_ptrs, nullptr)); |
diff --git a/src/video_core/shader_environment.cpp b/src/video_core/shader_environment.cpp index c7cb56243..4edbe5700 100644 --- a/src/video_core/shader_environment.cpp +++ b/src/video_core/shader_environment.cpp | |||
| @@ -102,7 +102,8 @@ static std::string_view StageToPrefix(Shader::Stage stage) { | |||
| 102 | } | 102 | } |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | static void DumpImpl(u64 hash, const u64* code, u32 read_highest, u32 read_lowest, | 105 | static void DumpImpl(u64 pipeline_hash, u64 shader_hash, std::span<const u64> code, |
| 106 | [[maybe_unused]] u32 read_highest, [[maybe_unused]] u32 read_lowest, | ||
| 106 | u32 initial_offset, Shader::Stage stage) { | 107 | u32 initial_offset, Shader::Stage stage) { |
| 107 | const auto shader_dir{Common::FS::GetYuzuPath(Common::FS::YuzuPath::DumpDir)}; | 108 | const auto shader_dir{Common::FS::GetYuzuPath(Common::FS::YuzuPath::DumpDir)}; |
| 108 | const auto base_dir{shader_dir / "shaders"}; | 109 | const auto base_dir{shader_dir / "shaders"}; |
| @@ -111,13 +112,18 @@ static void DumpImpl(u64 hash, const u64* code, u32 read_highest, u32 read_lowes | |||
| 111 | return; | 112 | return; |
| 112 | } | 113 | } |
| 113 | const auto prefix = StageToPrefix(stage); | 114 | const auto prefix = StageToPrefix(stage); |
| 114 | const auto name{base_dir / fmt::format("{}{:016x}.ash", prefix, hash)}; | 115 | const auto name{base_dir / |
| 115 | const size_t real_size = read_highest - read_lowest + initial_offset; | 116 | fmt::format("{:016x}_{}_{:016x}.ash", pipeline_hash, prefix, shader_hash)}; |
| 116 | const size_t padding_needed = ((32 - (real_size % 32)) % 32); | ||
| 117 | std::fstream shader_file(name, std::ios::out | std::ios::binary); | 117 | std::fstream shader_file(name, std::ios::out | std::ios::binary); |
| 118 | ASSERT(initial_offset % sizeof(u64) == 0); | ||
| 118 | const size_t jump_index = initial_offset / sizeof(u64); | 119 | const size_t jump_index = initial_offset / sizeof(u64); |
| 119 | shader_file.write(reinterpret_cast<const char*>(code + jump_index), real_size); | 120 | const size_t code_size = code.size_bytes() - initial_offset; |
| 120 | for (size_t i = 0; i < padding_needed; i++) { | 121 | shader_file.write(reinterpret_cast<const char*>(&code[jump_index]), code_size); |
| 122 | |||
| 123 | // + 1 instruction, due to the fact that we skip the final self branch instruction in the code, | ||
| 124 | // but we need to consider it for padding, otherwise nvdisasm rages. | ||
| 125 | const size_t padding_needed = (32 - ((code_size + INST_SIZE) % 32)) % 32; | ||
| 126 | for (size_t i = 0; i < INST_SIZE + padding_needed; i++) { | ||
| 121 | shader_file.put(0); | 127 | shader_file.put(0); |
| 122 | } | 128 | } |
| 123 | } | 129 | } |
| @@ -197,8 +203,8 @@ u64 GenericEnvironment::CalculateHash() const { | |||
| 197 | return Common::CityHash64(data.get(), size); | 203 | return Common::CityHash64(data.get(), size); |
| 198 | } | 204 | } |
| 199 | 205 | ||
| 200 | void GenericEnvironment::Dump(u64 hash) { | 206 | void GenericEnvironment::Dump(u64 pipeline_hash, u64 shader_hash) { |
| 201 | DumpImpl(hash, code.data(), read_highest, read_lowest, initial_offset, stage); | 207 | DumpImpl(pipeline_hash, shader_hash, code, read_highest, read_lowest, initial_offset, stage); |
| 202 | } | 208 | } |
| 203 | 209 | ||
| 204 | void GenericEnvironment::Serialize(std::ofstream& file) const { | 210 | void GenericEnvironment::Serialize(std::ofstream& file) const { |
| @@ -282,6 +288,7 @@ std::optional<u64> GenericEnvironment::TryFindSize() { | |||
| 282 | Tegra::Texture::TICEntry GenericEnvironment::ReadTextureInfo(GPUVAddr tic_addr, u32 tic_limit, | 288 | Tegra::Texture::TICEntry GenericEnvironment::ReadTextureInfo(GPUVAddr tic_addr, u32 tic_limit, |
| 283 | bool via_header_index, u32 raw) { | 289 | bool via_header_index, u32 raw) { |
| 284 | const auto handle{Tegra::Texture::TexturePair(raw, via_header_index)}; | 290 | const auto handle{Tegra::Texture::TexturePair(raw, via_header_index)}; |
| 291 | ASSERT(handle.first <= tic_limit); | ||
| 285 | const GPUVAddr descriptor_addr{tic_addr + handle.first * sizeof(Tegra::Texture::TICEntry)}; | 292 | const GPUVAddr descriptor_addr{tic_addr + handle.first * sizeof(Tegra::Texture::TICEntry)}; |
| 286 | Tegra::Texture::TICEntry entry; | 293 | Tegra::Texture::TICEntry entry; |
| 287 | gpu_memory->ReadBlock(descriptor_addr, &entry, sizeof(entry)); | 294 | gpu_memory->ReadBlock(descriptor_addr, &entry, sizeof(entry)); |
| @@ -465,8 +472,8 @@ void FileEnvironment::Deserialize(std::ifstream& file) { | |||
| 465 | .read(reinterpret_cast<char*>(&read_highest), sizeof(read_highest)) | 472 | .read(reinterpret_cast<char*>(&read_highest), sizeof(read_highest)) |
| 466 | .read(reinterpret_cast<char*>(&viewport_transform_state), sizeof(viewport_transform_state)) | 473 | .read(reinterpret_cast<char*>(&viewport_transform_state), sizeof(viewport_transform_state)) |
| 467 | .read(reinterpret_cast<char*>(&stage), sizeof(stage)); | 474 | .read(reinterpret_cast<char*>(&stage), sizeof(stage)); |
| 468 | code = std::make_unique<u64[]>(Common::DivCeil(code_size, sizeof(u64))); | 475 | code.resize(Common::DivCeil(code_size, sizeof(u64))); |
| 469 | file.read(reinterpret_cast<char*>(code.get()), code_size); | 476 | file.read(reinterpret_cast<char*>(code.data()), code_size); |
| 470 | for (size_t i = 0; i < num_texture_types; ++i) { | 477 | for (size_t i = 0; i < num_texture_types; ++i) { |
| 471 | u32 key; | 478 | u32 key; |
| 472 | Shader::TextureType type; | 479 | Shader::TextureType type; |
| @@ -509,8 +516,8 @@ void FileEnvironment::Deserialize(std::ifstream& file) { | |||
| 509 | is_propietary_driver = texture_bound == 2; | 516 | is_propietary_driver = texture_bound == 2; |
| 510 | } | 517 | } |
| 511 | 518 | ||
| 512 | void FileEnvironment::Dump(u64 hash) { | 519 | void FileEnvironment::Dump(u64 pipeline_hash, u64 shader_hash) { |
| 513 | DumpImpl(hash, code.get(), read_highest, read_lowest, initial_offset, stage); | 520 | DumpImpl(pipeline_hash, shader_hash, code, read_highest, read_lowest, initial_offset, stage); |
| 514 | } | 521 | } |
| 515 | 522 | ||
| 516 | u64 FileEnvironment::ReadInstruction(u32 address) { | 523 | u64 FileEnvironment::ReadInstruction(u32 address) { |
diff --git a/src/video_core/shader_environment.h b/src/video_core/shader_environment.h index a0f61cbda..b90f3d44e 100644 --- a/src/video_core/shader_environment.h +++ b/src/video_core/shader_environment.h | |||
| @@ -58,7 +58,7 @@ public: | |||
| 58 | 58 | ||
| 59 | [[nodiscard]] u64 CalculateHash() const; | 59 | [[nodiscard]] u64 CalculateHash() const; |
| 60 | 60 | ||
| 61 | void Dump(u64 hash) override; | 61 | void Dump(u64 pipeline_hash, u64 shader_hash) override; |
| 62 | 62 | ||
| 63 | void Serialize(std::ofstream& file) const; | 63 | void Serialize(std::ofstream& file) const; |
| 64 | 64 | ||
| @@ -188,10 +188,10 @@ public: | |||
| 188 | return cbuf_replacements.size() != 0; | 188 | return cbuf_replacements.size() != 0; |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | void Dump(u64 hash) override; | 191 | void Dump(u64 pipeline_hash, u64 shader_hash) override; |
| 192 | 192 | ||
| 193 | private: | 193 | private: |
| 194 | std::unique_ptr<u64[]> code; | 194 | std::vector<u64> code; |
| 195 | std::unordered_map<u32, Shader::TextureType> texture_types; | 195 | std::unordered_map<u32, Shader::TextureType> texture_types; |
| 196 | std::unordered_map<u32, Shader::TexturePixelFormat> texture_pixel_formats; | 196 | std::unordered_map<u32, Shader::TexturePixelFormat> texture_pixel_formats; |
| 197 | std::unordered_map<u64, u32> cbuf_values; | 197 | std::unordered_map<u64, u32> cbuf_values; |