summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-07-25 10:25:29 -0700
committerGravatar GitHub2018-07-25 10:25:29 -0700
commit5c42cadbc9e03f69b5544fedd152e646182b3af4 (patch)
tree6bbb0c812f4d04105888c46f4bdbcdd5e55d334c /src
parentMerge pull request #813 from Subv/z24_s8_tex (diff)
parentset_sys: Implement SetColorSetId() (diff)
downloadyuzu-5c42cadbc9e03f69b5544fedd152e646182b3af4.tar.gz
yuzu-5c42cadbc9e03f69b5544fedd152e646182b3af4.tar.xz
yuzu-5c42cadbc9e03f69b5544fedd152e646182b3af4.zip
Merge pull request #800 from lioncash/set
set_sys: Implement SetColorSetId()
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/ipc_helpers.h8
-rw-r--r--src/core/hle/service/set/set_sys.cpp19
-rw-r--r--src/core/hle/service/set/set_sys.h11
3 files changed, 33 insertions, 5 deletions
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h
index f5bd27a75..7fb0da408 100644
--- a/src/core/hle/ipc_helpers.h
+++ b/src/core/hle/ipc_helpers.h
@@ -300,6 +300,14 @@ public:
300 template <typename First, typename... Other> 300 template <typename First, typename... Other>
301 void Pop(First& first_value, Other&... other_values); 301 void Pop(First& first_value, Other&... other_values);
302 302
303 template <typename T>
304 T PopEnum() {
305 static_assert(std::is_enum_v<T>, "T must be an enum type within a PopEnum call.");
306 static_assert(!std::is_convertible_v<T, int>,
307 "enum type in PopEnum must be a strongly typed enum.");
308 return static_cast<T>(Pop<std::underlying_type_t<T>>());
309 }
310
303 /** 311 /**
304 * @brief Reads the next normal parameters as a struct, by copying it 312 * @brief Reads the next normal parameters as a struct, by copying it
305 * @note: The output class must be correctly packed/padded to fit hardware layout. 313 * @note: The output class must be correctly packed/padded to fit hardware layout.
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp
index fa85277fe..41efca31c 100644
--- a/src/core/hle/service/set/set_sys.cpp
+++ b/src/core/hle/service/set/set_sys.cpp
@@ -10,13 +10,22 @@
10namespace Service::Set { 10namespace Service::Set {
11 11
12void SET_SYS::GetColorSetId(Kernel::HLERequestContext& ctx) { 12void SET_SYS::GetColorSetId(Kernel::HLERequestContext& ctx) {
13
14 IPC::ResponseBuilder rb{ctx, 3}; 13 IPC::ResponseBuilder rb{ctx, 3};
15 14
16 rb.Push(RESULT_SUCCESS); 15 rb.Push(RESULT_SUCCESS);
17 rb.Push<u32>(0); 16 rb.PushEnum(color_set);
18 17
19 LOG_WARNING(Service_SET, "(STUBBED) called"); 18 LOG_DEBUG(Service_SET, "called");
19}
20
21void SET_SYS::SetColorSetId(Kernel::HLERequestContext& ctx) {
22 IPC::RequestParser rp{ctx};
23 color_set = rp.PopEnum<ColorSet>();
24
25 IPC::ResponseBuilder rb{ctx, 2};
26 rb.Push(RESULT_SUCCESS);
27
28 LOG_DEBUG(Service_SET, "called");
20} 29}
21 30
22SET_SYS::SET_SYS() : ServiceFramework("set:sys") { 31SET_SYS::SET_SYS() : ServiceFramework("set:sys") {
@@ -44,7 +53,7 @@ SET_SYS::SET_SYS() : ServiceFramework("set:sys") {
44 {21, nullptr, "GetEulaVersions"}, 53 {21, nullptr, "GetEulaVersions"},
45 {22, nullptr, "SetEulaVersions"}, 54 {22, nullptr, "SetEulaVersions"},
46 {23, &SET_SYS::GetColorSetId, "GetColorSetId"}, 55 {23, &SET_SYS::GetColorSetId, "GetColorSetId"},
47 {24, nullptr, "SetColorSetId"}, 56 {24, &SET_SYS::SetColorSetId, "SetColorSetId"},
48 {25, nullptr, "GetConsoleInformationUploadFlag"}, 57 {25, nullptr, "GetConsoleInformationUploadFlag"},
49 {26, nullptr, "SetConsoleInformationUploadFlag"}, 58 {26, nullptr, "SetConsoleInformationUploadFlag"},
50 {27, nullptr, "GetAutomaticApplicationDownloadFlag"}, 59 {27, nullptr, "GetAutomaticApplicationDownloadFlag"},
@@ -172,4 +181,6 @@ SET_SYS::SET_SYS() : ServiceFramework("set:sys") {
172 RegisterHandlers(functions); 181 RegisterHandlers(functions);
173} 182}
174 183
184SET_SYS::~SET_SYS() = default;
185
175} // namespace Service::Set 186} // namespace Service::Set
diff --git a/src/core/hle/service/set/set_sys.h b/src/core/hle/service/set/set_sys.h
index b77a97cde..f602f3c77 100644
--- a/src/core/hle/service/set/set_sys.h
+++ b/src/core/hle/service/set/set_sys.h
@@ -11,10 +11,19 @@ namespace Service::Set {
11class SET_SYS final : public ServiceFramework<SET_SYS> { 11class SET_SYS final : public ServiceFramework<SET_SYS> {
12public: 12public:
13 explicit SET_SYS(); 13 explicit SET_SYS();
14 ~SET_SYS() = default; 14 ~SET_SYS() override;
15 15
16private: 16private:
17 /// Indicates the current theme set by the system settings
18 enum class ColorSet : u32 {
19 BasicWhite = 0,
20 BasicBlack = 1,
21 };
22
17 void GetColorSetId(Kernel::HLERequestContext& ctx); 23 void GetColorSetId(Kernel::HLERequestContext& ctx);
24 void SetColorSetId(Kernel::HLERequestContext& ctx);
25
26 ColorSet color_set = ColorSet::BasicWhite;
18}; 27};
19 28
20} // namespace Service::Set 29} // namespace Service::Set