diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2022-12-16 20:05:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-16 20:05:00 +0100 |
commit | bbb202ceedf8c4054f6a602ad572ba8df33e315d (patch) | |
tree | 8b51f7711e7b698ca712c24b854f88a0022e1d9c /src | |
parent | Merge pull request #9450 from ameerj/hle-ipc-vector-reserve (diff) | |
parent | Set: Allow setting device nickname (diff) | |
download | yuzu-bbb202ceedf8c4054f6a602ad572ba8df33e315d.tar yuzu-bbb202ceedf8c4054f6a602ad572ba8df33e315d.tar.gz yuzu-bbb202ceedf8c4054f6a602ad572ba8df33e315d.tar.bz2 yuzu-bbb202ceedf8c4054f6a602ad572ba8df33e315d.tar.lz yuzu-bbb202ceedf8c4054f6a602ad572ba8df33e315d.tar.xz yuzu-bbb202ceedf8c4054f6a602ad572ba8df33e315d.tar.zst yuzu-bbb202ceedf8c4054f6a602ad572ba8df33e315d.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/common/settings.cpp | 1 | ||||
-rw-r--r-- | src/common/settings.h | 1 | ||||
-rw-r--r-- | src/core/hle/service/set/set.cpp | 9 | ||||
-rw-r--r-- | src/core/hle/service/set/set.h | 1 | ||||
-rw-r--r-- | src/core/hle/service/set/set_sys.cpp | 10 | ||||
-rw-r--r-- | src/core/hle/service/set/set_sys.h | 1 | ||||
-rw-r--r-- | src/yuzu/configuration/config.cpp | 3 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_system.cpp | 4 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_system.ui | 14 |
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() { LOG_INFO(Config, "yuzu Configuration:"); log_setting("Controls_UseDockedMode", values.use_docked_mode.GetValue()); log_setting("System_RngSeed", values.rng_seed.GetValue().value_or(0)); + log_setting("System_DeviceName", values.device_name.GetValue()); log_setting("System_CurrentUser", values.current_user.GetValue()); log_setting("System_LanguageIndex", values.language_index.GetValue()); 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 { // System SwitchableSetting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"}; + Setting<std::string> device_name{"Yuzu", "device_name"}; // Measured in seconds since epoch std::optional<s64> custom_rtc; // 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) { GetKeyCodeMapImpl(ctx); } +void SET::GetDeviceNickName(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_SET, "called"); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + ctx.WriteBuffer(Settings::values.device_name.GetValue()); +} + SET::SET(Core::System& system_) : ServiceFramework{system_, "set"} { // clang-format off static const FunctionInfo functions[] = { @@ -205,7 +212,7 @@ SET::SET(Core::System& system_) : ServiceFramework{system_, "set"} { {8, &SET::GetQuestFlag, "GetQuestFlag"}, {9, &SET::GetKeyCodeMap2, "GetKeyCodeMap2"}, {10, nullptr, "GetFirmwareVersionForDebug"}, - {11, nullptr, "GetDeviceNickName"}, + {11, &SET::GetDeviceNickName, "GetDeviceNickName"}, }; // clang-format on 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: void GetRegionCode(Kernel::HLERequestContext& ctx); void GetKeyCodeMap(Kernel::HLERequestContext& ctx); void GetKeyCodeMap2(Kernel::HLERequestContext& ctx); + void GetDeviceNickName(Kernel::HLERequestContext& ctx); }; } // 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 @@ #include "common/assert.h" #include "common/logging/log.h" +#include "common/settings.h" #include "core/file_sys/errors.h" #include "core/file_sys/system_archive/system_version.h" #include "core/hle/ipc_helpers.h" @@ -176,6 +177,13 @@ void SET_SYS::GetSettingsItemValue(Kernel::HLERequestContext& ctx) { rb.Push(response); } +void SET_SYS::GetDeviceNickName(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_SET, "called"); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + ctx.WriteBuffer(::Settings::values.device_name.GetValue()); +} + SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { // clang-format off static const FunctionInfo functions[] = { @@ -253,7 +261,7 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { {74, nullptr, "SetWirelessLanEnableFlag"}, {75, nullptr, "GetInitialLaunchSettings"}, {76, nullptr, "SetInitialLaunchSettings"}, - {77, nullptr, "GetDeviceNickName"}, + {77, &SET_SYS::GetDeviceNickName, "GetDeviceNickName"}, {78, nullptr, "SetDeviceNickName"}, {79, nullptr, "GetProductModel"}, {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: void GetFirmwareVersion2(Kernel::HLERequestContext& ctx); void GetColorSetId(Kernel::HLERequestContext& ctx); void SetColorSetId(Kernel::HLERequestContext& ctx); + void GetDeviceNickName(Kernel::HLERequestContext& ctx); ColorSet color_set = ColorSet::BasicWhite; }; 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() { } } + ReadBasicSetting(Settings::values.device_name); + if (global) { ReadBasicSetting(Settings::values.current_user); Settings::values.current_user = std::clamp<int>(Settings::values.current_user.GetValue(), 0, @@ -1405,6 +1407,7 @@ void Config::SaveSystemValues() { Settings::values.rng_seed.UsingGlobal()); WriteSetting(QStringLiteral("rng_seed"), Settings::values.rng_seed.GetValue(global).value_or(0), 0, Settings::values.rng_seed.UsingGlobal()); + WriteBasicSetting(Settings::values.device_name); if (global) { 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() { ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.has_value()); ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.has_value()); ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time)); + ui->device_name_edit->setText( + QString::fromUtf8(Settings::values.device_name.GetValue().c_str())); if (Settings::IsConfiguringGlobal()) { ui->combo_language->setCurrentIndex(Settings::values.language_index.GetValue()); @@ -115,6 +117,8 @@ void ConfigureSystem::ApplyConfiguration() { } } + Settings::values.device_name = ui->device_name_edit->text().toStdString(); + if (!enabled) { return; } 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 @@ </property> </widget> </item> + <item row="7" column="0"> + <widget class="QLabel" name="device_name_label"> + <property name="text"> + <string>Device Name</string> + </property> + </widget> + </item> <item row="3" column="1"> <widget class="QComboBox" name="combo_sound"> <item> @@ -476,6 +483,13 @@ </property> </widget> </item> + <item row="7" column="1"> + <widget class="QLineEdit" name="device_name_edit"> + <property name="maxLength"> + <number>128</number> + </property> + </widget> + </item> <item row="6" column="1"> <widget class="QLineEdit" name="rng_seed_edit"> <property name="sizePolicy"> |