-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathHIDControllerInput.h
78 lines (49 loc) · 2.06 KB
/
HIDControllerInput.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#pragma once
#include <collection.h>
#include "EmulatorInput.h"
#include "EventHandlerForDevice.h"
namespace VBA10
{
ref class HidNumericControlExt sealed
{
public:
HidNumericControlExt(unsigned short usagepage, unsigned short usageid);
internal:
unsigned short UsagePage;
unsigned short UsageId;
long long DefaultValue;
long long MaximumValue;
Platform::String^ Assignment;
int Type; //0: only on-off state , 1: left - off -right state , 2: value state
Platform::Collections::Map<int, Platform::String^>^ Mapping;
};
ref class HIDControllerInput sealed
{
public:
HIDControllerInput();
internal:
const ControllerState* GetControllerState(void);
void Update(bool shouldUpdate);
void StartListening(); //start listening to report event
void StopListening();
void RegisterForInputReportEvents();
void UnregisterFromInputReportEvent(void);
//Windows::Devices::HumanInterfaceDevice::HidDevice ^Device;
Platform::Collections::Vector < HidNumericControlExt^>^ allNumericControls;
Platform::Collections::Map <int, Platform::String^>^ booleanControlMapping;
void OnDeviceConnected(EventHandlerForDevice^ sender, OnDeviceConnectedEventArgs^ onDeviceConnectedEventArgs);
void OnDeviceClosing(EventHandlerForDevice^ sender, Windows::Devices::Enumeration::DeviceInformation^ deviceInformation);
private:
ControllerState state;
bool shouldUpdate;
Windows::Foundation::EventRegistrationToken inputReportEventToken;
bool isRegisteredForInputReportEvents;
// Device that we registered for events with
Windows::Devices::HumanInterfaceDevice::HidDevice^ registeredDevice;
~HIDControllerInput(void);
void OnInputReportEvent(
Windows::Devices::HumanInterfaceDevice::HidDevice^ sender,
Windows::Devices::HumanInterfaceDevice::HidInputReportReceivedEventArgs^ eventArgs);
void GetMapping(Platform::String^ tag, bool* left, bool* right, bool* up, bool* down, bool* a, bool* b, bool* l, bool* r, bool* select, bool* start, bool* turbo);
};
}