Add Riffmaster support for shadPS4#41
Conversation
aoiyu-dev
commented
Jan 16, 2025
- Added shadPS4 Mapper for Riffmaster
- Added a new setting to control the sensitivity of the Riffmaster's tilt for Overdrive.
- Added the ability to change the pickup effect via clicking down the thumbstick.
+ Added shadPS4 Mapper for Riffmaster + Added a new setting to control the sensitivity of the Riffmaster's tilt for Overdrive. + Added the ability to change the pickup effect via clicking down the thumbstick.
|
@fartboygh not at the moment, I don't have RPCS3 installed to work with, but if it is something you want, I can add it in quickly. I have a thing for certain songs in RB4 and the frets look cooler IMHO. |
|
I did a major overhaul to the project structure which caused a bunch of merge conflicts, got that fixed for you. I still don't quite have a moment to fully review this, but I should within the next couple days! |
TheNathannator
left a comment
There was a problem hiding this comment.
There's a couple issues that need fixing before I can merge this, specifically the seeming duplicate inputs and manual editing of Settings.Designer.cs.
I'd also prefer if a standard GuitarshadPS4Mapper was provided, with the Riffmaster one being based on that instead of the ViGEm mapper. Just copy the ViGEm mapping code over, make changes to suit shadPS4, and it should be all good.
| // Guitar inputs | ||
| GuitarViGEmMapper.HandleReport(device, report.Base); |
There was a problem hiding this comment.
This call as-is is going to cause duplicate inputs with whammy/tilt, as GuitarViGEmMapper.HandleReport puts whammy on right stick X instead of left thumb Y, and the additional code here does nothing to account for that.
I'd prefer if the code in GuitarViGEmMapper.HandleReport was duplicated in its entirety into here, and modified to suit shadPS4's mapping requirements.
|
|
||
| // Pickup | ||
| HandlePickup(report); | ||
| device.SetSliderValue(Xbox360Slider.LeftTrigger, (byte)(currentPickup * 51 - 25)); |
There was a problem hiding this comment.
Would somewhat prefer if there was a way to use GuitarViGEmMapper.CalculatePickupSwitch, instead of copying the constants from there as magic values with no context.
|
|
||
| private static void HandlePickup(XboxRiffmasterInput report) | ||
| { | ||
| bool pickupSetDown = ((XboxGamepadButton)report.Base.Buttons).HasFlag(XboxGamepadButton.LeftStickPress); |
There was a problem hiding this comment.
Don't use Enum.HasFlag, as it has performance problems due to being non-generic and boxing its values to the heap (causing GC allocations). Use a bit-test instead:
| bool pickupSetDown = ((XboxGamepadButton)report.Base.Buttons).HasFlag(XboxGamepadButton.LeftStickPress); | |
| bool pickupSetDown = (report.Base.Buttons & (ushort)XboxGamepadButton.LeftStickPress) != 0; |
(Casting the constant to ushort is more concise, but casting the Buttons field to XboxGamepadButton instead has the same result:)
| bool pickupSetDown = ((XboxGamepadButton)report.Base.Buttons).HasFlag(XboxGamepadButton.LeftStickPress); | |
| bool pickupSetDown = ((XboxGamepadButton)report.Base.Buttons & XboxGamepadButton.LeftStickPress) != 0; |
| /// </summary> | ||
| public static short ScaleToPositiveInt16(this byte input) | ||
| { | ||
| return (short)(((input / 2) << 8) | input); |
There was a problem hiding this comment.
This can be done equivalently with just bit-shift operations:
| return (short)(((input / 2) << 8) | input); | |
| return (short)((input << 7) | (input >> 1)); |
|
|
||
| [global::System.Configuration.UserScopedSettingAttribute()] | ||
| [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | ||
| [global::System.Configuration.DefaultSettingValueAttribute("1.5")] | ||
| public double riffmasterTiltSensitivity | ||
| { | ||
| get | ||
| { | ||
| return ((double)(this["riffmasterTiltSensitivity"])); | ||
| } | ||
| set | ||
| { | ||
| this["riffmasterTiltSensitivity"] = value; | ||
| } | ||
| } |
There was a problem hiding this comment.
I don't see a corresponding change to Settings.settings or App.config for this additional setting; don't manually edit Settings.Designer.cs as it is auto-generated. You need to add the new setting through Visual Studio so it can update other files as necessary.
There was a problem hiding this comment.
As for here, since I use Rider, I lack the tooling to adjust XAML properly, so I may just need to push sans the addition for this adjustment slider. (at least I think, I use WinUI 2/3 when making apps like this)
|
Copy all, I will make the revisions this weekend, and add the needed changes to add the effect slider to RB3 also. |