From b0a346709e207a1713890be36e4cf24cd3c5087b Mon Sep 17 00:00:00 2001 From: Dark Date: Mon, 26 Jun 2023 14:11:17 -0400 Subject: [PATCH] RB3MidiGuitar.cpp: Support 5-Fret play Rock Band 3 has support for playing the regular guitar mode with the Pro Guitar. While the real MPA does not support this, the game accepts it just fine so there's no harm in emulating it. --- rpcs3/Emu/Io/RB3MidiGuitar.cpp | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/rpcs3/Emu/Io/RB3MidiGuitar.cpp b/rpcs3/Emu/Io/RB3MidiGuitar.cpp index fcac0e3885..77633ebf6d 100644 --- a/rpcs3/Emu/Io/RB3MidiGuitar.cpp +++ b/rpcs3/Emu/Io/RB3MidiGuitar.cpp @@ -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) {