summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar liamwhite2022-12-16 14:05:00 -0500
committerGravatar GitHub2022-12-16 14:05:00 -0500
commitbbb202ceedf8c4054f6a602ad572ba8df33e315d (patch)
tree8b51f7711e7b698ca712c24b854f88a0022e1d9c /src
parentMerge pull request #9450 from ameerj/hle-ipc-vector-reserve (diff)
parentSet: Allow setting device nickname (diff)
downloadyuzu-bbb202ceedf8c4054f6a602ad572ba8df33e315d.tar.gz
yuzu-bbb202ceedf8c4054f6a602ad572ba8df33e315d.tar.xz
yuzu-bbb202ceedf8c4054f6a602ad572ba8df33e315d.zip
Merge pull request #6354 from ogniK5377/device-name
Set: Allow setting device nickname
Diffstat (limited to 'src')
-rw-r--r--src/common/settings.cpp1
-rw-r--r--src/common/settings.h1
-rw-r--r--src/core/hle/service/set/set.cpp9
-rw-r--r--src/core/hle/service/set/set.h1
-rw-r--r--src/core/hle/service/set/set_sys.cpp10
-rw-r--r--src/core/hle/service/set/set_sys.h1
-rw-r--r--src/yuzu/configuration/config.cpp3
-rw-r--r--src/yuzu/configuration/configure_system.cpp4
-rw-r--r--src/yuzu/configuration/configure_system.ui14
9 files changed, 42 insertions, 2 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index d8ffe34c3..149e621f9 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -40,6 +40,7 @@ void LogSettings() {
40 LOG_INFO(Config, "yuzu Configuration:"); 40 LOG_INFO(Config, "yuzu Configuration:");
41 log_setting("Controls_UseDockedMode", values.use_docked_mode.GetValue()); 41 log_setting("Controls_UseDockedMode", values.use_docked_mode.GetValue());
42 log_setting("System_RngSeed", values.rng_seed.GetValue().value_or(0)); 42 log_setting("System_RngSeed", values.rng_seed.GetValue().value_or(0));
43 log_setting("System_DeviceName", values.device_name.GetValue());
43 log_setting("System_CurrentUser", values.current_user.GetValue()); 44 log_setting("System_CurrentUser", values.current_user.GetValue());
44 log_setting("System_LanguageIndex", values.language_index.GetValue()); 45 log_setting("System_LanguageIndex", values.language_index.GetValue());
45 log_setting("System_RegionIndex", values.region_index.GetValue()); 46 log_setting("System_RegionIndex", values.region_index.GetValue());
diff --git a/src/common/settings.h b/src/common/settings.h
index 7ce9ea23c..6b199af93 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -458,6 +458,7 @@ struct Values {
458 458
459 // System 459 // System
460 SwitchableSetting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"}; 460 SwitchableSetting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"};
461 Setting<std::string> device_name{"Yuzu", "device_name"};
461 // Measured in seconds since epoch 462 // Measured in seconds since epoch
462 std::optional<s64> custom_rtc; 463 std::optional<s64> custom_rtc;
463 // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` 464 // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc`
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp
index 4f1a8d6b7..16c5eaf75 100644
--- a/src/core/hle/service/set/set.cpp
+++ b/src/core/hle/service/set/set.cpp
@@ -191,6 +191,13 @@ void SET::GetKeyCodeMap2(Kernel::HLERequestContext& ctx) {
191 GetKeyCodeMapImpl(ctx); 191 GetKeyCodeMapImpl(ctx);
192} 192}
193 193
194void SET::GetDeviceNickName(Kernel::HLERequestContext& ctx) {
195 LOG_DEBUG(Service_SET, "called");
196 IPC::ResponseBuilder rb{ctx, 2};
197 rb.Push(ResultSuccess);
198 ctx.WriteBuffer(Settings::values.device_name.GetValue());
199}
200
194SET::SET(Core::System& system_) : ServiceFramework{system_, "set"} { 201SET::SET(Core::System& system_) : ServiceFramework{system_, "set"} {
195 // clang-format off 202 // clang-format off
196 static const FunctionInfo functions[] = { 203 static const FunctionInfo functions[] = {
@@ -205,7 +212,7 @@ SET::SET(Core::System& system_) : ServiceFramework{system_, "set"} {
205 {8, &SET::GetQuestFlag, "GetQuestFlag"}, 212 {8, &SET::GetQuestFlag, "GetQuestFlag"},
206 {9, &SET::GetKeyCodeMap2, "GetKeyCodeMap2"}, 213 {9, &SET::GetKeyCodeMap2, "GetKeyCodeMap2"},
207 {10, nullptr, "GetFirmwareVersionForDebug"}, 214 {10, nullptr, "GetFirmwareVersionForDebug"},
208 {11, nullptr, "GetDeviceNickName"}, 215 {11, &SET::GetDeviceNickName, "GetDeviceNickName"},
209 }; 216 };
210 // clang-format on 217 // clang-format on
211 218
diff --git a/src/core/hle/service/set/set.h b/src/core/hle/service/set/set.h
index 60cad3e6f..375975711 100644
--- a/src/core/hle/service/set/set.h
+++ b/src/core/hle/service/set/set.h
@@ -50,6 +50,7 @@ private:
50 void GetRegionCode(Kernel::HLERequestContext& ctx); 50 void GetRegionCode(Kernel::HLERequestContext& ctx);
51 void GetKeyCodeMap(Kernel::HLERequestContext& ctx); 51 void GetKeyCodeMap(Kernel::HLERequestContext& ctx);
52 void GetKeyCodeMap2(Kernel::HLERequestContext& ctx); 52 void GetKeyCodeMap2(Kernel::HLERequestContext& ctx);
53 void GetDeviceNickName(Kernel::HLERequestContext& ctx);
53}; 54};
54 55
55} // namespace Service::Set 56} // namespace Service::Set
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp
index d7cea6aac..94c20edda 100644
--- a/src/core/hle/service/set/set_sys.cpp
+++ b/src/core/hle/service/set/set_sys.cpp
@@ -3,6 +3,7 @@
3 3
4#include "common/assert.h" 4#include "common/assert.h"
5#include "common/logging/log.h" 5#include "common/logging/log.h"
6#include "common/settings.h"
6#include "core/file_sys/errors.h" 7#include "core/file_sys/errors.h"
7#include "core/file_sys/system_archive/system_version.h" 8#include "core/file_sys/system_archive/system_version.h"
8#include "core/hle/ipc_helpers.h" 9#include "core/hle/ipc_helpers.h"
@@ -176,6 +177,13 @@ void SET_SYS::GetSettingsItemValue(Kernel::HLERequestContext& ctx) {
176 rb.Push(response); 177 rb.Push(response);
177} 178}
178 179
180void SET_SYS::GetDeviceNickName(Kernel::HLERequestContext& ctx) {
181 LOG_DEBUG(Service_SET, "called");
182 IPC::ResponseBuilder rb{ctx, 2};
183 rb.Push(ResultSuccess);
184 ctx.WriteBuffer(::Settings::values.device_name.GetValue());
185}
186
179SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { 187SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
180 // clang-format off 188 // clang-format off
181 static const FunctionInfo functions[] = { 189 static const FunctionInfo functions[] = {
@@ -253,7 +261,7 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
253 {74, nullptr, "SetWirelessLanEnableFlag"}, 261 {74, nullptr, "SetWirelessLanEnableFlag"},
254 {75, nullptr, "GetInitialLaunchSettings"}, 262 {75, nullptr, "GetInitialLaunchSettings"},
255 {76, nullptr, "SetInitialLaunchSettings"}, 263 {76, nullptr, "SetInitialLaunchSettings"},
256 {77, nullptr, "GetDeviceNickName"}, 264 {77, &SET_SYS::GetDeviceNickName, "GetDeviceNickName"},
257 {78, nullptr, "SetDeviceNickName"}, 265 {78, nullptr, "SetDeviceNickName"},
258 {79, nullptr, "GetProductModel"}, 266 {79, nullptr, "GetProductModel"},
259 {80, nullptr, "GetLdnChannel"}, 267 {80, nullptr, "GetLdnChannel"},
diff --git a/src/core/hle/service/set/set_sys.h b/src/core/hle/service/set/set_sys.h
index 258ef8c57..464ac3da1 100644
--- a/src/core/hle/service/set/set_sys.h
+++ b/src/core/hle/service/set/set_sys.h
@@ -29,6 +29,7 @@ private:
29 void GetFirmwareVersion2(Kernel::HLERequestContext& ctx); 29 void GetFirmwareVersion2(Kernel::HLERequestContext& ctx);
30 void GetColorSetId(Kernel::HLERequestContext& ctx); 30 void GetColorSetId(Kernel::HLERequestContext& ctx);
31 void SetColorSetId(Kernel::HLERequestContext& ctx); 31 void SetColorSetId(Kernel::HLERequestContext& ctx);
32 void GetDeviceNickName(Kernel::HLERequestContext& ctx);
32 33
33 ColorSet color_set = ColorSet::BasicWhite; 34 ColorSet color_set = ColorSet::BasicWhite;
34}; 35};
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 90fb4b0a4..a8d47a2f9 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -783,6 +783,8 @@ void Config::ReadSystemValues() {
783 } 783 }
784 } 784 }
785 785
786 ReadBasicSetting(Settings::values.device_name);
787
786 if (global) { 788 if (global) {
787 ReadBasicSetting(Settings::values.current_user); 789 ReadBasicSetting(Settings::values.current_user);
788 Settings::values.current_user = std::clamp<int>(Settings::values.current_user.GetValue(), 0, 790 Settings::values.current_user = std::clamp<int>(Settings::values.current_user.GetValue(), 0,
@@ -1405,6 +1407,7 @@ void Config::SaveSystemValues() {
1405 Settings::values.rng_seed.UsingGlobal()); 1407 Settings::values.rng_seed.UsingGlobal());
1406 WriteSetting(QStringLiteral("rng_seed"), Settings::values.rng_seed.GetValue(global).value_or(0), 1408 WriteSetting(QStringLiteral("rng_seed"), Settings::values.rng_seed.GetValue(global).value_or(0),
1407 0, Settings::values.rng_seed.UsingGlobal()); 1409 0, Settings::values.rng_seed.UsingGlobal());
1410 WriteBasicSetting(Settings::values.device_name);
1408 1411
1409 if (global) { 1412 if (global) {
1410 WriteBasicSetting(Settings::values.current_user); 1413 WriteBasicSetting(Settings::values.current_user);
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp
index bc9d9d77a..9b14e5903 100644
--- a/src/yuzu/configuration/configure_system.cpp
+++ b/src/yuzu/configuration/configure_system.cpp
@@ -72,6 +72,8 @@ void ConfigureSystem::SetConfiguration() {
72 ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.has_value()); 72 ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.has_value());
73 ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.has_value()); 73 ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.has_value());
74 ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time)); 74 ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time));
75 ui->device_name_edit->setText(
76 QString::fromUtf8(Settings::values.device_name.GetValue().c_str()));
75 77
76 if (Settings::IsConfiguringGlobal()) { 78 if (Settings::IsConfiguringGlobal()) {
77 ui->combo_language->setCurrentIndex(Settings::values.language_index.GetValue()); 79 ui->combo_language->setCurrentIndex(Settings::values.language_index.GetValue());
@@ -115,6 +117,8 @@ void ConfigureSystem::ApplyConfiguration() {
115 } 117 }
116 } 118 }
117 119
120 Settings::values.device_name = ui->device_name_edit->text().toStdString();
121
118 if (!enabled) { 122 if (!enabled) {
119 return; 123 return;
120 } 124 }
diff --git a/src/yuzu/configuration/configure_system.ui b/src/yuzu/configuration/configure_system.ui
index b234ea87b..46892f5c1 100644
--- a/src/yuzu/configuration/configure_system.ui
+++ b/src/yuzu/configuration/configure_system.ui
@@ -432,6 +432,13 @@
432 </property> 432 </property>
433 </widget> 433 </widget>
434 </item> 434 </item>
435 <item row="7" column="0">
436 <widget class="QLabel" name="device_name_label">
437 <property name="text">
438 <string>Device Name</string>
439 </property>
440 </widget>
441 </item>
435 <item row="3" column="1"> 442 <item row="3" column="1">
436 <widget class="QComboBox" name="combo_sound"> 443 <widget class="QComboBox" name="combo_sound">
437 <item> 444 <item>
@@ -476,6 +483,13 @@
476 </property> 483 </property>
477 </widget> 484 </widget>
478 </item> 485 </item>
486 <item row="7" column="1">
487 <widget class="QLineEdit" name="device_name_edit">
488 <property name="maxLength">
489 <number>128</number>
490 </property>
491 </widget>
492 </item>
479 <item row="6" column="1"> 493 <item row="6" column="1">
480 <widget class="QLineEdit" name="rng_seed_edit"> 494 <widget class="QLineEdit" name="rng_seed_edit">
481 <property name="sizePolicy"> 495 <property name="sizePolicy">