mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
gitadora: (arena model) fix j32d encoding & use velocity (#483)
## Link to GitHub Issue, if one exists N/A ## Description of change in current implementation j32d analog values are not encoded properly, values are supposed to go up to 1023, but they show up as 771 in game ## Testing tested with M32-007-2025092400, used DM PAD CALIBRATION menu
This commit is contained in:
@@ -53,37 +53,27 @@ bool games::gitadora::J32DSerialDevice::parse_msg(
|
||||
pid += 1;
|
||||
J32D_IO_STATUS payload;
|
||||
memset(&payload, 0, sizeof(J32D_IO_STATUS));
|
||||
|
||||
auto &buttons = get_buttons();
|
||||
auto high_tom = (uint16_t) (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumHiTom]) * 1023);
|
||||
auto low_tom = (uint16_t) (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumLowTom]) * 1023);
|
||||
auto snare = (uint16_t) (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumSnare]) * 1023);
|
||||
auto floor_tom = (uint16_t) (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumFloorTom]) * 1023);
|
||||
auto left_cymbal = (uint16_t) (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumLeftCymbal]) * 1023);
|
||||
auto right_cymbal = (uint16_t) (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumRightCymbal]) * 1023);
|
||||
auto hihat = (uint16_t) ((GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumHiHat]) ||
|
||||
GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumHiHatClosed]) ||
|
||||
GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumHiHatHalfOpen])) * 1023);
|
||||
|
||||
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumHiTom])) {
|
||||
payload.high_tom = 4092;
|
||||
}
|
||||
|
||||
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumLowTom])) {
|
||||
payload.low_tom = 4092;
|
||||
}
|
||||
|
||||
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumSnare])) {
|
||||
payload.snare = 4092;
|
||||
}
|
||||
|
||||
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumFloorTom])) {
|
||||
payload.floor_tom = 4092;
|
||||
}
|
||||
|
||||
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumLeftCymbal])) {
|
||||
payload.left_cymbal = 4092;
|
||||
}
|
||||
|
||||
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumRightCymbal])) {
|
||||
payload.right_cymbal = 4092;
|
||||
}
|
||||
|
||||
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumHiHat]) ||
|
||||
GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumHiHatClosed]) ||
|
||||
GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumHiHatHalfOpen])) {
|
||||
payload.hihat = 4092;
|
||||
}
|
||||
#define ENCODE_ANALOG(__val) (((__val & 0x3f) << 10) | ((__val & 0x3c0) >> 6))
|
||||
payload.high_tom = ENCODE_ANALOG(high_tom);
|
||||
payload.low_tom = ENCODE_ANALOG(low_tom);
|
||||
payload.snare = ENCODE_ANALOG(snare);
|
||||
payload.floor_tom = ENCODE_ANALOG(floor_tom);
|
||||
payload.left_cymbal = ENCODE_ANALOG(left_cymbal);
|
||||
payload.right_cymbal = ENCODE_ANALOG(right_cymbal);
|
||||
payload.hihat = ENCODE_ANALOG(hihat);
|
||||
#undef ENCODE_ANALOG
|
||||
|
||||
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumBassPedal])) {
|
||||
payload.pedals |= 1;
|
||||
|
||||
Reference in New Issue
Block a user