Skip to content

Add Riffmaster support for shadPS4#41

Open
aoiyu-dev wants to merge 6 commits intoTheNathannator:mainfrom
aoiyu-dev:main
Open

Add Riffmaster support for shadPS4#41
aoiyu-dev wants to merge 6 commits intoTheNathannator:mainfrom
aoiyu-dev:main

Conversation

@aoiyu-dev
Copy link
Copy Markdown

  • 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.
@aoiyu-dev
Copy link
Copy Markdown
Author

@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.

@TheNathannator
Copy link
Copy Markdown
Owner

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!

Copy link
Copy Markdown
Owner

@TheNathannator TheNathannator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +49 to +50
// Guitar inputs
GuitarViGEmMapper.HandleReport(device, report.Base);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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));
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Suggested change
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:)

Suggested change
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);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be done equivalently with just bit-shift operations:

Suggested change
return (short)(((input / 2) << 8) | input);
return (short)((input << 7) | (input >> 1));

Comment on lines +73 to +87

[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;
}
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

@aoiyu-dev aoiyu-dev Apr 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@aoiyu-dev
Copy link
Copy Markdown
Author

Copy all, I will make the revisions this weekend, and add the needed changes to add the effect slider to RB3 also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants