2020-06-02 21:24:40 +00:00
|
|
|
#pragma once
|
2020-07-11 18:26:55 +00:00
|
|
|
#include "fakeswitchcontroller.hpp"
|
2020-06-02 21:24:40 +00:00
|
|
|
|
2020-07-11 11:43:21 +00:00
|
|
|
namespace ams::controller {
|
2020-06-02 21:24:40 +00:00
|
|
|
|
|
|
|
enum WiiControllerLEDs {
|
|
|
|
WiiControllerLEDs_P1 = 0x10,
|
|
|
|
WiiControllerLEDs_P2 = 0x20,
|
|
|
|
WiiControllerLEDs_P3 = 0x40,
|
|
|
|
WiiControllerLEDs_P4 = 0x80,
|
|
|
|
};
|
|
|
|
|
2020-06-09 20:39:30 +00:00
|
|
|
struct WiiButtonData {
|
|
|
|
uint8_t dpad_left : 1;
|
|
|
|
uint8_t dpad_right : 1;
|
|
|
|
uint8_t dpad_down : 1;
|
|
|
|
uint8_t dpad_up : 1;
|
|
|
|
uint8_t plus : 1;
|
|
|
|
uint8_t : 0;
|
|
|
|
|
|
|
|
uint8_t two : 1;
|
|
|
|
uint8_t one : 1;
|
|
|
|
uint8_t B : 1;
|
|
|
|
uint8_t A : 1;
|
|
|
|
uint8_t minus : 1;
|
|
|
|
uint8_t : 2;
|
|
|
|
uint8_t home : 1;
|
2020-07-11 11:43:21 +00:00
|
|
|
} __attribute__ ((__packed__));
|
2020-06-09 20:39:30 +00:00
|
|
|
|
2020-07-09 22:46:11 +00:00
|
|
|
struct WiiAccelerometerData {
|
|
|
|
uint8_t xyz[3];
|
2020-07-11 11:43:21 +00:00
|
|
|
} __attribute__ ((__packed__));
|
|
|
|
|
2020-07-11 13:24:00 +00:00
|
|
|
struct WiiInputReport0x30 {
|
2020-07-11 11:43:21 +00:00
|
|
|
WiiButtonData buttons;
|
|
|
|
} __attribute__ ((__packed__));
|
|
|
|
|
2020-07-11 13:24:00 +00:00
|
|
|
struct WiiInputReport0x31 {
|
2020-07-11 11:43:21 +00:00
|
|
|
WiiButtonData buttons;
|
|
|
|
WiiAccelerometerData accel;
|
|
|
|
} __attribute__ ((__packed__));
|
|
|
|
|
2020-07-11 13:24:00 +00:00
|
|
|
struct WiiInputReport0x32 {
|
2020-07-11 11:43:21 +00:00
|
|
|
WiiButtonData buttons;
|
|
|
|
uint8_t extension[8];
|
|
|
|
} __attribute__ ((__packed__));
|
|
|
|
|
2020-07-11 13:24:00 +00:00
|
|
|
struct WiiInputReport0x33 {
|
2020-07-11 11:43:21 +00:00
|
|
|
WiiButtonData buttons;
|
|
|
|
WiiAccelerometerData accel;
|
|
|
|
uint8_t ir[12];
|
|
|
|
} __attribute__ ((__packed__));
|
|
|
|
|
2020-07-11 13:24:00 +00:00
|
|
|
struct WiiInputReport0x34 {
|
2020-07-11 11:43:21 +00:00
|
|
|
WiiButtonData buttons;
|
|
|
|
uint8_t extension[19];
|
|
|
|
} __attribute__ ((__packed__));
|
|
|
|
|
2020-07-11 13:24:00 +00:00
|
|
|
struct WiiInputReport0x35 {
|
2020-07-11 11:43:21 +00:00
|
|
|
WiiButtonData buttons;
|
|
|
|
WiiAccelerometerData accel;
|
|
|
|
uint8_t extension[16];
|
|
|
|
} __attribute__ ((__packed__));
|
|
|
|
|
2020-07-11 13:24:00 +00:00
|
|
|
struct WiiInputReport0x36 {
|
2020-07-11 11:43:21 +00:00
|
|
|
WiiButtonData buttons;
|
|
|
|
uint8_t ir[10];
|
|
|
|
uint8_t extension[9];
|
|
|
|
} __attribute__ ((__packed__));
|
|
|
|
|
2020-07-11 13:24:00 +00:00
|
|
|
struct WiiInputReport0x37 {
|
2020-07-11 11:43:21 +00:00
|
|
|
WiiButtonData buttons;
|
|
|
|
WiiAccelerometerData accel;
|
|
|
|
uint8_t ir[10];
|
|
|
|
uint8_t extension[6];
|
|
|
|
} __attribute__ ((__packed__));
|
|
|
|
|
2020-07-11 13:24:00 +00:00
|
|
|
struct WiiInputReport0x3d {
|
2020-07-11 11:43:21 +00:00
|
|
|
uint8_t extension[21];
|
|
|
|
} __attribute__ ((__packed__));
|
|
|
|
|
|
|
|
struct WiiReportData {
|
|
|
|
uint8_t id;
|
|
|
|
union {
|
2020-07-11 13:24:00 +00:00
|
|
|
WiiInputReport0x30 input0x30;
|
|
|
|
WiiInputReport0x31 input0x31;
|
|
|
|
WiiInputReport0x32 input0x32;
|
|
|
|
WiiInputReport0x33 input0x33;
|
|
|
|
WiiInputReport0x34 input0x34;
|
|
|
|
WiiInputReport0x35 input0x35;
|
|
|
|
WiiInputReport0x36 input0x36;
|
|
|
|
WiiInputReport0x37 input0x37;
|
|
|
|
WiiInputReport0x3d input0x3d;
|
2020-07-11 11:43:21 +00:00
|
|
|
};
|
|
|
|
} __attribute__ ((__packed__));
|
2020-07-09 22:46:11 +00:00
|
|
|
|
2020-07-11 18:26:55 +00:00
|
|
|
class WiiController : public FakeSwitchController {
|
2020-06-02 21:24:40 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
Result initialize(void);
|
|
|
|
|
|
|
|
protected:
|
2020-07-11 18:26:55 +00:00
|
|
|
WiiController(ControllerType type, const bluetooth::Address *address) : FakeSwitchController(type, address) {};
|
2020-06-02 21:24:40 +00:00
|
|
|
|
2020-07-11 11:43:21 +00:00
|
|
|
Result writeMemory(const bluetooth::Address *address, uint32_t writeaddr, const uint8_t *data, uint8_t length);
|
|
|
|
Result setReportMode(const bluetooth::Address *address, uint8_t mode);
|
|
|
|
Result setPlayerLeds(const bluetooth::Address *address, uint8_t mask);
|
2020-06-02 21:24:40 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|