mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-05-16 10:15:46 +00:00
Input: Implement HD Rumble for compatible Nin devices (#40)
This PR addresses [this issue](https://github.com/Ryubing/Issues/issues/231) and implements HD Rumble for compatible Nin devices. ## New Features - Add the option for Gamepads to implement HD Rumble - Add the HD rumble capability to SDL3Gamepad and SDL3JoyCon when they meet certain requirements Reviewed-on: https://git.ryujinx.app/projects/Ryubing/pulls/40
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
using Ryujinx.Common.Configuration.Hid.Controller;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.HLE.HOS.Services.Hid;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
@@ -61,6 +62,8 @@ namespace Ryujinx.Input.SDL3
|
||||
public GamepadFeaturesFlag Features { get; }
|
||||
|
||||
private SDL_Gamepad* _gamepadHandle;
|
||||
|
||||
private NpadHdRumble _hdRumble;
|
||||
|
||||
private enum JoyConType
|
||||
{
|
||||
@@ -76,6 +79,7 @@ namespace Ryujinx.Input.SDL3
|
||||
public SDL3JoyCon(SDL_Gamepad* gamepadHandle, string driverId)
|
||||
{
|
||||
_gamepadHandle = gamepadHandle;
|
||||
_hdRumble = NpadHdRumble.Create(gamepadHandle);
|
||||
_buttonsUserMapping = new List<ButtonMappingEntry>(10);
|
||||
|
||||
Name = SDL_GetGamepadName(_gamepadHandle);
|
||||
@@ -139,6 +143,10 @@ namespace Ryujinx.Input.SDL3
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && _hdRumble != null)
|
||||
{
|
||||
_hdRumble.Dispose();
|
||||
}
|
||||
if (disposing && _gamepadHandle != null)
|
||||
{
|
||||
SDL_CloseGamepad(_gamepadHandle);
|
||||
@@ -156,6 +164,11 @@ namespace Ryujinx.Input.SDL3
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool HDRumble(VibrationValue left, VibrationValue right)
|
||||
{
|
||||
return _hdRumble?.HdRumble(left, right) ?? false;
|
||||
}
|
||||
|
||||
public void Rumble(float lowFrequency, float highFrequency, uint durationMs)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user