DonCon2040/include/utils/InputState.h

69 lines
1.4 KiB
C
Raw Normal View History

2023-04-10 13:04:38 +02:00
#ifndef _UTILS_INPUTSTATE_H_
#define _UTILS_INPUTSTATE_H_
#include "usb/hid_driver.h"
2023-07-17 22:50:27 +02:00
#include "usb/midi_driver.h"
2023-04-22 17:44:38 +02:00
#include "usb/usb_driver.h"
2023-04-22 18:10:42 +02:00
#include "usb/xinput_driver.h"
2023-04-22 17:44:38 +02:00
2023-04-10 13:04:38 +02:00
#include <stdint.h>
2023-04-22 17:44:38 +02:00
#include <string>
2023-04-10 13:04:38 +02:00
namespace Doncon::Utils {
struct InputState {
public:
struct Drum {
2023-05-13 15:27:43 +02:00
struct Pad {
bool triggered;
uint16_t raw;
};
Pad don_left, ka_left, don_right, ka_right;
2023-04-10 13:04:38 +02:00
};
2023-05-21 22:02:24 +02:00
struct Controller {
struct DPad {
bool up, down, left, right;
};
struct Buttons {
bool north, east, south, west;
bool l, r;
bool start, select, home, share;
};
2023-05-21 22:02:24 +02:00
DPad dpad;
Buttons buttons;
};
2023-04-10 13:04:38 +02:00
public:
Drum drum;
2023-05-21 22:02:24 +02:00
Controller controller;
2023-04-10 13:04:38 +02:00
2023-04-22 17:44:38 +02:00
private:
hid_switch_report_t m_switch_report;
hid_ps3_report_t m_ps3_report;
hid_ps4_report_t m_ps4_report;
2023-04-22 18:10:42 +02:00
xinput_report_t m_xinput_report;
2023-07-17 22:50:27 +02:00
midi_report_t m_midi_report;
2023-04-22 17:44:38 +02:00
std::string m_debug_report;
usb_report_t getSwitchReport();
usb_report_t getPS3InputReport();
usb_report_t getPS4InputReport();
2023-04-22 18:10:42 +02:00
usb_report_t getXinputReport();
2023-07-17 22:50:27 +02:00
usb_report_t getMidiReport();
2023-04-22 17:44:38 +02:00
usb_report_t getDebugReport();
2023-04-10 13:04:38 +02:00
public:
InputState();
2023-04-22 17:44:38 +02:00
usb_report_t getReport(usb_mode_t mode);
2023-07-06 20:55:26 +02:00
bool checkHotkey();
2023-04-10 13:04:38 +02:00
};
} // namespace Doncon::Utils
#endif // _UTILS_INPUTSTATE_H_