More progress

This commit is contained in:
Isaac Marovitz 2024-03-13 15:32:02 +00:00
parent b7239a6e3e
commit baf85f3b93
No known key found for this signature in database
GPG key ID: 97250B2B09A132E1
70 changed files with 403 additions and 117 deletions

View file

@ -1,14 +0,0 @@
namespace Ryujinx.HLE.HOS.Services.Hid
{
public abstract class BaseDevice
{
protected readonly Switch _device;
public bool Active;
public BaseDevice(Switch device, bool active)
{
_device = device;
Active = active;
}
}
}

View file

@ -5,6 +5,7 @@ using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.HLE.HOS.Services.Hid.HidServer;
using Ryujinx.Horizon.Common;
using Ryujinx.Horizon.Sdk.Hid;
using Ryujinx.Horizon.Sdk.Hid.HidDevices;
using Ryujinx.Horizon.Sdk.Hid.Npad;
using Ryujinx.Horizon.Sdk.Hid.SixAxis;
using Ryujinx.Horizon.Sdk.Hid.Vibration;
@ -83,7 +84,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
// Initialize entries to avoid issues with some games.
for (int entry = 0; entry < Hid.SharedMemEntryCount; entry++)
for (int entry = 0; entry < Ryujinx.Horizon.Sdk.Hid.Hid.SharedMemEntryCount; entry++)
{
context.Device.Hid.DebugPad.Update();
}
@ -103,7 +104,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
// Initialize entries to avoid issues with some games.
for (int entry = 0; entry < Hid.SharedMemEntryCount; entry++)
for (int entry = 0; entry < Ryujinx.Horizon.Sdk.Hid.Hid.SharedMemEntryCount; entry++)
{
context.Device.Hid.Touchscreen.Update();
}
@ -123,7 +124,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
// Initialize entries to avoid issues with some games.
for (int entry = 0; entry < Hid.SharedMemEntryCount; entry++)
for (int entry = 0; entry < Ryujinx.Horizon.Sdk.Hid.Hid.SharedMemEntryCount; entry++)
{
context.Device.Hid.Mouse.Update(0, 0);
}
@ -148,7 +149,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
Keys = new ulong[4],
};
for (int entry = 0; entry < Hid.SharedMemEntryCount; entry++)
for (int entry = 0; entry < Ryujinx.Horizon.Sdk.Hid.Hid.SharedMemEntryCount; entry++)
{
context.Device.Hid.Keyboard.Update(emptyInput);
}
@ -859,7 +860,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
emptySixAxisInputs.Add(sixaxisInput);
}
for (int entry = 0; entry < Hid.SharedMemEntryCount; entry++)
for (int entry = 0; entry < Ryujinx.Horizon.Sdk.Hid.Hid.SharedMemEntryCount; entry++)
{
context.Device.Hid.Npads.Update(emptyGamepadInputs);
context.Device.Hid.Npads.UpdateSixAxis(emptySixAxisInputs);

View file

@ -8,6 +8,7 @@ using Ryujinx.HLE.HOS.Services.Apm;
using Ryujinx.HLE.HOS.Services.Hid;
using Ryujinx.HLE.Loaders.Processes;
using Ryujinx.HLE.UI;
using Ryujinx.Horizon.Sdk.Hid;
using Ryujinx.Memory;
using System;

View file

@ -0,0 +1,7 @@
namespace Ryujinx.Horizon.Hid
{
class HidServer : IHidServer
{
}
}

View file

@ -1,21 +1,18 @@
using Ryujinx.Common;
using Ryujinx.Common.Configuration.Hid;
using Ryujinx.Common.Memory;
using Ryujinx.HLE.Exceptions;
using Ryujinx.HLE.HOS.Kernel.Memory;
using Ryujinx.Horizon.Sdk.Hid;
using Ryujinx.Horizon.Sdk.Hid.HidDevices;
using Ryujinx.Horizon.Sdk.Hid.Npad;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using ControllerType = Ryujinx.Horizon.Sdk.Hid.Npad.ControllerType;
using PlayerIndex = Ryujinx.Horizon.Sdk.Hid.Npad.PlayerIndex;
namespace Ryujinx.HLE.HOS.Services.Hid
namespace Ryujinx.Horizon.Sdk.Hid
{
public class Hid
{
private readonly Switch _device;
internal const int HidSize = 0x40000;
private readonly SharedMemoryStorage _storage;
internal ref SharedMemory SharedMemory => ref _storage.GetRef<SharedMemory>(0);
@ -43,12 +40,11 @@ namespace Ryujinx.HLE.HOS.Services.Hid
CheckTypeSizeOrThrow<RingLifo<MouseState>>(0x350);
CheckTypeSizeOrThrow<RingLifo<KeyboardState>>(0x3D8);
CheckTypeSizeOrThrow<Array10<NpadState>>(0x32000);
CheckTypeSizeOrThrow<SharedMemory>(Horizon.HidSize);
CheckTypeSizeOrThrow<SharedMemory>(HidSize);
}
internal Hid(in Switch device, SharedMemoryStorage storage)
internal Hid(SharedMemoryStorage storage)
{
_device = device;
_storage = storage;
SharedMemory = SharedMemory.Create();
@ -58,11 +54,11 @@ namespace Ryujinx.HLE.HOS.Services.Hid
private void InitDevices()
{
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);
DebugPad = new DebugPadDevice(true);
Touchscreen = new TouchDevice(true);
Mouse = new MouseDevice(false);
Keyboard = new KeyboardDevice(false);
Npads = new NpadDevices(true);
}
public void RefreshInputConfig(List<InputConfig> inputConfig)
@ -75,7 +71,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
npadConfig[i].Type = (ControllerType)inputConfig[i].ControllerType;
}
_device.Hid.Npads.Configure(npadConfig);
Npads.Configure(npadConfig);
}
public ControllerKeys UpdateStickButtons(JoystickPosition leftStick, JoystickPosition rightStick)

