2018-10-05 16:23:21 +02:00
|
|
|
// Copyright 2018 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
2018-10-06 05:14:42 +02:00
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
#include <array>
|
|
|
|
#include "common/common_types.h"
|
|
|
|
#include "common/swap.h"
|
|
|
|
#include "core/hle/service/hid/controllers/controller_base.h"
|
|
|
|
|
|
|
|
namespace Service::HID {
|
|
|
|
class Controller_Gesture final : public ControllerBase {
|
|
|
|
public:
|
2019-09-21 14:13:27 +02:00
|
|
|
explicit Controller_Gesture(Core::System& system);
|
2018-10-18 02:34:25 +02:00
|
|
|
~Controller_Gesture() override;
|
2018-10-05 16:23:21 +02:00
|
|
|
|
|
|
|
// Called when the controller is initialized
|
2019-09-22 08:41:34 +02:00
|
|
|
void OnInit() override;
|
2018-10-05 16:23:21 +02:00
|
|
|
|
|
|
|
// When the controller is released
|
|
|
|
void OnRelease() override;
|
|
|
|
|
|
|
|
// When the controller is requesting an update for the shared memory
|
2019-02-14 18:42:58 +01:00
|
|
|
void OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, size_t size) override;
|
2018-10-05 16:23:21 +02:00
|
|
|
|
|
|
|
// Called when input devices should be loaded
|
|
|
|
void OnLoadInputDevices() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct Locations {
|
|
|
|
s32_le x;
|
|
|
|
s32_le y;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GestureState {
|
|
|
|
s64_le sampling_number;
|
|
|
|
s64_le sampling_number2;
|
|
|
|
|
|
|
|
s64_le detection_count;
|
|
|
|
s32_le type;
|
|
|
|
s32_le dir;
|
|
|
|
s32_le x;
|
|
|
|
s32_le y;
|
|
|
|
s32_le delta_x;
|
|
|
|
s32_le delta_y;
|
|
|
|
f32 vel_x;
|
|
|
|
f32 vel_y;
|
|
|
|
s32_le attributes;
|
|
|
|
f32 scale;
|
|
|
|
f32 rotation;
|
|
|
|
s32_le location_count;
|
2018-10-06 05:14:42 +02:00
|
|
|
std::array<Locations, 4> locations;
|
2018-10-05 16:23:21 +02:00
|
|
|
};
|
|
|
|
static_assert(sizeof(GestureState) == 0x68, "GestureState is an invalid size");
|
|
|
|
|
|
|
|
struct SharedMemory {
|
|
|
|
CommonHeader header;
|
|
|
|
std::array<GestureState, 17> gesture_states;
|
|
|
|
};
|
|
|
|
SharedMemory shared_memory{};
|
|
|
|
};
|
2018-10-06 05:14:42 +02:00
|
|
|
} // namespace Service::HID
|