Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RB3MidiGuitar.cpp: Support the regular guitar mode. #14099

Merged
merged 3 commits into from
Jun 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions rpcs3/Emu/Io/RB3MidiGuitar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,49 @@ void usb_device_rb3_midi_guitar::write_state(u8* buf)
buf[10] = button_state.string_velocities[4];
buf[9] = button_state.string_velocities[5];

// encode frets for playing 5 fret on the pro guitar
// this actually isn't done by the real MPA, but Rock Band 3 allows this
// so there's no harm in supporting it.
for (u8 i : button_state.frets)
{
switch (i)
{
case 1:
case 6:
case 13:
buf[9] |= 0b1000'0000;
break;
case 2:
case 7:
case 14:
buf[10] |= 0b1000'0000;
break;
case 3:
case 8:
case 15:
buf[11] |= 0b1000'0000;
break;
case 4:
case 9:
case 16:
buf[12] |= 0b1000'0000;
break;
case 5:
case 10:
case 17:
buf[13] |= 0b1000'0000;
break;
default:
break;
}

// enable the solo bit for frets >= 13
if (i >= 13)
{
buf[8] |= 0b1000'0000;
}
}

// encode tilt sensor/sustain_pedal
if (button_state.tilt_sensor || button_state.sustain_pedal)
{
Expand Down