2020-06-17 23:36:56 +00:00
|
|
|
#include <stratosphere.hpp>
|
2020-06-02 21:24:40 +00:00
|
|
|
#include "wiimote.hpp"
|
2020-06-10 21:15:26 +00:00
|
|
|
#include "hdlsvirtualcontroller.hpp"
|
2020-06-02 21:24:40 +00:00
|
|
|
|
|
|
|
namespace controller {
|
|
|
|
|
2020-06-10 21:15:26 +00:00
|
|
|
WiimoteController::WiimoteController(const BluetoothAddress *address)
|
|
|
|
: WiiController(ControllerType_Wiimote, address) {
|
2020-06-28 15:21:07 +00:00
|
|
|
//if (ams::hos::GetVersion() >= ams::hos::Version_7_0_0)
|
|
|
|
//m_virtualController = std::make_unique<HdlsVirtualController>();
|
2020-06-10 21:15:26 +00:00
|
|
|
}
|
|
|
|
|
2020-06-09 20:39:30 +00:00
|
|
|
void WiimoteController::convertReportFormat(const HidReport *inReport, HidReport *outReport) {
|
|
|
|
auto wiiData = reinterpret_cast<const WiimoteReportData *>(&inReport->data);
|
|
|
|
auto switchData = reinterpret_cast<SwitchReportData *>(&outReport->data);
|
2020-06-02 21:24:40 +00:00
|
|
|
|
2020-06-09 20:39:30 +00:00
|
|
|
outReport->type = 0x31;
|
|
|
|
outReport->id = 0x30;
|
|
|
|
|
|
|
|
switchData->report0x30.conn_info = 0x0;
|
|
|
|
switchData->report0x30.battery = 0x8;
|
|
|
|
|
|
|
|
switch(inReport->id) {
|
|
|
|
case 0x30:
|
|
|
|
handleInputReport0x30(wiiData, switchData);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void WiimoteController::handleInputReport0x30(const WiimoteReportData *src, SwitchReportData *dst) {
|
|
|
|
|
|
|
|
dst->report0x30.buttons.dpad_down = src->report0x30.buttons.dpad_down;
|
|
|
|
dst->report0x30.buttons.dpad_up = src->report0x30.buttons.dpad_up;
|
|
|
|
dst->report0x30.buttons.dpad_right = src->report0x30.buttons.dpad_right;
|
|
|
|
dst->report0x30.buttons.dpad_left = src->report0x30.buttons.dpad_left;
|
|
|
|
|
|
|
|
dst->report0x30.buttons.A = src->report0x30.buttons.two;
|
|
|
|
dst->report0x30.buttons.B = src->report0x30.buttons.one;
|
|
|
|
|
|
|
|
dst->report0x30.buttons.R = src->report0x30.buttons.B;
|
|
|
|
dst->report0x30.buttons.L = src->report0x30.buttons.A;
|
|
|
|
|
|
|
|
dst->report0x30.buttons.minus = src->report0x30.buttons.minus;
|
|
|
|
dst->report0x30.buttons.plus = src->report0x30.buttons.plus;
|
|
|
|
|
|
|
|
dst->report0x30.buttons.home = src->report0x30.buttons.home;
|
|
|
|
}
|
2020-06-02 21:24:40 +00:00
|
|
|
|
|
|
|
}
|