Merge pull request #800 from lioncash/set

set_sys: Implement SetColorSetId()
This commit is contained in:
bunnei 2018-07-25 10:25:29 -07:00 committed by GitHub
commit 5c42cadbc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 5 deletions

View File

@ -300,6 +300,14 @@ public:
template <typename First, typename... Other> template <typename First, typename... Other>
void Pop(First& first_value, Other&... other_values); void Pop(First& first_value, Other&... other_values);
template <typename T>
T PopEnum() {
static_assert(std::is_enum_v<T>, "T must be an enum type within a PopEnum call.");
static_assert(!std::is_convertible_v<T, int>,
"enum type in PopEnum must be a strongly typed enum.");
return static_cast<T>(Pop<std::underlying_type_t<T>>());
}
/** /**
* @brief Reads the next normal parameters as a struct, by copying it * @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. * @note: The output class must be correctly packed/padded to fit hardware layout.

View File

@ -10,13 +10,22 @@
namespace Service::Set { namespace Service::Set {
void SET_SYS::GetColorSetId(Kernel::HLERequestContext& ctx) { void SET_SYS::GetColorSetId(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(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<ColorSet>();
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
LOG_DEBUG(Service_SET, "called");
} }
SET_SYS::SET_SYS() : ServiceFramework("set:sys") { SET_SYS::SET_SYS() : ServiceFramework("set:sys") {
@ -44,7 +53,7 @@ SET_SYS::SET_SYS() : ServiceFramework("set:sys") {
{21, nullptr, "GetEulaVersions"}, {21, nullptr, "GetEulaVersions"},
{22, nullptr, "SetEulaVersions"}, {22, nullptr, "SetEulaVersions"},
{23, &SET_SYS::GetColorSetId, "GetColorSetId"}, {23, &SET_SYS::GetColorSetId, "GetColorSetId"},
{24, nullptr, "SetColorSetId"}, {24, &SET_SYS::SetColorSetId, "SetColorSetId"},
{25, nullptr, "GetConsoleInformationUploadFlag"}, {25, nullptr, "GetConsoleInformationUploadFlag"},
{26, nullptr, "SetConsoleInformationUploadFlag"}, {26, nullptr, "SetConsoleInformationUploadFlag"},
{27, nullptr, "GetAutomaticApplicationDownloadFlag"}, {27, nullptr, "GetAutomaticApplicationDownloadFlag"},
@ -172,4 +181,6 @@ SET_SYS::SET_SYS() : ServiceFramework("set:sys") {
RegisterHandlers(functions); RegisterHandlers(functions);
} }
SET_SYS::~SET_SYS() = default;
} // namespace Service::Set } // namespace Service::Set

View File

@ -11,10 +11,19 @@ namespace Service::Set {
class SET_SYS final : public ServiceFramework<SET_SYS> { class SET_SYS final : public ServiceFramework<SET_SYS> {
public: public:
explicit SET_SYS(); explicit SET_SYS();
~SET_SYS() = default; ~SET_SYS() override;
private: private:
/// Indicates the current theme set by the system settings
enum class ColorSet : u32 {
BasicWhite = 0,
BasicBlack = 1,
};
void GetColorSetId(Kernel::HLERequestContext& ctx); void GetColorSetId(Kernel::HLERequestContext& ctx);
void SetColorSetId(Kernel::HLERequestContext& ctx);
ColorSet color_set = ColorSet::BasicWhite;
}; };
} // namespace Service::Set } // namespace Service::Set