2023-04-10 13:04:38 +02:00
|
|
|
#ifndef _UTILS_INPUTSTATE_H_
|
|
|
|
#define _UTILS_INPUTSTATE_H_
|
|
|
|
|
2024-11-03 22:30:29 +01:00
|
|
|
#include "usb/device/hid/keyboard_driver.h"
|
|
|
|
#include "usb/device/hid/ps3_driver.h"
|
|
|
|
#include "usb/device/hid/ps4_driver.h"
|
|
|
|
#include "usb/device/hid/switch_driver.h"
|
|
|
|
#include "usb/device/midi_driver.h"
|
|
|
|
#include "usb/device/vendor/xinput_driver.h"
|
|
|
|
#include "usb/device_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;
|
2024-10-12 18:38:42 +02:00
|
|
|
uint16_t analog;
|
2024-11-24 16:48:39 +01:00
|
|
|
uint16_t raw;
|
2023-05-13 15:27:43 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
Pad don_left, ka_left, don_right, ka_right;
|
2023-12-29 20:57:56 +01:00
|
|
|
uint16_t current_roll;
|
|
|
|
uint16_t previous_roll;
|
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-20 20:17:26 +02:00
|
|
|
|
2023-05-21 22:02:24 +02:00
|
|
|
DPad dpad;
|
|
|
|
Buttons buttons;
|
2023-05-20 20:17:26 +02:00
|
|
|
};
|
|
|
|
|
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-12-29 22:49:25 +01:00
|
|
|
private:
|
|
|
|
enum class Player {
|
|
|
|
One,
|
|
|
|
Two,
|
|
|
|
};
|
|
|
|
|
2023-04-22 17:44:38 +02:00
|
|
|
private:
|
2023-07-04 21:57:42 +02:00
|
|
|
hid_switch_report_t m_switch_report;
|
|
|
|
hid_ps3_report_t m_ps3_report;
|
|
|
|
hid_ps4_report_t m_ps4_report;
|
2023-12-03 11:27:19 +01:00
|
|
|
hid_nkro_keyboard_report_t m_keyboard_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;
|
|
|
|
|
2023-07-04 21:57:42 +02:00
|
|
|
usb_report_t getSwitchReport();
|
|
|
|
usb_report_t getPS3InputReport();
|
|
|
|
usb_report_t getPS4InputReport();
|
2023-12-29 22:49:25 +01:00
|
|
|
usb_report_t getKeyboardReport(Player player);
|
2024-10-12 18:38:42 +02:00
|
|
|
usb_report_t getXinputBaseReport();
|
|
|
|
usb_report_t getXinputDigitalReport();
|
|
|
|
usb_report_t getXinputAnalogReport(Player player);
|
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
|
|
|
|
2023-12-02 22:11:24 +01:00
|
|
|
void releaseAll();
|
|
|
|
|
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_
|