Serialize HID service

This commit is contained in:
Hamish Milne
2020-02-13 17:41:21 +08:00
committed by zhupengfei
parent 30494c06a4
commit 74361fa3fb
7 changed files with 50 additions and 2 deletions
+25
View File
@@ -4,6 +4,7 @@
#include <algorithm>
#include <cmath>
#include "common/archives.h"
#include "common/logging/log.h"
#include "core/3ds.h"
#include "core/core.h"
@@ -20,8 +21,32 @@
#include "core/movie.h"
#include "video_core/video_core.h"
SERVICE_CONSTRUCT_IMPL(Service::HID::Module)
SERIALIZE_EXPORT_IMPL(Service::HID::Module)
namespace Service::HID {
template <class Archive>
void Module::serialize(Archive& ar, const unsigned int) {
ar& shared_mem;
ar& event_pad_or_touch_1;
ar& event_pad_or_touch_2;
ar& event_accelerometer;
ar& event_gyroscope;
ar& event_debug_pad;
ar& next_pad_index;
ar& next_touch_index;
ar& next_accelerometer_index;
ar& next_gyroscope_index;
ar& enable_accelerometer_count;
ar& enable_gyroscope_count;
ReloadInputDevices();
// Pad state not needed as it's always updated
// Update events are set in the constructor
// Devices are set from the implementation (and are stateless afaik)
}
SERIALIZE_IMPL(Module)
// Updating period for each HID device. These empirical values are measured from a 11.2 3DS.
constexpr u64 pad_update_ticks = BASE_CLOCK_RATE_ARM11 / 234;
constexpr u64 accelerometer_update_ticks = BASE_CLOCK_RATE_ARM11 / 104;