diff options
Diffstat (limited to 'src/core/hle')
-rw-r--r-- | src/core/hle/service/hid/hid.cpp | 11 | ||||
-rw-r--r-- | src/core/hle/service/hid/hid.h | 1 | ||||
-rw-r--r-- | src/core/hle/service/time/time_manager.cpp | 11 | ||||
-rw-r--r-- | src/core/hle/service/time/time_zone_content_manager.cpp | 24 |
4 files changed, 43 insertions, 4 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 5559587e3..c84cb1483 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -157,7 +157,7 @@ Hid::Hid(Core::System& system) : ServiceFramework("hid"), system(system) { {11, &Hid::ActivateTouchScreen, "ActivateTouchScreen"}, {21, &Hid::ActivateMouse, "ActivateMouse"}, {31, &Hid::ActivateKeyboard, "ActivateKeyboard"}, - {32, nullptr, "SendKeyboardLockKeyEvent"}, + {32, &Hid::SendKeyboardLockKeyEvent, "SendKeyboardLockKeyEvent"}, {40, nullptr, "AcquireXpadIdEventHandle"}, {41, nullptr, "ReleaseXpadIdEventHandle"}, {51, &Hid::ActivateXpad, "ActivateXpad"}, @@ -871,6 +871,15 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); } +void Hid::SendKeyboardLockKeyEvent(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto flags{rp.Pop<u32>()}; + LOG_WARNING(Service_HID, "(STUBBED) called. flags={}", flags); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); +} + class HidDbg final : public ServiceFramework<HidDbg> { public: explicit HidDbg() : ServiceFramework{"hid:dbg"} { diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index 23552efb1..c8ed4ad8b 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -130,6 +130,7 @@ private: void SetPalmaBoostMode(Kernel::HLERequestContext& ctx); void StopSevenSixAxisSensor(Kernel::HLERequestContext& ctx); void InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx); + void SendKeyboardLockKeyEvent(Kernel::HLERequestContext& ctx); std::shared_ptr<IAppletResource> applet_resource; Core::System& system; diff --git a/src/core/hle/service/time/time_manager.cpp b/src/core/hle/service/time/time_manager.cpp index 9d6c55865..b4dfe45e5 100644 --- a/src/core/hle/service/time/time_manager.cpp +++ b/src/core/hle/service/time/time_manager.cpp @@ -5,6 +5,7 @@ #include <chrono> #include <ctime> +#include "common/time_zone.h" #include "core/hle/service/time/ephemeral_network_system_clock_context_writer.h" #include "core/hle/service/time/local_system_clock_context_writer.h" #include "core/hle/service/time/network_system_clock_context_writer.h" @@ -21,8 +22,16 @@ static std::chrono::seconds GetSecondsSinceEpoch() { Settings::values.custom_rtc_differential; } +static s64 GetExternalTimeZoneOffset() { + // With "auto" timezone setting, we use the external system's timezone offset + if (Settings::GetTimeZoneString() == "auto") { + return Common::TimeZone::GetCurrentOffsetSeconds().count(); + } + return 0; +} + static s64 GetExternalRtcValue() { - return GetSecondsSinceEpoch().count(); + return GetSecondsSinceEpoch().count() + GetExternalTimeZoneOffset(); } TimeManager::TimeManager(Core::System& system) diff --git a/src/core/hle/service/time/time_zone_content_manager.cpp b/src/core/hle/service/time/time_zone_content_manager.cpp index 78d4acd95..c070d6e97 100644 --- a/src/core/hle/service/time/time_zone_content_manager.cpp +++ b/src/core/hle/service/time/time_zone_content_manager.cpp @@ -5,6 +5,7 @@ #include <sstream> #include "common/logging/log.h" +#include "common/time_zone.h" #include "core/core.h" #include "core/file_sys/content_archive.h" #include "core/file_sys/nca_metadata.h" @@ -14,6 +15,7 @@ #include "core/hle/service/filesystem/filesystem.h" #include "core/hle/service/time/time_manager.h" #include "core/hle/service/time/time_zone_content_manager.h" +#include "core/settings.h" namespace Service::Time::TimeZone { @@ -68,10 +70,22 @@ static std::vector<std::string> BuildLocationNameCache(Core::System& system) { TimeZoneContentManager::TimeZoneContentManager(TimeManager& time_manager, Core::System& system) : system{system}, location_name_cache{BuildLocationNameCache(system)} { - if (FileSys::VirtualFile vfs_file; GetTimeZoneInfoFile("GMT", vfs_file) == RESULT_SUCCESS) { + + std::string location_name; + const auto timezone_setting = Settings::GetTimeZoneString(); + if (timezone_setting == "auto") { + location_name = Common::TimeZone::GetDefaultTimeZone(); + } else if (timezone_setting == "default") { + location_name = location_name; + } else { + location_name = timezone_setting; + } + + if (FileSys::VirtualFile vfs_file; + GetTimeZoneInfoFile(location_name, vfs_file) == RESULT_SUCCESS) { const auto time_point{ time_manager.GetStandardSteadyClockCore().GetCurrentTimePoint(system)}; - time_manager.SetupTimeZoneManager("GMT", time_point, location_name_cache.size(), {}, + time_manager.SetupTimeZoneManager(location_name, time_point, location_name_cache.size(), {}, vfs_file); } else { time_zone_manager.MarkAsInitialized(); @@ -114,6 +128,12 @@ ResultCode TimeZoneContentManager::GetTimeZoneInfoFile(const std::string& locati vfs_file = zoneinfo_dir->GetFile(location_name); if (!vfs_file) { + LOG_ERROR(Service_Time, "{:016X} has no file \"{}\"! Using default timezone.", + time_zone_binary_titleid, location_name); + vfs_file = zoneinfo_dir->GetFile(Common::TimeZone::GetDefaultTimeZone()); + } + + if (!vfs_file) { LOG_ERROR(Service_Time, "{:016X} has no file \"{}\"!", time_zone_binary_titleid, location_name); return ERROR_TIME_NOT_FOUND; |