summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/android/app/src/main/AndroidManifest.xml3
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt9
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/InstallableFragment.kt219
-rw-r--r--src/android/app/src/main/jni/native.cpp16
-rw-r--r--src/android/app/src/main/res/values/strings.xml10
-rw-r--r--src/android/app/src/main/res/xml/game_mode_config.xml7
-rw-r--r--src/core/CMakeLists.txt16
-rw-r--r--src/core/file_sys/patch_manager.cpp2
-rw-r--r--src/core/file_sys/savedata_factory.cpp9
-rw-r--r--src/core/file_sys/savedata_factory.h1
-rw-r--r--src/core/hle/service/ns/language.cpp2
-rw-r--r--src/core/hle/service/ns/ns.cpp2
-rw-r--r--src/core/hle/service/set/factory_settings_server.cpp (renamed from src/core/hle/service/set/set_cal.cpp)7
-rw-r--r--src/core/hle/service/set/factory_settings_server.h (renamed from src/core/hle/service/set/set_fd.h)6
-rw-r--r--src/core/hle/service/set/firmware_debug_settings_server.cpp (renamed from src/core/hle/service/set/set_fd.cpp)7
-rw-r--r--src/core/hle/service/set/firmware_debug_settings_server.h (renamed from src/core/hle/service/set/set_cal.h)6
-rw-r--r--src/core/hle/service/set/settings.cpp19
-rw-r--r--src/core/hle/service/set/settings_server.cpp (renamed from src/core/hle/service/set/set.cpp)70
-rw-r--r--src/core/hle/service/set/settings_server.h (renamed from src/core/hle/service/set/set.h)6
-rw-r--r--src/core/hle/service/set/system_settings_server.cpp (renamed from src/core/hle/service/set/set_sys.cpp)623
-rw-r--r--src/core/hle/service/set/system_settings_server.h (renamed from src/core/hle/service/set/set_sys.h)6
-rw-r--r--src/hid_core/resources/npad/npad.cpp5
-rw-r--r--src/yuzu/main.cpp2
23 files changed, 673 insertions, 380 deletions
diff --git a/src/android/app/src/main/AndroidManifest.xml b/src/android/app/src/main/AndroidManifest.xml
index f10131b24..f011bd696 100644
--- a/src/android/app/src/main/AndroidManifest.xml
+++ b/src/android/app/src/main/AndroidManifest.xml
@@ -31,6 +31,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
31 android:dataExtractionRules="@xml/data_extraction_rules_api_31" 31 android:dataExtractionRules="@xml/data_extraction_rules_api_31"
32 android:enableOnBackInvokedCallback="true"> 32 android:enableOnBackInvokedCallback="true">
33 33
34 <meta-data android:name="android.game_mode_config"
35 android:resource="@xml/game_mode_config" />
36
34 <activity 37 <activity
35 android:name="org.yuzu.yuzu_emu.ui.main.MainActivity" 38 android:name="org.yuzu.yuzu_emu.ui.main.MainActivity"
36 android:exported="true" 39 android:exported="true"
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt
index 010c44951..b7556e353 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt
@@ -548,6 +548,15 @@ object NativeLibrary {
548 external fun getSavePath(programId: String): String 548 external fun getSavePath(programId: String): String
549 549
550 /** 550 /**
551 * Gets the root save directory for the default profile as either
552 * /user/save/account/<user id raw string> or /user/save/000...000/<user id>
553 *
554 * @param future If true, returns the /user/save/account/... directory
555 * @return Save data path that may not exist yet
556 */
557 external fun getDefaultProfileSaveDataRoot(future: Boolean): String
558
559 /**
551 * Adds a file to the manual filesystem provider in our EmulationSession instance 560 * Adds a file to the manual filesystem provider in our EmulationSession instance
552 * @param path Path to the file we're adding. Can be a string representation of a [Uri] or 561 * @param path Path to the file we're adding. Can be a string representation of a [Uri] or
553 * a normal path 562 * a normal path
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/InstallableFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/InstallableFragment.kt
index 569727b90..5b4bf2c9f 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/InstallableFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/InstallableFragment.kt
@@ -7,20 +7,39 @@ import android.os.Bundle
7import android.view.LayoutInflater 7import android.view.LayoutInflater
8import android.view.View 8import android.view.View
9import android.view.ViewGroup 9import android.view.ViewGroup
10import android.widget.Toast
11import androidx.activity.result.contract.ActivityResultContracts
10import androidx.core.view.ViewCompat 12import androidx.core.view.ViewCompat
11import androidx.core.view.WindowInsetsCompat 13import androidx.core.view.WindowInsetsCompat
12import androidx.core.view.updatePadding 14import androidx.core.view.updatePadding
13import androidx.fragment.app.Fragment 15import androidx.fragment.app.Fragment
14import androidx.fragment.app.activityViewModels 16import androidx.fragment.app.activityViewModels
17import androidx.lifecycle.Lifecycle
18import androidx.lifecycle.lifecycleScope
19import androidx.lifecycle.repeatOnLifecycle
15import androidx.navigation.findNavController 20import androidx.navigation.findNavController
16import androidx.recyclerview.widget.GridLayoutManager 21import androidx.recyclerview.widget.GridLayoutManager
17import com.google.android.material.transition.MaterialSharedAxis 22import com.google.android.material.transition.MaterialSharedAxis
23import kotlinx.coroutines.Dispatchers
24import kotlinx.coroutines.launch
25import kotlinx.coroutines.withContext
26import org.yuzu.yuzu_emu.NativeLibrary
18import org.yuzu.yuzu_emu.R 27import org.yuzu.yuzu_emu.R
28import org.yuzu.yuzu_emu.YuzuApplication
19import org.yuzu.yuzu_emu.adapters.InstallableAdapter 29import org.yuzu.yuzu_emu.adapters.InstallableAdapter
20import org.yuzu.yuzu_emu.databinding.FragmentInstallablesBinding 30import org.yuzu.yuzu_emu.databinding.FragmentInstallablesBinding
21import org.yuzu.yuzu_emu.model.HomeViewModel 31import org.yuzu.yuzu_emu.model.HomeViewModel
22import org.yuzu.yuzu_emu.model.Installable 32import org.yuzu.yuzu_emu.model.Installable
33import org.yuzu.yuzu_emu.model.TaskState
23import org.yuzu.yuzu_emu.ui.main.MainActivity 34import org.yuzu.yuzu_emu.ui.main.MainActivity
35import org.yuzu.yuzu_emu.utils.DirectoryInitialization
36import org.yuzu.yuzu_emu.utils.FileUtil
37import java.io.BufferedInputStream
38import java.io.BufferedOutputStream
39import java.io.File
40import java.math.BigInteger
41import java.time.LocalDateTime
42import java.time.format.DateTimeFormatter
24 43
25class InstallableFragment : Fragment() { 44class InstallableFragment : Fragment() {
26 private var _binding: FragmentInstallablesBinding? = null 45 private var _binding: FragmentInstallablesBinding? = null
@@ -56,6 +75,17 @@ class InstallableFragment : Fragment() {
56 binding.root.findNavController().popBackStack() 75 binding.root.findNavController().popBackStack()
57 } 76 }
58 77
78 viewLifecycleOwner.lifecycleScope.launch {
79 repeatOnLifecycle(Lifecycle.State.CREATED) {
80 homeViewModel.openImportSaves.collect {
81 if (it) {
82 importSaves.launch(arrayOf("application/zip"))
83 homeViewModel.setOpenImportSaves(false)
84 }
85 }
86 }
87 }
88
59 val installables = listOf( 89 val installables = listOf(
60 Installable( 90 Installable(
61 R.string.user_data, 91 R.string.user_data,
@@ -64,6 +94,43 @@ class InstallableFragment : Fragment() {
64 export = { mainActivity.exportUserData.launch("export.zip") } 94 export = { mainActivity.exportUserData.launch("export.zip") }
65 ), 95 ),
66 Installable( 96 Installable(
97 R.string.manage_save_data,
98 R.string.manage_save_data_description,
99 install = {
100 MessageDialogFragment.newInstance(
101 requireActivity(),
102 titleId = R.string.import_save_warning,
103 descriptionId = R.string.import_save_warning_description,
104 positiveAction = { homeViewModel.setOpenImportSaves(true) }
105 ).show(parentFragmentManager, MessageDialogFragment.TAG)
106 },
107 export = {
108 val oldSaveDataFolder = File(
109 "${DirectoryInitialization.userDirectory}/nand" +
110 NativeLibrary.getDefaultProfileSaveDataRoot(false)
111 )
112 val futureSaveDataFolder = File(
113 "${DirectoryInitialization.userDirectory}/nand" +
114 NativeLibrary.getDefaultProfileSaveDataRoot(true)
115 )
116 if (!oldSaveDataFolder.exists() && !futureSaveDataFolder.exists()) {
117 Toast.makeText(
118 YuzuApplication.appContext,
119 R.string.no_save_data_found,
120 Toast.LENGTH_SHORT
121 ).show()
122 return@Installable
123 } else {
124 exportSaves.launch(
125 "${getString(R.string.save_data)} " +
126 LocalDateTime.now().format(
127 DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")
128 )
129 )
130 }
131 }
132 ),
133 Installable(
67 R.string.install_game_content, 134 R.string.install_game_content,
68 R.string.install_game_content_description, 135 R.string.install_game_content_description,
69 install = { mainActivity.installGameUpdate.launch(arrayOf("*/*")) } 136 install = { mainActivity.installGameUpdate.launch(arrayOf("*/*")) }
@@ -121,4 +188,156 @@ class InstallableFragment : Fragment() {
121 188
122 windowInsets 189 windowInsets
123 } 190 }
191
192 private val importSaves =
193 registerForActivityResult(ActivityResultContracts.OpenDocument()) { result ->
194 if (result == null) {
195 return@registerForActivityResult
196 }
197
198 val inputZip = requireContext().contentResolver.openInputStream(result)
199 val cacheSaveDir = File("${requireContext().cacheDir.path}/saves/")
200 cacheSaveDir.mkdir()
201
202 if (inputZip == null) {
203 Toast.makeText(
204 YuzuApplication.appContext,
205 getString(R.string.fatal_error),
206 Toast.LENGTH_LONG
207 ).show()
208 return@registerForActivityResult
209 }
210
211 IndeterminateProgressDialogFragment.newInstance(
212 requireActivity(),
213 R.string.save_files_importing,
214 false
215 ) {
216 try {
217 FileUtil.unzipToInternalStorage(BufferedInputStream(inputZip), cacheSaveDir)
218 val files = cacheSaveDir.listFiles()
219 var successfulImports = 0
220 var failedImports = 0
221 if (files != null) {
222 for (file in files) {
223 if (file.isDirectory) {
224 val baseSaveDir =
225 NativeLibrary.getSavePath(BigInteger(file.name, 16).toString())
226 if (baseSaveDir.isEmpty()) {
227 failedImports++
228 continue
229 }
230
231 val internalSaveFolder = File(
232 "${DirectoryInitialization.userDirectory}/nand$baseSaveDir"
233 )
234 internalSaveFolder.deleteRecursively()
235 internalSaveFolder.mkdir()
236 file.copyRecursively(target = internalSaveFolder, overwrite = true)
237 successfulImports++
238 }
239 }
240 }
241
242 withContext(Dispatchers.Main) {
243 if (successfulImports == 0) {
244 MessageDialogFragment.newInstance(
245 requireActivity(),
246 titleId = R.string.save_file_invalid_zip_structure,
247 descriptionId = R.string.save_file_invalid_zip_structure_description
248 ).show(parentFragmentManager, MessageDialogFragment.TAG)
249 return@withContext
250 }
251 val successString = if (failedImports > 0) {
252 """
253 ${
254 requireContext().resources.getQuantityString(
255 R.plurals.saves_import_success,
256 successfulImports,
257 successfulImports
258 )
259 }
260 ${
261 requireContext().resources.getQuantityString(
262 R.plurals.saves_import_failed,
263 failedImports,
264 failedImports
265 )
266 }
267 """
268 } else {
269 requireContext().resources.getQuantityString(
270 R.plurals.saves_import_success,
271 successfulImports,
272 successfulImports
273 )
274 }
275 MessageDialogFragment.newInstance(
276 requireActivity(),
277 titleId = R.string.import_complete,
278 descriptionString = successString
279 ).show(parentFragmentManager, MessageDialogFragment.TAG)
280 }
281
282 cacheSaveDir.deleteRecursively()
283 } catch (e: Exception) {
284 Toast.makeText(
285 YuzuApplication.appContext,
286 getString(R.string.fatal_error),
287 Toast.LENGTH_LONG
288 ).show()
289 }
290 }.show(parentFragmentManager, IndeterminateProgressDialogFragment.TAG)
291 }
292
293 private val exportSaves = registerForActivityResult(
294 ActivityResultContracts.CreateDocument("application/zip")
295 ) { result ->
296 if (result == null) {
297 return@registerForActivityResult
298 }
299
300 IndeterminateProgressDialogFragment.newInstance(
301 requireActivity(),
302 R.string.save_files_exporting,
303 false
304 ) {
305 val cacheSaveDir = File("${requireContext().cacheDir.path}/saves/")
306 cacheSaveDir.mkdir()
307
308 val oldSaveDataFolder = File(
309 "${DirectoryInitialization.userDirectory}/nand" +
310 NativeLibrary.getDefaultProfileSaveDataRoot(false)
311 )
312 if (oldSaveDataFolder.exists()) {
313 oldSaveDataFolder.copyRecursively(cacheSaveDir)
314 }
315
316 val futureSaveDataFolder = File(
317 "${DirectoryInitialization.userDirectory}/nand" +
318 NativeLibrary.getDefaultProfileSaveDataRoot(true)
319 )
320 if (futureSaveDataFolder.exists()) {
321 futureSaveDataFolder.copyRecursively(cacheSaveDir)
322 }
323
324 val saveFilesTotal = cacheSaveDir.listFiles()?.size ?: 0
325 if (saveFilesTotal == 0) {
326 cacheSaveDir.deleteRecursively()
327 return@newInstance getString(R.string.no_save_data_found)
328 }
329
330 val zipResult = FileUtil.zipFromInternalStorage(
331 cacheSaveDir,
332 cacheSaveDir.path,
333 BufferedOutputStream(requireContext().contentResolver.openOutputStream(result))
334 )
335 cacheSaveDir.deleteRecursively()
336
337 return@newInstance when (zipResult) {
338 TaskState.Completed -> getString(R.string.export_success)
339 TaskState.Cancelled, TaskState.Failed -> getString(R.string.export_failed)
340 }
341 }.show(parentFragmentManager, IndeterminateProgressDialogFragment.TAG)
342 }
124} 343}
diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp
index 056920a4a..136c8dee6 100644
--- a/src/android/app/src/main/jni/native.cpp
+++ b/src/android/app/src/main/jni/native.cpp
@@ -862,6 +862,9 @@ jobjectArray Java_org_yuzu_yuzu_1emu_NativeLibrary_getAddonsForFile(JNIEnv* env,
862jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_getSavePath(JNIEnv* env, jobject jobj, 862jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_getSavePath(JNIEnv* env, jobject jobj,
863 jstring jprogramId) { 863 jstring jprogramId) {
864 auto program_id = EmulationSession::GetProgramId(env, jprogramId); 864 auto program_id = EmulationSession::GetProgramId(env, jprogramId);
865 if (program_id == 0) {
866 return ToJString(env, "");
867 }
865 868
866 auto& system = EmulationSession::GetInstance().System(); 869 auto& system = EmulationSession::GetInstance().System();
867 870
@@ -880,6 +883,19 @@ jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_getSavePath(JNIEnv* env, jobject j
880 return ToJString(env, user_save_data_path); 883 return ToJString(env, user_save_data_path);
881} 884}
882 885
886jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_getDefaultProfileSaveDataRoot(JNIEnv* env,
887 jobject jobj,
888 jboolean jfuture) {
889 Service::Account::ProfileManager manager;
890 // TODO: Pass in a selected user once we get the relevant UI working
891 const auto user_id = manager.GetUser(static_cast<std::size_t>(0));
892 ASSERT(user_id);
893
894 const auto user_save_data_root =
895 FileSys::SaveDataFactory::GetUserGameSaveDataRoot(user_id->AsU128(), jfuture);
896 return ToJString(env, user_save_data_root);
897}
898
883void Java_org_yuzu_yuzu_1emu_NativeLibrary_addFileToFilesystemProvider(JNIEnv* env, jobject jobj, 899void Java_org_yuzu_yuzu_1emu_NativeLibrary_addFileToFilesystemProvider(JNIEnv* env, jobject jobj,
884 jstring jpath) { 900 jstring jpath) {
885 EmulationSession::GetInstance().ConfigureFilesystemProvider(GetJString(env, jpath)); 901 EmulationSession::GetInstance().ConfigureFilesystemProvider(GetJString(env, jpath));
diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml
index 83aa1b781..3bb92ad67 100644
--- a/src/android/app/src/main/res/values/strings.xml
+++ b/src/android/app/src/main/res/values/strings.xml
@@ -133,6 +133,15 @@
133 <string name="add_game_folder">Add game folder</string> 133 <string name="add_game_folder">Add game folder</string>
134 <string name="folder_already_added">This folder was already added!</string> 134 <string name="folder_already_added">This folder was already added!</string>
135 <string name="game_folder_properties">Game folder properties</string> 135 <string name="game_folder_properties">Game folder properties</string>
136 <plurals name="saves_import_failed">
137 <item quantity="one">Failed to import %d save</item>
138 <item quantity="other">Failed to import %d saves</item>
139 </plurals>
140 <plurals name="saves_import_success">
141 <item quantity="one">Successfully imported %d save</item>
142 <item quantity="other">Successfully imported %d saves</item>
143 </plurals>
144 <string name="no_save_data_found">No save data found</string>
136 145
137 <!-- Applet launcher strings --> 146 <!-- Applet launcher strings -->
138 <string name="applets">Applet launcher</string> 147 <string name="applets">Applet launcher</string>
@@ -276,6 +285,7 @@
276 <string name="global">Global</string> 285 <string name="global">Global</string>
277 <string name="custom">Custom</string> 286 <string name="custom">Custom</string>
278 <string name="notice">Notice</string> 287 <string name="notice">Notice</string>
288 <string name="import_complete">Import complete</string>
279 289
280 <!-- GPU driver installation --> 290 <!-- GPU driver installation -->
281 <string name="select_gpu_driver">Select GPU driver</string> 291 <string name="select_gpu_driver">Select GPU driver</string>
diff --git a/src/android/app/src/main/res/xml/game_mode_config.xml b/src/android/app/src/main/res/xml/game_mode_config.xml
new file mode 100644
index 000000000..b28dd3a11
--- /dev/null
+++ b/src/android/app/src/main/res/xml/game_mode_config.xml
@@ -0,0 +1,7 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<game-mode-config
3 xmlns:android="http://schemas.android.com/apk/res/android"
4 android:supportsBatteryGameMode="true"
5 android:supportsPerformanceGameMode="true"
6 android:allowGameDownscaling="false"
7 android:allowGameFpsOverride="false"/>
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index adcc23c18..753f55ebe 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -708,24 +708,24 @@ add_library(core STATIC
708 hle/service/server_manager.h 708 hle/service/server_manager.h
709 hle/service/service.cpp 709 hle/service/service.cpp
710 hle/service/service.h 710 hle/service/service.h
711 hle/service/set/set.cpp
712 hle/service/set/set.h
713 hle/service/set/appln_settings.cpp 711 hle/service/set/appln_settings.cpp
714 hle/service/set/appln_settings.h 712 hle/service/set/appln_settings.h
715 hle/service/set/device_settings.cpp 713 hle/service/set/device_settings.cpp
716 hle/service/set/device_settings.h 714 hle/service/set/device_settings.h
715 hle/service/set/factory_settings_server.cpp
716 hle/service/set/factory_settings_server.h
717 hle/service/set/firmware_debug_settings_server.cpp
718 hle/service/set/firmware_debug_settings_server.h
717 hle/service/set/private_settings.cpp 719 hle/service/set/private_settings.cpp
718 hle/service/set/private_settings.h 720 hle/service/set/private_settings.h
719 hle/service/set/set_cal.cpp
720 hle/service/set/set_cal.h
721 hle/service/set/set_fd.cpp
722 hle/service/set/set_fd.h
723 hle/service/set/set_sys.cpp
724 hle/service/set/set_sys.h
725 hle/service/set/settings.cpp 721 hle/service/set/settings.cpp
726 hle/service/set/settings.h 722 hle/service/set/settings.h
723 hle/service/set/settings_server.cpp
724 hle/service/set/settings_server.h
727 hle/service/set/system_settings.cpp 725 hle/service/set/system_settings.cpp
728 hle/service/set/system_settings.h 726 hle/service/set/system_settings.h
727 hle/service/set/system_settings_server.cpp
728 hle/service/set/system_settings_server.h
729 hle/service/sm/sm.cpp 729 hle/service/sm/sm.cpp
730 hle/service/sm/sm.h 730 hle/service/sm/sm.h
731 hle/service/sm/sm_controller.cpp 731 hle/service/sm/sm_controller.cpp
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp
index cc7af2ea3..4a3dbc6a3 100644
--- a/src/core/file_sys/patch_manager.cpp
+++ b/src/core/file_sys/patch_manager.cpp
@@ -26,7 +26,7 @@
26#include "core/file_sys/vfs_vector.h" 26#include "core/file_sys/vfs_vector.h"
27#include "core/hle/service/filesystem/filesystem.h" 27#include "core/hle/service/filesystem/filesystem.h"
28#include "core/hle/service/ns/language.h" 28#include "core/hle/service/ns/language.h"
29#include "core/hle/service/set/set.h" 29#include "core/hle/service/set/settings_server.h"
30#include "core/loader/loader.h" 30#include "core/loader/loader.h"
31#include "core/loader/nso.h" 31#include "core/loader/nso.h"
32#include "core/memory/cheat_engine.h" 32#include "core/memory/cheat_engine.h"
diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp
index 8d5d593e8..12b3bd797 100644
--- a/src/core/file_sys/savedata_factory.cpp
+++ b/src/core/file_sys/savedata_factory.cpp
@@ -189,6 +189,15 @@ std::string SaveDataFactory::GetFullPath(Core::System& system, VirtualDir dir,
189 } 189 }
190} 190}
191 191
192std::string SaveDataFactory::GetUserGameSaveDataRoot(u128 user_id, bool future) {
193 if (future) {
194 Common::UUID uuid;
195 std::memcpy(uuid.uuid.data(), user_id.data(), sizeof(Common::UUID));
196 return fmt::format("/user/save/account/{}", uuid.RawString());
197 }
198 return fmt::format("/user/save/{:016X}/{:016X}{:016X}", 0, user_id[1], user_id[0]);
199}
200
192SaveDataSize SaveDataFactory::ReadSaveDataSize(SaveDataType type, u64 title_id, 201SaveDataSize SaveDataFactory::ReadSaveDataSize(SaveDataType type, u64 title_id,
193 u128 user_id) const { 202 u128 user_id) const {
194 const auto path = 203 const auto path =
diff --git a/src/core/file_sys/savedata_factory.h b/src/core/file_sys/savedata_factory.h
index e3a0f8cef..fd4887e99 100644
--- a/src/core/file_sys/savedata_factory.h
+++ b/src/core/file_sys/savedata_factory.h
@@ -101,6 +101,7 @@ public:
101 static std::string GetSaveDataSpaceIdPath(SaveDataSpaceId space); 101 static std::string GetSaveDataSpaceIdPath(SaveDataSpaceId space);
102 static std::string GetFullPath(Core::System& system, VirtualDir dir, SaveDataSpaceId space, 102 static std::string GetFullPath(Core::System& system, VirtualDir dir, SaveDataSpaceId space,
103 SaveDataType type, u64 title_id, u128 user_id, u64 save_id); 103 SaveDataType type, u64 title_id, u128 user_id, u64 save_id);
104 static std::string GetUserGameSaveDataRoot(u128 user_id, bool future);
104 105
105 SaveDataSize ReadSaveDataSize(SaveDataType type, u64 title_id, u128 user_id) const; 106 SaveDataSize ReadSaveDataSize(SaveDataType type, u64 title_id, u128 user_id) const;
106 void WriteSaveDataSize(SaveDataType type, u64 title_id, u128 user_id, 107 void WriteSaveDataSize(SaveDataType type, u64 title_id, u128 user_id,
diff --git a/src/core/hle/service/ns/language.cpp b/src/core/hle/service/ns/language.cpp
index 036a1e9b7..b1a7686ff 100644
--- a/src/core/hle/service/ns/language.cpp
+++ b/src/core/hle/service/ns/language.cpp
@@ -2,7 +2,7 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/service/ns/language.h" 4#include "core/hle/service/ns/language.h"
5#include "core/hle/service/set/set.h" 5#include "core/hle/service/set/settings_server.h"
6 6
7namespace Service::NS { 7namespace Service::NS {
8 8
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp
index f9e0e272d..a25b79513 100644
--- a/src/core/hle/service/ns/ns.cpp
+++ b/src/core/hle/service/ns/ns.cpp
@@ -16,7 +16,7 @@
16#include "core/hle/service/ns/ns.h" 16#include "core/hle/service/ns/ns.h"
17#include "core/hle/service/ns/pdm_qry.h" 17#include "core/hle/service/ns/pdm_qry.h"
18#include "core/hle/service/server_manager.h" 18#include "core/hle/service/server_manager.h"
19#include "core/hle/service/set/set.h" 19#include "core/hle/service/set/settings_server.h"
20 20
21namespace Service::NS { 21namespace Service::NS {
22 22
diff --git a/src/core/hle/service/set/set_cal.cpp b/src/core/hle/service/set/factory_settings_server.cpp
index d2c0d536f..a8e307ae2 100644
--- a/src/core/hle/service/set/set_cal.cpp
+++ b/src/core/hle/service/set/factory_settings_server.cpp
@@ -1,11 +1,12 @@
1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/service/set/set_cal.h" 4#include "core/hle/service/set/factory_settings_server.h"
5 5
6namespace Service::Set { 6namespace Service::Set {
7 7
8SET_CAL::SET_CAL(Core::System& system_) : ServiceFramework{system_, "set:cal"} { 8IFactorySettingsServer::IFactorySettingsServer(Core::System& system_)
9 : ServiceFramework{system_, "set:cal"} {
9 // clang-format off 10 // clang-format off
10 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
11 {0, nullptr, "GetBluetoothBdAddress"}, 12 {0, nullptr, "GetBluetoothBdAddress"},
@@ -57,6 +58,6 @@ SET_CAL::SET_CAL(Core::System& system_) : ServiceFramework{system_, "set:cal"} {
57 RegisterHandlers(functions); 58 RegisterHandlers(functions);
58} 59}
59 60
60SET_CAL::~SET_CAL() = default; 61IFactorySettingsServer::~IFactorySettingsServer() = default;
61 62
62} // namespace Service::Set 63} // namespace Service::Set
diff --git a/src/core/hle/service/set/set_fd.h b/src/core/hle/service/set/factory_settings_server.h
index 150a7cbce..e64cd1380 100644
--- a/src/core/hle/service/set/set_fd.h
+++ b/src/core/hle/service/set/factory_settings_server.h
@@ -11,10 +11,10 @@ class System;
11 11
12namespace Service::Set { 12namespace Service::Set {
13 13
14class SET_FD final : public ServiceFramework<SET_FD> { 14class IFactorySettingsServer final : public ServiceFramework<IFactorySettingsServer> {
15public: 15public:
16 explicit SET_FD(Core::System& system_); 16 explicit IFactorySettingsServer(Core::System& system_);
17 ~SET_FD() override; 17 ~IFactorySettingsServer() override;
18}; 18};
19 19
20} // namespace Service::Set 20} // namespace Service::Set
diff --git a/src/core/hle/service/set/set_fd.cpp b/src/core/hle/service/set/firmware_debug_settings_server.cpp
index 278ef32e1..b3a5e623b 100644
--- a/src/core/hle/service/set/set_fd.cpp
+++ b/src/core/hle/service/set/firmware_debug_settings_server.cpp
@@ -1,11 +1,12 @@
1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/service/set/set_fd.h" 4#include "core/hle/service/set/firmware_debug_settings_server.h"
5 5
6namespace Service::Set { 6namespace Service::Set {
7 7
8SET_FD::SET_FD(Core::System& system_) : ServiceFramework{system_, "set:fd"} { 8IFirmwareDebugSettingsServer::IFirmwareDebugSettingsServer(Core::System& system_)
9 : ServiceFramework{system_, "set:fd"} {
9 // clang-format off 10 // clang-format off
10 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
11 {2, nullptr, "SetSettingsItemValue"}, 12 {2, nullptr, "SetSettingsItemValue"},
@@ -23,6 +24,6 @@ SET_FD::SET_FD(Core::System& system_) : ServiceFramework{system_, "set:fd"} {
23 RegisterHandlers(functions); 24 RegisterHandlers(functions);
24} 25}
25 26
26SET_FD::~SET_FD() = default; 27IFirmwareDebugSettingsServer::~IFirmwareDebugSettingsServer() = default;
27 28
28} // namespace Service::Set 29} // namespace Service::Set
diff --git a/src/core/hle/service/set/set_cal.h b/src/core/hle/service/set/firmware_debug_settings_server.h
index 8f50278ed..5dae2263e 100644
--- a/src/core/hle/service/set/set_cal.h
+++ b/src/core/hle/service/set/firmware_debug_settings_server.h
@@ -11,10 +11,10 @@ class System;
11 11
12namespace Service::Set { 12namespace Service::Set {
13 13
14class SET_CAL final : public ServiceFramework<SET_CAL> { 14class IFirmwareDebugSettingsServer final : public ServiceFramework<IFirmwareDebugSettingsServer> {
15public: 15public:
16 explicit SET_CAL(Core::System& system_); 16 explicit IFirmwareDebugSettingsServer(Core::System& system_);
17 ~SET_CAL() override; 17 ~IFirmwareDebugSettingsServer() override;
18}; 18};
19 19
20} // namespace Service::Set 20} // namespace Service::Set
diff --git a/src/core/hle/service/set/settings.cpp b/src/core/hle/service/set/settings.cpp
index c48844f77..73d021ff4 100644
--- a/src/core/hle/service/set/settings.cpp
+++ b/src/core/hle/service/set/settings.cpp
@@ -2,21 +2,24 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/service/server_manager.h" 4#include "core/hle/service/server_manager.h"
5#include "core/hle/service/set/set.h" 5#include "core/hle/service/set/factory_settings_server.h"
6#include "core/hle/service/set/set_cal.h" 6#include "core/hle/service/set/firmware_debug_settings_server.h"
7#include "core/hle/service/set/set_fd.h"
8#include "core/hle/service/set/set_sys.h"
9#include "core/hle/service/set/settings.h" 7#include "core/hle/service/set/settings.h"
8#include "core/hle/service/set/settings_server.h"
9#include "core/hle/service/set/system_settings_server.h"
10 10
11namespace Service::Set { 11namespace Service::Set {
12 12
13void LoopProcess(Core::System& system) { 13void LoopProcess(Core::System& system) {
14 auto server_manager = std::make_unique<ServerManager>(system); 14 auto server_manager = std::make_unique<ServerManager>(system);
15 15
16 server_manager->RegisterNamedService("set", std::make_shared<SET>(system)); 16 server_manager->RegisterNamedService("set", std::make_shared<ISettingsServer>(system));
17 server_manager->RegisterNamedService("set:cal", std::make_shared<SET_CAL>(system)); 17 server_manager->RegisterNamedService("set:cal",
18 server_manager->RegisterNamedService("set:fd", std::make_shared<SET_FD>(system)); 18 std::make_shared<IFactorySettingsServer>(system));
19 server_manager->RegisterNamedService("set:sys", std::make_shared<SET_SYS>(system)); 19 server_manager->RegisterNamedService("set:fd",
20 std::make_shared<IFirmwareDebugSettingsServer>(system));
21 server_manager->RegisterNamedService("set:sys",
22 std::make_shared<ISystemSettingsServer>(system));
20 ServerManager::RunServer(std::move(server_manager)); 23 ServerManager::RunServer(std::move(server_manager));
21} 24}
22 25
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/settings_server.cpp
index 2082b8ef7..b2caa00ff 100644
--- a/src/core/hle/service/set/set.cpp
+++ b/src/core/hle/service/set/settings_server.cpp
@@ -7,7 +7,7 @@
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "common/settings.h" 8#include "common/settings.h"
9#include "core/hle/service/ipc_helpers.h" 9#include "core/hle/service/ipc_helpers.h"
10#include "core/hle/service/set/set.h" 10#include "core/hle/service/set/settings_server.h"
11 11
12namespace Service::Set { 12namespace Service::Set {
13namespace { 13namespace {
@@ -58,13 +58,36 @@ LanguageCode GetLanguageCodeFromIndex(std::size_t index) {
58 return available_language_codes.at(index); 58 return available_language_codes.at(index);
59} 59}
60 60
61void SET::GetAvailableLanguageCodes(HLERequestContext& ctx) { 61ISettingsServer::ISettingsServer(Core::System& system_) : ServiceFramework{system_, "set"} {
62 // clang-format off
63 static const FunctionInfo functions[] = {
64 {0, &ISettingsServer::GetLanguageCode, "GetLanguageCode"},
65 {1, &ISettingsServer::GetAvailableLanguageCodes, "GetAvailableLanguageCodes"},
66 {2, &ISettingsServer::MakeLanguageCode, "MakeLanguageCode"},
67 {3, &ISettingsServer::GetAvailableLanguageCodeCount, "GetAvailableLanguageCodeCount"},
68 {4, &ISettingsServer::GetRegionCode, "GetRegionCode"},
69 {5, &ISettingsServer::GetAvailableLanguageCodes2, "GetAvailableLanguageCodes2"},
70 {6, &ISettingsServer::GetAvailableLanguageCodeCount2, "GetAvailableLanguageCodeCount2"},
71 {7, &ISettingsServer::GetKeyCodeMap, "GetKeyCodeMap"},
72 {8, &ISettingsServer::GetQuestFlag, "GetQuestFlag"},
73 {9, &ISettingsServer::GetKeyCodeMap2, "GetKeyCodeMap2"},
74 {10, nullptr, "GetFirmwareVersionForDebug"},
75 {11, &ISettingsServer::GetDeviceNickName, "GetDeviceNickName"},
76 };
77 // clang-format on
78
79 RegisterHandlers(functions);
80}
81
82ISettingsServer::~ISettingsServer() = default;
83
84void ISettingsServer::GetAvailableLanguageCodes(HLERequestContext& ctx) {
62 LOG_DEBUG(Service_SET, "called"); 85 LOG_DEBUG(Service_SET, "called");
63 86
64 GetAvailableLanguageCodesImpl(ctx, PRE_4_0_0_MAX_ENTRIES); 87 GetAvailableLanguageCodesImpl(ctx, PRE_4_0_0_MAX_ENTRIES);
65} 88}
66 89
67void SET::MakeLanguageCode(HLERequestContext& ctx) { 90void ISettingsServer::MakeLanguageCode(HLERequestContext& ctx) {
68 IPC::RequestParser rp{ctx}; 91 IPC::RequestParser rp{ctx};
69 const auto index = rp.Pop<u32>(); 92 const auto index = rp.Pop<u32>();
70 93
@@ -80,25 +103,25 @@ void SET::MakeLanguageCode(HLERequestContext& ctx) {
80 rb.PushEnum(available_language_codes[index]); 103 rb.PushEnum(available_language_codes[index]);
81} 104}
82 105
83void SET::GetAvailableLanguageCodes2(HLERequestContext& ctx) { 106void ISettingsServer::GetAvailableLanguageCodes2(HLERequestContext& ctx) {
84 LOG_DEBUG(Service_SET, "called"); 107 LOG_DEBUG(Service_SET, "called");
85 108
86 GetAvailableLanguageCodesImpl(ctx, POST_4_0_0_MAX_ENTRIES); 109 GetAvailableLanguageCodesImpl(ctx, POST_4_0_0_MAX_ENTRIES);
87} 110}
88 111
89void SET::GetAvailableLanguageCodeCount(HLERequestContext& ctx) { 112void ISettingsServer::GetAvailableLanguageCodeCount(HLERequestContext& ctx) {
90 LOG_DEBUG(Service_SET, "called"); 113 LOG_DEBUG(Service_SET, "called");
91 114
92 PushResponseLanguageCode(ctx, PRE_4_0_0_MAX_ENTRIES); 115 PushResponseLanguageCode(ctx, PRE_4_0_0_MAX_ENTRIES);
93} 116}
94 117
95void SET::GetAvailableLanguageCodeCount2(HLERequestContext& ctx) { 118void ISettingsServer::GetAvailableLanguageCodeCount2(HLERequestContext& ctx) {
96 LOG_DEBUG(Service_SET, "called"); 119 LOG_DEBUG(Service_SET, "called");
97 120
98 PushResponseLanguageCode(ctx, POST_4_0_0_MAX_ENTRIES); 121 PushResponseLanguageCode(ctx, POST_4_0_0_MAX_ENTRIES);
99} 122}
100 123
101void SET::GetQuestFlag(HLERequestContext& ctx) { 124void ISettingsServer::GetQuestFlag(HLERequestContext& ctx) {
102 LOG_DEBUG(Service_SET, "called"); 125 LOG_DEBUG(Service_SET, "called");
103 126
104 IPC::ResponseBuilder rb{ctx, 3}; 127 IPC::ResponseBuilder rb{ctx, 3};
@@ -106,7 +129,7 @@ void SET::GetQuestFlag(HLERequestContext& ctx) {
106 rb.Push(static_cast<s32>(Settings::values.quest_flag.GetValue())); 129 rb.Push(static_cast<s32>(Settings::values.quest_flag.GetValue()));
107} 130}
108 131
109void SET::GetLanguageCode(HLERequestContext& ctx) { 132void ISettingsServer::GetLanguageCode(HLERequestContext& ctx) {
110 LOG_DEBUG(Service_SET, "called {}", Settings::values.language_index.GetValue()); 133 LOG_DEBUG(Service_SET, "called {}", Settings::values.language_index.GetValue());
111 134
112 IPC::ResponseBuilder rb{ctx, 4}; 135 IPC::ResponseBuilder rb{ctx, 4};
@@ -115,7 +138,7 @@ void SET::GetLanguageCode(HLERequestContext& ctx) {
115 available_language_codes[static_cast<s32>(Settings::values.language_index.GetValue())]); 138 available_language_codes[static_cast<s32>(Settings::values.language_index.GetValue())]);
116} 139}
117 140
118void SET::GetRegionCode(HLERequestContext& ctx) { 141void ISettingsServer::GetRegionCode(HLERequestContext& ctx) {
119 LOG_DEBUG(Service_SET, "called"); 142 LOG_DEBUG(Service_SET, "called");
120 143
121 IPC::ResponseBuilder rb{ctx, 3}; 144 IPC::ResponseBuilder rb{ctx, 3};
@@ -123,44 +146,21 @@ void SET::GetRegionCode(HLERequestContext& ctx) {
123 rb.Push(static_cast<u32>(Settings::values.region_index.GetValue())); 146 rb.Push(static_cast<u32>(Settings::values.region_index.GetValue()));
124} 147}
125 148
126void SET::GetKeyCodeMap(HLERequestContext& ctx) { 149void ISettingsServer::GetKeyCodeMap(HLERequestContext& ctx) {
127 LOG_DEBUG(Service_SET, "Called {}", ctx.Description()); 150 LOG_DEBUG(Service_SET, "Called {}", ctx.Description());
128 GetKeyCodeMapImpl(ctx); 151 GetKeyCodeMapImpl(ctx);
129} 152}
130 153
131void SET::GetKeyCodeMap2(HLERequestContext& ctx) { 154void ISettingsServer::GetKeyCodeMap2(HLERequestContext& ctx) {
132 LOG_DEBUG(Service_SET, "Called {}", ctx.Description()); 155 LOG_DEBUG(Service_SET, "Called {}", ctx.Description());
133 GetKeyCodeMapImpl(ctx); 156 GetKeyCodeMapImpl(ctx);
134} 157}
135 158
136void SET::GetDeviceNickName(HLERequestContext& ctx) { 159void ISettingsServer::GetDeviceNickName(HLERequestContext& ctx) {
137 LOG_DEBUG(Service_SET, "called"); 160 LOG_DEBUG(Service_SET, "called");
138 IPC::ResponseBuilder rb{ctx, 2}; 161 IPC::ResponseBuilder rb{ctx, 2};
139 rb.Push(ResultSuccess); 162 rb.Push(ResultSuccess);
140 ctx.WriteBuffer(Settings::values.device_name.GetValue()); 163 ctx.WriteBuffer(Settings::values.device_name.GetValue());
141} 164}
142 165
143SET::SET(Core::System& system_) : ServiceFramework{system_, "set"} {
144 // clang-format off
145 static const FunctionInfo functions[] = {
146 {0, &SET::GetLanguageCode, "GetLanguageCode"},
147 {1, &SET::GetAvailableLanguageCodes, "GetAvailableLanguageCodes"},
148 {2, &SET::MakeLanguageCode, "MakeLanguageCode"},
149 {3, &SET::GetAvailableLanguageCodeCount, "GetAvailableLanguageCodeCount"},
150 {4, &SET::GetRegionCode, "GetRegionCode"},
151 {5, &SET::GetAvailableLanguageCodes2, "GetAvailableLanguageCodes2"},
152 {6, &SET::GetAvailableLanguageCodeCount2, "GetAvailableLanguageCodeCount2"},
153 {7, &SET::GetKeyCodeMap, "GetKeyCodeMap"},
154 {8, &SET::GetQuestFlag, "GetQuestFlag"},
155 {9, &SET::GetKeyCodeMap2, "GetKeyCodeMap2"},
156 {10, nullptr, "GetFirmwareVersionForDebug"},
157 {11, &SET::GetDeviceNickName, "GetDeviceNickName"},
158 };
159 // clang-format on
160
161 RegisterHandlers(functions);
162}
163
164SET::~SET() = default;
165
166} // namespace Service::Set 166} // namespace Service::Set
diff --git a/src/core/hle/service/set/set.h b/src/core/hle/service/set/settings_server.h
index 6ef3da410..a4e78db6c 100644
--- a/src/core/hle/service/set/set.h
+++ b/src/core/hle/service/set/settings_server.h
@@ -73,10 +73,10 @@ static constexpr std::array<std::pair<LanguageCode, KeyboardLayout>, 18> languag
73 73
74LanguageCode GetLanguageCodeFromIndex(std::size_t idx); 74LanguageCode GetLanguageCodeFromIndex(std::size_t idx);
75 75
76class SET final : public ServiceFramework<SET> { 76class ISettingsServer final : public ServiceFramework<ISettingsServer> {
77public: 77public:
78 explicit SET(Core::System& system_); 78 explicit ISettingsServer(Core::System& system_);
79 ~SET() override; 79 ~ISettingsServer() override;
80 80
81private: 81private:
82 void GetLanguageCode(HLERequestContext& ctx); 82 void GetLanguageCode(HLERequestContext& ctx);
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/system_settings_server.cpp
index 8e637f963..f7ad6193e 100644
--- a/src/core/hle/service/set/set_sys.cpp
+++ b/src/core/hle/service/set/system_settings_server.cpp
@@ -19,8 +19,8 @@
19#include "core/file_sys/system_archive/system_archive.h" 19#include "core/file_sys/system_archive/system_archive.h"
20#include "core/hle/service/filesystem/filesystem.h" 20#include "core/hle/service/filesystem/filesystem.h"
21#include "core/hle/service/ipc_helpers.h" 21#include "core/hle/service/ipc_helpers.h"
22#include "core/hle/service/set/set.h" 22#include "core/hle/service/set/settings_server.h"
23#include "core/hle/service/set/set_sys.h" 23#include "core/hle/service/set/system_settings_server.h"
24 24
25namespace Service::Set { 25namespace Service::Set {
26 26
@@ -87,7 +87,234 @@ Result GetFirmwareVersionImpl(FirmwareVersionFormat& out_firmware, Core::System&
87 return ResultSuccess; 87 return ResultSuccess;
88} 88}
89 89
90bool SET_SYS::LoadSettingsFile(std::filesystem::path& path, auto&& default_func) { 90ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
91 : ServiceFramework{system_, "set:sys"}, m_system{system} {
92 // clang-format off
93 static const FunctionInfo functions[] = {
94 {0, &ISystemSettingsServer::SetLanguageCode, "SetLanguageCode"},
95 {1, nullptr, "SetNetworkSettings"},
96 {2, nullptr, "GetNetworkSettings"},
97 {3, &ISystemSettingsServer::GetFirmwareVersion, "GetFirmwareVersion"},
98 {4, &ISystemSettingsServer::GetFirmwareVersion2, "GetFirmwareVersion2"},
99 {5, nullptr, "GetFirmwareVersionDigest"},
100 {7, nullptr, "GetLockScreenFlag"},
101 {8, nullptr, "SetLockScreenFlag"},
102 {9, nullptr, "GetBacklightSettings"},
103 {10, nullptr, "SetBacklightSettings"},
104 {11, nullptr, "SetBluetoothDevicesSettings"},
105 {12, nullptr, "GetBluetoothDevicesSettings"},
106 {13, &ISystemSettingsServer::GetExternalSteadyClockSourceId, "GetExternalSteadyClockSourceId"},
107 {14, &ISystemSettingsServer::SetExternalSteadyClockSourceId, "SetExternalSteadyClockSourceId"},
108 {15, &ISystemSettingsServer::GetUserSystemClockContext, "GetUserSystemClockContext"},
109 {16, &ISystemSettingsServer::SetUserSystemClockContext, "SetUserSystemClockContext"},
110 {17, &ISystemSettingsServer::GetAccountSettings, "GetAccountSettings"},
111 {18, &ISystemSettingsServer::SetAccountSettings, "SetAccountSettings"},
112 {19, nullptr, "GetAudioVolume"},
113 {20, nullptr, "SetAudioVolume"},
114 {21, &ISystemSettingsServer::GetEulaVersions, "GetEulaVersions"},
115 {22, &ISystemSettingsServer::SetEulaVersions, "SetEulaVersions"},
116 {23, &ISystemSettingsServer::GetColorSetId, "GetColorSetId"},
117 {24, &ISystemSettingsServer::SetColorSetId, "SetColorSetId"},
118 {25, nullptr, "GetConsoleInformationUploadFlag"},
119 {26, nullptr, "SetConsoleInformationUploadFlag"},
120 {27, nullptr, "GetAutomaticApplicationDownloadFlag"},
121 {28, nullptr, "SetAutomaticApplicationDownloadFlag"},
122 {29, &ISystemSettingsServer::GetNotificationSettings, "GetNotificationSettings"},
123 {30, &ISystemSettingsServer::SetNotificationSettings, "SetNotificationSettings"},
124 {31, &ISystemSettingsServer::GetAccountNotificationSettings, "GetAccountNotificationSettings"},
125 {32, &ISystemSettingsServer::SetAccountNotificationSettings, "SetAccountNotificationSettings"},
126 {35, nullptr, "GetVibrationMasterVolume"},
127 {36, nullptr, "SetVibrationMasterVolume"},
128 {37, &ISystemSettingsServer::GetSettingsItemValueSize, "GetSettingsItemValueSize"},
129 {38, &ISystemSettingsServer::GetSettingsItemValue, "GetSettingsItemValue"},
130 {39, &ISystemSettingsServer::GetTvSettings, "GetTvSettings"},
131 {40, &ISystemSettingsServer::SetTvSettings, "SetTvSettings"},
132 {41, nullptr, "GetEdid"},
133 {42, nullptr, "SetEdid"},
134 {43, nullptr, "GetAudioOutputMode"},
135 {44, nullptr, "SetAudioOutputMode"},
136 {45, nullptr, "IsForceMuteOnHeadphoneRemoved"},
137 {46, nullptr, "SetForceMuteOnHeadphoneRemoved"},
138 {47, &ISystemSettingsServer::GetQuestFlag, "GetQuestFlag"},
139 {48, nullptr, "SetQuestFlag"},
140 {49, nullptr, "GetDataDeletionSettings"},
141 {50, nullptr, "SetDataDeletionSettings"},
142 {51, nullptr, "GetInitialSystemAppletProgramId"},
143 {52, nullptr, "GetOverlayDispProgramId"},
144 {53, &ISystemSettingsServer::GetDeviceTimeZoneLocationName, "GetDeviceTimeZoneLocationName"},
145 {54, &ISystemSettingsServer::SetDeviceTimeZoneLocationName, "SetDeviceTimeZoneLocationName"},
146 {55, nullptr, "GetWirelessCertificationFileSize"},
147 {56, nullptr, "GetWirelessCertificationFile"},
148 {57, &ISystemSettingsServer::SetRegionCode, "SetRegionCode"},
149 {58, &ISystemSettingsServer::GetNetworkSystemClockContext, "GetNetworkSystemClockContext"},
150 {59, &ISystemSettingsServer::SetNetworkSystemClockContext, "SetNetworkSystemClockContext"},
151 {60, &ISystemSettingsServer::IsUserSystemClockAutomaticCorrectionEnabled, "IsUserSystemClockAutomaticCorrectionEnabled"},
152 {61, &ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled, "SetUserSystemClockAutomaticCorrectionEnabled"},
153 {62, &ISystemSettingsServer::GetDebugModeFlag, "GetDebugModeFlag"},
154 {63, &ISystemSettingsServer::GetPrimaryAlbumStorage, "GetPrimaryAlbumStorage"},
155 {64, nullptr, "SetPrimaryAlbumStorage"},
156 {65, nullptr, "GetUsb30EnableFlag"},
157 {66, nullptr, "SetUsb30EnableFlag"},
158 {67, nullptr, "GetBatteryLot"},
159 {68, nullptr, "GetSerialNumber"},
160 {69, nullptr, "GetNfcEnableFlag"},
161 {70, nullptr, "SetNfcEnableFlag"},
162 {71, &ISystemSettingsServer::GetSleepSettings, "GetSleepSettings"},
163 {72, &ISystemSettingsServer::SetSleepSettings, "SetSleepSettings"},
164 {73, nullptr, "GetWirelessLanEnableFlag"},
165 {74, nullptr, "SetWirelessLanEnableFlag"},
166 {75, &ISystemSettingsServer::GetInitialLaunchSettings, "GetInitialLaunchSettings"},
167 {76, &ISystemSettingsServer::SetInitialLaunchSettings, "SetInitialLaunchSettings"},
168 {77, &ISystemSettingsServer::GetDeviceNickName, "GetDeviceNickName"},
169 {78, &ISystemSettingsServer::SetDeviceNickName, "SetDeviceNickName"},
170 {79, &ISystemSettingsServer::GetProductModel, "GetProductModel"},
171 {80, nullptr, "GetLdnChannel"},
172 {81, nullptr, "SetLdnChannel"},
173 {82, nullptr, "AcquireTelemetryDirtyFlagEventHandle"},
174 {83, nullptr, "GetTelemetryDirtyFlags"},
175 {84, nullptr, "GetPtmBatteryLot"},
176 {85, nullptr, "SetPtmBatteryLot"},
177 {86, nullptr, "GetPtmFuelGaugeParameter"},
178 {87, nullptr, "SetPtmFuelGaugeParameter"},
179 {88, nullptr, "GetBluetoothEnableFlag"},
180 {89, nullptr, "SetBluetoothEnableFlag"},
181 {90, &ISystemSettingsServer::GetMiiAuthorId, "GetMiiAuthorId"},
182 {91, nullptr, "SetShutdownRtcValue"},
183 {92, nullptr, "GetShutdownRtcValue"},
184 {93, nullptr, "AcquireFatalDirtyFlagEventHandle"},
185 {94, nullptr, "GetFatalDirtyFlags"},
186 {95, &ISystemSettingsServer::GetAutoUpdateEnableFlag, "GetAutoUpdateEnableFlag"},
187 {96, nullptr, "SetAutoUpdateEnableFlag"},
188 {97, nullptr, "GetNxControllerSettings"},
189 {98, nullptr, "SetNxControllerSettings"},
190 {99, &ISystemSettingsServer::GetBatteryPercentageFlag, "GetBatteryPercentageFlag"},
191 {100, nullptr, "SetBatteryPercentageFlag"},
192 {101, nullptr, "GetExternalRtcResetFlag"},
193 {102, nullptr, "SetExternalRtcResetFlag"},
194 {103, nullptr, "GetUsbFullKeyEnableFlag"},
195 {104, nullptr, "SetUsbFullKeyEnableFlag"},
196 {105, &ISystemSettingsServer::SetExternalSteadyClockInternalOffset, "SetExternalSteadyClockInternalOffset"},
197 {106, &ISystemSettingsServer::GetExternalSteadyClockInternalOffset, "GetExternalSteadyClockInternalOffset"},
198 {107, nullptr, "GetBacklightSettingsEx"},
199 {108, nullptr, "SetBacklightSettingsEx"},
200 {109, nullptr, "GetHeadphoneVolumeWarningCount"},
201 {110, nullptr, "SetHeadphoneVolumeWarningCount"},
202 {111, nullptr, "GetBluetoothAfhEnableFlag"},
203 {112, nullptr, "SetBluetoothAfhEnableFlag"},
204 {113, nullptr, "GetBluetoothBoostEnableFlag"},
205 {114, nullptr, "SetBluetoothBoostEnableFlag"},
206 {115, nullptr, "GetInRepairProcessEnableFlag"},
207 {116, nullptr, "SetInRepairProcessEnableFlag"},
208 {117, nullptr, "GetHeadphoneVolumeUpdateFlag"},
209 {118, nullptr, "SetHeadphoneVolumeUpdateFlag"},
210 {119, nullptr, "NeedsToUpdateHeadphoneVolume"},
211 {120, nullptr, "GetPushNotificationActivityModeOnSleep"},
212 {121, nullptr, "SetPushNotificationActivityModeOnSleep"},
213 {122, nullptr, "GetServiceDiscoveryControlSettings"},
214 {123, nullptr, "SetServiceDiscoveryControlSettings"},
215 {124, &ISystemSettingsServer::GetErrorReportSharePermission, "GetErrorReportSharePermission"},
216 {125, nullptr, "SetErrorReportSharePermission"},
217 {126, &ISystemSettingsServer::GetAppletLaunchFlags, "GetAppletLaunchFlags"},
218 {127, &ISystemSettingsServer::SetAppletLaunchFlags, "SetAppletLaunchFlags"},
219 {128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"},
220 {129, nullptr, "SetConsoleSixAxisSensorAccelerationBias"},
221 {130, nullptr, "GetConsoleSixAxisSensorAngularVelocityBias"},
222 {131, nullptr, "SetConsoleSixAxisSensorAngularVelocityBias"},
223 {132, nullptr, "GetConsoleSixAxisSensorAccelerationGain"},
224 {133, nullptr, "SetConsoleSixAxisSensorAccelerationGain"},
225 {134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"},
226 {135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"},
227 {136, &ISystemSettingsServer::GetKeyboardLayout, "GetKeyboardLayout"},
228 {137, nullptr, "SetKeyboardLayout"},
229 {138, nullptr, "GetWebInspectorFlag"},
230 {139, nullptr, "GetAllowedSslHosts"},
231 {140, nullptr, "GetHostFsMountPoint"},
232 {141, nullptr, "GetRequiresRunRepairTimeReviser"},
233 {142, nullptr, "SetRequiresRunRepairTimeReviser"},
234 {143, nullptr, "SetBlePairingSettings"},
235 {144, nullptr, "GetBlePairingSettings"},
236 {145, nullptr, "GetConsoleSixAxisSensorAngularVelocityTimeBias"},
237 {146, nullptr, "SetConsoleSixAxisSensorAngularVelocityTimeBias"},
238 {147, nullptr, "GetConsoleSixAxisSensorAngularAcceleration"},
239 {148, nullptr, "SetConsoleSixAxisSensorAngularAcceleration"},
240 {149, nullptr, "GetRebootlessSystemUpdateVersion"},
241 {150, &ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime, "GetDeviceTimeZoneLocationUpdatedTime"},
242 {151, &ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime, "SetDeviceTimeZoneLocationUpdatedTime"},
243 {152, &ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime, "GetUserSystemClockAutomaticCorrectionUpdatedTime"},
244 {153, &ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime, "SetUserSystemClockAutomaticCorrectionUpdatedTime"},
245 {154, nullptr, "GetAccountOnlineStorageSettings"},
246 {155, nullptr, "SetAccountOnlineStorageSettings"},
247 {156, nullptr, "GetPctlReadyFlag"},
248 {157, nullptr, "SetPctlReadyFlag"},
249 {158, nullptr, "GetAnalogStickUserCalibrationL"},
250 {159, nullptr, "SetAnalogStickUserCalibrationL"},
251 {160, nullptr, "GetAnalogStickUserCalibrationR"},
252 {161, nullptr, "SetAnalogStickUserCalibrationR"},
253 {162, nullptr, "GetPtmBatteryVersion"},
254 {163, nullptr, "SetPtmBatteryVersion"},
255 {164, nullptr, "GetUsb30HostEnableFlag"},
256 {165, nullptr, "SetUsb30HostEnableFlag"},
257 {166, nullptr, "GetUsb30DeviceEnableFlag"},
258 {167, nullptr, "SetUsb30DeviceEnableFlag"},
259 {168, nullptr, "GetThemeId"},
260 {169, nullptr, "SetThemeId"},
261 {170, &ISystemSettingsServer::GetChineseTraditionalInputMethod, "GetChineseTraditionalInputMethod"},
262 {171, nullptr, "SetChineseTraditionalInputMethod"},
263 {172, nullptr, "GetPtmCycleCountReliability"},
264 {173, nullptr, "SetPtmCycleCountReliability"},
265 {174, &ISystemSettingsServer::GetHomeMenuScheme, "GetHomeMenuScheme"},
266 {175, nullptr, "GetThemeSettings"},
267 {176, nullptr, "SetThemeSettings"},
268 {177, nullptr, "GetThemeKey"},
269 {178, nullptr, "SetThemeKey"},
270 {179, nullptr, "GetZoomFlag"},
271 {180, nullptr, "SetZoomFlag"},
272 {181, nullptr, "GetT"},
273 {182, nullptr, "SetT"},
274 {183, nullptr, "GetPlatformRegion"},
275 {184, nullptr, "SetPlatformRegion"},
276 {185, &ISystemSettingsServer::GetHomeMenuSchemeModel, "GetHomeMenuSchemeModel"},
277 {186, nullptr, "GetMemoryUsageRateFlag"},
278 {187, nullptr, "GetTouchScreenMode"},
279 {188, nullptr, "SetTouchScreenMode"},
280 {189, nullptr, "GetButtonConfigSettingsFull"},
281 {190, nullptr, "SetButtonConfigSettingsFull"},
282 {191, nullptr, "GetButtonConfigSettingsEmbedded"},
283 {192, nullptr, "SetButtonConfigSettingsEmbedded"},
284 {193, nullptr, "GetButtonConfigSettingsLeft"},
285 {194, nullptr, "SetButtonConfigSettingsLeft"},
286 {195, nullptr, "GetButtonConfigSettingsRight"},
287 {196, nullptr, "SetButtonConfigSettingsRight"},
288 {197, nullptr, "GetButtonConfigRegisteredSettingsEmbedded"},
289 {198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"},
290 {199, nullptr, "GetButtonConfigRegisteredSettings"},
291 {200, nullptr, "SetButtonConfigRegisteredSettings"},
292 {201, &ISystemSettingsServer::GetFieldTestingFlag, "GetFieldTestingFlag"},
293 {202, nullptr, "SetFieldTestingFlag"},
294 {203, nullptr, "GetPanelCrcMode"},
295 {204, nullptr, "SetPanelCrcMode"},
296 {205, nullptr, "GetNxControllerSettingsEx"},
297 {206, nullptr, "SetNxControllerSettingsEx"},
298 {207, nullptr, "GetHearingProtectionSafeguardFlag"},
299 {208, nullptr, "SetHearingProtectionSafeguardFlag"},
300 {209, nullptr, "GetHearingProtectionSafeguardRemainingTime"},
301 {210, nullptr, "SetHearingProtectionSafeguardRemainingTime"},
302 };
303 // clang-format on
304
305 RegisterHandlers(functions);
306
307 SetupSettings();
308 m_save_thread =
309 std::jthread([this](std::stop_token stop_token) { StoreSettingsThreadFunc(stop_token); });
310}
311
312ISystemSettingsServer::~ISystemSettingsServer() {
313 SetSaveNeeded();
314 m_save_thread.request_stop();
315}
316
317bool ISystemSettingsServer::LoadSettingsFile(std::filesystem::path& path, auto&& default_func) {
91 using settings_type = decltype(default_func()); 318 using settings_type = decltype(default_func());
92 319
93 if (!Common::FS::CreateDirs(path)) { 320 if (!Common::FS::CreateDirs(path)) {
@@ -155,7 +382,7 @@ bool SET_SYS::LoadSettingsFile(std::filesystem::path& path, auto&& default_func)
155 return true; 382 return true;
156} 383}
157 384
158bool SET_SYS::StoreSettingsFile(std::filesystem::path& path, auto& settings) { 385bool ISystemSettingsServer::StoreSettingsFile(std::filesystem::path& path, auto& settings) {
159 using settings_type = std::decay_t<decltype(settings)>; 386 using settings_type = std::decay_t<decltype(settings)>;
160 387
161 if (!Common::FS::IsDir(path)) { 388 if (!Common::FS::IsDir(path)) {
@@ -195,7 +422,7 @@ bool SET_SYS::StoreSettingsFile(std::filesystem::path& path, auto& settings) {
195 return true; 422 return true;
196} 423}
197 424
198void SET_SYS::SetLanguageCode(HLERequestContext& ctx) { 425void ISystemSettingsServer::SetLanguageCode(HLERequestContext& ctx) {
199 IPC::RequestParser rp{ctx}; 426 IPC::RequestParser rp{ctx};
200 m_system_settings.language_code = rp.PopEnum<LanguageCode>(); 427 m_system_settings.language_code = rp.PopEnum<LanguageCode>();
201 SetSaveNeeded(); 428 SetSaveNeeded();
@@ -206,7 +433,7 @@ void SET_SYS::SetLanguageCode(HLERequestContext& ctx) {
206 rb.Push(ResultSuccess); 433 rb.Push(ResultSuccess);
207} 434}
208 435
209void SET_SYS::GetFirmwareVersion(HLERequestContext& ctx) { 436void ISystemSettingsServer::GetFirmwareVersion(HLERequestContext& ctx) {
210 LOG_DEBUG(Service_SET, "called"); 437 LOG_DEBUG(Service_SET, "called");
211 438
212 FirmwareVersionFormat firmware_data{}; 439 FirmwareVersionFormat firmware_data{};
@@ -221,7 +448,7 @@ void SET_SYS::GetFirmwareVersion(HLERequestContext& ctx) {
221 rb.Push(result); 448 rb.Push(result);
222} 449}
223 450
224void SET_SYS::GetFirmwareVersion2(HLERequestContext& ctx) { 451void ISystemSettingsServer::GetFirmwareVersion2(HLERequestContext& ctx) {
225 LOG_DEBUG(Service_SET, "called"); 452 LOG_DEBUG(Service_SET, "called");
226 453
227 FirmwareVersionFormat firmware_data{}; 454 FirmwareVersionFormat firmware_data{};
@@ -236,7 +463,7 @@ void SET_SYS::GetFirmwareVersion2(HLERequestContext& ctx) {
236 rb.Push(result); 463 rb.Push(result);
237} 464}
238 465
239void SET_SYS::GetExternalSteadyClockSourceId(HLERequestContext& ctx) { 466void ISystemSettingsServer::GetExternalSteadyClockSourceId(HLERequestContext& ctx) {
240 LOG_INFO(Service_SET, "called"); 467 LOG_INFO(Service_SET, "called");
241 468
242 Common::UUID id{}; 469 Common::UUID id{};
@@ -247,7 +474,7 @@ void SET_SYS::GetExternalSteadyClockSourceId(HLERequestContext& ctx) {
247 rb.PushRaw(id); 474 rb.PushRaw(id);
248} 475}
249 476
250void SET_SYS::SetExternalSteadyClockSourceId(HLERequestContext& ctx) { 477void ISystemSettingsServer::SetExternalSteadyClockSourceId(HLERequestContext& ctx) {
251 LOG_INFO(Service_SET, "called"); 478 LOG_INFO(Service_SET, "called");
252 479
253 IPC::RequestParser rp{ctx}; 480 IPC::RequestParser rp{ctx};
@@ -259,7 +486,7 @@ void SET_SYS::SetExternalSteadyClockSourceId(HLERequestContext& ctx) {
259 rb.Push(res); 486 rb.Push(res);
260} 487}
261 488
262void SET_SYS::GetUserSystemClockContext(HLERequestContext& ctx) { 489void ISystemSettingsServer::GetUserSystemClockContext(HLERequestContext& ctx) {
263 LOG_INFO(Service_SET, "called"); 490 LOG_INFO(Service_SET, "called");
264 491
265 Service::Time::Clock::SystemClockContext context{}; 492 Service::Time::Clock::SystemClockContext context{};
@@ -271,7 +498,7 @@ void SET_SYS::GetUserSystemClockContext(HLERequestContext& ctx) {
271 rb.PushRaw(context); 498 rb.PushRaw(context);
272} 499}
273 500
274void SET_SYS::SetUserSystemClockContext(HLERequestContext& ctx) { 501void ISystemSettingsServer::SetUserSystemClockContext(HLERequestContext& ctx) {
275 LOG_INFO(Service_SET, "called"); 502 LOG_INFO(Service_SET, "called");
276 503
277 IPC::RequestParser rp{ctx}; 504 IPC::RequestParser rp{ctx};
@@ -283,7 +510,7 @@ void SET_SYS::SetUserSystemClockContext(HLERequestContext& ctx) {
283 rb.Push(res); 510 rb.Push(res);
284} 511}
285 512
286void SET_SYS::GetAccountSettings(HLERequestContext& ctx) { 513void ISystemSettingsServer::GetAccountSettings(HLERequestContext& ctx) {
287 LOG_INFO(Service_SET, "called"); 514 LOG_INFO(Service_SET, "called");
288 515
289 IPC::ResponseBuilder rb{ctx, 3}; 516 IPC::ResponseBuilder rb{ctx, 3};
@@ -291,7 +518,7 @@ void SET_SYS::GetAccountSettings(HLERequestContext& ctx) {
291 rb.PushRaw(m_system_settings.account_settings); 518 rb.PushRaw(m_system_settings.account_settings);
292} 519}
293 520
294void SET_SYS::SetAccountSettings(HLERequestContext& ctx) { 521void ISystemSettingsServer::SetAccountSettings(HLERequestContext& ctx) {
295 IPC::RequestParser rp{ctx}; 522 IPC::RequestParser rp{ctx};
296 m_system_settings.account_settings = rp.PopRaw<AccountSettings>(); 523 m_system_settings.account_settings = rp.PopRaw<AccountSettings>();
297 SetSaveNeeded(); 524 SetSaveNeeded();
@@ -303,7 +530,7 @@ void SET_SYS::SetAccountSettings(HLERequestContext& ctx) {
303 rb.Push(ResultSuccess); 530 rb.Push(ResultSuccess);
304} 531}
305 532
306void SET_SYS::GetEulaVersions(HLERequestContext& ctx) { 533void ISystemSettingsServer::GetEulaVersions(HLERequestContext& ctx) {
307 LOG_INFO(Service_SET, "called"); 534 LOG_INFO(Service_SET, "called");
308 535
309 ctx.WriteBuffer(m_system_settings.eula_versions); 536 ctx.WriteBuffer(m_system_settings.eula_versions);
@@ -313,7 +540,7 @@ void SET_SYS::GetEulaVersions(HLERequestContext& ctx) {
313 rb.Push(m_system_settings.eula_version_count); 540 rb.Push(m_system_settings.eula_version_count);
314} 541}
315 542
316void SET_SYS::SetEulaVersions(HLERequestContext& ctx) { 543void ISystemSettingsServer::SetEulaVersions(HLERequestContext& ctx) {
317 const auto elements = ctx.GetReadBufferNumElements<EulaVersion>(); 544 const auto elements = ctx.GetReadBufferNumElements<EulaVersion>();
318 const auto buffer_data = ctx.ReadBuffer(); 545 const auto buffer_data = ctx.ReadBuffer();
319 546
@@ -329,7 +556,7 @@ void SET_SYS::SetEulaVersions(HLERequestContext& ctx) {
329 rb.Push(ResultSuccess); 556 rb.Push(ResultSuccess);
330} 557}
331 558
332void SET_SYS::GetColorSetId(HLERequestContext& ctx) { 559void ISystemSettingsServer::GetColorSetId(HLERequestContext& ctx) {
333 LOG_DEBUG(Service_SET, "called"); 560 LOG_DEBUG(Service_SET, "called");
334 561
335 IPC::ResponseBuilder rb{ctx, 3}; 562 IPC::ResponseBuilder rb{ctx, 3};
@@ -337,7 +564,7 @@ void SET_SYS::GetColorSetId(HLERequestContext& ctx) {
337 rb.PushEnum(m_system_settings.color_set_id); 564 rb.PushEnum(m_system_settings.color_set_id);
338} 565}
339 566
340void SET_SYS::SetColorSetId(HLERequestContext& ctx) { 567void ISystemSettingsServer::SetColorSetId(HLERequestContext& ctx) {
341 IPC::RequestParser rp{ctx}; 568 IPC::RequestParser rp{ctx};
342 m_system_settings.color_set_id = rp.PopEnum<ColorSet>(); 569 m_system_settings.color_set_id = rp.PopEnum<ColorSet>();
343 SetSaveNeeded(); 570 SetSaveNeeded();
@@ -348,7 +575,7 @@ void SET_SYS::SetColorSetId(HLERequestContext& ctx) {
348 rb.Push(ResultSuccess); 575 rb.Push(ResultSuccess);
349} 576}
350 577
351void SET_SYS::GetNotificationSettings(HLERequestContext& ctx) { 578void ISystemSettingsServer::GetNotificationSettings(HLERequestContext& ctx) {
352 LOG_INFO(Service_SET, "called"); 579 LOG_INFO(Service_SET, "called");
353 580
354 IPC::ResponseBuilder rb{ctx, 8}; 581 IPC::ResponseBuilder rb{ctx, 8};
@@ -356,7 +583,7 @@ void SET_SYS::GetNotificationSettings(HLERequestContext& ctx) {
356 rb.PushRaw(m_system_settings.notification_settings); 583 rb.PushRaw(m_system_settings.notification_settings);
357} 584}
358 585
359void SET_SYS::SetNotificationSettings(HLERequestContext& ctx) { 586void ISystemSettingsServer::SetNotificationSettings(HLERequestContext& ctx) {
360 IPC::RequestParser rp{ctx}; 587 IPC::RequestParser rp{ctx};
361 m_system_settings.notification_settings = rp.PopRaw<NotificationSettings>(); 588 m_system_settings.notification_settings = rp.PopRaw<NotificationSettings>();
362 SetSaveNeeded(); 589 SetSaveNeeded();
@@ -373,7 +600,7 @@ void SET_SYS::SetNotificationSettings(HLERequestContext& ctx) {
373 rb.Push(ResultSuccess); 600 rb.Push(ResultSuccess);
374} 601}
375 602
376void SET_SYS::GetAccountNotificationSettings(HLERequestContext& ctx) { 603void ISystemSettingsServer::GetAccountNotificationSettings(HLERequestContext& ctx) {
377 LOG_INFO(Service_SET, "called"); 604 LOG_INFO(Service_SET, "called");
378 605
379 ctx.WriteBuffer(m_system_settings.account_notification_settings); 606 ctx.WriteBuffer(m_system_settings.account_notification_settings);
@@ -383,7 +610,7 @@ void SET_SYS::GetAccountNotificationSettings(HLERequestContext& ctx) {
383 rb.Push(m_system_settings.account_notification_settings_count); 610 rb.Push(m_system_settings.account_notification_settings_count);
384} 611}
385 612
386void SET_SYS::SetAccountNotificationSettings(HLERequestContext& ctx) { 613void ISystemSettingsServer::SetAccountNotificationSettings(HLERequestContext& ctx) {
387 const auto elements = ctx.GetReadBufferNumElements<AccountNotificationSettings>(); 614 const auto elements = ctx.GetReadBufferNumElements<AccountNotificationSettings>();
388 const auto buffer_data = ctx.ReadBuffer(); 615 const auto buffer_data = ctx.ReadBuffer();
389 616
@@ -432,7 +659,7 @@ static Settings GetSettings() {
432 return ret; 659 return ret;
433} 660}
434 661
435void SET_SYS::GetSettingsItemValueSize(HLERequestContext& ctx) { 662void ISystemSettingsServer::GetSettingsItemValueSize(HLERequestContext& ctx) {
436 LOG_DEBUG(Service_SET, "called"); 663 LOG_DEBUG(Service_SET, "called");
437 664
438 // The category of the setting. This corresponds to the top-level keys of 665 // The category of the setting. This corresponds to the top-level keys of
@@ -457,7 +684,7 @@ void SET_SYS::GetSettingsItemValueSize(HLERequestContext& ctx) {
457 rb.Push(response_size); 684 rb.Push(response_size);
458} 685}
459 686
460void SET_SYS::GetSettingsItemValue(HLERequestContext& ctx) { 687void ISystemSettingsServer::GetSettingsItemValue(HLERequestContext& ctx) {
461 // The category of the setting. This corresponds to the top-level keys of 688 // The category of the setting. This corresponds to the top-level keys of
462 // system_settings.ini. 689 // system_settings.ini.
463 const auto setting_category_buf{ctx.ReadBuffer(0)}; 690 const auto setting_category_buf{ctx.ReadBuffer(0)};
@@ -480,7 +707,7 @@ void SET_SYS::GetSettingsItemValue(HLERequestContext& ctx) {
480 rb.Push(response); 707 rb.Push(response);
481} 708}
482 709
483void SET_SYS::GetTvSettings(HLERequestContext& ctx) { 710void ISystemSettingsServer::GetTvSettings(HLERequestContext& ctx) {
484 LOG_INFO(Service_SET, "called"); 711 LOG_INFO(Service_SET, "called");
485 712
486 IPC::ResponseBuilder rb{ctx, 10}; 713 IPC::ResponseBuilder rb{ctx, 10};
@@ -488,7 +715,7 @@ void SET_SYS::GetTvSettings(HLERequestContext& ctx) {
488 rb.PushRaw(m_system_settings.tv_settings); 715 rb.PushRaw(m_system_settings.tv_settings);
489} 716}
490 717
491void SET_SYS::SetTvSettings(HLERequestContext& ctx) { 718void ISystemSettingsServer::SetTvSettings(HLERequestContext& ctx) {
492 IPC::RequestParser rp{ctx}; 719 IPC::RequestParser rp{ctx};
493 m_system_settings.tv_settings = rp.PopRaw<TvSettings>(); 720 m_system_settings.tv_settings = rp.PopRaw<TvSettings>();
494 SetSaveNeeded(); 721 SetSaveNeeded();
@@ -507,7 +734,7 @@ void SET_SYS::SetTvSettings(HLERequestContext& ctx) {
507 rb.Push(ResultSuccess); 734 rb.Push(ResultSuccess);
508} 735}
509 736
510void SET_SYS::GetDebugModeFlag(HLERequestContext& ctx) { 737void ISystemSettingsServer::GetDebugModeFlag(HLERequestContext& ctx) {
511 LOG_DEBUG(Service_SET, "called"); 738 LOG_DEBUG(Service_SET, "called");
512 739
513 IPC::ResponseBuilder rb{ctx, 3}; 740 IPC::ResponseBuilder rb{ctx, 3};
@@ -515,7 +742,7 @@ void SET_SYS::GetDebugModeFlag(HLERequestContext& ctx) {
515 rb.Push<u32>(0); 742 rb.Push<u32>(0);
516} 743}
517 744
518void SET_SYS::GetQuestFlag(HLERequestContext& ctx) { 745void ISystemSettingsServer::GetQuestFlag(HLERequestContext& ctx) {
519 LOG_WARNING(Service_SET, "(STUBBED) called"); 746 LOG_WARNING(Service_SET, "(STUBBED) called");
520 747
521 IPC::ResponseBuilder rb{ctx, 3}; 748 IPC::ResponseBuilder rb{ctx, 3};
@@ -523,7 +750,7 @@ void SET_SYS::GetQuestFlag(HLERequestContext& ctx) {
523 rb.PushEnum(QuestFlag::Retail); 750 rb.PushEnum(QuestFlag::Retail);
524} 751}
525 752
526void SET_SYS::GetDeviceTimeZoneLocationName(HLERequestContext& ctx) { 753void ISystemSettingsServer::GetDeviceTimeZoneLocationName(HLERequestContext& ctx) {
527 LOG_WARNING(Service_SET, "called"); 754 LOG_WARNING(Service_SET, "called");
528 755
529 Service::Time::TimeZone::LocationName name{}; 756 Service::Time::TimeZone::LocationName name{};
@@ -534,7 +761,7 @@ void SET_SYS::GetDeviceTimeZoneLocationName(HLERequestContext& ctx) {
534 rb.PushRaw<Service::Time::TimeZone::LocationName>(name); 761 rb.PushRaw<Service::Time::TimeZone::LocationName>(name);
535} 762}
536 763
537void SET_SYS::SetDeviceTimeZoneLocationName(HLERequestContext& ctx) { 764void ISystemSettingsServer::SetDeviceTimeZoneLocationName(HLERequestContext& ctx) {
538 LOG_WARNING(Service_SET, "called"); 765 LOG_WARNING(Service_SET, "called");
539 766
540 IPC::RequestParser rp{ctx}; 767 IPC::RequestParser rp{ctx};
@@ -546,7 +773,7 @@ void SET_SYS::SetDeviceTimeZoneLocationName(HLERequestContext& ctx) {
546 rb.Push(res); 773 rb.Push(res);
547} 774}
548 775
549void SET_SYS::SetRegionCode(HLERequestContext& ctx) { 776void ISystemSettingsServer::SetRegionCode(HLERequestContext& ctx) {
550 IPC::RequestParser rp{ctx}; 777 IPC::RequestParser rp{ctx};
551 m_system_settings.region_code = rp.PopEnum<RegionCode>(); 778 m_system_settings.region_code = rp.PopEnum<RegionCode>();
552 SetSaveNeeded(); 779 SetSaveNeeded();
@@ -557,7 +784,7 @@ void SET_SYS::SetRegionCode(HLERequestContext& ctx) {
557 rb.Push(ResultSuccess); 784 rb.Push(ResultSuccess);
558} 785}
559 786
560void SET_SYS::GetNetworkSystemClockContext(HLERequestContext& ctx) { 787void ISystemSettingsServer::GetNetworkSystemClockContext(HLERequestContext& ctx) {
561 LOG_INFO(Service_SET, "called"); 788 LOG_INFO(Service_SET, "called");
562 789
563 Service::Time::Clock::SystemClockContext context{}; 790 Service::Time::Clock::SystemClockContext context{};
@@ -569,7 +796,7 @@ void SET_SYS::GetNetworkSystemClockContext(HLERequestContext& ctx) {
569 rb.PushRaw(context); 796 rb.PushRaw(context);
570} 797}
571 798
572void SET_SYS::SetNetworkSystemClockContext(HLERequestContext& ctx) { 799void ISystemSettingsServer::SetNetworkSystemClockContext(HLERequestContext& ctx) {
573 LOG_INFO(Service_SET, "called"); 800 LOG_INFO(Service_SET, "called");
574 801
575 IPC::RequestParser rp{ctx}; 802 IPC::RequestParser rp{ctx};
@@ -581,7 +808,7 @@ void SET_SYS::SetNetworkSystemClockContext(HLERequestContext& ctx) {
581 rb.Push(res); 808 rb.Push(res);
582} 809}
583 810
584void SET_SYS::IsUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx) { 811void ISystemSettingsServer::IsUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx) {
585 LOG_INFO(Service_SET, "called"); 812 LOG_INFO(Service_SET, "called");
586 813
587 bool enabled{}; 814 bool enabled{};
@@ -592,7 +819,7 @@ void SET_SYS::IsUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx
592 rb.PushRaw(enabled); 819 rb.PushRaw(enabled);
593} 820}
594 821
595void SET_SYS::SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx) { 822void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx) {
596 LOG_INFO(Service_SET, "called"); 823 LOG_INFO(Service_SET, "called");
597 824
598 IPC::RequestParser rp{ctx}; 825 IPC::RequestParser rp{ctx};
@@ -604,7 +831,7 @@ void SET_SYS::SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ct
604 rb.Push(res); 831 rb.Push(res);
605} 832}
606 833
607void SET_SYS::GetPrimaryAlbumStorage(HLERequestContext& ctx) { 834void ISystemSettingsServer::GetPrimaryAlbumStorage(HLERequestContext& ctx) {
608 LOG_WARNING(Service_SET, "(STUBBED) called"); 835 LOG_WARNING(Service_SET, "(STUBBED) called");
609 836
610 IPC::ResponseBuilder rb{ctx, 3}; 837 IPC::ResponseBuilder rb{ctx, 3};
@@ -612,7 +839,7 @@ void SET_SYS::GetPrimaryAlbumStorage(HLERequestContext& ctx) {
612 rb.PushEnum(PrimaryAlbumStorage::SdCard); 839 rb.PushEnum(PrimaryAlbumStorage::SdCard);
613} 840}
614 841
615void SET_SYS::GetSleepSettings(HLERequestContext& ctx) { 842void ISystemSettingsServer::GetSleepSettings(HLERequestContext& ctx) {
616 LOG_INFO(Service_SET, "called"); 843 LOG_INFO(Service_SET, "called");
617 844
618 IPC::ResponseBuilder rb{ctx, 5}; 845 IPC::ResponseBuilder rb{ctx, 5};
@@ -620,7 +847,7 @@ void SET_SYS::GetSleepSettings(HLERequestContext& ctx) {
620 rb.PushRaw(m_system_settings.sleep_settings); 847 rb.PushRaw(m_system_settings.sleep_settings);
621} 848}
622 849
623void SET_SYS::SetSleepSettings(HLERequestContext& ctx) { 850void ISystemSettingsServer::SetSleepSettings(HLERequestContext& ctx) {
624 IPC::RequestParser rp{ctx}; 851 IPC::RequestParser rp{ctx};
625 m_system_settings.sleep_settings = rp.PopRaw<SleepSettings>(); 852 m_system_settings.sleep_settings = rp.PopRaw<SleepSettings>();
626 SetSaveNeeded(); 853 SetSaveNeeded();
@@ -634,14 +861,14 @@ void SET_SYS::SetSleepSettings(HLERequestContext& ctx) {
634 rb.Push(ResultSuccess); 861 rb.Push(ResultSuccess);
635} 862}
636 863
637void SET_SYS::GetInitialLaunchSettings(HLERequestContext& ctx) { 864void ISystemSettingsServer::GetInitialLaunchSettings(HLERequestContext& ctx) {
638 LOG_INFO(Service_SET, "called"); 865 LOG_INFO(Service_SET, "called");
639 IPC::ResponseBuilder rb{ctx, 10}; 866 IPC::ResponseBuilder rb{ctx, 10};
640 rb.Push(ResultSuccess); 867 rb.Push(ResultSuccess);
641 rb.PushRaw(m_system_settings.initial_launch_settings_packed); 868 rb.PushRaw(m_system_settings.initial_launch_settings_packed);
642} 869}
643 870
644void SET_SYS::SetInitialLaunchSettings(HLERequestContext& ctx) { 871void ISystemSettingsServer::SetInitialLaunchSettings(HLERequestContext& ctx) {
645 IPC::RequestParser rp{ctx}; 872 IPC::RequestParser rp{ctx};
646 auto inital_launch_settings = rp.PopRaw<InitialLaunchSettings>(); 873 auto inital_launch_settings = rp.PopRaw<InitialLaunchSettings>();
647 874
@@ -657,7 +884,7 @@ void SET_SYS::SetInitialLaunchSettings(HLERequestContext& ctx) {
657 rb.Push(ResultSuccess); 884 rb.Push(ResultSuccess);
658} 885}
659 886
660void SET_SYS::GetDeviceNickName(HLERequestContext& ctx) { 887void ISystemSettingsServer::GetDeviceNickName(HLERequestContext& ctx) {
661 LOG_DEBUG(Service_SET, "called"); 888 LOG_DEBUG(Service_SET, "called");
662 889
663 ctx.WriteBuffer(::Settings::values.device_name.GetValue()); 890 ctx.WriteBuffer(::Settings::values.device_name.GetValue());
@@ -666,7 +893,7 @@ void SET_SYS::GetDeviceNickName(HLERequestContext& ctx) {
666 rb.Push(ResultSuccess); 893 rb.Push(ResultSuccess);
667} 894}
668 895
669void SET_SYS::SetDeviceNickName(HLERequestContext& ctx) { 896void ISystemSettingsServer::SetDeviceNickName(HLERequestContext& ctx) {
670 const std::string device_name = Common::StringFromBuffer(ctx.ReadBuffer()); 897 const std::string device_name = Common::StringFromBuffer(ctx.ReadBuffer());
671 898
672 LOG_INFO(Service_SET, "called, device_name={}", device_name); 899 LOG_INFO(Service_SET, "called, device_name={}", device_name);
@@ -677,7 +904,7 @@ void SET_SYS::SetDeviceNickName(HLERequestContext& ctx) {
677 rb.Push(ResultSuccess); 904 rb.Push(ResultSuccess);
678} 905}
679 906
680void SET_SYS::GetProductModel(HLERequestContext& ctx) { 907void ISystemSettingsServer::GetProductModel(HLERequestContext& ctx) {
681 const u32 product_model = 1; 908 const u32 product_model = 1;
682 909
683 LOG_WARNING(Service_SET, "(STUBBED) called, product_model={}", product_model); 910 LOG_WARNING(Service_SET, "(STUBBED) called, product_model={}", product_model);
@@ -686,7 +913,7 @@ void SET_SYS::GetProductModel(HLERequestContext& ctx) {
686 rb.Push(product_model); 913 rb.Push(product_model);
687} 914}
688 915
689void SET_SYS::GetMiiAuthorId(HLERequestContext& ctx) { 916void ISystemSettingsServer::GetMiiAuthorId(HLERequestContext& ctx) {
690 const auto author_id = Common::UUID::MakeDefault(); 917 const auto author_id = Common::UUID::MakeDefault();
691 918
692 LOG_WARNING(Service_SET, "(STUBBED) called, author_id={}", author_id.FormattedString()); 919 LOG_WARNING(Service_SET, "(STUBBED) called, author_id={}", author_id.FormattedString());
@@ -696,7 +923,7 @@ void SET_SYS::GetMiiAuthorId(HLERequestContext& ctx) {
696 rb.PushRaw(author_id); 923 rb.PushRaw(author_id);
697} 924}
698 925
699void SET_SYS::GetAutoUpdateEnableFlag(HLERequestContext& ctx) { 926void ISystemSettingsServer::GetAutoUpdateEnableFlag(HLERequestContext& ctx) {
700 u8 auto_update_flag{}; 927 u8 auto_update_flag{};
701 928
702 LOG_WARNING(Service_SET, "(STUBBED) called, auto_update_flag={}", auto_update_flag); 929 LOG_WARNING(Service_SET, "(STUBBED) called, auto_update_flag={}", auto_update_flag);
@@ -706,7 +933,7 @@ void SET_SYS::GetAutoUpdateEnableFlag(HLERequestContext& ctx) {
706 rb.Push(auto_update_flag); 933 rb.Push(auto_update_flag);
707} 934}
708 935
709void SET_SYS::GetBatteryPercentageFlag(HLERequestContext& ctx) { 936void ISystemSettingsServer::GetBatteryPercentageFlag(HLERequestContext& ctx) {
710 u8 battery_percentage_flag{1}; 937 u8 battery_percentage_flag{1};
711 938
712 LOG_WARNING(Service_SET, "(STUBBED) called, battery_percentage_flag={}", 939 LOG_WARNING(Service_SET, "(STUBBED) called, battery_percentage_flag={}",
@@ -717,7 +944,7 @@ void SET_SYS::GetBatteryPercentageFlag(HLERequestContext& ctx) {
717 rb.Push(battery_percentage_flag); 944 rb.Push(battery_percentage_flag);
718} 945}
719 946
720void SET_SYS::SetExternalSteadyClockInternalOffset(HLERequestContext& ctx) { 947void ISystemSettingsServer::SetExternalSteadyClockInternalOffset(HLERequestContext& ctx) {
721 LOG_DEBUG(Service_SET, "called."); 948 LOG_DEBUG(Service_SET, "called.");
722 949
723 IPC::RequestParser rp{ctx}; 950 IPC::RequestParser rp{ctx};
@@ -729,7 +956,7 @@ void SET_SYS::SetExternalSteadyClockInternalOffset(HLERequestContext& ctx) {
729 rb.Push(res); 956 rb.Push(res);
730} 957}
731 958
732void SET_SYS::GetExternalSteadyClockInternalOffset(HLERequestContext& ctx) { 959void ISystemSettingsServer::GetExternalSteadyClockInternalOffset(HLERequestContext& ctx) {
733 LOG_DEBUG(Service_SET, "called."); 960 LOG_DEBUG(Service_SET, "called.");
734 961
735 s64 offset{}; 962 s64 offset{};
@@ -740,7 +967,7 @@ void SET_SYS::GetExternalSteadyClockInternalOffset(HLERequestContext& ctx) {
740 rb.Push(offset); 967 rb.Push(offset);
741} 968}
742 969
743void SET_SYS::GetErrorReportSharePermission(HLERequestContext& ctx) { 970void ISystemSettingsServer::GetErrorReportSharePermission(HLERequestContext& ctx) {
744 LOG_WARNING(Service_SET, "(STUBBED) called"); 971 LOG_WARNING(Service_SET, "(STUBBED) called");
745 972
746 IPC::ResponseBuilder rb{ctx, 3}; 973 IPC::ResponseBuilder rb{ctx, 3};
@@ -748,7 +975,7 @@ void SET_SYS::GetErrorReportSharePermission(HLERequestContext& ctx) {
748 rb.PushEnum(ErrorReportSharePermission::Denied); 975 rb.PushEnum(ErrorReportSharePermission::Denied);
749} 976}
750 977
751void SET_SYS::GetAppletLaunchFlags(HLERequestContext& ctx) { 978void ISystemSettingsServer::GetAppletLaunchFlags(HLERequestContext& ctx) {
752 LOG_INFO(Service_SET, "called, applet_launch_flag={}", m_system_settings.applet_launch_flag); 979 LOG_INFO(Service_SET, "called, applet_launch_flag={}", m_system_settings.applet_launch_flag);
753 980
754 IPC::ResponseBuilder rb{ctx, 3}; 981 IPC::ResponseBuilder rb{ctx, 3};
@@ -756,7 +983,7 @@ void SET_SYS::GetAppletLaunchFlags(HLERequestContext& ctx) {
756 rb.Push(m_system_settings.applet_launch_flag); 983 rb.Push(m_system_settings.applet_launch_flag);
757} 984}
758 985
759void SET_SYS::SetAppletLaunchFlags(HLERequestContext& ctx) { 986void ISystemSettingsServer::SetAppletLaunchFlags(HLERequestContext& ctx) {
760 IPC::RequestParser rp{ctx}; 987 IPC::RequestParser rp{ctx};
761 m_system_settings.applet_launch_flag = rp.Pop<u32>(); 988 m_system_settings.applet_launch_flag = rp.Pop<u32>();
762 SetSaveNeeded(); 989 SetSaveNeeded();
@@ -767,7 +994,7 @@ void SET_SYS::SetAppletLaunchFlags(HLERequestContext& ctx) {
767 rb.Push(ResultSuccess); 994 rb.Push(ResultSuccess);
768} 995}
769 996
770void SET_SYS::GetKeyboardLayout(HLERequestContext& ctx) { 997void ISystemSettingsServer::GetKeyboardLayout(HLERequestContext& ctx) {
771 const auto language_code = 998 const auto language_code =
772 available_language_codes[static_cast<s32>(::Settings::values.language_index.GetValue())]; 999 available_language_codes[static_cast<s32>(::Settings::values.language_index.GetValue())];
773 const auto key_code = 1000 const auto key_code =
@@ -786,7 +1013,7 @@ void SET_SYS::GetKeyboardLayout(HLERequestContext& ctx) {
786 rb.Push(static_cast<u32>(selected_keyboard_layout)); 1013 rb.Push(static_cast<u32>(selected_keyboard_layout));
787} 1014}
788 1015
789void SET_SYS::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) { 1016void ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
790 LOG_WARNING(Service_SET, "called."); 1017 LOG_WARNING(Service_SET, "called.");
791 1018
792 Service::Time::Clock::SteadyClockTimePoint time_point{}; 1019 Service::Time::Clock::SteadyClockTimePoint time_point{};
@@ -797,7 +1024,7 @@ void SET_SYS::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
797 rb.PushRaw<Service::Time::Clock::SteadyClockTimePoint>(time_point); 1024 rb.PushRaw<Service::Time::Clock::SteadyClockTimePoint>(time_point);
798} 1025}
799 1026
800void SET_SYS::SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) { 1027void ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
801 LOG_WARNING(Service_SET, "called."); 1028 LOG_WARNING(Service_SET, "called.");
802 1029
803 IPC::RequestParser rp{ctx}; 1030 IPC::RequestParser rp{ctx};
@@ -809,7 +1036,8 @@ void SET_SYS::SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
809 rb.Push(res); 1036 rb.Push(res);
810} 1037}
811 1038
812void SET_SYS::GetUserSystemClockAutomaticCorrectionUpdatedTime(HLERequestContext& ctx) { 1039void ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime(
1040 HLERequestContext& ctx) {
813 LOG_WARNING(Service_SET, "called."); 1041 LOG_WARNING(Service_SET, "called.");
814 1042
815 Service::Time::Clock::SteadyClockTimePoint time_point{}; 1043 Service::Time::Clock::SteadyClockTimePoint time_point{};
@@ -820,7 +1048,8 @@ void SET_SYS::GetUserSystemClockAutomaticCorrectionUpdatedTime(HLERequestContext
820 rb.PushRaw<Service::Time::Clock::SteadyClockTimePoint>(time_point); 1048 rb.PushRaw<Service::Time::Clock::SteadyClockTimePoint>(time_point);
821} 1049}
822 1050
823void SET_SYS::SetUserSystemClockAutomaticCorrectionUpdatedTime(HLERequestContext& ctx) { 1051void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime(
1052 HLERequestContext& ctx) {
824 LOG_WARNING(Service_SET, "called."); 1053 LOG_WARNING(Service_SET, "called.");
825 1054
826 IPC::RequestParser rp{ctx}; 1055 IPC::RequestParser rp{ctx};
@@ -832,7 +1061,7 @@ void SET_SYS::SetUserSystemClockAutomaticCorrectionUpdatedTime(HLERequestContext
832 rb.Push(res); 1061 rb.Push(res);
833} 1062}
834 1063
835void SET_SYS::GetChineseTraditionalInputMethod(HLERequestContext& ctx) { 1064void ISystemSettingsServer::GetChineseTraditionalInputMethod(HLERequestContext& ctx) {
836 LOG_WARNING(Service_SET, "(STUBBED) called"); 1065 LOG_WARNING(Service_SET, "(STUBBED) called");
837 1066
838 IPC::ResponseBuilder rb{ctx, 3}; 1067 IPC::ResponseBuilder rb{ctx, 3};
@@ -840,7 +1069,7 @@ void SET_SYS::GetChineseTraditionalInputMethod(HLERequestContext& ctx) {
840 rb.PushEnum(ChineseTraditionalInputMethod::Unknown0); 1069 rb.PushEnum(ChineseTraditionalInputMethod::Unknown0);
841} 1070}
842 1071
843void SET_SYS::GetHomeMenuScheme(HLERequestContext& ctx) { 1072void ISystemSettingsServer::GetHomeMenuScheme(HLERequestContext& ctx) {
844 LOG_DEBUG(Service_SET, "(STUBBED) called"); 1073 LOG_DEBUG(Service_SET, "(STUBBED) called");
845 1074
846 const HomeMenuScheme default_color = { 1075 const HomeMenuScheme default_color = {
@@ -856,7 +1085,7 @@ void SET_SYS::GetHomeMenuScheme(HLERequestContext& ctx) {
856 rb.PushRaw(default_color); 1085 rb.PushRaw(default_color);
857} 1086}
858 1087
859void SET_SYS::GetHomeMenuSchemeModel(HLERequestContext& ctx) { 1088void ISystemSettingsServer::GetHomeMenuSchemeModel(HLERequestContext& ctx) {
860 LOG_WARNING(Service_SET, "(STUBBED) called"); 1089 LOG_WARNING(Service_SET, "(STUBBED) called");
861 1090
862 IPC::ResponseBuilder rb{ctx, 3}; 1091 IPC::ResponseBuilder rb{ctx, 3};
@@ -864,7 +1093,7 @@ void SET_SYS::GetHomeMenuSchemeModel(HLERequestContext& ctx) {
864 rb.Push(0); 1093 rb.Push(0);
865} 1094}
866 1095
867void SET_SYS::GetFieldTestingFlag(HLERequestContext& ctx) { 1096void ISystemSettingsServer::GetFieldTestingFlag(HLERequestContext& ctx) {
868 LOG_WARNING(Service_SET, "(STUBBED) called"); 1097 LOG_WARNING(Service_SET, "(STUBBED) called");
869 1098
870 IPC::ResponseBuilder rb{ctx, 3}; 1099 IPC::ResponseBuilder rb{ctx, 3};
@@ -872,233 +1101,7 @@ void SET_SYS::GetFieldTestingFlag(HLERequestContext& ctx) {
872 rb.Push<u8>(false); 1101 rb.Push<u8>(false);
873} 1102}
874 1103
875SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"}, m_system{system} { 1104void ISystemSettingsServer::SetupSettings() {
876 // clang-format off
877 static const FunctionInfo functions[] = {
878 {0, &SET_SYS::SetLanguageCode, "SetLanguageCode"},
879 {1, nullptr, "SetNetworkSettings"},
880 {2, nullptr, "GetNetworkSettings"},
881 {3, &SET_SYS::GetFirmwareVersion, "GetFirmwareVersion"},
882 {4, &SET_SYS::GetFirmwareVersion2, "GetFirmwareVersion2"},
883 {5, nullptr, "GetFirmwareVersionDigest"},
884 {7, nullptr, "GetLockScreenFlag"},
885 {8, nullptr, "SetLockScreenFlag"},
886 {9, nullptr, "GetBacklightSettings"},
887 {10, nullptr, "SetBacklightSettings"},
888 {11, nullptr, "SetBluetoothDevicesSettings"},
889 {12, nullptr, "GetBluetoothDevicesSettings"},
890 {13, &SET_SYS::GetExternalSteadyClockSourceId, "GetExternalSteadyClockSourceId"},
891 {14, &SET_SYS::SetExternalSteadyClockSourceId, "SetExternalSteadyClockSourceId"},
892 {15, &SET_SYS::GetUserSystemClockContext, "GetUserSystemClockContext"},
893 {16, &SET_SYS::SetUserSystemClockContext, "SetUserSystemClockContext"},
894 {17, &SET_SYS::GetAccountSettings, "GetAccountSettings"},
895 {18, &SET_SYS::SetAccountSettings, "SetAccountSettings"},
896 {19, nullptr, "GetAudioVolume"},
897 {20, nullptr, "SetAudioVolume"},
898 {21, &SET_SYS::GetEulaVersions, "GetEulaVersions"},
899 {22, &SET_SYS::SetEulaVersions, "SetEulaVersions"},
900 {23, &SET_SYS::GetColorSetId, "GetColorSetId"},
901 {24, &SET_SYS::SetColorSetId, "SetColorSetId"},
902 {25, nullptr, "GetConsoleInformationUploadFlag"},
903 {26, nullptr, "SetConsoleInformationUploadFlag"},
904 {27, nullptr, "GetAutomaticApplicationDownloadFlag"},
905 {28, nullptr, "SetAutomaticApplicationDownloadFlag"},
906 {29, &SET_SYS::GetNotificationSettings, "GetNotificationSettings"},
907 {30, &SET_SYS::SetNotificationSettings, "SetNotificationSettings"},
908 {31, &SET_SYS::GetAccountNotificationSettings, "GetAccountNotificationSettings"},
909 {32, &SET_SYS::SetAccountNotificationSettings, "SetAccountNotificationSettings"},
910 {35, nullptr, "GetVibrationMasterVolume"},
911 {36, nullptr, "SetVibrationMasterVolume"},
912 {37, &SET_SYS::GetSettingsItemValueSize, "GetSettingsItemValueSize"},
913 {38, &SET_SYS::GetSettingsItemValue, "GetSettingsItemValue"},
914 {39, &SET_SYS::GetTvSettings, "GetTvSettings"},
915 {40, &SET_SYS::SetTvSettings, "SetTvSettings"},
916 {41, nullptr, "GetEdid"},
917 {42, nullptr, "SetEdid"},
918 {43, nullptr, "GetAudioOutputMode"},
919 {44, nullptr, "SetAudioOutputMode"},
920 {45, nullptr, "IsForceMuteOnHeadphoneRemoved"},
921 {46, nullptr, "SetForceMuteOnHeadphoneRemoved"},
922 {47, &SET_SYS::GetQuestFlag, "GetQuestFlag"},
923 {48, nullptr, "SetQuestFlag"},
924 {49, nullptr, "GetDataDeletionSettings"},
925 {50, nullptr, "SetDataDeletionSettings"},
926 {51, nullptr, "GetInitialSystemAppletProgramId"},
927 {52, nullptr, "GetOverlayDispProgramId"},
928 {53, &SET_SYS::GetDeviceTimeZoneLocationName, "GetDeviceTimeZoneLocationName"},
929 {54, &SET_SYS::SetDeviceTimeZoneLocationName, "SetDeviceTimeZoneLocationName"},
930 {55, nullptr, "GetWirelessCertificationFileSize"},
931 {56, nullptr, "GetWirelessCertificationFile"},
932 {57, &SET_SYS::SetRegionCode, "SetRegionCode"},
933 {58, &SET_SYS::GetNetworkSystemClockContext, "GetNetworkSystemClockContext"},
934 {59, &SET_SYS::SetNetworkSystemClockContext, "SetNetworkSystemClockContext"},
935 {60, &SET_SYS::IsUserSystemClockAutomaticCorrectionEnabled, "IsUserSystemClockAutomaticCorrectionEnabled"},
936 {61, &SET_SYS::SetUserSystemClockAutomaticCorrectionEnabled, "SetUserSystemClockAutomaticCorrectionEnabled"},
937 {62, &SET_SYS::GetDebugModeFlag, "GetDebugModeFlag"},
938 {63, &SET_SYS::GetPrimaryAlbumStorage, "GetPrimaryAlbumStorage"},
939 {64, nullptr, "SetPrimaryAlbumStorage"},
940 {65, nullptr, "GetUsb30EnableFlag"},
941 {66, nullptr, "SetUsb30EnableFlag"},
942 {67, nullptr, "GetBatteryLot"},
943 {68, nullptr, "GetSerialNumber"},
944 {69, nullptr, "GetNfcEnableFlag"},
945 {70, nullptr, "SetNfcEnableFlag"},
946 {71, &SET_SYS::GetSleepSettings, "GetSleepSettings"},
947 {72, &SET_SYS::SetSleepSettings, "SetSleepSettings"},
948 {73, nullptr, "GetWirelessLanEnableFlag"},
949 {74, nullptr, "SetWirelessLanEnableFlag"},
950 {75, &SET_SYS::GetInitialLaunchSettings, "GetInitialLaunchSettings"},
951 {76, &SET_SYS::SetInitialLaunchSettings, "SetInitialLaunchSettings"},
952 {77, &SET_SYS::GetDeviceNickName, "GetDeviceNickName"},
953 {78, &SET_SYS::SetDeviceNickName, "SetDeviceNickName"},
954 {79, &SET_SYS::GetProductModel, "GetProductModel"},
955 {80, nullptr, "GetLdnChannel"},
956 {81, nullptr, "SetLdnChannel"},
957 {82, nullptr, "AcquireTelemetryDirtyFlagEventHandle"},
958 {83, nullptr, "GetTelemetryDirtyFlags"},
959 {84, nullptr, "GetPtmBatteryLot"},
960 {85, nullptr, "SetPtmBatteryLot"},
961 {86, nullptr, "GetPtmFuelGaugeParameter"},
962 {87, nullptr, "SetPtmFuelGaugeParameter"},
963 {88, nullptr, "GetBluetoothEnableFlag"},
964 {89, nullptr, "SetBluetoothEnableFlag"},
965 {90, &SET_SYS::GetMiiAuthorId, "GetMiiAuthorId"},
966 {91, nullptr, "SetShutdownRtcValue"},
967 {92, nullptr, "GetShutdownRtcValue"},
968 {93, nullptr, "AcquireFatalDirtyFlagEventHandle"},
969 {94, nullptr, "GetFatalDirtyFlags"},
970 {95, &SET_SYS::GetAutoUpdateEnableFlag, "GetAutoUpdateEnableFlag"},
971 {96, nullptr, "SetAutoUpdateEnableFlag"},
972 {97, nullptr, "GetNxControllerSettings"},
973 {98, nullptr, "SetNxControllerSettings"},
974 {99, &SET_SYS::GetBatteryPercentageFlag, "GetBatteryPercentageFlag"},
975 {100, nullptr, "SetBatteryPercentageFlag"},
976 {101, nullptr, "GetExternalRtcResetFlag"},
977 {102, nullptr, "SetExternalRtcResetFlag"},
978 {103, nullptr, "GetUsbFullKeyEnableFlag"},
979 {104, nullptr, "SetUsbFullKeyEnableFlag"},
980 {105, &SET_SYS::SetExternalSteadyClockInternalOffset, "SetExternalSteadyClockInternalOffset"},
981 {106, &SET_SYS::GetExternalSteadyClockInternalOffset, "GetExternalSteadyClockInternalOffset"},
982 {107, nullptr, "GetBacklightSettingsEx"},
983 {108, nullptr, "SetBacklightSettingsEx"},
984 {109, nullptr, "GetHeadphoneVolumeWarningCount"},
985 {110, nullptr, "SetHeadphoneVolumeWarningCount"},
986 {111, nullptr, "GetBluetoothAfhEnableFlag"},
987 {112, nullptr, "SetBluetoothAfhEnableFlag"},
988 {113, nullptr, "GetBluetoothBoostEnableFlag"},
989 {114, nullptr, "SetBluetoothBoostEnableFlag"},
990 {115, nullptr, "GetInRepairProcessEnableFlag"},
991 {116, nullptr, "SetInRepairProcessEnableFlag"},
992 {117, nullptr, "GetHeadphoneVolumeUpdateFlag"},
993 {118, nullptr, "SetHeadphoneVolumeUpdateFlag"},
994 {119, nullptr, "NeedsToUpdateHeadphoneVolume"},
995 {120, nullptr, "GetPushNotificationActivityModeOnSleep"},
996 {121, nullptr, "SetPushNotificationActivityModeOnSleep"},
997 {122, nullptr, "GetServiceDiscoveryControlSettings"},
998 {123, nullptr, "SetServiceDiscoveryControlSettings"},
999 {124, &SET_SYS::GetErrorReportSharePermission, "GetErrorReportSharePermission"},
1000 {125, nullptr, "SetErrorReportSharePermission"},
1001 {126, &SET_SYS::GetAppletLaunchFlags, "GetAppletLaunchFlags"},
1002 {127, &SET_SYS::SetAppletLaunchFlags, "SetAppletLaunchFlags"},
1003 {128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"},
1004 {129, nullptr, "SetConsoleSixAxisSensorAccelerationBias"},
1005 {130, nullptr, "GetConsoleSixAxisSensorAngularVelocityBias"},
1006 {131, nullptr, "SetConsoleSixAxisSensorAngularVelocityBias"},
1007 {132, nullptr, "GetConsoleSixAxisSensorAccelerationGain"},
1008 {133, nullptr, "SetConsoleSixAxisSensorAccelerationGain"},
1009 {134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"},
1010 {135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"},
1011 {136, &SET_SYS::GetKeyboardLayout, "GetKeyboardLayout"},
1012 {137, nullptr, "SetKeyboardLayout"},
1013 {138, nullptr, "GetWebInspectorFlag"},
1014 {139, nullptr, "GetAllowedSslHosts"},
1015 {140, nullptr, "GetHostFsMountPoint"},
1016 {141, nullptr, "GetRequiresRunRepairTimeReviser"},
1017 {142, nullptr, "SetRequiresRunRepairTimeReviser"},
1018 {143, nullptr, "SetBlePairingSettings"},
1019 {144, nullptr, "GetBlePairingSettings"},
1020 {145, nullptr, "GetConsoleSixAxisSensorAngularVelocityTimeBias"},
1021 {146, nullptr, "SetConsoleSixAxisSensorAngularVelocityTimeBias"},
1022 {147, nullptr, "GetConsoleSixAxisSensorAngularAcceleration"},
1023 {148, nullptr, "SetConsoleSixAxisSensorAngularAcceleration"},
1024 {149, nullptr, "GetRebootlessSystemUpdateVersion"},
1025 {150, &SET_SYS::GetDeviceTimeZoneLocationUpdatedTime, "GetDeviceTimeZoneLocationUpdatedTime"},
1026 {151, &SET_SYS::SetDeviceTimeZoneLocationUpdatedTime, "SetDeviceTimeZoneLocationUpdatedTime"},
1027 {152, &SET_SYS::GetUserSystemClockAutomaticCorrectionUpdatedTime, "GetUserSystemClockAutomaticCorrectionUpdatedTime"},
1028 {153, &SET_SYS::SetUserSystemClockAutomaticCorrectionUpdatedTime, "SetUserSystemClockAutomaticCorrectionUpdatedTime"},
1029 {154, nullptr, "GetAccountOnlineStorageSettings"},
1030 {155, nullptr, "SetAccountOnlineStorageSettings"},
1031 {156, nullptr, "GetPctlReadyFlag"},
1032 {157, nullptr, "SetPctlReadyFlag"},
1033 {158, nullptr, "GetAnalogStickUserCalibrationL"},
1034 {159, nullptr, "SetAnalogStickUserCalibrationL"},
1035 {160, nullptr, "GetAnalogStickUserCalibrationR"},
1036 {161, nullptr, "SetAnalogStickUserCalibrationR"},
1037 {162, nullptr, "GetPtmBatteryVersion"},
1038 {163, nullptr, "SetPtmBatteryVersion"},
1039 {164, nullptr, "GetUsb30HostEnableFlag"},
1040 {165, nullptr, "SetUsb30HostEnableFlag"},
1041 {166, nullptr, "GetUsb30DeviceEnableFlag"},
1042 {167, nullptr, "SetUsb30DeviceEnableFlag"},
1043 {168, nullptr, "GetThemeId"},
1044 {169, nullptr, "SetThemeId"},
1045 {170, &SET_SYS::GetChineseTraditionalInputMethod, "GetChineseTraditionalInputMethod"},
1046 {171, nullptr, "SetChineseTraditionalInputMethod"},
1047 {172, nullptr, "GetPtmCycleCountReliability"},
1048 {173, nullptr, "SetPtmCycleCountReliability"},
1049 {174, &SET_SYS::GetHomeMenuScheme, "GetHomeMenuScheme"},
1050 {175, nullptr, "GetThemeSettings"},
1051 {176, nullptr, "SetThemeSettings"},
1052 {177, nullptr, "GetThemeKey"},
1053 {178, nullptr, "SetThemeKey"},
1054 {179, nullptr, "GetZoomFlag"},
1055 {180, nullptr, "SetZoomFlag"},
1056 {181, nullptr, "GetT"},
1057 {182, nullptr, "SetT"},
1058 {183, nullptr, "GetPlatformRegion"},
1059 {184, nullptr, "SetPlatformRegion"},
1060 {185, &SET_SYS::GetHomeMenuSchemeModel, "GetHomeMenuSchemeModel"},
1061 {186, nullptr, "GetMemoryUsageRateFlag"},
1062 {187, nullptr, "GetTouchScreenMode"},
1063 {188, nullptr, "SetTouchScreenMode"},
1064 {189, nullptr, "GetButtonConfigSettingsFull"},
1065 {190, nullptr, "SetButtonConfigSettingsFull"},
1066 {191, nullptr, "GetButtonConfigSettingsEmbedded"},
1067 {192, nullptr, "SetButtonConfigSettingsEmbedded"},
1068 {193, nullptr, "GetButtonConfigSettingsLeft"},
1069 {194, nullptr, "SetButtonConfigSettingsLeft"},
1070 {195, nullptr, "GetButtonConfigSettingsRight"},
1071 {196, nullptr, "SetButtonConfigSettingsRight"},
1072 {197, nullptr, "GetButtonConfigRegisteredSettingsEmbedded"},
1073 {198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"},
1074 {199, nullptr, "GetButtonConfigRegisteredSettings"},
1075 {200, nullptr, "SetButtonConfigRegisteredSettings"},
1076 {201, &SET_SYS::GetFieldTestingFlag, "GetFieldTestingFlag"},
1077 {202, nullptr, "SetFieldTestingFlag"},
1078 {203, nullptr, "GetPanelCrcMode"},
1079 {204, nullptr, "SetPanelCrcMode"},
1080 {205, nullptr, "GetNxControllerSettingsEx"},
1081 {206, nullptr, "SetNxControllerSettingsEx"},
1082 {207, nullptr, "GetHearingProtectionSafeguardFlag"},
1083 {208, nullptr, "SetHearingProtectionSafeguardFlag"},
1084 {209, nullptr, "GetHearingProtectionSafeguardRemainingTime"},
1085 {210, nullptr, "SetHearingProtectionSafeguardRemainingTime"},
1086 };
1087 // clang-format on
1088
1089 RegisterHandlers(functions);
1090
1091 SetupSettings();
1092 m_save_thread =
1093 std::jthread([this](std::stop_token stop_token) { StoreSettingsThreadFunc(stop_token); });
1094}
1095
1096SET_SYS::~SET_SYS() {
1097 SetSaveNeeded();
1098 m_save_thread.request_stop();
1099}
1100
1101void SET_SYS::SetupSettings() {
1102 auto system_dir = 1105 auto system_dir =
1103 Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000050"; 1106 Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000050";
1104 if (!LoadSettingsFile(system_dir, []() { return DefaultSystemSettings(); })) { 1107 if (!LoadSettingsFile(system_dir, []() { return DefaultSystemSettings(); })) {
@@ -1124,7 +1127,7 @@ void SET_SYS::SetupSettings() {
1124 } 1127 }
1125} 1128}
1126 1129
1127void SET_SYS::StoreSettings() { 1130void ISystemSettingsServer::StoreSettings() {
1128 auto system_dir = 1131 auto system_dir =
1129 Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000050"; 1132 Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000050";
1130 if (!StoreSettingsFile(system_dir, m_system_settings)) { 1133 if (!StoreSettingsFile(system_dir, m_system_settings)) {
@@ -1150,7 +1153,7 @@ void SET_SYS::StoreSettings() {
1150 } 1153 }
1151} 1154}
1152 1155
1153void SET_SYS::StoreSettingsThreadFunc(std::stop_token stop_token) { 1156void ISystemSettingsServer::StoreSettingsThreadFunc(std::stop_token stop_token) {
1154 Common::SetCurrentThreadName("SettingsStore"); 1157 Common::SetCurrentThreadName("SettingsStore");
1155 1158
1156 while (Common::StoppableTimedWait(stop_token, std::chrono::minutes(1))) { 1159 while (Common::StoppableTimedWait(stop_token, std::chrono::minutes(1))) {
@@ -1162,13 +1165,14 @@ void SET_SYS::StoreSettingsThreadFunc(std::stop_token stop_token) {
1162 } 1165 }
1163} 1166}
1164 1167
1165void SET_SYS::SetSaveNeeded() { 1168void ISystemSettingsServer::SetSaveNeeded() {
1166 std::scoped_lock l{m_save_needed_mutex}; 1169 std::scoped_lock l{m_save_needed_mutex};
1167 m_save_needed = true; 1170 m_save_needed = true;
1168} 1171}
1169 1172
1170Result SET_SYS::GetSettingsItemValue(std::vector<u8>& out_value, const std::string& category, 1173Result ISystemSettingsServer::GetSettingsItemValue(std::vector<u8>& out_value,
1171 const std::string& name) { 1174 const std::string& category,
1175 const std::string& name) {
1172 auto settings{GetSettings()}; 1176 auto settings{GetSettings()};
1173 R_UNLESS(settings.contains(category) && settings[category].contains(name), ResultUnknown); 1177 R_UNLESS(settings.contains(category) && settings[category].contains(name), ResultUnknown);
1174 1178
@@ -1176,93 +1180,98 @@ Result SET_SYS::GetSettingsItemValue(std::vector<u8>& out_value, const std::stri
1176 R_SUCCEED(); 1180 R_SUCCEED();
1177} 1181}
1178 1182
1179Result SET_SYS::GetExternalSteadyClockSourceId(Common::UUID& out_id) { 1183Result ISystemSettingsServer::GetExternalSteadyClockSourceId(Common::UUID& out_id) {
1180 out_id = m_private_settings.external_clock_source_id; 1184 out_id = m_private_settings.external_clock_source_id;
1181 R_SUCCEED(); 1185 R_SUCCEED();
1182} 1186}
1183 1187
1184Result SET_SYS::SetExternalSteadyClockSourceId(Common::UUID id) { 1188Result ISystemSettingsServer::SetExternalSteadyClockSourceId(Common::UUID id) {
1185 m_private_settings.external_clock_source_id = id; 1189 m_private_settings.external_clock_source_id = id;
1186 SetSaveNeeded(); 1190 SetSaveNeeded();
1187 R_SUCCEED(); 1191 R_SUCCEED();
1188} 1192}
1189 1193
1190Result SET_SYS::GetUserSystemClockContext(Service::Time::Clock::SystemClockContext& out_context) { 1194Result ISystemSettingsServer::GetUserSystemClockContext(
1195 Service::Time::Clock::SystemClockContext& out_context) {
1191 out_context = m_system_settings.user_system_clock_context; 1196 out_context = m_system_settings.user_system_clock_context;
1192 R_SUCCEED(); 1197 R_SUCCEED();
1193} 1198}
1194 1199
1195Result SET_SYS::SetUserSystemClockContext(Service::Time::Clock::SystemClockContext& context) { 1200Result ISystemSettingsServer::SetUserSystemClockContext(
1201 Service::Time::Clock::SystemClockContext& context) {
1196 m_system_settings.user_system_clock_context = context; 1202 m_system_settings.user_system_clock_context = context;
1197 SetSaveNeeded(); 1203 SetSaveNeeded();
1198 R_SUCCEED(); 1204 R_SUCCEED();
1199} 1205}
1200 1206
1201Result SET_SYS::GetDeviceTimeZoneLocationName(Service::Time::TimeZone::LocationName& out_name) { 1207Result ISystemSettingsServer::GetDeviceTimeZoneLocationName(
1208 Service::Time::TimeZone::LocationName& out_name) {
1202 out_name = m_system_settings.device_time_zone_location_name; 1209 out_name = m_system_settings.device_time_zone_location_name;
1203 R_SUCCEED(); 1210 R_SUCCEED();
1204} 1211}
1205 1212
1206Result SET_SYS::SetDeviceTimeZoneLocationName(Service::Time::TimeZone::LocationName& name) { 1213Result ISystemSettingsServer::SetDeviceTimeZoneLocationName(
1214 Service::Time::TimeZone::LocationName& name) {
1207 m_system_settings.device_time_zone_location_name = name; 1215 m_system_settings.device_time_zone_location_name = name;
1208 SetSaveNeeded(); 1216 SetSaveNeeded();
1209 R_SUCCEED(); 1217 R_SUCCEED();
1210} 1218}
1211 1219
1212Result SET_SYS::GetNetworkSystemClockContext( 1220Result ISystemSettingsServer::GetNetworkSystemClockContext(
1213 Service::Time::Clock::SystemClockContext& out_context) { 1221 Service::Time::Clock::SystemClockContext& out_context) {
1214 out_context = m_system_settings.network_system_clock_context; 1222 out_context = m_system_settings.network_system_clock_context;
1215 R_SUCCEED(); 1223 R_SUCCEED();
1216} 1224}
1217 1225
1218Result SET_SYS::SetNetworkSystemClockContext(Service::Time::Clock::SystemClockContext& context) { 1226Result ISystemSettingsServer::SetNetworkSystemClockContext(
1227 Service::Time::Clock::SystemClockContext& context) {
1219 m_system_settings.network_system_clock_context = context; 1228 m_system_settings.network_system_clock_context = context;
1220 SetSaveNeeded(); 1229 SetSaveNeeded();
1221 R_SUCCEED(); 1230 R_SUCCEED();
1222} 1231}
1223 1232
1224Result SET_SYS::IsUserSystemClockAutomaticCorrectionEnabled(bool& out_enabled) { 1233Result ISystemSettingsServer::IsUserSystemClockAutomaticCorrectionEnabled(bool& out_enabled) {
1225 out_enabled = m_system_settings.user_system_clock_automatic_correction_enabled; 1234 out_enabled = m_system_settings.user_system_clock_automatic_correction_enabled;
1226 R_SUCCEED(); 1235 R_SUCCEED();
1227} 1236}
1228 1237
1229Result SET_SYS::SetUserSystemClockAutomaticCorrectionEnabled(bool enabled) { 1238Result ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled(bool enabled) {
1230 m_system_settings.user_system_clock_automatic_correction_enabled = enabled; 1239 m_system_settings.user_system_clock_automatic_correction_enabled = enabled;
1231 SetSaveNeeded(); 1240 SetSaveNeeded();
1232 R_SUCCEED(); 1241 R_SUCCEED();
1233} 1242}
1234 1243
1235Result SET_SYS::SetExternalSteadyClockInternalOffset(s64 offset) { 1244Result ISystemSettingsServer::SetExternalSteadyClockInternalOffset(s64 offset) {
1236 m_private_settings.external_steady_clock_internal_offset = offset; 1245 m_private_settings.external_steady_clock_internal_offset = offset;
1237 SetSaveNeeded(); 1246 SetSaveNeeded();
1238 R_SUCCEED(); 1247 R_SUCCEED();
1239} 1248}
1240 1249
1241Result SET_SYS::GetExternalSteadyClockInternalOffset(s64& out_offset) { 1250Result ISystemSettingsServer::GetExternalSteadyClockInternalOffset(s64& out_offset) {
1242 out_offset = m_private_settings.external_steady_clock_internal_offset; 1251 out_offset = m_private_settings.external_steady_clock_internal_offset;
1243 R_SUCCEED(); 1252 R_SUCCEED();
1244} 1253}
1245 1254
1246Result SET_SYS::GetDeviceTimeZoneLocationUpdatedTime( 1255Result ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(
1247 Service::Time::Clock::SteadyClockTimePoint& out_time_point) { 1256 Service::Time::Clock::SteadyClockTimePoint& out_time_point) {
1248 out_time_point = m_system_settings.device_time_zone_location_updated_time; 1257 out_time_point = m_system_settings.device_time_zone_location_updated_time;
1249 R_SUCCEED(); 1258 R_SUCCEED();
1250} 1259}
1251 1260
1252Result SET_SYS::SetDeviceTimeZoneLocationUpdatedTime( 1261Result ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(
1253 Service::Time::Clock::SteadyClockTimePoint& time_point) { 1262 Service::Time::Clock::SteadyClockTimePoint& time_point) {
1254 m_system_settings.device_time_zone_location_updated_time = time_point; 1263 m_system_settings.device_time_zone_location_updated_time = time_point;
1255 SetSaveNeeded(); 1264 SetSaveNeeded();
1256 R_SUCCEED(); 1265 R_SUCCEED();
1257} 1266}
1258 1267
1259Result SET_SYS::GetUserSystemClockAutomaticCorrectionUpdatedTime( 1268Result ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime(
1260 Service::Time::Clock::SteadyClockTimePoint& out_time_point) { 1269 Service::Time::Clock::SteadyClockTimePoint& out_time_point) {
1261 out_time_point = m_system_settings.user_system_clock_automatic_correction_updated_time_point; 1270 out_time_point = m_system_settings.user_system_clock_automatic_correction_updated_time_point;
1262 R_SUCCEED(); 1271 R_SUCCEED();
1263} 1272}
1264 1273
1265Result SET_SYS::SetUserSystemClockAutomaticCorrectionUpdatedTime( 1274Result ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime(
1266 Service::Time::Clock::SteadyClockTimePoint out_time_point) { 1275 Service::Time::Clock::SteadyClockTimePoint out_time_point) {
1267 m_system_settings.user_system_clock_automatic_correction_updated_time_point = out_time_point; 1276 m_system_settings.user_system_clock_automatic_correction_updated_time_point = out_time_point;
1268 SetSaveNeeded(); 1277 SetSaveNeeded();
diff --git a/src/core/hle/service/set/set_sys.h b/src/core/hle/service/set/system_settings_server.h
index 853f76fce..6f587e0b3 100644
--- a/src/core/hle/service/set/set_sys.h
+++ b/src/core/hle/service/set/system_settings_server.h
@@ -47,10 +47,10 @@ static_assert(sizeof(FirmwareVersionFormat) == 0x100, "FirmwareVersionFormat is
47Result GetFirmwareVersionImpl(FirmwareVersionFormat& out_firmware, Core::System& system, 47Result GetFirmwareVersionImpl(FirmwareVersionFormat& out_firmware, Core::System& system,
48 GetFirmwareVersionType type); 48 GetFirmwareVersionType type);
49 49
50class SET_SYS final : public ServiceFramework<SET_SYS> { 50class ISystemSettingsServer final : public ServiceFramework<ISystemSettingsServer> {
51public: 51public:
52 explicit SET_SYS(Core::System& system_); 52 explicit ISystemSettingsServer(Core::System& system_);
53 ~SET_SYS() override; 53 ~ISystemSettingsServer() override;
54 54
55 Result GetSettingsItemValue(std::vector<u8>& out_value, const std::string& category, 55 Result GetSettingsItemValue(std::vector<u8>& out_value, const std::string& category,
56 const std::string& name); 56 const std::string& name);
diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp
index 14871ebee..1f8a0f8ab 100644
--- a/src/hid_core/resources/npad/npad.cpp
+++ b/src/hid_core/resources/npad/npad.cpp
@@ -870,6 +870,11 @@ void NPad::InitializeVibrationDevice(
870 const auto aruid = applet_resource_holder.applet_resource->GetActiveAruid(); 870 const auto aruid = applet_resource_holder.applet_resource->GetActiveAruid();
871 const auto npad_index = static_cast<Core::HID::NpadIdType>(vibration_device_handle.npad_id); 871 const auto npad_index = static_cast<Core::HID::NpadIdType>(vibration_device_handle.npad_id);
872 const auto device_index = static_cast<std::size_t>(vibration_device_handle.device_index); 872 const auto device_index = static_cast<std::size_t>(vibration_device_handle.device_index);
873
874 if (aruid == 0) {
875 return;
876 }
877
873 InitializeVibrationDeviceAtIndex(aruid, npad_index, device_index); 878 InitializeVibrationDeviceAtIndex(aruid, npad_index, device_index);
874} 879}
875 880
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 2a83486f9..4f4c75f5c 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -46,7 +46,7 @@
46#include "core/hle/service/am/applet_ae.h" 46#include "core/hle/service/am/applet_ae.h"
47#include "core/hle/service/am/applet_oe.h" 47#include "core/hle/service/am/applet_oe.h"
48#include "core/hle/service/am/applets/applets.h" 48#include "core/hle/service/am/applets/applets.h"
49#include "core/hle/service/set/set_sys.h" 49#include "core/hle/service/set/system_settings_server.h"
50#include "hid_core/frontend/emulated_controller.h" 50#include "hid_core/frontend/emulated_controller.h"
51#include "hid_core/hid_core.h" 51#include "hid_core/hid_core.h"
52#include "yuzu/multiplayer/state.h" 52#include "yuzu/multiplayer/state.h"