Serialize HID service
This commit is contained in:
parent
30494c06a4
commit
74361fa3fb
2
TODO
2
TODO
|
@ -83,7 +83,7 @@
|
||||||
✔ FS @done(19-12-27 11:46)
|
✔ FS @done(19-12-27 11:46)
|
||||||
✔ GSP @done(19-12-30 12:45)
|
✔ GSP @done(19-12-30 12:45)
|
||||||
☐ Fix the global weak_ptr to gsp
|
☐ Fix the global weak_ptr to gsp
|
||||||
☐ HID
|
✔ HID @done(19-12-30 14:46)
|
||||||
☐ HTTP
|
☐ HTTP
|
||||||
☐ IR
|
☐ IR
|
||||||
☐ LDR_RO
|
☐ LDR_RO
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include "common/archives.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/3ds.h"
|
#include "core/3ds.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
|
@ -20,8 +21,32 @@
|
||||||
#include "core/movie.h"
|
#include "core/movie.h"
|
||||||
#include "video_core/video_core.h"
|
#include "video_core/video_core.h"
|
||||||
|
|
||||||
|
SERVICE_CONSTRUCT_IMPL(Service::HID::Module)
|
||||||
|
SERIALIZE_EXPORT_IMPL(Service::HID::Module)
|
||||||
|
|
||||||
namespace Service::HID {
|
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.
|
// 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 pad_update_ticks = BASE_CLOCK_RATE_ARM11 / 234;
|
||||||
constexpr u64 accelerometer_update_ticks = BASE_CLOCK_RATE_ARM11 / 104;
|
constexpr u64 accelerometer_update_ticks = BASE_CLOCK_RATE_ARM11 / 104;
|
||||||
|
|
|
@ -294,7 +294,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void GetGyroscopeLowCalibrateParam(Kernel::HLERequestContext& ctx);
|
void GetGyroscopeLowCalibrateParam(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
std::shared_ptr<Module> hid;
|
std::shared_ptr<Module> hid;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -342,9 +342,16 @@ private:
|
||||||
std::unique_ptr<Input::AnalogDevice> circle_pad;
|
std::unique_ptr<Input::AnalogDevice> circle_pad;
|
||||||
std::unique_ptr<Input::MotionDevice> motion_device;
|
std::unique_ptr<Input::MotionDevice> motion_device;
|
||||||
std::unique_ptr<Input::TouchDevice> touch_device;
|
std::unique_ptr<Input::TouchDevice> touch_device;
|
||||||
|
|
||||||
|
template <class Archive>
|
||||||
|
void serialize(Archive& ar, const unsigned int);
|
||||||
|
friend class boost::serialization::access;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::shared_ptr<Module> GetModule(Core::System& system);
|
std::shared_ptr<Module> GetModule(Core::System& system);
|
||||||
|
|
||||||
void InstallInterfaces(Core::System& system);
|
void InstallInterfaces(Core::System& system);
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
|
||||||
|
SERVICE_CONSTRUCT(Service::HID::Module)
|
||||||
|
BOOST_CLASS_EXPORT_KEY(Service::HID::Module)
|
||||||
|
|
|
@ -2,8 +2,11 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "common/archives.h"
|
||||||
#include "core/hle/service/hid/hid_spvr.h"
|
#include "core/hle/service/hid/hid_spvr.h"
|
||||||
|
|
||||||
|
SERIALIZE_EXPORT_IMPL(Service::HID::Spvr)
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
|
|
||||||
Spvr::Spvr(std::shared_ptr<Module> hid) : Module::Interface(std::move(hid), "hid:SPVR", 6) {
|
Spvr::Spvr(std::shared_ptr<Module> hid) : Module::Interface(std::move(hid), "hid:SPVR", 6) {
|
||||||
|
|
|
@ -11,6 +11,11 @@ namespace Service::HID {
|
||||||
class Spvr final : public Module::Interface {
|
class Spvr final : public Module::Interface {
|
||||||
public:
|
public:
|
||||||
explicit Spvr(std::shared_ptr<Module> hid);
|
explicit Spvr(std::shared_ptr<Module> hid);
|
||||||
|
private:
|
||||||
|
SERVICE_SERIALIZATION(Spvr, hid, Module)
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
|
||||||
|
BOOST_CLASS_EXPORT_KEY(Service::HID::Spvr)
|
||||||
|
BOOST_SERIALIZATION_CONSTRUCT(Service::HID::Spvr)
|
||||||
|
|
|
@ -2,8 +2,11 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "common/archives.h"
|
||||||
#include "core/hle/service/hid/hid_user.h"
|
#include "core/hle/service/hid/hid_user.h"
|
||||||
|
|
||||||
|
SERIALIZE_EXPORT_IMPL(Service::HID::User)
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
|
|
||||||
User::User(std::shared_ptr<Module> hid) : Module::Interface(std::move(hid), "hid:USER", 6) {
|
User::User(std::shared_ptr<Module> hid) : Module::Interface(std::move(hid), "hid:USER", 6) {
|
||||||
|
|
|
@ -14,6 +14,11 @@ namespace Service::HID {
|
||||||
class User final : public Module::Interface {
|
class User final : public Module::Interface {
|
||||||
public:
|
public:
|
||||||
explicit User(std::shared_ptr<Module> hid);
|
explicit User(std::shared_ptr<Module> hid);
|
||||||
|
private:
|
||||||
|
SERVICE_SERIALIZATION(User, hid, Module)
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
|
||||||
|
BOOST_CLASS_EXPORT_KEY(Service::HID::User)
|
||||||
|
BOOST_SERIALIZATION_CONSTRUCT(Service::HID::User)
|
||||||
|
|
Reference in New Issue