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:
oleg238948234
2025-12-30 13:29:43 +05:00
committed by GitHub
parent ab3d41432a
commit 69d78e0a87
2 changed files with 21 additions and 31 deletions
+19 -29
View File
@@ -53,37 +53,27 @@ bool games::gitadora::J32DSerialDevice::parse_msg(
pid += 1; pid += 1;
J32D_IO_STATUS payload; J32D_IO_STATUS payload;
memset(&payload, 0, sizeof(J32D_IO_STATUS)); memset(&payload, 0, sizeof(J32D_IO_STATUS));
auto &buttons = get_buttons(); auto &buttons = get_buttons();
auto high_tom = (uint16_t) (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumHiTom]) * 1023);
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumHiTom])) { auto low_tom = (uint16_t) (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumLowTom]) * 1023);
payload.high_tom = 4092; 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);
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumLowTom])) { auto right_cymbal = (uint16_t) (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumRightCymbal]) * 1023);
payload.low_tom = 4092; auto hihat = (uint16_t) ((GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumHiHat]) ||
}
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::DrumHiHatClosed]) ||
GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumHiHatHalfOpen])) { GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumHiHatHalfOpen])) * 1023);
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])) { if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::DrumBassPedal])) {
payload.pedals |= 1; payload.pedals |= 1;