View file

@ -0,0 +1,12 @@
namespace Ryujinx.Horizon.Sdk.Hid.HidDevices
{
public abstract class BaseDevice
{
public bool Active;
public BaseDevice(bool active)
{
Active = active;
}
}
}

View file

@ -1,8 +1,8 @@
namespace Ryujinx.HLE.HOS.Services.Hid
namespace Ryujinx.Horizon.Sdk.Hid.HidDevices
{
public class DebugPadDevice : BaseDevice
{
public DebugPadDevice(Switch device, bool active) : base(device, active) { }
public DebugPadDevice(bool active) : base(active) { }
public void Update()
{

View file

@ -1,11 +1,10 @@
using Ryujinx.Horizon.Sdk.Hid;
using System;
namespace Ryujinx.HLE.HOS.Services.Hid
namespace Ryujinx.Horizon.Sdk.Hid.HidDevices
{
public class KeyboardDevice : BaseDevice
{
public KeyboardDevice(Switch device, bool active) : base(device, active) { }
public KeyboardDevice(bool active) : base(active) { }
public void Update(KeyboardInput keyState)
{

View file

@ -1,8 +1,8 @@
namespace Ryujinx.HLE.HOS.Services.Hid
namespace Ryujinx.Horizon.Sdk.Hid.HidDevices
{
public class MouseDevice : BaseDevice
{
public MouseDevice(Switch device, bool active) : base(device, active) { }
public MouseDevice(bool active) : base(active) { }
public void Update(int mouseX, int mouseY, uint buttons = 0, int scrollX = 0, int scrollY = 0, bool connected = false)
{

View file

@ -1,15 +1,15 @@
using Ryujinx.Common;
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.Horizon.Sdk.Hid;
using Ryujinx.Horizon.Sdk.Hid.Npad;
using Ryujinx.Horizon.Sdk.Hid.SixAxis;
using Ryujinx.Horizon.Sdk.Hid.Vibration;
using Ryujinx.Horizon.Sdk.OsTypes;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace Ryujinx.HLE.HOS.Services.Hid
namespace Ryujinx.Horizon.Sdk.Hid.HidDevices
{
public class NpadDevices : BaseDevice
{
@ -19,7 +19,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
public const int MaxControllers = 9; // Players 1-8 and Handheld
private ControllerType[] _configuredTypes;
private readonly KEvent[] _styleSetUpdateEvents;
private readonly Event[] _styleSetUpdateEvents;
private readonly bool[] _supportedPlayers;
private VibrationValue _neutralVibrationValue = new()
{
@ -36,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
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)
public NpadDevices(bool active = true) : base(active)
{
_configuredTypes = new ControllerType[MaxControllers];
@ -47,10 +47,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid
_supportedPlayers = new bool[MaxControllers];
_supportedPlayers.AsSpan().Fill(true);
_styleSetUpdateEvents = new KEvent[MaxControllers];
_styleSetUpdateEvents = new Event[MaxControllers];
for (int i = 0; i < _styleSetUpdateEvents.Length; ++i)
{
_styleSetUpdateEvents[i] = new KEvent(_device.System.KernelContext);
_styleSetUpdateEvents[i] = new Event(_device.System.KernelContext);
}
_activeCount = 0;
@ -58,7 +58,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
JoyHold = NpadJoyHoldType.Vertical;
}
internal ref KEvent GetStyleSetUpdateEvent(PlayerIndex player)
internal ref Event GetStyleSetUpdateEvent(PlayerIndex player)
{
return ref _styleSetUpdateEvents[(int)player];
}

View file

@ -1,11 +1,10 @@
using Ryujinx.Horizon.Sdk.Hid;
using System;
namespace Ryujinx.HLE.HOS.Services.Hid
namespace Ryujinx.Horizon.Sdk.Hid.HidDevices
{
public class TouchDevice : BaseDevice
{
public TouchDevice(Switch device, bool active) : base(device, active) { }
public TouchDevice(bool active) : base(active) { }
public void Update(params TouchPoint[] points)
{

View file

@ -0,0 +1,150 @@
using Ryujinx.Horizon.Common;
using Ryujinx.Horizon.Sdk.Applet;
using Ryujinx.Horizon.Sdk.Hid.SixAxis;
using Ryujinx.Horizon.Sdk.Hid.Vibration;
using Ryujinx.Horizon.Sdk.Sf;
using System;
namespace Ryujinx.Horizon.Sdk.Hid
{
interface IHidServer : IServiceObject
{
Result CreateAppletResource(out IAppletResource arg0, AppletResourceUserId appletResourceUserId, ulong pid);
Result ActivateDebugPad(AppletResourceUserId appletResourceUserId, ulong pid);
Result ActivateTouchScreen(AppletResourceUserId appletResourceUserId, ulong pid);
Result ActivateMouse(AppletResourceUserId appletResourceUserId, ulong pid);
Result ActivateKeyboard(AppletResourceUserId appletResourceUserId, ulong pid);
Result SendKeyboardLockKeyEvent(AppletResourceUserId appletResourceUserId, KeyboardLockKeyEvent keyboardLockKeyEvent, ulong pid);
Result AcquireXpadIdEventHandle(out int arg0, ulong arg1);
Result ReleaseXpadIdEventHandle(ulong arg0);
Result ActivateXpad(AppletResourceUserId appletResourceUserId, BasicXpadId arg1, ulong pid);
Result GetXpadIds(out long arg0, Span<BasicXpadId> arg1);
Result ActivateJoyXpad(JoyXpadId arg0);
Result GetJoyXpadLifoHandle(out int arg0, JoyXpadId arg1);
Result GetJoyXpadIds(out long arg0, Span<JoyXpadId> arg1);
Result ActivateSixAxisSensor(BasicXpadId arg0);
Result DeactivateSixAxisSensor(BasicXpadId arg0);
Result GetSixAxisSensorLifoHandle(out int arg0, BasicXpadId arg1);
Result ActivateJoySixAxisSensor(JoyXpadId arg0);
Result DeactivateJoySixAxisSensor(JoyXpadId arg0);
Result GetJoySixAxisSensorLifoHandle(out int arg0, JoyXpadId arg1);
Result StartSixAxisSensor(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result StopSixAxisSensor(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result IsSixAxisSensorFusionEnabled(out bool arg0, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result EnableSixAxisSensorFusion(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, bool arg2, ulong pid);
Result SetSixAxisSensorFusionParameters(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, float arg2, float arg3, ulong pid);
Result GetSixAxisSensorFusionParameters(out float arg0, out float arg1, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result ResetSixAxisSensorFusionParameters(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result SetAccelerometerParameters(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, float arg2, float arg3, ulong pid);
Result GetAccelerometerParameters(out float arg0, out float arg1, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result ResetAccelerometerParameters(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result SetAccelerometerPlayMode(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, uint arg2, ulong pid);
Result GetAccelerometerPlayMode(out uint arg0, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result ResetAccelerometerPlayMode(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result SetGyroscopeZeroDriftMode(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, uint arg2, ulong pid);
Result GetGyroscopeZeroDriftMode(out uint arg0, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result ResetGyroscopeZeroDriftMode(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result IsSixAxisSensorAtRest(out bool arg0, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result IsFirmwareUpdateAvailableForSixAxisSensor(out bool arg0, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result EnableSixAxisSensorUnalteredPassthrough(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, bool arg2, ulong pid);
Result IsSixAxisSensorUnalteredPassthroughEnabled(out bool arg0, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result StoreSixAxisSensorCalibrationParameter(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, in SixAxisSensorCalibrationParameter sixAxisSensorCalibrationParameter, ulong pid);
Result LoadSixAxisSensorCalibrationParameter(AppletResourceUserId appletResourceUserId, out SixAxisSensorCalibrationParameter sixAxisSensorCalibrationParameter, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result GetSixAxisSensorIcInformation(AppletResourceUserId appletResourceUserId, out SixAxisSensorIcInformation sixAxisSensorIcInformation, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result ResetIsSixAxisSensorDeviceNewlyAssigned(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
Result ActivateGesture(AppletResourceUserId appletResourceUserId, int arg1, ulong pid);
Result SetSupportedNpadStyleSet(AppletResourceUserId appletResourceUserId, NpadStyleTag arg1, ulong pid);
Result GetSupportedNpadStyleSet(AppletResourceUserId appletResourceUserId, out NpadStyleTag arg1, ulong pid);
Result SetSupportedNpadIdType(AppletResourceUserId appletResourceUserId, ReadOnlySpan<uint> arg1, ulong pid);
Result ActivateNpad(AppletResourceUserId appletResourceUserId, ulong pid);
Result DeactivateNpad(AppletResourceUserId appletResourceUserId, ulong pid);
Result AcquireNpadStyleSetUpdateEventHandle(AppletResourceUserId appletResourceUserId, out int arg1, uint arg2, ulong arg3, ulong pid);
Result DisconnectNpad(AppletResourceUserId appletResourceUserId, uint arg1, ulong pid);
Result GetPlayerLedPattern(out ulong arg0, uint arg1);
Result ActivateNpadWithRevision(AppletResourceUserId appletResourceUserId, int arg1, ulong pid);
Result SetNpadJoyHoldType(AppletResourceUserId appletResourceUserId, long arg1, ulong pid);
Result GetNpadJoyHoldType(AppletResourceUserId appletResourceUserId, out long arg1, ulong pid);
Result SetNpadJoyAssignmentModeSingleByDefault(AppletResourceUserId appletResourceUserId, uint arg1, ulong pid);
Result SetNpadJoyAssignmentModeSingle(AppletResourceUserId appletResourceUserId, uint arg1, long arg2, ulong pid);
Result SetNpadJoyAssignmentModeDual(AppletResourceUserId appletResourceUserId, uint arg1, ulong pid);
Result MergeSingleJoyAsDualJoy(AppletResourceUserId appletResourceUserId, uint arg1, uint arg2, ulong pid);
Result StartLrAssignmentMode(AppletResourceUserId appletResourceUserId, ulong pid);
Result StopLrAssignmentMode(AppletResourceUserId appletResourceUserId, ulong pid);
Result SetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, long arg1, ulong pid);
Result GetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, out long arg1, ulong pid);
Result SwapNpadAssignment(AppletResourceUserId appletResourceUserId, uint arg1, uint arg2, ulong pid);
Result IsUnintendedHomeButtonInputProtectionEnabled(out bool arg0, AppletResourceUserId appletResourceUserId, uint arg2, ulong pid);
Result EnableUnintendedHomeButtonInputProtection(AppletResourceUserId appletResourceUserId, uint arg1, bool arg2, ulong pid);
Result SetNpadJoyAssignmentModeSingleWithDestination(out bool arg0, out uint arg1, AppletResourceUserId appletResourceUserId, uint arg3, long arg4, ulong pid);
Result SetNpadAnalogStickUseCenterClamp(AppletResourceUserId appletResourceUserId, bool arg1, ulong pid);
Result SetNpadCaptureButtonAssignment(AppletResourceUserId appletResourceUserId, NpadStyleTag arg1, NpadButton arg2, ulong pid);
Result ClearNpadCaptureButtonAssignment(AppletResourceUserId appletResourceUserId, ulong pid);
Result GetVibrationDeviceInfo(out VibrationDeviceInfoForIpc vibrationDeviceInfoForIpc, VibrationDeviceHandle vibrationDeviceHandle);
Result SendVibrationValue(AppletResourceUserId appletResourceUserId, VibrationDeviceHandle vibrationDeviceHandle, VibrationValue arg2, ulong pid);
Result GetActualVibrationValue(out VibrationValue arg0, AppletResourceUserId appletResourceUserId, VibrationDeviceHandle vibrationDeviceHandle, ulong pid);
Result CreateActiveVibrationDeviceList(out IActiveVibrationDeviceList arg0);
Result PermitVibration(bool arg0);
Result IsVibrationPermitted(out bool arg0);
Result SendVibrationValues(AppletResourceUserId appletResourceUserId, ReadOnlySpan<VibrationDeviceHandle> vibrationDeviceHandles, ReadOnlySpan<VibrationValue> vibrationValues);
Result SendVibrationGcErmCommand(AppletResourceUserId appletResourceUserId, VibrationDeviceHandle vibrationDeviceHandle, VibrationGcErmCommand vibrationGcErmCommand, ulong pid);
Result GetActualVibrationGcErmCommand(out VibrationGcErmCommand vibrationGcErmCommand, AppletResourceUserId appletResourceUserId, VibrationDeviceHandle vibrationDeviceHandle, ulong pid);
Result BeginPermitVibrationSession(AppletResourceUserId appletResourceUserId);
Result EndPermitVibrationSession();
Result IsVibrationDeviceMounted(out bool arg0, AppletResourceUserId appletResourceUserId, VibrationDeviceHandle vibrationDeviceHandle, ulong pid);
Result SendVibrationValueInBool(AppletResourceUserId appletResourceUserId, VibrationDeviceHandle vibrationDeviceHandle, bool arg2, ulong pid);
Result ActivateConsoleSixAxisSensor(AppletResourceUserId appletResourceUserId, ulong pid);
Result StartConsoleSixAxisSensor(AppletResourceUserId appletResourceUserId, ConsoleSixAxisSensorHandle consoleSixAxisSensorHandle, ulong pid);
Result StopConsoleSixAxisSensor(AppletResourceUserId appletResourceUserId, ConsoleSixAxisSensorHandle consoleSixAxisSensorHandle, ulong pid);
Result ActivateSevenSixAxisSensor(AppletResourceUserId appletResourceUserId, ulong pid);
Result StartSevenSixAxisSensor(AppletResourceUserId appletResourceUserId, ulong pid);
Result StopSevenSixAxisSensor(AppletResourceUserId appletResourceUserId, ulong pid);
Result InitializeSevenSixAxisSensor(AppletResourceUserId appletResourceUserId, int arg1, ulong arg2, int arg3, ulong arg4, ulong pid);
Result FinalizeSevenSixAxisSensor(AppletResourceUserId appletResourceUserId, ulong pid);
Result SetSevenSixAxisSensorFusionStrength(AppletResourceUserId appletResourceUserId, float arg1, ulong pid);
Result GetSevenSixAxisSensorFusionStrength(out float arg0, AppletResourceUserId appletResourceUserId, ulong pid);
Result ResetSevenSixAxisSensorTimestamp(AppletResourceUserId appletResourceUserId, ulong pid);
Result IsUsbFullKeyControllerEnabled(out bool arg0);
Result EnableUsbFullKeyController(bool arg0);
Result IsUsbFullKeyControllerConnected(out bool arg0, uint arg1);
Result HasBattery(out bool arg0, uint arg1);
Result HasLeftRightBattery(out bool arg0, out bool arg1, uint arg2);
Result GetNpadInterfaceType(out byte arg0, uint arg1);
Result GetNpadLeftRightInterfaceType(out byte arg0, out byte arg1, uint arg2);
Result GetNpadOfHighestBatteryLevel(out uint arg0, ReadOnlySpan<uint> arg1, AppletResourceUserId appletResourceUserId, ulong pid);
Result GetPalmaConnectionHandle(out PalmaConnectionHandle palmaConnectionHandle, uint arg1, AppletResourceUserId appletResourceUserId, ulong pid);
Result InitializePalma(PalmaConnectionHandle palmaConnectionHandle);
Result AcquirePalmaOperationCompleteEvent(out int arg0, PalmaConnectionHandle palmaConnectionHandle);
Result GetPalmaOperationInfo(out ulong arg0, Span<byte> arg1, PalmaConnectionHandle palmaConnectionHandle);
Result PlayPalmaActivity(PalmaConnectionHandle palmaConnectionHandle, ulong arg1);
Result SetPalmaFrModeType(PalmaConnectionHandle palmaConnectionHandle, ulong arg1);
Result ReadPalmaStep(PalmaConnectionHandle palmaConnectionHandle);
Result EnablePalmaStep(PalmaConnectionHandle palmaConnectionHandle, bool arg1);
Result ResetPalmaStep(PalmaConnectionHandle palmaConnectionHandle);
Result ReadPalmaApplicationSection(PalmaConnectionHandle palmaConnectionHandle, ulong arg1, ulong arg2);
Result WritePalmaApplicationSection(PalmaConnectionHandle palmaConnectionHandle, ulong arg1, ulong arg2, in PalmaApplicationSectionAccessBuffer palmaApplicationSectionAccessBuffer);
Result ReadPalmaUniqueCode(PalmaConnectionHandle palmaConnectionHandle);
Result SetPalmaUniqueCodeInvalid(PalmaConnectionHandle palmaConnectionHandle);
Result WritePalmaActivityEntry(PalmaConnectionHandle palmaConnectionHandle, ulong arg1, ulong arg2, ulong arg3, ulong arg4);
Result WritePalmaRgbLedPatternEntry(PalmaConnectionHandle palmaConnectionHandle, ulong arg1, ReadOnlySpan<byte> arg2);
Result WritePalmaWaveEntry(PalmaConnectionHandle palmaConnectionHandle, PalmaWaveSet palmaWaveSet, ulong arg2, int arg3, ulong arg4, ulong arg5);
Result SetPalmaDataBaseIdentificationVersion(PalmaConnectionHandle palmaConnectionHandle, int arg1);
Result GetPalmaDataBaseIdentificationVersion(PalmaConnectionHandle palmaConnectionHandle);
Result SuspendPalmaFeature(PalmaConnectionHandle palmaConnectionHandle, PalmaFeature palmaFeature);
Result GetPalmaOperationResult(PalmaConnectionHandle palmaConnectionHandle);
Result ReadPalmaPlayLog(PalmaConnectionHandle palmaConnectionHandle, ushort arg1);
Result ResetPalmaPlayLog(PalmaConnectionHandle palmaConnectionHandle, ushort arg1);
Result SetIsPalmaAllConnectable(AppletResourceUserId appletResourceUserId, bool arg1, ulong pid);
Result SetIsPalmaPairedConnectable(AppletResourceUserId appletResourceUserId, bool arg1, ulong pid);
Result PairPalma(PalmaConnectionHandle palmaConnectionHandle);
Result SetPalmaBoostMode(bool arg0);
Result CancelWritePalmaWaveEntry(PalmaConnectionHandle palmaConnectionHandle);
Result EnablePalmaBoostMode(AppletResourceUserId appletResourceUserId, bool arg1, ulong pid);
Result GetPalmaBluetoothAddress(out Address arg0, PalmaConnectionHandle palmaConnectionHandle);
Result SetDisallowedPalmaConnection(AppletResourceUserId appletResourceUserId, ReadOnlySpan<Address> arg1, ulong pid);
Result SetNpadCommunicationMode(AppletResourceUserId appletResourceUserId, long arg1, ulong pid);
Result GetNpadCommunicationMode(out long arg0);
Result SetTouchScreenConfiguration(AppletResourceUserId appletResourceUserId, TouchScreenConfigurationForNx arg1, ulong pid);
Result IsFirmwareUpdateNeededForNotification(out bool arg0, int arg1, AppletResourceUserId appletResourceUserId, ulong pid);
Result ActivateDigitizer(AppletResourceUserId appletResourceUserId, ulong pid);
}
}

View file

@ -0,0 +1,18 @@
using System;
namespace Ryujinx.Horizon.Sdk.Hid
{
[Flags]
enum KeyboardLockKeyEvent
{
NumLockOn = 1 << 0,
NumLockOff = 1 << 1,
NumLockToggle = 1 << 2,
CapsLockOn = 1 << 3,
CapsLockOff = 1 << 4,
CapsLockToggle = 1 << 5,
ScrollLockOn = 1 << 6,
ScrollLockOff = 1 << 7,
ScrollLockToggle = 1 << 8
}
}

View file

@ -1,4 +1,4 @@
namespace Ryujinx.Horizon.Sdk.Hid
namespace Ryujinx.Horizon.Sdk.Hid.Npad
{
enum NpadJoyHoldType
{

View file

@ -0,0 +1,10 @@
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid
{
[StructLayout(LayoutKind.Sequential, Size = 0x100)]
struct PalmaApplicationSectionAccessBuffer
{
}
}

View file

@ -0,0 +1,10 @@
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid
{
[StructLayout(LayoutKind.Sequential, Size = 0x8)]
struct PalmaConnectionHandle
{
}
}

View file

@ -0,0 +1,13 @@
using System;
namespace Ryujinx.Horizon.Sdk.Hid
{
[Flags]
enum PalmaFeature
{
FrMode = 1 << 0,
RumbleFeedback = 1 << 1,
Step = 1 << 2,
MuteSwitch = 1 << 3
}
}

View file

@ -0,0 +1,9 @@
namespace Ryujinx.Horizon.Sdk.Hid
{
enum PalmaWaveSet : ulong
{
Small = 0,
Medium = 1,
Large = 2
}
}

View file

@ -1,4 +1,4 @@
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Common
namespace Ryujinx.Horizon.Sdk.Hid
{
struct AnalogStickState
{

View file

@ -1,6 +1,6 @@
using System.Threading;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Common
namespace Ryujinx.Horizon.Sdk.Hid
{
struct AtomicStorage<T> where T : unmanaged, ISampledDataStruct
{

View file

@ -2,7 +2,7 @@ using System;
using System.Buffers.Binary;
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Common
namespace Ryujinx.Horizon.Sdk.Hid
{
/// <summary>
/// This is a "marker interface" to add some compile-time safety to a convention-based optimization.
@ -57,7 +57,7 @@ namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Common
{
return sampledDataStruct switch
{
Npad.SixAxisSensorState _ => sizeof(ulong),
SixAxisSensorState _ => sizeof(ulong),
_ => 0,
};
}

View file

@ -3,7 +3,7 @@ using System;
using System.Runtime.CompilerServices;
using System.Threading;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Common
namespace Ryujinx.Horizon.Sdk.Hid
{
struct RingLifo<T> where T : unmanaged, ISampledDataStruct
{

View file

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.DebugPad
namespace Ryujinx.Horizon.Sdk.Hid
{
[Flags]
enum DebugPadAttribute : uint

View file

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.DebugPad
namespace Ryujinx.Horizon.Sdk.Hid
{
[Flags]
enum DebugPadButton : uint

View file

@ -1,7 +1,6 @@
using Ryujinx.Horizon.Sdk.Hid.SharedMemory.Common;
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.DebugPad
namespace Ryujinx.Horizon.Sdk.Hid
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct DebugPadState : ISampledDataStruct

View file

@ -1,6 +1,6 @@
using Ryujinx.Common.Memory;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Keyboard
namespace Ryujinx.Horizon.Sdk.Hid
{
struct KeyboardKey
{

View file

@ -1,4 +1,4 @@
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Keyboard
namespace Ryujinx.Horizon.Sdk.Hid
{
enum KeyboardKeyShift
{

View file

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Keyboard
namespace Ryujinx.Horizon.Sdk.Hid
{
[Flags]
enum KeyboardModifier : ulong

View file

@ -1,7 +1,6 @@
using Ryujinx.Horizon.Sdk.Hid.SharedMemory.Common;
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Keyboard
namespace Ryujinx.Horizon.Sdk.Hid
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct KeyboardState : ISampledDataStruct

View file

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Mouse
namespace Ryujinx.Horizon.Sdk.Hid
{
[Flags]
enum MouseAttribute : uint

View file

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Mouse
namespace Ryujinx.Horizon.Sdk.Hid
{
[Flags]
enum MouseButton : uint

View file

@ -1,7 +1,6 @@
using Ryujinx.Horizon.Sdk.Hid.SharedMemory.Common;
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Mouse
namespace Ryujinx.Horizon.Sdk.Hid
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct MouseState : ISampledDataStruct

View file

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
[Flags]
enum DeviceType

View file

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
[Flags]
enum NpadAttribute : uint

View file

@ -1,4 +1,4 @@
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
enum NpadBatteryLevel
{

View file

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
[Flags]
enum NpadButton : ulong

View file

@ -1,4 +1,4 @@
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
enum NpadColorAttribute : uint
{

View file

@ -1,7 +1,6 @@
using Ryujinx.Horizon.Sdk.Hid.SharedMemory.Common;
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct NpadCommonState : ISampledDataStruct

View file

@ -1,4 +1,4 @@
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
struct NpadFullKeyColorState
{

View file

@ -1,7 +1,6 @@
using Ryujinx.Horizon.Sdk.Hid.SharedMemory.Common;
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct NpadGcTriggerState : ISampledDataStruct

View file

@ -1,7 +1,6 @@
using Ryujinx.Horizon.Sdk.Hid.SharedMemory.Common;
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
struct NpadInternalState
{

View file

@ -1,4 +1,4 @@
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
enum NpadJoyAssignmentMode : uint
{

View file

@ -1,4 +1,4 @@
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
struct NpadJoyColorState
{

View file

@ -1,4 +1,4 @@
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
enum NpadLarkType : uint
{

View file

@ -1,4 +1,4 @@
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
enum NpadLuciaType
{

View file

@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
[StructLayout(LayoutKind.Sequential, Size = 0x5000)]
struct NpadState

View file

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
/// <summary>
/// Nintendo pad style

View file

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
[Flags]
enum NpadSystemButtonProperties : uint

View file

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
[Flags]
enum NpadSystemProperties : ulong

View file

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
[Flags]
enum SixAxisSensorAttribute : uint

View file

@ -1,8 +1,7 @@
using Ryujinx.Common.Memory;
using Ryujinx.Horizon.Sdk.Hid.SharedMemory.Common;
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad
namespace Ryujinx.Horizon.Sdk.Hid
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct SixAxisSensorState : ISampledDataStruct

View file

@ -1,13 +1,7 @@
using Ryujinx.Common.Memory;
using Ryujinx.Horizon.Sdk.Hid.SharedMemory.Common;
using Ryujinx.Horizon.Sdk.Hid.SharedMemory.DebugPad;
using Ryujinx.Horizon.Sdk.Hid.SharedMemory.Keyboard;
using Ryujinx.Horizon.Sdk.Hid.SharedMemory.Mouse;
using Ryujinx.Horizon.Sdk.Hid.SharedMemory.Npad;
using Ryujinx.Horizon.Sdk.Hid.SharedMemory.TouchScreen;
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory
namespace Ryujinx.Horizon.Sdk.Hid
{
/// <summary>
/// Represent the shared memory shared between applications for input.

View file

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.TouchScreen
namespace Ryujinx.Horizon.Sdk.Hid
{
[Flags]
public enum TouchAttribute : uint

View file

@ -1,8 +1,7 @@
using Ryujinx.Common.Memory;
using Ryujinx.Horizon.Sdk.Hid.SharedMemory.Common;
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.TouchScreen
namespace Ryujinx.Horizon.Sdk.Hid
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct TouchScreenState : ISampledDataStruct

View file

@ -1,4 +1,4 @@
namespace Ryujinx.Horizon.Sdk.Hid.SharedMemory.TouchScreen
namespace Ryujinx.Horizon.Sdk.Hid
{
struct TouchState
{

View file

@ -0,0 +1,12 @@
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid.SixAxis
{
[StructLayout(LayoutKind.Sequential, Size = 0x4)]
struct ConsoleSixAxisSensorHandle
{
public int TypeValue;
public byte Unknown1;
public byte Unknown2;
}
}

View file

@ -1,7 +1,7 @@
using Ryujinx.Horizon.Sdk.Hid.Npad;
using System.Numerics;
namespace Ryujinx.Horizon.Sdk.Hid
namespace Ryujinx.Horizon.Sdk.Hid.SixAxis
{
public struct SixAxisInput
{

View file

@ -0,0 +1,10 @@
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid.SixAxis
{
[StructLayout(LayoutKind.Sequential, Size = 0x744)]
struct SixAxisSensorCalibrationParameter
{
}
}

View file

@ -0,0 +1,13 @@
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid.SixAxis
{
[StructLayout(LayoutKind.Sequential, Size = 0x4)]
struct SixAxisSensorHandle
{
public int TypeValue;
public byte NpadStyleIndex;
public byte PlayerNumber;
public byte DeviceIdx;
}
}

View file

@ -0,0 +1,10 @@
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid.SixAxis
{
[StructLayout(LayoutKind.Sequential, Size = 0xC8)]
public struct SixAxisSensorIcInformation
{
}
}

View file

@ -1,5 +1,3 @@
using Ryujinx.Horizon.Sdk.Hid.SharedMemory.TouchScreen;
namespace Ryujinx.Horizon.Sdk.Hid
{
public struct TouchPoint

View file

@ -0,0 +1,10 @@
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid
{
[StructLayout(LayoutKind.Sequential, Size = 0x10)]
struct TouchScreenConfigurationForNx
{
public TouchScreenModeForNx Mode;
}
}

View file

@ -0,0 +1,9 @@
namespace Ryujinx.Horizon.Sdk.Hid
{
enum TouchScreenModeForNx : byte
{
UseSystemSetting = 0,
Finger = 1,
Heat2 = 2
}
}

View file

@ -0,0 +1,11 @@
using System.Runtime.InteropServices;
namespace Ryujinx.Horizon.Sdk.Hid.Vibration
{
[StructLayout(LayoutKind.Sequential, Size = 0x8)]
struct VibrationDeviceInfoForIpc
{
public VibrationDeviceType DeviceType;
public VibrationDevicePosition Position;
}
}

View file

@ -1,9 +1,9 @@
namespace Ryujinx.Horizon.Sdk.Hid.Vibration
{
public enum VibrationDevicePosition
enum VibrationDevicePosition
{
None,
Left,
Right,
None = 0,
Left = 1,
Right = 2
}
}

View file

@ -1,9 +1,10 @@
namespace Ryujinx.Horizon.Sdk.Hid.Vibration
{
public enum VibrationDeviceType
enum VibrationDeviceType
{
None,
LinearResonantActuator,
GcErm,
Unknown = 0,
LinearResonantActuator = 1,
GcErm = 2,
Erm = 3
}
}

View file

@ -1,6 +1,6 @@
namespace Ryujinx.Horizon.Sdk.Hid.Vibration
{
public struct VibrationDeviceValue
struct VibrationDeviceValue
{
public VibrationDeviceType DeviceType;
public VibrationDevicePosition Position;

View file

@ -0,0 +1,12 @@
namespace Ryujinx.Horizon.Sdk.Hid.Vibration
{
enum VibrationGcErmCommand
{
// Stops the vibration with a decay phase.
Stop = 0,
// Starts the vibration.
Start = 1,
// Stops the vibration immediately, with no decay phase.
StopHard = 2
}
}

View file

@ -6,6 +6,7 @@ using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Services.Hid;
using Ryujinx.Horizon.Sdk.Hid;
using Ryujinx.Horizon.Sdk.Hid.Npad;
using Ryujinx.Horizon.Sdk.Hid.SixAxis;
using Ryujinx.Horizon.Sdk.Hid.Vibration;
using System;
using System.Collections.Concurrent;

View file

@ -3,6 +3,8 @@ using Ryujinx.Common.Configuration.Hid.Controller;
using Ryujinx.Common.Configuration.Hid.Keyboard;
using Ryujinx.HLE.HOS.Services.Hid;
using Ryujinx.Horizon.Sdk.Hid;
using Ryujinx.Horizon.Sdk.Hid.HidDevices;
using Ryujinx.Horizon.Sdk.Hid.SixAxis;
using System;
using System.Collections.Generic;
using System.Diagnostics;