From 19872b599baa824ff26716a502a4c6ca441c1347 Mon Sep 17 00:00:00 2001 From: Hamish Milne Date: Sat, 11 Apr 2020 20:47:14 +0100 Subject: [PATCH] Fix button state not persisting between loads --- src/core/hle/service/hid/hid.cpp | 6 ++++-- src/core/hle/service/hid/hid.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 981a4aa63..4c8718276 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -30,7 +30,7 @@ SERIALIZE_EXPORT_IMPL(Service::HID::Module) namespace Service::HID { template -void Module::serialize(Archive& ar, const unsigned int) { +void Module::serialize(Archive& ar, const unsigned int file_version) { ar& shared_mem; ar& event_pad_or_touch_1; ar& event_pad_or_touch_2; @@ -46,7 +46,9 @@ void Module::serialize(Archive& ar, const unsigned int) { if (Archive::is_loading::value) { LoadInputDevices(); } - // Pad state not needed as it's always updated + if (file_version >= 1) { + ar& state.hex; + } // Update events are set in the constructor // Devices are set from the implementation (and are stateless afaik) } diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index ad526ac6f..58a3c68a5 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -8,6 +8,7 @@ #include #include #include +#include #include "common/bit_field.h" #include "common/common_funcs.h" #include "common/common_types.h" @@ -348,3 +349,4 @@ void InstallInterfaces(Core::System& system); SERVICE_CONSTRUCT(Service::HID::Module) BOOST_CLASS_EXPORT_KEY(Service::HID::Module) +BOOST_CLASS_VERSION(Service::HID::Module, 1)