Fix button state not persisting between loads

This commit is contained in:
Hamish Milne 2020-04-11 20:47:14 +01:00
parent 34af0d3452
commit 19872b599b
2 changed files with 6 additions and 2 deletions

View file

@ -30,7 +30,7 @@ SERIALIZE_EXPORT_IMPL(Service::HID::Module)
namespace Service::HID { namespace Service::HID {
template <class Archive> template <class Archive>
void Module::serialize(Archive& ar, const unsigned int) { void Module::serialize(Archive& ar, const unsigned int file_version) {
ar& shared_mem; ar& shared_mem;
ar& event_pad_or_touch_1; ar& event_pad_or_touch_1;
ar& event_pad_or_touch_2; ar& event_pad_or_touch_2;
@ -46,7 +46,9 @@ void Module::serialize(Archive& ar, const unsigned int) {
if (Archive::is_loading::value) { if (Archive::is_loading::value) {
LoadInputDevices(); LoadInputDevices();
} }
// Pad state not needed as it's always updated if (file_version >= 1) {
ar& state.hex;
}
// Update events are set in the constructor // Update events are set in the constructor
// Devices are set from the implementation (and are stateless afaik) // Devices are set from the implementation (and are stateless afaik)
} }

View file

@ -8,6 +8,7 @@
#include <atomic> #include <atomic>
#include <cstddef> #include <cstddef>
#include <memory> #include <memory>
#include <boost/serialization/version.hpp>
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/common_funcs.h" #include "common/common_funcs.h"
#include "common/common_types.h" #include "common/common_types.h"
@ -348,3 +349,4 @@ void InstallInterfaces(Core::System& system);
SERVICE_CONSTRUCT(Service::HID::Module) SERVICE_CONSTRUCT(Service::HID::Module)
BOOST_CLASS_EXPORT_KEY(Service::HID::Module) BOOST_CLASS_EXPORT_KEY(Service::HID::Module)
BOOST_CLASS_VERSION(Service::HID::Module, 1)