service: hid: Fully implement touch resource

This commit is contained in:
Narr the Reg
2024-01-16 12:17:18 -06:00
committed by german77
parent 6a2532fe17
commit 575183d6dc
30 changed files with 1888 additions and 745 deletions

View File

@ -12,6 +12,7 @@
#include "common/vector_math.h"
#include "core/hle/service/set/setting_formats/private_settings.h"
#include "core/hle/service/set/settings_types.h"
#include "hid_core/resources/touch_screen/touch_types.h"
namespace Service::Set {
@ -257,8 +258,7 @@ struct SystemSettings {
std::array<u8, 0x10> analog_stick_user_calibration_left;
std::array<u8, 0x10> analog_stick_user_calibration_right;
// nn::settings::system::TouchScreenMode
s32 touch_screen_mode;
TouchScreenMode touch_screen_mode;
INSERT_PADDING_BYTES(0x14); // Reserved
TvSettings tv_settings;

View File

@ -275,8 +275,8 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
{184, nullptr, "SetPlatformRegion"},
{185, &ISystemSettingsServer::GetHomeMenuSchemeModel, "GetHomeMenuSchemeModel"},
{186, nullptr, "GetMemoryUsageRateFlag"},
{187, nullptr, "GetTouchScreenMode"},
{188, nullptr, "SetTouchScreenMode"},
{187, &ISystemSettingsServer::GetTouchScreenMode, "GetTouchScreenMode"},
{188, &ISystemSettingsServer::SetTouchScreenMode, "SetTouchScreenMode"},
{189, nullptr, "GetButtonConfigSettingsFull"},
{190, nullptr, "SetButtonConfigSettingsFull"},
{191, nullptr, "GetButtonConfigSettingsEmbedded"},
@ -1395,6 +1395,28 @@ void ISystemSettingsServer::GetHomeMenuSchemeModel(HLERequestContext& ctx) {
rb.Push(0);
}
void ISystemSettingsServer::GetTouchScreenMode(HLERequestContext& ctx) {
TouchScreenMode touch_screen_mode{};
auto res = GetTouchScreenMode(touch_screen_mode);
LOG_INFO(Service_SET, "called, touch_screen_mode={}", touch_screen_mode);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(res);
rb.PushEnum(touch_screen_mode);
}
void ISystemSettingsServer::SetTouchScreenMode(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto touch_screen_mode = rp.PopEnum<TouchScreenMode>();
auto res = SetTouchScreenMode(touch_screen_mode);
LOG_INFO(Service_SET, "called, touch_screen_mode={}", touch_screen_mode);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(res);
}
void ISystemSettingsServer::GetFieldTestingFlag(HLERequestContext& ctx) {
LOG_INFO(Service_SET, "called, field_testing_flag={}", m_system_settings.field_testing_flag);
@ -1670,4 +1692,15 @@ Result ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime(
R_SUCCEED();
}
Result ISystemSettingsServer::GetTouchScreenMode(TouchScreenMode& touch_screen_mode) const {
touch_screen_mode = m_system_settings.touch_screen_mode;
R_SUCCEED();
}
Result ISystemSettingsServer::SetTouchScreenMode(TouchScreenMode touch_screen_mode) {
m_system_settings.touch_screen_mode = touch_screen_mode;
SetSaveNeeded();
R_SUCCEED();
}
} // namespace Service::Set

View File

@ -74,6 +74,8 @@ public:
Service::PSC::Time::SteadyClockTimePoint& out_time_point) const;
Result SetUserSystemClockAutomaticCorrectionUpdatedTime(
const Service::PSC::Time::SteadyClockTimePoint& time_point);
Result GetTouchScreenMode(TouchScreenMode& touch_screen_mode) const;
Result SetTouchScreenMode(TouchScreenMode touch_screen_mode);
private:
void SetLanguageCode(HLERequestContext& ctx);
@ -154,6 +156,8 @@ private:
void GetChineseTraditionalInputMethod(HLERequestContext& ctx);
void GetHomeMenuScheme(HLERequestContext& ctx);
void GetHomeMenuSchemeModel(HLERequestContext& ctx);
void GetTouchScreenMode(HLERequestContext& ctx);
void SetTouchScreenMode(HLERequestContext& ctx);
void GetFieldTestingFlag(HLERequestContext& ctx);
void GetPanelCrcMode(HLERequestContext& ctx);
void SetPanelCrcMode(HLERequestContext& ctx);