mirror of
https://github.com/Ryubing/Ryujinx.git
synced 2025-11-27 01:22:22 -05:00
[Ryujinx.HLE] Address dotnet-format issues (#5380)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0052 warnings * Address or silence dotnet format IDE1006 warnings * Address dotnet format CA1816 warnings * Address or silence dotnet format CA2208 warnings * Address or silence dotnet format CA1806 and a few CA1854 warnings * Address dotnet format CA2211 warnings * Address dotnet format CA1822 warnings * Address or silence dotnet format CA1069 warnings * Make dotnet format succeed in style mode * Address or silence dotnet format CA2211 warnings * Address review comments * Address dotnet format CA2208 warnings properly * Make ProcessResult readonly * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Add previously silenced warnings back I have no clue how these disappeared * Revert formatting changes for while and for-loops * Format if-blocks correctly * Run dotnet format style after rebase * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Run dotnet format analyzers after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Fix a few disabled warnings * Fix naming rule violation, Convert shader properties to auto-property and convert values to const * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Run dotnet format after rebase * Use using declaration instead of block syntax * Address IDE0251 warnings * Address a few disabled IDE0060 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Fix naming rule violations * Fix typo * Add trailing commas, use targeted new and use array initializer * Fix build issues * Fix remaining build issues * Remove SuppressMessage for CA1069 where possible * Address dotnet format issues * Address formatting issues Co-authored-by: Ac_K <acoustik666@gmail.com> * Add GetHashCode implementation for RenderingSurfaceInfo * Explicitly silence CA1822 for every affected method in Syscall * Address formatting issues in Demangler.cs * Address review feedback Co-authored-by: Ac_K <acoustik666@gmail.com> * Revert marking service methods as static * Next dotnet format pass * Address review feedback --------- Co-authored-by: Ac_K <acoustik666@gmail.com>
This commit is contained in:
@@ -26,10 +26,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
internal const int SharedMemEntryCount = 17;
|
||||
|
||||
public DebugPadDevice DebugPad;
|
||||
public TouchDevice Touchscreen;
|
||||
public MouseDevice Mouse;
|
||||
public TouchDevice Touchscreen;
|
||||
public MouseDevice Mouse;
|
||||
public KeyboardDevice Keyboard;
|
||||
public NpadDevices Npads;
|
||||
public NpadDevices Npads;
|
||||
|
||||
private static void CheckTypeSizeOrThrow<T>(int expectedSize)
|
||||
{
|
||||
@@ -51,7 +51,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
internal Hid(in Switch device, SharedMemoryStorage storage)
|
||||
{
|
||||
_device = device;
|
||||
_device = device;
|
||||
_storage = storage;
|
||||
|
||||
SharedMemory = SharedMemory.Create();
|
||||
@@ -61,11 +61,11 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
private void InitDevices()
|
||||
{
|
||||
DebugPad = new DebugPadDevice(_device, true);
|
||||
DebugPad = new DebugPadDevice(_device, true);
|
||||
Touchscreen = new TouchDevice(_device, true);
|
||||
Mouse = new MouseDevice(_device, false);
|
||||
Keyboard = new KeyboardDevice(_device, false);
|
||||
Npads = new NpadDevices(_device, true);
|
||||
Mouse = new MouseDevice(_device, false);
|
||||
Keyboard = new KeyboardDevice(_device, false);
|
||||
Npads = new NpadDevices(_device, true);
|
||||
}
|
||||
|
||||
public void RefreshInputConfig(List<InputConfig> inputConfig)
|
||||
@@ -86,6 +86,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
const int StickButtonThreshold = short.MaxValue / 2;
|
||||
ControllerKeys result = 0;
|
||||
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
result |= (leftStick.Dx < -StickButtonThreshold) ? ControllerKeys.LStickLeft : result;
|
||||
result |= (leftStick.Dx > StickButtonThreshold) ? ControllerKeys.LStickRight : result;
|
||||
result |= (leftStick.Dy < -StickButtonThreshold) ? ControllerKeys.LStickDown : result;
|
||||
@@ -95,11 +96,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
result |= (rightStick.Dx > StickButtonThreshold) ? ControllerKeys.RStickRight : result;
|
||||
result |= (rightStick.Dy < -StickButtonThreshold) ? ControllerKeys.RStickDown : result;
|
||||
result |= (rightStick.Dy > StickButtonThreshold) ? ControllerKeys.RStickUp : result;
|
||||
#pragma warning restore IDE0055
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static ulong GetTimestampTicks()
|
||||
internal ulong GetTimestampTicks()
|
||||
{
|
||||
return (ulong)PerformanceCounter.ElapsedMilliseconds * 19200;
|
||||
}
|
||||
|
||||
@@ -11,4 +11,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
Active = active;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
ref DebugPadState previousEntry = ref lifo.GetCurrentEntryRef();
|
||||
|
||||
DebugPadState newState = new DebugPadState();
|
||||
DebugPadState newState = new();
|
||||
|
||||
if (Active)
|
||||
{
|
||||
@@ -25,4 +25,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
lifo.Write(ref newState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
ref KeyboardState previousEntry = ref lifo.GetCurrentEntryRef();
|
||||
|
||||
KeyboardState newState = new KeyboardState
|
||||
KeyboardState newState = new()
|
||||
{
|
||||
SamplingNumber = previousEntry.SamplingNumber + 1,
|
||||
};
|
||||
@@ -32,4 +32,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
lifo.Write(ref newState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
ref RingLifo<MouseState> lifo = ref _device.Hid.SharedMemory.Mouse;
|
||||
|
||||
ref MouseState previousEntry = ref lifo.GetCurrentEntryRef();
|
||||
|
||||
MouseState newState = new MouseState()
|
||||
|
||||
MouseState newState = new()
|
||||
{
|
||||
SamplingNumber = previousEntry.SamplingNumber + 1,
|
||||
};
|
||||
@@ -33,4 +33,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
lifo.Write(ref newState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,22 +19,22 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
public const int MaxControllers = 9; // Players 1-8 and Handheld
|
||||
private ControllerType[] _configuredTypes;
|
||||
private KEvent[] _styleSetUpdateEvents;
|
||||
private bool[] _supportedPlayers;
|
||||
private static VibrationValue _neutralVibrationValue = new VibrationValue
|
||||
private readonly KEvent[] _styleSetUpdateEvents;
|
||||
private readonly bool[] _supportedPlayers;
|
||||
private VibrationValue _neutralVibrationValue = new()
|
||||
{
|
||||
AmplitudeLow = 0f,
|
||||
FrequencyLow = 160f,
|
||||
AmplitudeHigh = 0f,
|
||||
FrequencyHigh = 320f
|
||||
FrequencyHigh = 320f,
|
||||
};
|
||||
|
||||
internal NpadJoyHoldType JoyHold { get; set; }
|
||||
internal bool SixAxisActive = false; // TODO: link to hidserver when implemented
|
||||
internal ControllerType SupportedStyleSets { get; set; }
|
||||
|
||||
public Dictionary<PlayerIndex, ConcurrentQueue<(VibrationValue, VibrationValue)>> RumbleQueues = new Dictionary<PlayerIndex, ConcurrentQueue<(VibrationValue, VibrationValue)>>();
|
||||
public Dictionary<PlayerIndex, (VibrationValue, VibrationValue)> LastVibrationValues = new Dictionary<PlayerIndex, (VibrationValue, VibrationValue)>();
|
||||
public Dictionary<PlayerIndex, ConcurrentQueue<(VibrationValue, VibrationValue)>> RumbleQueues = new();
|
||||
public Dictionary<PlayerIndex, (VibrationValue, VibrationValue)> LastVibrationValues = new();
|
||||
|
||||
public NpadDevices(Switch device, bool active = true) : base(device, active)
|
||||
{
|
||||
@@ -129,7 +129,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
if (player > PlayerIndex.Handheld)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("Player must be Player1-8 or Handheld");
|
||||
throw new InvalidOperationException("Player must be Player1-8 or Handheld");
|
||||
}
|
||||
|
||||
if (controllerType == ControllerType.Handheld)
|
||||
@@ -249,6 +249,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
switch (type)
|
||||
{
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
case ControllerType.ProController:
|
||||
controller.StyleSet = NpadStyleTag.FullKey;
|
||||
controller.DeviceType = DeviceType.FullKey;
|
||||
@@ -296,6 +297,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
controller.DeviceType = DeviceType.Palma;
|
||||
controller.AppletFooterUiType = AppletFooterUiType.None;
|
||||
break;
|
||||
#pragma warning restore IDE0055
|
||||
}
|
||||
|
||||
_styleSetUpdateEvents[(int)player].ReadableEvent.Signal();
|
||||
@@ -329,7 +331,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
if (!Unsafe.AreSame(ref currentlyUsed, ref possiblyUnused))
|
||||
{
|
||||
NpadCommonState newState = new NpadCommonState();
|
||||
NpadCommonState newState = new();
|
||||
|
||||
WriteNewInputEntry(ref possiblyUnused, ref newState);
|
||||
}
|
||||
@@ -348,7 +350,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
if (!Unsafe.AreSame(ref currentlyUsed, ref possiblyUnused))
|
||||
{
|
||||
SixAxisSensorState newState = new SixAxisSensorState();
|
||||
SixAxisSensorState newState = new();
|
||||
|
||||
WriteNewSixInputEntry(ref possiblyUnused, ref newState);
|
||||
}
|
||||
@@ -379,23 +381,22 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
ref RingLifo<NpadCommonState> lifo = ref GetCommonStateLifo(ref currentNpad);
|
||||
|
||||
NpadCommonState newState = new NpadCommonState
|
||||
NpadCommonState newState = new()
|
||||
{
|
||||
Buttons = (NpadButton)state.Buttons,
|
||||
Buttons = (NpadButton)state.Buttons,
|
||||
AnalogStickL = new AnalogStickState
|
||||
{
|
||||
X = state.LStick.Dx,
|
||||
Y = state.LStick.Dy,
|
||||
X = state.LStick.Dx,
|
||||
Y = state.LStick.Dy,
|
||||
},
|
||||
AnalogStickR = new AnalogStickState
|
||||
{
|
||||
X = state.RStick.Dx,
|
||||
Y = state.RStick.Dy,
|
||||
}
|
||||
X = state.RStick.Dx,
|
||||
Y = state.RStick.Dy,
|
||||
},
|
||||
Attributes = NpadAttribute.IsConnected,
|
||||
};
|
||||
|
||||
newState.Attributes = NpadAttribute.IsConnected;
|
||||
|
||||
switch (currentNpad.StyleSet)
|
||||
{
|
||||
case NpadStyleTag.Handheld:
|
||||
@@ -434,7 +435,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
ref NpadInternalState currentNpad = ref _device.Hid.SharedMemory.Npads[(int)index].InternalState;
|
||||
|
||||
NpadCommonState newState = new NpadCommonState();
|
||||
NpadCommonState newState = new();
|
||||
|
||||
WriteNewInputEntry(ref currentNpad.FullKey, ref newState);
|
||||
WriteNewInputEntry(ref currentNpad.Handheld, ref newState);
|
||||
@@ -514,33 +515,33 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
return false;
|
||||
}
|
||||
|
||||
HidVector accel = new HidVector()
|
||||
HidVector accel = new()
|
||||
{
|
||||
X = state.Accelerometer.X,
|
||||
Y = state.Accelerometer.Y,
|
||||
Z = state.Accelerometer.Z
|
||||
Z = state.Accelerometer.Z,
|
||||
};
|
||||
|
||||
HidVector gyro = new HidVector()
|
||||
HidVector gyro = new()
|
||||
{
|
||||
X = state.Gyroscope.X,
|
||||
Y = state.Gyroscope.Y,
|
||||
Z = state.Gyroscope.Z
|
||||
Z = state.Gyroscope.Z,
|
||||
};
|
||||
|
||||
HidVector rotation = new HidVector()
|
||||
HidVector rotation = new()
|
||||
{
|
||||
X = state.Rotation.X,
|
||||
Y = state.Rotation.Y,
|
||||
Z = state.Rotation.Z
|
||||
Z = state.Rotation.Z,
|
||||
};
|
||||
|
||||
SixAxisSensorState newState = new SixAxisSensorState
|
||||
SixAxisSensorState newState = new()
|
||||
{
|
||||
Acceleration = accel,
|
||||
Acceleration = accel,
|
||||
AngularVelocity = gyro,
|
||||
Angle = rotation,
|
||||
Attributes = SixAxisSensorAttribute.IsConnected
|
||||
Angle = rotation,
|
||||
Attributes = SixAxisSensorAttribute.IsConnected,
|
||||
};
|
||||
|
||||
state.Orientation.AsSpan().CopyTo(newState.Direction.AsSpan());
|
||||
@@ -562,9 +563,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
if (!needUpdateRight && !isRightPair)
|
||||
{
|
||||
SixAxisSensorState emptyState = new SixAxisSensorState();
|
||||
|
||||
emptyState.Attributes = SixAxisSensorAttribute.IsConnected;
|
||||
SixAxisSensorState emptyState = new()
|
||||
{
|
||||
Attributes = SixAxisSensorAttribute.IsConnected,
|
||||
};
|
||||
|
||||
WriteNewSixInputEntry(ref currentNpad.JoyDualRightSixAxisSensor, ref emptyState);
|
||||
}
|
||||
@@ -576,9 +578,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
ref NpadInternalState currentNpad = ref _device.Hid.SharedMemory.Npads[(int)index].InternalState;
|
||||
|
||||
SixAxisSensorState newState = new SixAxisSensorState();
|
||||
|
||||
newState.Attributes = SixAxisSensorAttribute.IsConnected;
|
||||
SixAxisSensorState newState = new()
|
||||
{
|
||||
Attributes = SixAxisSensorAttribute.IsConnected,
|
||||
};
|
||||
|
||||
WriteNewSixInputEntry(ref currentNpad.FullKeySixAxisSensor, ref newState);
|
||||
WriteNewSixInputEntry(ref currentNpad.HandheldSixAxisSensor, ref newState);
|
||||
@@ -632,4 +635,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
return rumbleQueue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
ref TouchScreenState previousEntry = ref lifo.GetCurrentEntryRef();
|
||||
|
||||
TouchScreenState newState = new TouchScreenState
|
||||
TouchScreenState newState = new()
|
||||
{
|
||||
SamplingNumber = previousEntry.SamplingNumber + 1
|
||||
SamplingNumber = previousEntry.SamplingNumber + 1,
|
||||
};
|
||||
|
||||
if (Active)
|
||||
@@ -37,7 +37,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
FingerId = (uint)i,
|
||||
DiameterX = pi.DiameterX,
|
||||
DiameterY = pi.DiameterY,
|
||||
RotationAngle = pi.Angle
|
||||
RotationAngle = pi.Angle,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -45,4 +45,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
lifo.Write(ref newState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
public struct ControllerConfig
|
||||
{
|
||||
public PlayerIndex Player;
|
||||
public PlayerIndex Player;
|
||||
public ControllerType Type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
public struct GamepadInput
|
||||
{
|
||||
public PlayerIndex PlayerId;
|
||||
public ControllerKeys Buttons;
|
||||
public PlayerIndex PlayerId;
|
||||
public ControllerKeys Buttons;
|
||||
public JoystickPosition LStick;
|
||||
public JoystickPosition RStick;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
public int Dx;
|
||||
public int Dy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
public int Modifier;
|
||||
public ulong[] Keys;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
public struct SixAxisInput
|
||||
{
|
||||
public PlayerIndex PlayerId;
|
||||
public Vector3 Accelerometer;
|
||||
public Vector3 Gyroscope;
|
||||
public Vector3 Rotation;
|
||||
public float[] Orientation;
|
||||
public Vector3 Accelerometer;
|
||||
public Vector3 Gyroscope;
|
||||
public Vector3 Rotation;
|
||||
public float[] Orientation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
public uint DiameterY;
|
||||
public uint Angle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer
|
||||
public static PlayerIndex GetIndexFromNpadIdType(NpadIdType npadIdType)
|
||||
=> npadIdType switch
|
||||
{
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
NpadIdType.Player1 => PlayerIndex.Player1,
|
||||
NpadIdType.Player2 => PlayerIndex.Player2,
|
||||
NpadIdType.Player3 => PlayerIndex.Player3,
|
||||
@@ -17,12 +18,14 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer
|
||||
NpadIdType.Player8 => PlayerIndex.Player8,
|
||||
NpadIdType.Handheld => PlayerIndex.Handheld,
|
||||
NpadIdType.Unknown => PlayerIndex.Unknown,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(npadIdType))
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(npadIdType)),
|
||||
#pragma warning restore IDE0055
|
||||
};
|
||||
|
||||
public static NpadIdType GetNpadIdTypeFromIndex(PlayerIndex index)
|
||||
=> index switch
|
||||
{
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
PlayerIndex.Player1 => NpadIdType.Player1,
|
||||
PlayerIndex.Player2 => NpadIdType.Player2,
|
||||
PlayerIndex.Player3 => NpadIdType.Player3,
|
||||
@@ -33,7 +36,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer
|
||||
PlayerIndex.Player8 => NpadIdType.Player8,
|
||||
PlayerIndex.Handheld => NpadIdType.Handheld,
|
||||
PlayerIndex.Unknown => NpadIdType.Unknown,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(index))
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(index)),
|
||||
#pragma warning restore IDE0055
|
||||
};
|
||||
|
||||
public static bool IsValidNpadIdType(NpadIdType npadIdType)
|
||||
@@ -43,4 +47,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer
|
||||
npadIdType == NpadIdType.Unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,11 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer
|
||||
// ActivateVibrationDevice(nn::hid::VibrationDeviceHandle)
|
||||
public ResultCode ActivateVibrationDevice(ServiceCtx context)
|
||||
{
|
||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
||||
int vibrationDeviceHandle = context.RequestData.ReadInt32();
|
||||
#pragma warning restore IDE0059
|
||||
|
||||
return ResultCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer
|
||||
{
|
||||
class IAppletResource : IpcService
|
||||
{
|
||||
private KSharedMemory _hidSharedMem;
|
||||
private int _hidSharedMemHandle;
|
||||
private readonly KSharedMemory _hidSharedMem;
|
||||
private int _hidSharedMemHandle;
|
||||
|
||||
public IAppletResource(KSharedMemory hidSharedMem)
|
||||
{
|
||||
@@ -32,4 +32,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer
|
||||
return ResultCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
{
|
||||
Dual,
|
||||
Single,
|
||||
None
|
||||
None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
public enum NpadJoyDeviceType
|
||||
{
|
||||
Left,
|
||||
Right
|
||||
Right,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
public float X;
|
||||
public float Y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
{
|
||||
Loose,
|
||||
Standard,
|
||||
Tight
|
||||
Tight,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
public float RevisePower;
|
||||
public float ReviseRange;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,4 @@
|
||||
public byte Position;
|
||||
public byte Reserved;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
{
|
||||
None,
|
||||
Left,
|
||||
Right
|
||||
Right,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
{
|
||||
None,
|
||||
LinearResonantActuator,
|
||||
GcErm
|
||||
GcErm,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
public struct VibrationDeviceValue
|
||||
{
|
||||
public VibrationDeviceType DeviceType;
|
||||
public VibrationDeviceType DeviceType;
|
||||
public VibrationDevicePosition Position;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,16 +9,26 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
public float AmplitudeHigh;
|
||||
public float FrequencyHigh;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
public readonly override bool Equals(object obj)
|
||||
{
|
||||
return obj is VibrationValue value &&
|
||||
AmplitudeLow == value.AmplitudeLow &&
|
||||
AmplitudeHigh == value.AmplitudeHigh;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
public readonly override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(AmplitudeLow, AmplitudeHigh);
|
||||
}
|
||||
|
||||
public static bool operator ==(VibrationValue left, VibrationValue right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
public static bool operator !=(VibrationValue left, VibrationValue right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
{
|
||||
public IHidDebugServer(ServiceCtx context) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
[Service("hid")]
|
||||
class IHidServer : IpcService
|
||||
{
|
||||
private KEvent _xpadIdEvent;
|
||||
private KEvent _palmaOperationCompleteEvent;
|
||||
private readonly KEvent _xpadIdEvent;
|
||||
private readonly KEvent _palmaOperationCompleteEvent;
|
||||
|
||||
private int _xpadIdEventHandle;
|
||||
|
||||
@@ -24,33 +24,33 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
private bool _unintendedHomeButtonInputProtectionEnabled;
|
||||
private bool _vibrationPermitted;
|
||||
private bool _usbFullKeyControllerEnabled;
|
||||
private bool _isFirmwareUpdateAvailableForSixAxisSensor;
|
||||
private readonly bool _isFirmwareUpdateAvailableForSixAxisSensor;
|
||||
private bool _isSixAxisSensorUnalteredPassthroughEnabled;
|
||||
|
||||
private NpadHandheldActivationMode _npadHandheldActivationMode;
|
||||
private GyroscopeZeroDriftMode _gyroscopeZeroDriftMode;
|
||||
private GyroscopeZeroDriftMode _gyroscopeZeroDriftMode;
|
||||
|
||||
private long _npadCommunicationMode;
|
||||
private uint _accelerometerPlayMode;
|
||||
#pragma warning disable CS0649
|
||||
private long _vibrationGcErmCommand;
|
||||
private long _npadCommunicationMode;
|
||||
private uint _accelerometerPlayMode;
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
private readonly long _vibrationGcErmCommand;
|
||||
#pragma warning restore CS0649
|
||||
private float _sevenSixAxisSensorFusionStrength;
|
||||
|
||||
private SensorFusionParameters _sensorFusionParams;
|
||||
private SensorFusionParameters _sensorFusionParams;
|
||||
private AccelerometerParameters _accelerometerParams;
|
||||
|
||||
public IHidServer(ServiceCtx context) : base(context.Device.System.HidServer)
|
||||
{
|
||||
_xpadIdEvent = new KEvent(context.Device.System.KernelContext);
|
||||
_xpadIdEvent = new KEvent(context.Device.System.KernelContext);
|
||||
_palmaOperationCompleteEvent = new KEvent(context.Device.System.KernelContext);
|
||||
|
||||
_npadHandheldActivationMode = NpadHandheldActivationMode.Dual;
|
||||
_gyroscopeZeroDriftMode = GyroscopeZeroDriftMode.Standard;
|
||||
_gyroscopeZeroDriftMode = GyroscopeZeroDriftMode.Standard;
|
||||
|
||||
_isFirmwareUpdateAvailableForSixAxisSensor = false;
|
||||
|
||||
_sensorFusionParams = new SensorFusionParameters();
|
||||
_sensorFusionParams = new SensorFusionParameters();
|
||||
_accelerometerParams = new AccelerometerParameters();
|
||||
|
||||
// TODO: signal event at right place
|
||||
@@ -63,7 +63,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// CreateAppletResource(nn::applet::AppletResourceUserId) -> object<nn::hid::IAppletResource>
|
||||
public ResultCode CreateAppletResource(ServiceCtx context)
|
||||
{
|
||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
#pragma warning restore IDE0059
|
||||
|
||||
MakeObject(context, new IAppletResource(context.Device.System.HidSharedMem));
|
||||
|
||||
@@ -138,8 +140,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
// Initialize entries to avoid issues with some games.
|
||||
|
||||
KeyboardInput emptyInput = new KeyboardInput();
|
||||
emptyInput.Keys = new ulong[4];
|
||||
KeyboardInput emptyInput = new()
|
||||
{
|
||||
Keys = new ulong[4],
|
||||
};
|
||||
|
||||
for (int entry = 0; entry < Hid.SharedMemEntryCount; entry++)
|
||||
{
|
||||
@@ -199,7 +203,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// ActivateXpad(nn::hid::BasicXpadId, nn::applet::AppletResourceUserId)
|
||||
public ResultCode ActivateXpad(ServiceCtx context)
|
||||
{
|
||||
int basicXpadId = context.RequestData.ReadInt32();
|
||||
int basicXpadId = context.RequestData.ReadInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, basicXpadId });
|
||||
@@ -395,7 +399,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
_sensorFusionParams = new SensorFusionParameters
|
||||
{
|
||||
RevisePower = context.RequestData.ReadInt32(),
|
||||
ReviseRange = context.RequestData.ReadInt32()
|
||||
ReviseRange = context.RequestData.ReadInt32(),
|
||||
};
|
||||
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
@@ -447,7 +451,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
_accelerometerParams = new AccelerometerParameters
|
||||
{
|
||||
X = context.RequestData.ReadInt32(),
|
||||
Y = context.RequestData.ReadInt32()
|
||||
Y = context.RequestData.ReadInt32(),
|
||||
};
|
||||
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
@@ -671,7 +675,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
public ResultCode ActivateGesture(ServiceCtx context)
|
||||
{
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
int unknown0 = context.RequestData.ReadInt32();
|
||||
int unknown0 = context.RequestData.ReadInt32();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, unknown0 });
|
||||
|
||||
@@ -698,8 +702,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// GetSupportedNpadStyleSet(pid, nn::applet::AppletResourceUserId) -> uint nn::hid::NpadStyleTag
|
||||
public ResultCode GetSupportedNpadStyleSet(ServiceCtx context)
|
||||
{
|
||||
ulong pid = context.Request.HandleDesc.PId;
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
||||
ulong pid = context.Request.HandleDesc.PId;
|
||||
#pragma warning restore IDE0059
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
context.ResponseData.Write((int)context.Device.Hid.Npads.SupportedStyleSets);
|
||||
|
||||
@@ -712,9 +718,11 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// SetSupportedNpadIdType(nn::applet::AppletResourceUserId, array<NpadIdType, 9>)
|
||||
public ResultCode SetSupportedNpadIdType(ServiceCtx context)
|
||||
{
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
ulong arrayPosition = context.Request.PtrBuff[0].Position;
|
||||
ulong arraySize = context.Request.PtrBuff[0].Size;
|
||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
#pragma warning restore IDE0059
|
||||
ulong arrayPosition = context.Request.PtrBuff[0].Position;
|
||||
ulong arraySize = context.Request.PtrBuff[0].Size;
|
||||
|
||||
ReadOnlySpan<NpadIdType> supportedPlayerIds = MemoryMarshal.Cast<byte, NpadIdType>(context.Memory.GetSpan(arrayPosition, (int)arraySize));
|
||||
|
||||
@@ -756,9 +764,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// AcquireNpadStyleSetUpdateEventHandle(nn::applet::AppletResourceUserId, uint, ulong) -> nn::sf::NativeHandle
|
||||
public ResultCode AcquireNpadStyleSetUpdateEventHandle(ServiceCtx context)
|
||||
{
|
||||
PlayerIndex npadId = HidUtils.GetIndexFromNpadIdType((NpadIdType)context.RequestData.ReadInt32());
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
long npadStyleSet = context.RequestData.ReadInt64();
|
||||
PlayerIndex npadId = HidUtils.GetIndexFromNpadIdType((NpadIdType)context.RequestData.ReadInt32());
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
long npadStyleSet = context.RequestData.ReadInt64();
|
||||
|
||||
KEvent evnt = context.Device.Hid.Npads.GetStyleSetUpdateEvent(npadId);
|
||||
if (context.Process.HandleTable.GenerateHandle(evnt.ReadableEvent, out int handle) != Result.Success)
|
||||
@@ -780,8 +788,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// DisconnectNpad(nn::applet::AppletResourceUserId, uint NpadIdType)
|
||||
public ResultCode DisconnectNpad(ServiceCtx context)
|
||||
{
|
||||
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, npadIdType });
|
||||
|
||||
@@ -796,17 +804,17 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
ulong ledPattern = npadId switch
|
||||
{
|
||||
NpadIdType.Player1 => 0b0001,
|
||||
NpadIdType.Player2 => 0b0011,
|
||||
NpadIdType.Player3 => 0b0111,
|
||||
NpadIdType.Player4 => 0b1111,
|
||||
NpadIdType.Player5 => 0b1001,
|
||||
NpadIdType.Player6 => 0b0101,
|
||||
NpadIdType.Player7 => 0b1101,
|
||||
NpadIdType.Player8 => 0b0110,
|
||||
NpadIdType.Unknown => 0b0000,
|
||||
NpadIdType.Player1 => 0b0001,
|
||||
NpadIdType.Player2 => 0b0011,
|
||||
NpadIdType.Player3 => 0b0111,
|
||||
NpadIdType.Player4 => 0b1111,
|
||||
NpadIdType.Player5 => 0b1001,
|
||||
NpadIdType.Player6 => 0b0101,
|
||||
NpadIdType.Player7 => 0b1101,
|
||||
NpadIdType.Player8 => 0b0110,
|
||||
NpadIdType.Unknown => 0b0000,
|
||||
NpadIdType.Handheld => 0b0000,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(npadId))
|
||||
_ => throw new InvalidOperationException($"{nameof(npadId)} contains an invalid value: {npadId}"),
|
||||
};
|
||||
|
||||
context.ResponseData.Write(ledPattern);
|
||||
@@ -831,13 +839,13 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
// Initialize entries to avoid issues with some games.
|
||||
|
||||
List<GamepadInput> emptyGamepadInputs = new List<GamepadInput>();
|
||||
List<SixAxisInput> emptySixAxisInputs = new List<SixAxisInput>();
|
||||
List<GamepadInput> emptyGamepadInputs = new();
|
||||
List<SixAxisInput> emptySixAxisInputs = new();
|
||||
|
||||
for (int player = 0; player < NpadDevices.MaxControllers; player++)
|
||||
{
|
||||
GamepadInput gamepadInput = new GamepadInput();
|
||||
SixAxisInput sixaxisInput = new SixAxisInput();
|
||||
GamepadInput gamepadInput = new();
|
||||
SixAxisInput sixaxisInput = new();
|
||||
|
||||
gamepadInput.PlayerId = (PlayerIndex)player;
|
||||
sixaxisInput.PlayerId = (PlayerIndex)player;
|
||||
@@ -863,13 +871,15 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// SetNpadJoyHoldType(nn::applet::AppletResourceUserId, ulong NpadJoyHoldType)
|
||||
public ResultCode SetNpadJoyHoldType(ServiceCtx context)
|
||||
{
|
||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
#pragma warning restore IDE0059
|
||||
|
||||
NpadJoyHoldType npadJoyHoldType = (NpadJoyHoldType)context.RequestData.ReadUInt64();
|
||||
|
||||
if (npadJoyHoldType > NpadJoyHoldType.Horizontal)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(npadJoyHoldType));
|
||||
throw new InvalidOperationException($"{nameof(npadJoyHoldType)} contains an invalid value: {npadJoyHoldType}");
|
||||
}
|
||||
|
||||
foreach (PlayerIndex playerIndex in context.Device.Hid.Npads.GetSupportedPlayers())
|
||||
@@ -889,7 +899,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// GetNpadJoyHoldType(nn::applet::AppletResourceUserId) -> ulong NpadJoyHoldType
|
||||
public ResultCode GetNpadJoyHoldType(ServiceCtx context)
|
||||
{
|
||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
#pragma warning restore IDE0059
|
||||
|
||||
foreach (PlayerIndex playerIndex in context.Device.Hid.Npads.GetSupportedPlayers())
|
||||
{
|
||||
@@ -910,7 +922,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32();
|
||||
context.RequestData.BaseStream.Position += 4; // Padding
|
||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
#pragma warning restore IDE0059
|
||||
|
||||
if (HidUtils.IsValidNpadIdType(npadIdType))
|
||||
{
|
||||
@@ -943,7 +957,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32();
|
||||
context.RequestData.BaseStream.Position += 4; // Padding
|
||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
#pragma warning restore IDE0059
|
||||
|
||||
if (HidUtils.IsValidNpadIdType(npadIdType))
|
||||
{
|
||||
@@ -957,9 +973,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// MergeSingleJoyAsDualJoy(uint npadIdType0, uint npadIdType1, nn::applet::AppletResourceUserId)
|
||||
public ResultCode MergeSingleJoyAsDualJoy(ServiceCtx context)
|
||||
{
|
||||
NpadIdType npadIdType0 = (NpadIdType)context.RequestData.ReadUInt32();
|
||||
NpadIdType npadIdType1 = (NpadIdType)context.RequestData.ReadUInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
NpadIdType npadIdType0 = (NpadIdType)context.RequestData.ReadUInt32();
|
||||
NpadIdType npadIdType1 = (NpadIdType)context.RequestData.ReadUInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
if (HidUtils.IsValidNpadIdType(npadIdType0) && HidUtils.IsValidNpadIdType(npadIdType1))
|
||||
{
|
||||
@@ -995,7 +1011,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// SetNpadHandheldActivationMode(nn::applet::AppletResourceUserId, long HidNpadHandheldActivationMode)
|
||||
public ResultCode SetNpadHandheldActivationMode(ServiceCtx context)
|
||||
{
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
_npadHandheldActivationMode = (NpadHandheldActivationMode)context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadHandheldActivationMode });
|
||||
@@ -1020,8 +1036,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// SwapNpadAssignment(uint OldNpadAssignment, uint NewNpadAssignment, nn::applet::AppletResourceUserId)
|
||||
public ResultCode SwapNpadAssignment(ServiceCtx context)
|
||||
{
|
||||
int oldNpadAssignment = context.RequestData.ReadInt32();
|
||||
int newNpadAssignment = context.RequestData.ReadInt32();
|
||||
int oldNpadAssignment = context.RequestData.ReadInt32();
|
||||
int newNpadAssignment = context.RequestData.ReadInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, oldNpadAssignment, newNpadAssignment });
|
||||
@@ -1033,7 +1049,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// IsUnintendedHomeButtonInputProtectionEnabled(uint Unknown0, nn::applet::AppletResourceUserId) -> bool IsEnabled
|
||||
public ResultCode IsUnintendedHomeButtonInputProtectionEnabled(ServiceCtx context)
|
||||
{
|
||||
uint unknown0 = context.RequestData.ReadUInt32();
|
||||
uint unknown0 = context.RequestData.ReadUInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
context.ResponseData.Write(_unintendedHomeButtonInputProtectionEnabled);
|
||||
@@ -1048,8 +1064,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
public ResultCode EnableUnintendedHomeButtonInputProtection(ServiceCtx context)
|
||||
{
|
||||
_unintendedHomeButtonInputProtectionEnabled = context.RequestData.ReadBoolean();
|
||||
uint unknown0 = context.RequestData.ReadUInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
uint unknown0 = context.RequestData.ReadUInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, unknown0, _unintendedHomeButtonInputProtectionEnabled });
|
||||
|
||||
@@ -1060,7 +1076,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// SetNpadJoyAssignmentModeSingleWithDestination(uint npadIdType, uint npadJoyDeviceType, nn::applet::AppletResourceUserId) -> bool npadIdTypeIsSet, uint npadIdTypeSet
|
||||
public ResultCode SetNpadJoyAssignmentModeSingleWithDestination(ServiceCtx context)
|
||||
{
|
||||
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadInt32();
|
||||
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadInt32();
|
||||
NpadJoyDeviceType npadJoyDeviceType = (NpadJoyDeviceType)context.RequestData.ReadInt32();
|
||||
context.RequestData.BaseStream.Position += 4; // Padding
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
@@ -1081,7 +1097,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
private void SetNpadJoyAssignmentModeSingleWithDestinationImpl(ServiceCtx context, NpadIdType npadIdType, long appletResourceUserId, NpadJoyDeviceType npadJoyDeviceType, out NpadIdType npadIdTypeSet, out bool npadIdTypeIsSet)
|
||||
{
|
||||
npadIdTypeSet = default;
|
||||
npadIdTypeSet = default;
|
||||
npadIdTypeIsSet = false;
|
||||
|
||||
context.Device.Hid.SharedMemory.Npads[(int)HidUtils.GetIndexFromNpadIdType(npadIdType)].InternalState.JoyAssignmentMode = NpadJoyAssignmentMode.Single;
|
||||
@@ -1096,8 +1112,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
public ResultCode GetVibrationDeviceInfo(ServiceCtx context)
|
||||
{
|
||||
VibrationDeviceHandle deviceHandle = context.RequestData.ReadStruct<VibrationDeviceHandle>();
|
||||
NpadStyleIndex deviceType = (NpadStyleIndex)deviceHandle.DeviceType;
|
||||
NpadIdType npadIdType = (NpadIdType)deviceHandle.PlayerId;
|
||||
NpadStyleIndex deviceType = (NpadStyleIndex)deviceHandle.DeviceType;
|
||||
NpadIdType npadIdType = (NpadIdType)deviceHandle.PlayerId;
|
||||
|
||||
if (deviceType < NpadStyleIndex.System || deviceType >= NpadStyleIndex.FullKey)
|
||||
{
|
||||
@@ -1136,14 +1152,14 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(deviceHandle.Position));
|
||||
throw new InvalidOperationException($"{nameof(deviceHandle.Position)} contains an invalid value: {deviceHandle.Position}");
|
||||
}
|
||||
}
|
||||
|
||||
VibrationDeviceValue deviceInfo = new VibrationDeviceValue
|
||||
VibrationDeviceValue deviceInfo = new()
|
||||
{
|
||||
DeviceType = vibrationDeviceType,
|
||||
Position = vibrationDevicePosition
|
||||
Position = vibrationDevicePosition,
|
||||
};
|
||||
|
||||
context.ResponseData.WriteStruct(deviceInfo);
|
||||
@@ -1158,27 +1174,30 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// SendVibrationValue(nn::hid::VibrationDeviceHandle, nn::hid::VibrationValue, nn::applet::AppletResourceUserId)
|
||||
public ResultCode SendVibrationValue(ServiceCtx context)
|
||||
{
|
||||
VibrationDeviceHandle deviceHandle = new VibrationDeviceHandle
|
||||
VibrationDeviceHandle deviceHandle = new()
|
||||
{
|
||||
DeviceType = context.RequestData.ReadByte(),
|
||||
PlayerId = context.RequestData.ReadByte(),
|
||||
Position = context.RequestData.ReadByte(),
|
||||
Reserved = context.RequestData.ReadByte()
|
||||
PlayerId = context.RequestData.ReadByte(),
|
||||
Position = context.RequestData.ReadByte(),
|
||||
Reserved = context.RequestData.ReadByte(),
|
||||
};
|
||||
|
||||
VibrationValue vibrationValue = new VibrationValue
|
||||
VibrationValue vibrationValue = new()
|
||||
{
|
||||
AmplitudeLow = context.RequestData.ReadSingle(),
|
||||
FrequencyLow = context.RequestData.ReadSingle(),
|
||||
AmplitudeLow = context.RequestData.ReadSingle(),
|
||||
FrequencyLow = context.RequestData.ReadSingle(),
|
||||
AmplitudeHigh = context.RequestData.ReadSingle(),
|
||||
FrequencyHigh = context.RequestData.ReadSingle()
|
||||
FrequencyHigh = context.RequestData.ReadSingle(),
|
||||
};
|
||||
|
||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
#pragma warning restore IDE0059
|
||||
|
||||
Dictionary<byte, VibrationValue> dualVibrationValues = new Dictionary<byte, VibrationValue>();
|
||||
|
||||
dualVibrationValues[deviceHandle.Position] = vibrationValue;
|
||||
Dictionary<byte, VibrationValue> dualVibrationValues = new()
|
||||
{
|
||||
[deviceHandle.Position] = vibrationValue,
|
||||
};
|
||||
|
||||
context.Device.Hid.Npads.UpdateRumbleQueue((PlayerIndex)deviceHandle.PlayerId, dualVibrationValues);
|
||||
|
||||
@@ -1189,15 +1208,17 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// GetActualVibrationValue(nn::hid::VibrationDeviceHandle, nn::applet::AppletResourceUserId) -> nn::hid::VibrationValue
|
||||
public ResultCode GetActualVibrationValue(ServiceCtx context)
|
||||
{
|
||||
VibrationDeviceHandle deviceHandle = new VibrationDeviceHandle
|
||||
VibrationDeviceHandle deviceHandle = new()
|
||||
{
|
||||
DeviceType = context.RequestData.ReadByte(),
|
||||
PlayerId = context.RequestData.ReadByte(),
|
||||
Position = context.RequestData.ReadByte(),
|
||||
Reserved = context.RequestData.ReadByte()
|
||||
PlayerId = context.RequestData.ReadByte(),
|
||||
Position = context.RequestData.ReadByte(),
|
||||
Reserved = context.RequestData.ReadByte(),
|
||||
};
|
||||
|
||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
#pragma warning restore IDE0059
|
||||
|
||||
VibrationValue vibrationValue = context.Device.Hid.Npads.GetLastVibrationValue((PlayerIndex)deviceHandle.PlayerId, deviceHandle.Position);
|
||||
|
||||
@@ -1242,7 +1263,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// SendVibrationValues(nn::applet::AppletResourceUserId, buffer<array<nn::hid::VibrationDeviceHandle>, type: 9>, buffer<array<nn::hid::VibrationValue>, type: 9>)
|
||||
public ResultCode SendVibrationValues(ServiceCtx context)
|
||||
{
|
||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
#pragma warning restore IDE0059
|
||||
|
||||
byte[] vibrationDeviceHandleBuffer = new byte[context.Request.PtrBuff[0].Size];
|
||||
|
||||
@@ -1252,12 +1275,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
context.Memory.Read(context.Request.PtrBuff[1].Position, vibrationValueBuffer);
|
||||
|
||||
Span<VibrationDeviceHandle> deviceHandles = MemoryMarshal.Cast<byte, VibrationDeviceHandle>(vibrationDeviceHandleBuffer);
|
||||
Span<VibrationValue> vibrationValues = MemoryMarshal.Cast<byte, VibrationValue>(vibrationValueBuffer);
|
||||
Span<VibrationDeviceHandle> deviceHandles = MemoryMarshal.Cast<byte, VibrationDeviceHandle>(vibrationDeviceHandleBuffer);
|
||||
Span<VibrationValue> vibrationValues = MemoryMarshal.Cast<byte, VibrationValue>(vibrationValueBuffer);
|
||||
|
||||
if (!deviceHandles.IsEmpty && vibrationValues.Length == deviceHandles.Length)
|
||||
{
|
||||
Dictionary<byte, VibrationValue> dualVibrationValues = new Dictionary<byte, VibrationValue>();
|
||||
Dictionary<byte, VibrationValue> dualVibrationValues = new();
|
||||
PlayerIndex currentIndex = (PlayerIndex)deviceHandles[0].PlayerId;
|
||||
|
||||
for (int deviceCounter = 0; deviceCounter < deviceHandles.Length; deviceCounter++)
|
||||
@@ -1285,9 +1308,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// SendVibrationGcErmCommand(nn::hid::VibrationDeviceHandle, nn::hid::VibrationGcErmCommand, nn::applet::AppletResourceUserId)
|
||||
public ResultCode SendVibrationGcErmCommand(ServiceCtx context)
|
||||
{
|
||||
int vibrationDeviceHandle = context.RequestData.ReadInt32();
|
||||
int vibrationDeviceHandle = context.RequestData.ReadInt32();
|
||||
long vibrationGcErmCommand = context.RequestData.ReadInt64();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, vibrationDeviceHandle, vibrationGcErmCommand });
|
||||
|
||||
@@ -1298,8 +1321,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// GetActualVibrationGcErmCommand(nn::hid::VibrationDeviceHandle, nn::applet::AppletResourceUserId) -> nn::hid::VibrationGcErmCommand
|
||||
public ResultCode GetActualVibrationGcErmCommand(ServiceCtx context)
|
||||
{
|
||||
int vibrationDeviceHandle = context.RequestData.ReadInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
int vibrationDeviceHandle = context.RequestData.ReadInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
context.ResponseData.Write(_vibrationGcErmCommand);
|
||||
|
||||
@@ -1332,8 +1355,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// IsVibrationDeviceMounted(nn::hid::VibrationDeviceHandle, nn::applet::AppletResourceUserId)
|
||||
public ResultCode IsVibrationDeviceMounted(ServiceCtx context)
|
||||
{
|
||||
int vibrationDeviceHandle = context.RequestData.ReadInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
||||
int vibrationDeviceHandle = context.RequestData.ReadInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
#pragma warning restore IDE0059
|
||||
|
||||
// NOTE: Service use vibrationDeviceHandle to get the PlayerIndex.
|
||||
// And return false if (npadIdType >= (NpadIdType)8 && npadIdType != NpadIdType.Handheld && npadIdType != NpadIdType.Unknown)
|
||||
@@ -1358,8 +1383,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// StartConsoleSixAxisSensor(nn::hid::ConsoleSixAxisSensorHandle, nn::applet::AppletResourceUserId)
|
||||
public ResultCode StartConsoleSixAxisSensor(ServiceCtx context)
|
||||
{
|
||||
int consoleSixAxisSensorHandle = context.RequestData.ReadInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
int consoleSixAxisSensorHandle = context.RequestData.ReadInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, consoleSixAxisSensorHandle });
|
||||
|
||||
@@ -1370,8 +1395,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// StopConsoleSixAxisSensor(nn::hid::ConsoleSixAxisSensorHandle, nn::applet::AppletResourceUserId)
|
||||
public ResultCode StopConsoleSixAxisSensor(ServiceCtx context)
|
||||
{
|
||||
int consoleSixAxisSensorHandle = context.RequestData.ReadInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
int consoleSixAxisSensorHandle = context.RequestData.ReadInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, consoleSixAxisSensorHandle });
|
||||
|
||||
@@ -1416,8 +1441,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
public ResultCode InitializeSevenSixAxisSensor(ServiceCtx context)
|
||||
{
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
long counter0 = context.RequestData.ReadInt64();
|
||||
long counter1 = context.RequestData.ReadInt64();
|
||||
long counter0 = context.RequestData.ReadInt64();
|
||||
long counter1 = context.RequestData.ReadInt64();
|
||||
|
||||
// TODO: Determine if array<nn::sf::NativeHandle> is a buffer or not...
|
||||
|
||||
@@ -1441,8 +1466,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// SetSevenSixAxisSensorFusionStrength(float Strength, nn::applet::AppletResourceUserId)
|
||||
public ResultCode SetSevenSixAxisSensorFusionStrength(ServiceCtx context)
|
||||
{
|
||||
_sevenSixAxisSensorFusionStrength = context.RequestData.ReadSingle();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
_sevenSixAxisSensorFusionStrength = context.RequestData.ReadSingle();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _sevenSixAxisSensorFusionStrength });
|
||||
|
||||
@@ -1566,14 +1591,14 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// GetPalmaConnectionHandle(uint Unknown0, nn::applet::AppletResourceUserId) -> nn::hid::PalmaConnectionHandle
|
||||
public ResultCode GetPalmaConnectionHandle(ServiceCtx context)
|
||||
{
|
||||
int unknown0 = context.RequestData.ReadInt32();
|
||||
int unknown0 = context.RequestData.ReadInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
int palmaConnectionHandle = 0;
|
||||
|
||||
context.ResponseData.Write(palmaConnectionHandle);
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId , unknown0, palmaConnectionHandle });
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, unknown0, palmaConnectionHandle });
|
||||
|
||||
return ResultCode.Success;
|
||||
}
|
||||
@@ -1628,8 +1653,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// PlayPalmaActivity(nn::hid::PalmaConnectionHandle, ulong Unknown0)
|
||||
public ResultCode PlayPalmaActivity(ServiceCtx context)
|
||||
{
|
||||
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
||||
long unknown0 = context.RequestData.ReadInt64();
|
||||
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
||||
long unknown0 = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, unknown0 });
|
||||
|
||||
@@ -1642,8 +1667,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// SetPalmaFrModeType(nn::hid::PalmaConnectionHandle, ulong FrModeType)
|
||||
public ResultCode SetPalmaFrModeType(ServiceCtx context)
|
||||
{
|
||||
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
||||
long frModeType = context.RequestData.ReadInt64();
|
||||
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
||||
long frModeType = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, frModeType });
|
||||
|
||||
@@ -1667,8 +1692,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// EnablePalmaStep(nn::hid::PalmaConnectionHandle, bool Enable)
|
||||
public ResultCode EnablePalmaStep(ServiceCtx context)
|
||||
{
|
||||
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
||||
bool enabledPalmaStep = context.RequestData.ReadBoolean();
|
||||
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
||||
bool enabledPalmaStep = context.RequestData.ReadBoolean();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, enabledPalmaStep });
|
||||
|
||||
@@ -1694,9 +1719,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// ReadPalmaApplicationSection(nn::hid::PalmaConnectionHandle, ulong Unknown0, ulong Unknown1)
|
||||
public ResultCode ReadPalmaApplicationSection(ServiceCtx context)
|
||||
{
|
||||
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
||||
long unknown0 = context.RequestData.ReadInt64();
|
||||
long unknown1 = context.RequestData.ReadInt64();
|
||||
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
||||
long unknown0 = context.RequestData.ReadInt64();
|
||||
long unknown1 = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, unknown0, unknown1 });
|
||||
|
||||
@@ -1707,9 +1732,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// WritePalmaApplicationSection(nn::hid::PalmaConnectionHandle, ulong Unknown0, ulong Unknown1, nn::hid::PalmaApplicationSectionAccessBuffer)
|
||||
public ResultCode WritePalmaApplicationSection(ServiceCtx context)
|
||||
{
|
||||
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
||||
long unknown0 = context.RequestData.ReadInt64();
|
||||
long unknown1 = context.RequestData.ReadInt64();
|
||||
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
||||
long unknown0 = context.RequestData.ReadInt64();
|
||||
long unknown1 = context.RequestData.ReadInt64();
|
||||
// nn::hid::PalmaApplicationSectionAccessBuffer cast is unknown
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, unknown0, unknown1 });
|
||||
@@ -1746,7 +1771,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
public ResultCode SetIsPalmaAllConnectable(ServiceCtx context)
|
||||
{
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
long unknownBool = context.RequestData.ReadInt64();
|
||||
long unknownBool = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, unknownBool });
|
||||
|
||||
@@ -1766,8 +1791,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// SetNpadCommunicationMode(long CommunicationMode, nn::applet::AppletResourceUserId)
|
||||
public ResultCode SetNpadCommunicationMode(ServiceCtx context)
|
||||
{
|
||||
_npadCommunicationMode = context.RequestData.ReadInt64();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
_npadCommunicationMode = context.RequestData.ReadInt64();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadCommunicationMode });
|
||||
|
||||
@@ -1790,7 +1815,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
public ResultCode SetTouchScreenConfiguration(ServiceCtx context)
|
||||
{
|
||||
long touchScreenConfigurationForNx = context.RequestData.ReadInt64();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, touchScreenConfigurationForNx });
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
private ResultCode GetAppletFooterUiTypeImpl(ServiceCtx context, out AppletFooterUiType appletFooterUiType)
|
||||
{
|
||||
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32();
|
||||
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32();
|
||||
PlayerIndex playerIndex = HidUtils.GetIndexFromNpadIdType(npadIdType);
|
||||
|
||||
appletFooterUiType = context.Device.Hid.SharedMemory.Npads[(int)playerIndex].InternalState.AppletFooterUiType;
|
||||
@@ -73,4 +73,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
return ResultCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,12 +10,14 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
[CommandCmif(1)]
|
||||
// GetBusHandle(nn::hid::NpadIdType, nn::hidbus::BusType, nn::applet::AppletResourceUserId) -> (bool HasHandle, nn::hidbus::BusHandle)
|
||||
#pragma warning disable CA1822 // Mark member as static
|
||||
public ResultCode GetBusHandle(ServiceCtx context)
|
||||
#pragma warning restore CA1822
|
||||
{
|
||||
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadInt32();
|
||||
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadInt32();
|
||||
context.RequestData.BaseStream.Position += 4; // Padding
|
||||
BusType busType = (BusType)context.RequestData.ReadInt64();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
BusType busType = (BusType)context.RequestData.ReadInt64();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
context.ResponseData.Write(false);
|
||||
context.ResponseData.BaseStream.Position += 7; // Padding
|
||||
@@ -26,4 +28,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
return ResultCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
{
|
||||
public ISystemServer(ServiceCtx context) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
||||
// StopImageProcessor(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId)
|
||||
public ResultCode StopImageProcessor(ServiceCtx context)
|
||||
{
|
||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
||||
|
||||
CheckCameraHandle(irCameraHandle);
|
||||
|
||||
@@ -79,9 +79,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
||||
// RunMomentProcessor(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId, PackedMomentProcessorConfig)
|
||||
public ResultCode RunMomentProcessor(ServiceCtx context)
|
||||
{
|
||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
||||
var packedMomentProcessorConfig = context.RequestData.ReadStruct<PackedMomentProcessorConfig>();
|
||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
||||
var packedMomentProcessorConfig = context.RequestData.ReadStruct<PackedMomentProcessorConfig>();
|
||||
|
||||
CheckCameraHandle(irCameraHandle);
|
||||
|
||||
@@ -94,9 +94,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
||||
// RunClusteringProcessor(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId, PackedClusteringProcessorConfig)
|
||||
public ResultCode RunClusteringProcessor(ServiceCtx context)
|
||||
{
|
||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
||||
var packedClusteringProcessorConfig = context.RequestData.ReadStruct<PackedClusteringProcessorConfig>();
|
||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
||||
var packedClusteringProcessorConfig = context.RequestData.ReadStruct<PackedClusteringProcessorConfig>();
|
||||
|
||||
CheckCameraHandle(irCameraHandle);
|
||||
|
||||
@@ -109,9 +109,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
||||
// RunImageTransferProcessor(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId, PackedImageTransferProcessorConfig, u64 TransferMemorySize, TransferMemoryHandle)
|
||||
public ResultCode RunImageTransferProcessor(ServiceCtx context)
|
||||
{
|
||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
||||
var packedImageTransferProcessorConfig = context.RequestData.ReadStruct<PackedImageTransferProcessorConfig>();
|
||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
||||
var packedImageTransferProcessorConfig = context.RequestData.ReadStruct<PackedImageTransferProcessorConfig>();
|
||||
|
||||
CheckCameraHandle(irCameraHandle);
|
||||
|
||||
@@ -126,8 +126,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
||||
// GetImageTransferProcessorState(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId)
|
||||
public ResultCode GetImageTransferProcessorState(ServiceCtx context)
|
||||
{
|
||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
||||
|
||||
// ulong imageTransferBufferAddress = context.Request.ReceiveBuff[0].Position;
|
||||
ulong imageTransferBufferSize = context.Request.ReceiveBuff[0].Size;
|
||||
@@ -144,8 +144,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
||||
// TODO: Uses the buffer to copy the JoyCon IR data (by using a JoyCon driver) and update the following struct.
|
||||
context.ResponseData.WriteStruct(new ImageTransferProcessorState()
|
||||
{
|
||||
SamplingNumber = 0,
|
||||
AmbientNoiseLevel = 0
|
||||
SamplingNumber = 0,
|
||||
AmbientNoiseLevel = 0,
|
||||
});
|
||||
|
||||
return ResultCode.Success;
|
||||
@@ -155,9 +155,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
||||
// RunTeraPluginProcessor(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId, PackedTeraPluginProcessorConfig)
|
||||
public ResultCode RunTeraPluginProcessor(ServiceCtx context)
|
||||
{
|
||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
||||
var packedTeraPluginProcessorConfig = context.RequestData.ReadStruct<PackedTeraPluginProcessorConfig>();
|
||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
||||
var packedTeraPluginProcessorConfig = context.RequestData.ReadStruct<PackedTeraPluginProcessorConfig>();
|
||||
|
||||
CheckCameraHandle(irCameraHandle);
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
||||
{
|
||||
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32();
|
||||
|
||||
if (npadIdType > NpadIdType.Player8 &&
|
||||
if (npadIdType > NpadIdType.Player8 &&
|
||||
npadIdType != NpadIdType.Unknown &&
|
||||
npadIdType != NpadIdType.Handheld)
|
||||
{
|
||||
@@ -193,10 +193,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
||||
// CheckFirmwareVersion(nn::irsensor::IrCameraHandle, nn::irsensor::PackedMcuVersion, nn::applet::AppletResourceUserId, pid)
|
||||
public ResultCode CheckFirmwareVersion(ServiceCtx context)
|
||||
{
|
||||
int irCameraHandle = context.RequestData.ReadInt32();
|
||||
int irCameraHandle = context.RequestData.ReadInt32();
|
||||
short packedMcuVersionMajor = context.RequestData.ReadInt16();
|
||||
short packedMcuVersionMinor = context.RequestData.ReadInt16();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, irCameraHandle, packedMcuVersionMajor, packedMcuVersionMinor });
|
||||
|
||||
@@ -207,7 +207,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
||||
// StopImageProcessorAsync(nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId, pid)
|
||||
public ResultCode StopImageProcessorAsync(ServiceCtx context)
|
||||
{
|
||||
int irCameraHandle = context.RequestData.ReadInt32();
|
||||
int irCameraHandle = context.RequestData.ReadInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, irCameraHandle });
|
||||
@@ -220,7 +220,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
||||
public ResultCode ActivateIrsensorWithFunctionLevel(ServiceCtx context)
|
||||
{
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
long packedFunctionLevel = context.RequestData.ReadInt64();
|
||||
long packedFunctionLevel = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, packedFunctionLevel });
|
||||
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
{
|
||||
public IIrSensorSystemServer(ServiceCtx context) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
{
|
||||
public enum ResultCode
|
||||
{
|
||||
ModuleId = 205,
|
||||
ModuleId = 205,
|
||||
ErrorCodeShift = 9,
|
||||
|
||||
Success = 0,
|
||||
|
||||
InvalidCameraHandle = (204 << ErrorCodeShift) | ModuleId,
|
||||
InvalidBufferSize = (207 << ErrorCodeShift) | ModuleId,
|
||||
InvalidBufferSize = (207 << ErrorCodeShift) | ModuleId,
|
||||
HandlePointerIsNull = (212 << ErrorCodeShift) | ModuleId,
|
||||
NpadIdOutOfRange = (709 << ErrorCodeShift) | ModuleId
|
||||
NpadIdOutOfRange = (709 << ErrorCodeShift) | ModuleId,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs.Types
|
||||
struct ImageTransferProcessorState
|
||||
{
|
||||
public ulong SamplingNumber;
|
||||
public uint AmbientNoiseLevel;
|
||||
public uint Reserved;
|
||||
public uint AmbientNoiseLevel;
|
||||
public uint Reserved;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs.Types
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x4)]
|
||||
struct IrCameraHandle
|
||||
{
|
||||
public byte PlayerNumber;
|
||||
public byte DeviceType;
|
||||
public byte PlayerNumber;
|
||||
public byte DeviceType;
|
||||
public ushort Reserved;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,21 +5,21 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs.Types
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x28)]
|
||||
struct PackedClusteringProcessorConfig
|
||||
{
|
||||
public long ExposureTime;
|
||||
public byte LightTarget;
|
||||
public byte Gain;
|
||||
public byte IsNegativeImageUsed;
|
||||
public byte Reserved1;
|
||||
public uint Reserved2;
|
||||
public long ExposureTime;
|
||||
public byte LightTarget;
|
||||
public byte Gain;
|
||||
public byte IsNegativeImageUsed;
|
||||
public byte Reserved1;
|
||||
public uint Reserved2;
|
||||
public ushort WindowOfInterestX;
|
||||
public ushort WindowOfInterestY;
|
||||
public ushort WindowOfInterestWidth;
|
||||
public ushort WindowOfInterestHeight;
|
||||
public uint RequiredMcuVersion;
|
||||
public uint ObjectPixelCountMin;
|
||||
public uint ObjectPixelCountMax;
|
||||
public byte ObjectIntensityMin;
|
||||
public byte IsExternalLightFilterEnabled;
|
||||
public uint RequiredMcuVersion;
|
||||
public uint ObjectPixelCountMin;
|
||||
public uint ObjectPixelCountMax;
|
||||
public byte ObjectIntensityMin;
|
||||
public byte IsExternalLightFilterEnabled;
|
||||
public ushort Reserved3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,15 +5,15 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs.Types
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x18)]
|
||||
struct PackedImageTransferProcessorConfig
|
||||
{
|
||||
public long ExposureTime;
|
||||
public byte LightTarget;
|
||||
public byte Gain;
|
||||
public byte IsNegativeImageUsed;
|
||||
public byte Reserved1;
|
||||
public uint Reserved2;
|
||||
public uint RequiredMcuVersion;
|
||||
public byte Format;
|
||||
public byte Reserved3;
|
||||
public long ExposureTime;
|
||||
public byte LightTarget;
|
||||
public byte Gain;
|
||||
public byte IsNegativeImageUsed;
|
||||
public byte Reserved1;
|
||||
public uint Reserved2;
|
||||
public uint RequiredMcuVersion;
|
||||
public byte Format;
|
||||
public byte Reserved3;
|
||||
public ushort Reserved4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,19 +5,19 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs.Types
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x20)]
|
||||
struct PackedMomentProcessorConfig
|
||||
{
|
||||
public long ExposureTime;
|
||||
public byte LightTarget;
|
||||
public byte Gain;
|
||||
public byte IsNegativeImageUsed;
|
||||
public byte Reserved1;
|
||||
public uint Reserved2;
|
||||
public long ExposureTime;
|
||||
public byte LightTarget;
|
||||
public byte Gain;
|
||||
public byte IsNegativeImageUsed;
|
||||
public byte Reserved1;
|
||||
public uint Reserved2;
|
||||
public ushort WindowOfInterestX;
|
||||
public ushort WindowOfInterestY;
|
||||
public ushort WindowOfInterestWidth;
|
||||
public ushort WindowOfInterestHeight;
|
||||
public uint RequiredMcuVersion;
|
||||
public byte Preprocess;
|
||||
public byte PreprocessIntensityThreshold;
|
||||
public uint RequiredMcuVersion;
|
||||
public byte Preprocess;
|
||||
public byte PreprocessIntensityThreshold;
|
||||
public ushort Reserved3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs.Types
|
||||
public byte Unknown2;
|
||||
public byte Unknown3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
{
|
||||
enum ResultCode
|
||||
{
|
||||
ModuleId = 202,
|
||||
ModuleId = 202,
|
||||
ErrorCodeShift = 9,
|
||||
|
||||
Success = 0,
|
||||
|
||||
InvalidNpadDeviceType = (122 << ErrorCodeShift) | ModuleId,
|
||||
InvalidNpadIdType = (123 << ErrorCodeShift) | ModuleId,
|
||||
InvalidDeviceIndex = (124 << ErrorCodeShift) | ModuleId,
|
||||
InvalidBufferSize = (131 << ErrorCodeShift) | ModuleId
|
||||
InvalidNpadIdType = (123 << ErrorCodeShift) | ModuleId,
|
||||
InvalidDeviceIndex = (124 << ErrorCodeShift) | ModuleId,
|
||||
InvalidBufferSize = (131 << ErrorCodeShift) | ModuleId,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types
|
||||
LarkNesLeft,
|
||||
LarkNesRight,
|
||||
Lucia,
|
||||
Verification
|
||||
Verification,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types
|
||||
public float Y;
|
||||
public float Z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct BusHandle
|
||||
{
|
||||
public int AbstractedPadId;
|
||||
public int AbstractedPadId;
|
||||
public byte InternalIndex;
|
||||
public byte PlayerNumber;
|
||||
public byte BusTypeId;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
{
|
||||
public enum BusType : long
|
||||
{
|
||||
LeftJoyRail = 0,
|
||||
LeftJoyRail = 0,
|
||||
RightJoyRail = 1,
|
||||
InternalBus = 2
|
||||
InternalBus = 2,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,41 +5,41 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
[Flags]
|
||||
public enum ControllerKeys : long
|
||||
{
|
||||
A = 1 << 0,
|
||||
B = 1 << 1,
|
||||
X = 1 << 2,
|
||||
Y = 1 << 3,
|
||||
LStick = 1 << 4,
|
||||
RStick = 1 << 5,
|
||||
L = 1 << 6,
|
||||
R = 1 << 7,
|
||||
Zl = 1 << 8,
|
||||
Zr = 1 << 9,
|
||||
Plus = 1 << 10,
|
||||
Minus = 1 << 11,
|
||||
DpadLeft = 1 << 12,
|
||||
DpadUp = 1 << 13,
|
||||
DpadRight = 1 << 14,
|
||||
DpadDown = 1 << 15,
|
||||
LStickLeft = 1 << 16,
|
||||
LStickUp = 1 << 17,
|
||||
A = 1 << 0,
|
||||
B = 1 << 1,
|
||||
X = 1 << 2,
|
||||
Y = 1 << 3,
|
||||
LStick = 1 << 4,
|
||||
RStick = 1 << 5,
|
||||
L = 1 << 6,
|
||||
R = 1 << 7,
|
||||
Zl = 1 << 8,
|
||||
Zr = 1 << 9,
|
||||
Plus = 1 << 10,
|
||||
Minus = 1 << 11,
|
||||
DpadLeft = 1 << 12,
|
||||
DpadUp = 1 << 13,
|
||||
DpadRight = 1 << 14,
|
||||
DpadDown = 1 << 15,
|
||||
LStickLeft = 1 << 16,
|
||||
LStickUp = 1 << 17,
|
||||
LStickRight = 1 << 18,
|
||||
LStickDown = 1 << 19,
|
||||
RStickLeft = 1 << 20,
|
||||
RStickUp = 1 << 21,
|
||||
LStickDown = 1 << 19,
|
||||
RStickLeft = 1 << 20,
|
||||
RStickUp = 1 << 21,
|
||||
RStickRight = 1 << 22,
|
||||
RStickDown = 1 << 23,
|
||||
SlLeft = 1 << 24,
|
||||
SrLeft = 1 << 25,
|
||||
SlRight = 1 << 26,
|
||||
SrRight = 1 << 27,
|
||||
RStickDown = 1 << 23,
|
||||
SlLeft = 1 << 24,
|
||||
SrLeft = 1 << 25,
|
||||
SlRight = 1 << 26,
|
||||
SrRight = 1 << 27,
|
||||
|
||||
// Generic Catch-all
|
||||
Up = DpadUp | LStickUp | RStickUp,
|
||||
Down = DpadDown | LStickDown | RStickDown,
|
||||
Left = DpadLeft | LStickLeft | RStickLeft,
|
||||
Up = DpadUp | LStickUp | RStickUp,
|
||||
Down = DpadDown | LStickDown | RStickDown,
|
||||
Left = DpadLeft | LStickLeft | RStickLeft,
|
||||
Right = DpadRight | LStickRight | RStickRight,
|
||||
Sl = SlLeft | SlRight,
|
||||
Sr = SrLeft | SrRight
|
||||
Sl = SlLeft | SlRight,
|
||||
Sr = SrLeft | SrRight,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,14 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
public enum ControllerType
|
||||
{
|
||||
None,
|
||||
ProController = 1 << 0,
|
||||
Handheld = 1 << 1,
|
||||
JoyconPair = 1 << 2,
|
||||
JoyconLeft = 1 << 3,
|
||||
JoyconRight = 1 << 4,
|
||||
Invalid = 1 << 5,
|
||||
Pokeball = 1 << 6,
|
||||
ProController = 1 << 0,
|
||||
Handheld = 1 << 1,
|
||||
JoyconPair = 1 << 2,
|
||||
JoyconLeft = 1 << 3,
|
||||
JoyconRight = 1 << 4,
|
||||
Invalid = 1 << 5,
|
||||
Pokeball = 1 << 6,
|
||||
SystemExternal = 1 << 29,
|
||||
System = 1 << 30
|
||||
System = 1 << 30,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
public enum NpadColor : uint
|
||||
public enum NpadColor : uint
|
||||
{
|
||||
BodyGray = 0x828282,
|
||||
BodyNeonRed = 0xFF3C28,
|
||||
BodyNeonBlue = 0x0AB9E6,
|
||||
BodyNeonYellow = 0xE6FF00,
|
||||
BodyNeonGreen = 0x1EDC00,
|
||||
BodyNeonPink = 0xFF3278,
|
||||
BodyRed = 0xE10F00,
|
||||
BodyBlue = 0x4655F5,
|
||||
BodyNeonPurple = 0xB400E6,
|
||||
BodyNeonOrange = 0xFAA005,
|
||||
BodyPokemonLetsGoPikachu = 0xFFDC00,
|
||||
BodyPokemonLetsGoEevee = 0xC88C32,
|
||||
BodyNintendoLaboCreatorsContestEdition = 0xD7AA73,
|
||||
BodyAnimalCrossingSpecialEditionLeftJoyCon = 0x82FF96,
|
||||
BodyAnimalCrossingSpecialEditionRightJoyCon = 0x96F5F5,
|
||||
BodyGray = 0x828282,
|
||||
BodyNeonRed = 0xFF3C28,
|
||||
BodyNeonBlue = 0x0AB9E6,
|
||||
BodyNeonYellow = 0xE6FF00,
|
||||
BodyNeonGreen = 0x1EDC00,
|
||||
BodyNeonPink = 0xFF3278,
|
||||
BodyRed = 0xE10F00,
|
||||
BodyBlue = 0x4655F5,
|
||||
BodyNeonPurple = 0xB400E6,
|
||||
BodyNeonOrange = 0xFAA005,
|
||||
BodyPokemonLetsGoPikachu = 0xFFDC00,
|
||||
BodyPokemonLetsGoEevee = 0xC88C32,
|
||||
BodyNintendoLaboCreatorsContestEdition = 0xD7AA73,
|
||||
BodyAnimalCrossingSpecialEditionLeftJoyCon = 0x82FF96,
|
||||
BodyAnimalCrossingSpecialEditionRightJoyCon = 0x96F5F5,
|
||||
|
||||
ButtonGray = 0x0F0F0F,
|
||||
ButtonNeonRed = 0x1E0A0A,
|
||||
ButtonNeonBlue = 0x001E1E,
|
||||
ButtonNeonYellow = 0x142800,
|
||||
ButtonNeonGreen = 0x002800,
|
||||
ButtonNeonPink = 0x28001E,
|
||||
ButtonRed = 0x280A0A,
|
||||
ButtonBlue = 0x00000A,
|
||||
ButtonNeonPurple = 0x140014,
|
||||
ButtonNeonOrange = 0x0F0A00,
|
||||
ButtonPokemonLetsGoPikachu = 0x322800,
|
||||
ButtonPokemonLetsGoEevee = 0x281900,
|
||||
ButtonNintendoLaboCreatorsContestEdition = 0x1E1914,
|
||||
ButtonAnimalCrossingSpecialEditionLeftJoyCon = 0x0A1E0A,
|
||||
ButtonAnimalCrossingSpecialEditionRightJoyCon = 0x0A1E28
|
||||
ButtonGray = 0x0F0F0F,
|
||||
ButtonNeonRed = 0x1E0A0A,
|
||||
ButtonNeonBlue = 0x001E1E,
|
||||
ButtonNeonYellow = 0x142800,
|
||||
ButtonNeonGreen = 0x002800,
|
||||
ButtonNeonPink = 0x28001E,
|
||||
ButtonRed = 0x280A0A,
|
||||
ButtonBlue = 0x00000A,
|
||||
ButtonNeonPurple = 0x140014,
|
||||
ButtonNeonOrange = 0x0F0A00,
|
||||
ButtonPokemonLetsGoPikachu = 0x322800,
|
||||
ButtonPokemonLetsGoEevee = 0x281900,
|
||||
ButtonNintendoLaboCreatorsContestEdition = 0x1E1914,
|
||||
ButtonAnimalCrossingSpecialEditionLeftJoyCon = 0x0A1E0A,
|
||||
ButtonAnimalCrossingSpecialEditionRightJoyCon = 0x0A1E28,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
{
|
||||
public enum NpadIdType
|
||||
{
|
||||
Player1 = 0,
|
||||
Player2 = 1,
|
||||
Player3 = 2,
|
||||
Player4 = 3,
|
||||
Player5 = 4,
|
||||
Player6 = 5,
|
||||
Player7 = 6,
|
||||
Player8 = 7,
|
||||
Unknown = 16,
|
||||
Handheld = 32
|
||||
Player1 = 0,
|
||||
Player2 = 1,
|
||||
Player3 = 2,
|
||||
Player4 = 3,
|
||||
Player5 = 4,
|
||||
Player6 = 5,
|
||||
Player7 = 6,
|
||||
Player8 = 7,
|
||||
Unknown = 16,
|
||||
Handheld = 32,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
{
|
||||
public enum NpadStyleIndex : byte
|
||||
{
|
||||
FullKey = 3,
|
||||
Handheld = 4,
|
||||
JoyDual = 5,
|
||||
JoyLeft = 6,
|
||||
JoyRight = 7,
|
||||
FullKey = 3,
|
||||
Handheld = 4,
|
||||
JoyDual = 5,
|
||||
JoyLeft = 6,
|
||||
JoyRight = 7,
|
||||
SystemExt = 32,
|
||||
System = 33
|
||||
System = 33,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,16 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
public enum PlayerIndex
|
||||
{
|
||||
Player1 = 0,
|
||||
Player2 = 1,
|
||||
Player3 = 2,
|
||||
Player4 = 3,
|
||||
Player5 = 4,
|
||||
Player6 = 5,
|
||||
Player7 = 6,
|
||||
Player8 = 7,
|
||||
Player1 = 0,
|
||||
Player2 = 1,
|
||||
Player3 = 2,
|
||||
Player4 = 3,
|
||||
Player5 = 4,
|
||||
Player6 = 5,
|
||||
Player7 = 6,
|
||||
Player8 = 7,
|
||||
Handheld = 8,
|
||||
Unknown = 9,
|
||||
Auto = 10 // Shouldn't be used directly
|
||||
Unknown = 9,
|
||||
Auto = 10, // Shouldn't be used directly
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
enum NpadJoyHoldType
|
||||
{
|
||||
Vertical,
|
||||
Horizontal
|
||||
Horizontal,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common
|
||||
{
|
||||
struct AtomicStorage<T> where T: unmanaged, ISampledDataStruct
|
||||
struct AtomicStorage<T> where T : unmanaged, ISampledDataStruct
|
||||
{
|
||||
public ulong SamplingNumber;
|
||||
public T Object;
|
||||
|
||||
@@ -11,9 +11,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common
|
||||
/// - use <c>StructLayoutAttribute</c> (and related attributes) to explicity control how the struct is laid out in memory.
|
||||
/// - ensure that the method <c>ISampledDataStruct.GetSamplingNumberFieldOffset()</c> correctly returns the offset, in bytes,
|
||||
/// to the ulong "Sampling Number" field within the struct. Most types have it as the first field, so the default offset is 0.
|
||||
///
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
///
|
||||
/// <c>
|
||||
/// [StructLayout(LayoutKind.Sequential, Pack = 8)]
|
||||
/// struct DebugPadState : ISampledDataStruct
|
||||
@@ -45,7 +45,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common
|
||||
|
||||
if (fieldOffset > 0)
|
||||
{
|
||||
byteSpan = byteSpan.Slice(fieldOffset);
|
||||
byteSpan = byteSpan[fieldOffset..];
|
||||
}
|
||||
|
||||
ulong value = BinaryPrimitives.ReadUInt64LittleEndian(byteSpan);
|
||||
@@ -58,7 +58,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common
|
||||
return sampledDataStruct switch
|
||||
{
|
||||
Npad.SixAxisSensorState _ => sizeof(ulong),
|
||||
_ => 0
|
||||
_ => 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,16 +5,16 @@ using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common
|
||||
{
|
||||
struct RingLifo<T> where T: unmanaged, ISampledDataStruct
|
||||
struct RingLifo<T> where T : unmanaged, ISampledDataStruct
|
||||
{
|
||||
private const ulong MaxEntries = 17;
|
||||
|
||||
#pragma warning disable CS0169
|
||||
private ulong _unused;
|
||||
#pragma warning restore CS0169
|
||||
#pragma warning disable CS0414
|
||||
#pragma warning disable IDE0051, CS0169 // Remove unused private member
|
||||
private readonly ulong _unused;
|
||||
#pragma warning restore IDE0051, CS0169
|
||||
#pragma warning disable CS0414, IDE0052 // Remove unread private member
|
||||
private ulong _bufferCount;
|
||||
#pragma warning restore CS0414
|
||||
#pragma warning restore CS0414, IDE0052
|
||||
private ulong _index;
|
||||
private ulong _count;
|
||||
private Array17<AtomicStorage<T>> _storage;
|
||||
@@ -32,7 +32,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static ulong GetNextIndexForWrite(ulong index)
|
||||
private readonly ulong GetNextIndexForWrite(ulong index)
|
||||
{
|
||||
return (index + 1) % MaxEntries;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common
|
||||
{
|
||||
return new RingLifo<T>
|
||||
{
|
||||
_bufferCount = MaxEntries
|
||||
_bufferCount = MaxEntries,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.DebugPad
|
||||
enum DebugPadAttribute : uint
|
||||
{
|
||||
None = 0,
|
||||
Connected = 1 << 0
|
||||
Connected = 1 << 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.DebugPad
|
||||
Left = 1 << 10,
|
||||
Up = 1 << 11,
|
||||
Right = 1 << 12,
|
||||
Down = 1 << 13
|
||||
Down = 1 << 13,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,4 +26,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Keyboard
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,6 +133,6 @@
|
||||
RightControl = 228,
|
||||
RightShift = 229,
|
||||
RightAlt = 230,
|
||||
RightGui = 231
|
||||
RightGui = 231,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Keyboard
|
||||
ScrollLock = 1 << 9,
|
||||
NumLock = 1 << 10,
|
||||
Katakana = 1 << 11,
|
||||
Hiragana = 1 << 12
|
||||
Hiragana = 1 << 12,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Mouse
|
||||
{
|
||||
None = 0,
|
||||
Transferable = 1 << 0,
|
||||
IsConnected = 1 << 1
|
||||
IsConnected = 1 << 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Mouse
|
||||
Right = 1 << 1,
|
||||
Middle = 1 << 2,
|
||||
Forward = 1 << 3,
|
||||
Back = 1 << 4
|
||||
Back = 1 << 4,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
||||
HandheldLarkNesRight = 1 << 14,
|
||||
Lucia = 1 << 15,
|
||||
|
||||
System = 1 << 31
|
||||
System = 1 << 31,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
||||
IsLeftConnected = 1 << 2,
|
||||
IsLeftWired = 1 << 3,
|
||||
IsRightConnected = 1 << 4,
|
||||
IsRightWired = 1 << 5
|
||||
IsRightWired = 1 << 5,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
Percent25,
|
||||
Percent50,
|
||||
Percent75,
|
||||
Percent100
|
||||
Percent100,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
||||
// FIXME: Probably a button on Lark.
|
||||
Unknown29 = 1 << 29,
|
||||
|
||||
HandheldLeftB = 1 << 30
|
||||
HandheldLeftB = 1 << 30,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
{
|
||||
Ok,
|
||||
ReadError,
|
||||
NoController
|
||||
NoController,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
||||
public AnalogStickState AnalogStickL;
|
||||
public AnalogStickState AnalogStickR;
|
||||
public NpadAttribute Attributes;
|
||||
private uint _reserved;
|
||||
private readonly uint _reserved;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
public uint FullKeyBody;
|
||||
public uint FullKeyButtons;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct NpadGcTriggerState : ISampledDataStruct
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public ulong SamplingNumber;
|
||||
public uint TriggerL;
|
||||
public uint TriggerR;
|
||||
#pragma warning restore CS0649
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
||||
public RingLifo<SixAxisSensorState> JoyLeftSixAxisSensor;
|
||||
public RingLifo<SixAxisSensorState> JoyRightSixAxisSensor;
|
||||
public DeviceType DeviceType;
|
||||
private uint _reserved1;
|
||||
#pragma warning disable IDE0051 // Remove unused private member
|
||||
private readonly uint _reserved1;
|
||||
#pragma warning restore IDE0051
|
||||
public NpadSystemProperties SystemProperties;
|
||||
public NpadSystemButtonProperties SystemButtonProperties;
|
||||
public NpadBatteryLevel BatteryLevelJoyDual;
|
||||
@@ -31,7 +33,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
||||
public NpadBatteryLevel BatteryLevelJoyRight;
|
||||
public uint AppletFooterUiAttributes;
|
||||
public AppletFooterUiType AppletFooterUiType;
|
||||
private Reserved2Struct _reserved2;
|
||||
#pragma warning disable IDE0051 // Remove unused private member
|
||||
private readonly Reserved2Struct _reserved2;
|
||||
#pragma warning restore IDE0051
|
||||
public RingLifo<NpadGcTriggerState> GcTrigger;
|
||||
public NpadLarkType LarkTypeLeftAndMain;
|
||||
public NpadLarkType LarkTypeRight;
|
||||
@@ -39,7 +43,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
||||
public uint Unknown43EC;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 123, Pack = 1)]
|
||||
private struct Reserved2Struct {}
|
||||
private struct Reserved2Struct { }
|
||||
|
||||
public static NpadInternalState Create()
|
||||
{
|
||||
@@ -62,4 +66,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
enum NpadJoyAssignmentMode : uint
|
||||
{
|
||||
Dual,
|
||||
Single
|
||||
Single,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
public uint RightBody;
|
||||
public uint RightButtons;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
Invalid,
|
||||
J,
|
||||
E,
|
||||
U
|
||||
U,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
||||
{
|
||||
return new NpadState
|
||||
{
|
||||
InternalState = NpadInternalState.Create()
|
||||
InternalState = NpadInternalState.Create(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +71,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
||||
/// <summary>
|
||||
/// Generic controller.
|
||||
/// </summary>
|
||||
System = 1 << 30
|
||||
System = 1 << 30,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
||||
enum NpadSystemButtonProperties : uint
|
||||
{
|
||||
None = 0,
|
||||
IsUnintendedHomeButtonInputProtectionEnabled = 1 << 0
|
||||
IsUnintendedHomeButtonInputProtectionEnabled = 1 << 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
||||
IsSlSrButtonOriented = 1 << 12,
|
||||
IsPlusAvailable = 1 << 13,
|
||||
IsMinusAvailable = 1 << 14,
|
||||
IsDirectionalButtonsAvailable = 1 << 15
|
||||
IsDirectionalButtonsAvailable = 1 << 15,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
||||
{
|
||||
None = 0,
|
||||
IsConnected = 1 << 0,
|
||||
IsInterpolated = 1 << 1
|
||||
IsInterpolated = 1 << 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
||||
public HidVector Angle;
|
||||
public Array9<float> Direction;
|
||||
public SixAxisSensorAttribute Attributes;
|
||||
private uint _reserved;
|
||||
private readonly uint _reserved;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory
|
||||
|
||||
public static SharedMemory Create()
|
||||
{
|
||||
SharedMemory result = new SharedMemory
|
||||
SharedMemory result = new()
|
||||
{
|
||||
DebugPad = RingLifo<DebugPadState>.Create(),
|
||||
TouchScreen = RingLifo<TouchScreenState>.Create(),
|
||||
|
||||
@@ -7,6 +7,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.TouchScreen
|
||||
{
|
||||
None = 0,
|
||||
Start = 1 << 0,
|
||||
End = 1 << 1
|
||||
End = 1 << 1,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.TouchScreen
|
||||
{
|
||||
public ulong SamplingNumber;
|
||||
public int TouchesCount;
|
||||
private int _reserved;
|
||||
private readonly int _reserved;
|
||||
public Array16<TouchState> Touches;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
struct TouchState
|
||||
{
|
||||
public ulong DeltaTime;
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public TouchAttribute Attribute;
|
||||
#pragma warning restore CS0649
|
||||
public uint FingerId;
|
||||
@@ -12,8 +12,8 @@
|
||||
public uint DiameterX;
|
||||
public uint DiameterY;
|
||||
public uint RotationAngle;
|
||||
#pragma warning disable CS0169
|
||||
private uint _reserved;
|
||||
#pragma warning restore CS0169
|
||||
#pragma warning disable CS0169, IDE0051 // Remove unused private member
|
||||
private readonly uint _reserved;
|
||||
#pragma warning restore CS0169, IDE0051
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user