From 76f191ce3695c834fa6c2ffd2991b55e1bb96ccb Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 24 Jul 2018 00:47:01 -0400 Subject: ipc_helper: Add helper member function for popping enum values to RequestParser --- src/core/hle/ipc_helpers.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/core') diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index 8b5b06f31..ac1a633ba 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h @@ -298,6 +298,14 @@ public: template void Pop(First& first_value, Other&... other_values); + template + T PopEnum() { + static_assert(std::is_enum_v, "T must be an enum type within a PopEnum call."); + static_assert(!std::is_convertible_v, + "enum type in PopEnum must be a strongly typed enum."); + return static_cast(Pop>()); + } + /** * @brief Reads the next normal parameters as a struct, by copying it * @note: The output class must be correctly packed/padded to fit hardware layout. -- cgit v1.2.3 From 63c605c04af6f236cf13daf71cd6107b122820b5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 23 Jul 2018 23:47:01 -0400 Subject: set_sys: Implement SetColorSetId() --- src/core/hle/service/set/set_sys.cpp | 19 +++++++++++++++---- src/core/hle/service/set/set_sys.h | 11 ++++++++++- 2 files changed, 25 insertions(+), 5 deletions(-) (limited to 'src/core') 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 @@ namespace Service::Set { void SET_SYS::GetColorSetId(Kernel::HLERequestContext& ctx) { - IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); - rb.Push(0); + rb.PushEnum(color_set); - LOG_WARNING(Service_SET, "(STUBBED) called"); + LOG_DEBUG(Service_SET, "called"); +} + +void SET_SYS::SetColorSetId(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + color_set = rp.PopEnum(); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); + + LOG_DEBUG(Service_SET, "called"); } SET_SYS::SET_SYS() : ServiceFramework("set:sys") { @@ -44,7 +53,7 @@ SET_SYS::SET_SYS() : ServiceFramework("set:sys") { {21, nullptr, "GetEulaVersions"}, {22, nullptr, "SetEulaVersions"}, {23, &SET_SYS::GetColorSetId, "GetColorSetId"}, - {24, nullptr, "SetColorSetId"}, + {24, &SET_SYS::SetColorSetId, "SetColorSetId"}, {25, nullptr, "GetConsoleInformationUploadFlag"}, {26, nullptr, "SetConsoleInformationUploadFlag"}, {27, nullptr, "GetAutomaticApplicationDownloadFlag"}, @@ -172,4 +181,6 @@ SET_SYS::SET_SYS() : ServiceFramework("set:sys") { RegisterHandlers(functions); } +SET_SYS::~SET_SYS() = default; + } // 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 { class SET_SYS final : public ServiceFramework { public: explicit SET_SYS(); - ~SET_SYS() = default; + ~SET_SYS() override; private: + /// Indicates the current theme set by the system settings + enum class ColorSet : u32 { + BasicWhite = 0, + BasicBlack = 1, + }; + void GetColorSetId(Kernel::HLERequestContext& ctx); + void SetColorSetId(Kernel::HLERequestContext& ctx); + + ColorSet color_set = ColorSet::BasicWhite; }; } // namespace Service::Set -- cgit v1.2.3