summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/set
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2023-08-04 20:50:38 +0200
committerNarr the Reg <juangerman-13@hotmail.com>2023-08-05 01:20:40 +0200
commit7707768f80be477fce20131530731295420bb3f1 (patch)
tree62b2a989161343d0343c8c6dceb00b7cbf62fb41 /src/core/hle/service/set
parentservice: set: Implement system settings for Qlaunch (diff)
downloadyuzu-7707768f80be477fce20131530731295420bb3f1.tar
yuzu-7707768f80be477fce20131530731295420bb3f1.tar.gz
yuzu-7707768f80be477fce20131530731295420bb3f1.tar.bz2
yuzu-7707768f80be477fce20131530731295420bb3f1.tar.lz
yuzu-7707768f80be477fce20131530731295420bb3f1.tar.xz
yuzu-7707768f80be477fce20131530731295420bb3f1.tar.zst
yuzu-7707768f80be477fce20131530731295420bb3f1.zip
Diffstat (limited to 'src/core/hle/service/set')
-rw-r--r--src/core/hle/service/set/set_sys.cpp69
-rw-r--r--src/core/hle/service/set/set_sys.h38
2 files changed, 100 insertions, 7 deletions
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp
index 297e78379..165b97dad 100644
--- a/src/core/hle/service/set/set_sys.cpp
+++ b/src/core/hle/service/set/set_sys.cpp
@@ -75,6 +75,16 @@ void GetFirmwareVersionImpl(HLERequestContext& ctx, GetFirmwareVersionType type)
}
} // Anonymous namespace
+void SET_SYS::SetLanguageCode(HLERequestContext& ctx) {
+ IPC::RequestParser rp{ctx};
+ language_code_setting = rp.PopEnum<LanguageCode>();
+
+ LOG_INFO(Service_SET, "called, language_code={}", language_code_setting);
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ResultSuccess);
+}
+
void SET_SYS::GetFirmwareVersion(HLERequestContext& ctx) {
LOG_DEBUG(Service_SET, "called");
GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version1);
@@ -103,6 +113,33 @@ void SET_SYS::SetAccountSettings(HLERequestContext& ctx) {
rb.Push(ResultSuccess);
}
+void SET_SYS::GetEulaVersions(HLERequestContext& ctx) {
+ LOG_INFO(Service_SET, "called");
+
+ ctx.WriteBuffer(eula_versions);
+
+ IPC::ResponseBuilder rb{ctx, 3};
+ rb.Push(ResultSuccess);
+ rb.Push(static_cast<u32>(eula_versions.size()));
+}
+
+void SET_SYS::SetEulaVersions(HLERequestContext& ctx) {
+ const auto elements = ctx.GetReadBufferNumElements<EulaVersion>();
+ const auto buffer_data = ctx.ReadBuffer();
+
+ LOG_INFO(Service_SET, "called, elements={}", elements);
+
+ eula_versions.resize(elements);
+ for (std::size_t index = 0; index < elements; index++) {
+ const std::size_t start_index = index * sizeof(EulaVersion);
+ memcpy(eula_versions.data() + start_index, buffer_data.data() + start_index,
+ sizeof(EulaVersion));
+ }
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ResultSuccess);
+}
+
void SET_SYS::GetColorSetId(HLERequestContext& ctx) {
LOG_DEBUG(Service_SET, "called");
@@ -149,7 +186,7 @@ void SET_SYS::GetAccountNotificationSettings(HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
- rb.Push(account_notifications.size());
+ rb.Push(static_cast<u32>(account_notifications.size()));
}
void SET_SYS::SetAccountNotificationSettings(HLERequestContext& ctx) {
@@ -275,6 +312,16 @@ void SET_SYS::GetQuestFlag(HLERequestContext& ctx) {
rb.PushEnum(QuestFlag::Retail);
}
+void SET_SYS::SetRegionCode(HLERequestContext& ctx) {
+ IPC::RequestParser rp{ctx};
+ region_code = rp.PopEnum<RegionCode>();
+
+ LOG_INFO(Service_SET, "called, region_code={}", region_code);
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ResultSuccess);
+}
+
void SET_SYS::GetPrimaryAlbumStorage(HLERequestContext& ctx) {
LOG_WARNING(Service_SET, "(STUBBED) called");
@@ -286,7 +333,7 @@ void SET_SYS::GetPrimaryAlbumStorage(HLERequestContext& ctx) {
void SET_SYS::GetSleepSettings(HLERequestContext& ctx) {
LOG_INFO(Service_SET, "called");
- IPC::ResponseBuilder rb{ctx, 7};
+ IPC::ResponseBuilder rb{ctx, 5};
rb.Push(ResultSuccess);
rb.PushRaw(sleep_settings);
}
@@ -434,10 +481,18 @@ void SET_SYS::GetChineseTraditionalInputMethod(HLERequestContext& ctx) {
rb.PushEnum(ChineseTraditionalInputMethod::Unknown0);
}
+void SET_SYS::GetFieldTestingFlag(HLERequestContext& ctx) {
+ LOG_WARNING(Service_SET, "(STUBBED) called");
+
+ IPC::ResponseBuilder rb{ctx, 3};
+ rb.Push(ResultSuccess);
+ rb.Push<u8>(false);
+}
+
SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
// clang-format off
static const FunctionInfo functions[] = {
- {0, nullptr, "SetLanguageCode"},
+ {0, &SET_SYS::SetLanguageCode, "SetLanguageCode"},
{1, nullptr, "SetNetworkSettings"},
{2, nullptr, "GetNetworkSettings"},
{3, &SET_SYS::GetFirmwareVersion, "GetFirmwareVersion"},
@@ -457,8 +512,8 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
{18, &SET_SYS::SetAccountSettings, "SetAccountSettings"},
{19, nullptr, "GetAudioVolume"},
{20, nullptr, "SetAudioVolume"},
- {21, nullptr, "GetEulaVersions"},
- {22, nullptr, "SetEulaVersions"},
+ {21, &SET_SYS::GetEulaVersions, "GetEulaVersions"},
+ {22, &SET_SYS::SetEulaVersions, "SetEulaVersions"},
{23, &SET_SYS::GetColorSetId, "GetColorSetId"},
{24, &SET_SYS::SetColorSetId, "SetColorSetId"},
{25, nullptr, "GetConsoleInformationUploadFlag"},
@@ -491,7 +546,7 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
{54, nullptr, "SetDeviceTimeZoneLocationName"},
{55, nullptr, "GetWirelessCertificationFileSize"},
{56, nullptr, "GetWirelessCertificationFile"},
- {57, nullptr, "SetRegionCode"},
+ {57, &SET_SYS::SetRegionCode, "SetRegionCode"},
{58, nullptr, "GetNetworkSystemClockContext"},
{59, nullptr, "SetNetworkSystemClockContext"},
{60, nullptr, "IsUserSystemClockAutomaticCorrectionEnabled"},
@@ -635,7 +690,7 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
{198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"},
{199, nullptr, "GetButtonConfigRegisteredSettings"},
{200, nullptr, "SetButtonConfigRegisteredSettings"},
- {201, nullptr, "GetFieldTestingFlag"},
+ {201, &SET_SYS::GetFieldTestingFlag, "GetFieldTestingFlag"},
{202, nullptr, "SetFieldTestingFlag"},
{203, nullptr, "GetPanelCrcMode"},
{204, nullptr, "SetPanelCrcMode"},
diff --git a/src/core/hle/service/set/set_sys.h b/src/core/hle/service/set/set_sys.h
index 16624d3fd..c7dba2a9e 100644
--- a/src/core/hle/service/set/set_sys.h
+++ b/src/core/hle/service/set/set_sys.h
@@ -118,6 +118,22 @@ private:
Never,
};
+ /// This is nn::settings::system::RegionCode
+ enum class RegionCode : u32 {
+ Japan,
+ Usa,
+ Europe,
+ Australia,
+ HongKongTaiwanKorea,
+ China,
+ };
+
+ /// This is nn::settings::system::EulaVersionClockType
+ enum class EulaVersionClockType : u32 {
+ NetworkSystemClock,
+ SteadyClock,
+ };
+
/// This is nn::settings::system::SleepFlag
struct SleepFlag {
union {
@@ -242,10 +258,24 @@ private:
};
static_assert(sizeof(InitialLaunchSettings) == 0x20, "InitialLaunchSettings is incorrect size");
+ /// This is nn::settings::system::InitialLaunchSettings
+ struct EulaVersion {
+ u32 version;
+ RegionCode region_code;
+ EulaVersionClockType clock_type;
+ INSERT_PADDING_BYTES(0x4);
+ s64 posix_time;
+ Time::Clock::SteadyClockTimePoint timestamp;
+ };
+ static_assert(sizeof(EulaVersion) == 0x30, "EulaVersion is incorrect size");
+
+ void SetLanguageCode(HLERequestContext& ctx);
void GetFirmwareVersion(HLERequestContext& ctx);
void GetFirmwareVersion2(HLERequestContext& ctx);
void GetAccountSettings(HLERequestContext& ctx);
void SetAccountSettings(HLERequestContext& ctx);
+ void GetEulaVersions(HLERequestContext& ctx);
+ void SetEulaVersions(HLERequestContext& ctx);
void GetColorSetId(HLERequestContext& ctx);
void SetColorSetId(HLERequestContext& ctx);
void GetNotificationSettings(HLERequestContext& ctx);
@@ -257,6 +287,7 @@ private:
void GetTvSettings(HLERequestContext& ctx);
void SetTvSettings(HLERequestContext& ctx);
void GetQuestFlag(HLERequestContext& ctx);
+ void SetRegionCode(HLERequestContext& ctx);
void GetPrimaryAlbumStorage(HLERequestContext& ctx);
void GetSleepSettings(HLERequestContext& ctx);
void SetSleepSettings(HLERequestContext& ctx);
@@ -273,6 +304,7 @@ private:
void SetAppletLaunchFlags(HLERequestContext& ctx);
void GetKeyboardLayout(HLERequestContext& ctx);
void GetChineseTraditionalInputMethod(HLERequestContext& ctx);
+ void GetFieldTestingFlag(HLERequestContext& ctx);
AccountSettings account_settings{
.flags = {},
@@ -312,6 +344,12 @@ private:
};
u32 applet_launch_flag{};
+
+ std::vector<EulaVersion> eula_versions{};
+
+ RegionCode region_code;
+
+ LanguageCode language_code_setting;
};
} // namespace Service::Set