diff options
| author | Ac_K <Acoustik666@gmail.com> | 2019-09-19 02:45:11 +0200 |
|---|---|---|
| committer | jduncanator <1518948+jduncanator@users.noreply.github.com> | 2019-09-19 10:45:11 +1000 |
| commit | a0720b5681852f3d786d77bd3793b0359dea321c (patch) | |
| tree | 9d8f61e540d1d1d827999902dad95e5c0c1e076e /Ryujinx.HLE/HOS/Services/Hid | |
| parent | 4af3101b22e6957d6aa48a2768566d658699f4ed (diff) | |
Refactoring HOS folder structure (#771)
* Refactoring HOS folder structure
Refactoring HOS folder structure:
- Added some subfolders when needed (Following structure decided in private).
- Added some `Types` folders when needed.
- Little cleanup here and there.
- Add services placeholders for every HOS services (close #766 and #753).
* Remove Types namespaces
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Hid')
27 files changed, 204 insertions, 144 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Hid/HidNpad.cs b/Ryujinx.HLE/HOS/Services/Hid/HidNpad.cs deleted file mode 100644 index b2581202..00000000 --- a/Ryujinx.HLE/HOS/Services/Hid/HidNpad.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; - -namespace Ryujinx.HLE.HOS.Services.Hid -{ - public enum HidNpadJoyAssignmentMode - { - Dual, - Single - } - - public enum HidNpadHandheldActivationMode - { - Dual, - Single, - None - } - - public enum HidNpadJoyDeviceType - { - Left, - Right - } - - public enum HidNpadJoyHoldType - { - Vertical, - Horizontal - } - - [Flags] - public enum HidNpadStyle - { - None, - FullKey = 1 << 0, - Handheld = 1 << 1, - Dual = 1 << 2, - Left = 1 << 3, - Right = 1 << 4, - Invalid = 1 << 5 - } -}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/HidServer/HidUtils.cs b/Ryujinx.HLE/HOS/Services/Hid/HidServer/HidUtils.cs new file mode 100644 index 00000000..c89ea306 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/HidServer/HidUtils.cs @@ -0,0 +1,46 @@ +using Ryujinx.HLE.Input; +using System; + +namespace Ryujinx.HLE.HOS.Services.Hid.HidServer +{ + static class HidUtils + { + public static ControllerId GetIndexFromNpadIdType(HidNpadIdType npadIdType) + { + switch (npadIdType) + { + case HidNpadIdType.Player1: return ControllerId.ControllerPlayer1; + case HidNpadIdType.Player2: return ControllerId.ControllerPlayer2; + case HidNpadIdType.Player3: return ControllerId.ControllerPlayer3; + case HidNpadIdType.Player4: return ControllerId.ControllerPlayer4; + case HidNpadIdType.Player5: return ControllerId.ControllerPlayer5; + case HidNpadIdType.Player6: return ControllerId.ControllerPlayer6; + case HidNpadIdType.Player7: return ControllerId.ControllerPlayer7; + case HidNpadIdType.Player8: return ControllerId.ControllerPlayer8; + case HidNpadIdType.Handheld: return ControllerId.ControllerHandheld; + case HidNpadIdType.Unknown: return ControllerId.ControllerUnknown; + + default: throw new ArgumentOutOfRangeException(nameof(npadIdType)); + } + } + + public static HidNpadIdType GetNpadIdTypeFromIndex(ControllerId index) + { + switch (index) + { + case ControllerId.ControllerPlayer1: return HidNpadIdType.Player1; + case ControllerId.ControllerPlayer2: return HidNpadIdType.Player2; + case ControllerId.ControllerPlayer3: return HidNpadIdType.Player3; + case ControllerId.ControllerPlayer4: return HidNpadIdType.Player4; + case ControllerId.ControllerPlayer5: return HidNpadIdType.Player5; + case ControllerId.ControllerPlayer6: return HidNpadIdType.Player6; + case ControllerId.ControllerPlayer7: return HidNpadIdType.Player7; + case ControllerId.ControllerPlayer8: return HidNpadIdType.Player8; + case ControllerId.ControllerHandheld: return HidNpadIdType.Handheld; + case ControllerId.ControllerUnknown: return HidNpadIdType.Unknown; + + default: throw new ArgumentOutOfRangeException(nameof(index)); + } + } + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/IActiveVibrationDeviceList.cs b/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs index 8aa623ee..4c2050f1 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/IActiveVibrationDeviceList.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.HOS.Services.Hid +namespace Ryujinx.HLE.HOS.Services.Hid.HidServer { class IActiveApplicationDeviceList : IpcService { diff --git a/Ryujinx.HLE/HOS/Services/Hid/IAppletResource.cs b/Ryujinx.HLE/HOS/Services/Hid/HidServer/IAppletResource.cs index 437ef082..2c3a6500 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/IAppletResource.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/HidServer/IAppletResource.cs @@ -3,7 +3,7 @@ using Ryujinx.HLE.HOS.Kernel.Common; using Ryujinx.HLE.HOS.Kernel.Memory; using System; -namespace Ryujinx.HLE.HOS.Services.Hid +namespace Ryujinx.HLE.HOS.Services.Hid.HidServer { class IAppletResource : IpcService { diff --git a/Ryujinx.HLE/HOS/Services/Hid/HidSixAxis.cs b/Ryujinx.HLE/HOS/Services/Hid/HidSixAxis.cs deleted file mode 100644 index 7c7ebcc4..00000000 --- a/Ryujinx.HLE/HOS/Services/Hid/HidSixAxis.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace Ryujinx.HLE.HOS.Services.Hid -{ - public struct HidSensorFusionParameters - { - public float RevisePower; - public float ReviseRange; - } - - public struct HidAccelerometerParameters - { - public float X; - public float Y; - } - - public enum HidGyroscopeZeroDriftMode - { - Loose, - Standard, - Tight - } -}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/HidUtils.cs b/Ryujinx.HLE/HOS/Services/Hid/HidUtils.cs deleted file mode 100644 index fd540c7c..00000000 --- a/Ryujinx.HLE/HOS/Services/Hid/HidUtils.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Ryujinx.HLE.Input; -using System; - -namespace Ryujinx.HLE.HOS.Services.Hid -{ - static class HidUtils - { - public static ControllerId GetIndexFromNpadIdType(NpadIdType npadIdType) - { - switch (npadIdType) - { - case NpadIdType.Player1: return ControllerId.ControllerPlayer1; - case NpadIdType.Player2: return ControllerId.ControllerPlayer2; - case NpadIdType.Player3: return ControllerId.ControllerPlayer3; - case NpadIdType.Player4: return ControllerId.ControllerPlayer4; - case NpadIdType.Player5: return ControllerId.ControllerPlayer5; - case NpadIdType.Player6: return ControllerId.ControllerPlayer6; - case NpadIdType.Player7: return ControllerId.ControllerPlayer7; - case NpadIdType.Player8: return ControllerId.ControllerPlayer8; - case NpadIdType.Handheld: return ControllerId.ControllerHandheld; - case NpadIdType.Unknown: return ControllerId.ControllerUnknown; - - default: throw new ArgumentOutOfRangeException(nameof(npadIdType)); - } - } - - public static NpadIdType GetNpadIdTypeFromIndex(ControllerId index) - { - switch (index) - { - case ControllerId.ControllerPlayer1: return NpadIdType.Player1; - case ControllerId.ControllerPlayer2: return NpadIdType.Player2; - case ControllerId.ControllerPlayer3: return NpadIdType.Player3; - case ControllerId.ControllerPlayer4: return NpadIdType.Player4; - case ControllerId.ControllerPlayer5: return NpadIdType.Player5; - case ControllerId.ControllerPlayer6: return NpadIdType.Player6; - case ControllerId.ControllerPlayer7: return NpadIdType.Player7; - case ControllerId.ControllerPlayer8: return NpadIdType.Player8; - case ControllerId.ControllerHandheld: return NpadIdType.Handheld; - case ControllerId.ControllerUnknown: return NpadIdType.Unknown; - - default: throw new ArgumentOutOfRangeException(nameof(index)); - } - } - } -}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/HidVibration.cs b/Ryujinx.HLE/HOS/Services/Hid/HidVibration.cs deleted file mode 100644 index 635c356c..00000000 --- a/Ryujinx.HLE/HOS/Services/Hid/HidVibration.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace Ryujinx.HLE.HOS.Services.Hid -{ - public enum HidVibrationDeviceType - { - None, - LinearResonantActuator - } - - public enum HidVibrationDevicePosition - { - None, - Left, - Right - } - - public struct HidVibrationDeviceValue - { - public HidVibrationDeviceType DeviceType; - public HidVibrationDevicePosition Position; - } - - public struct HidVibrationValue - { - public float AmplitudeLow; - public float FrequencyLow; - public float AmplitudeHigh; - public float FrequencyHigh; - } -}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/IHidDebugServer.cs b/Ryujinx.HLE/HOS/Services/Hid/IHidDebugServer.cs new file mode 100644 index 00000000..adaaa012 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/IHidDebugServer.cs @@ -0,0 +1,8 @@ +namespace Ryujinx.HLE.HOS.Services.Hid +{ + [Service("hid:dbg")] + class IHidDebugServer : IpcService + { + public IHidDebugServer(ServiceCtx context) { } + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs b/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs index 9adc08c1..1af9baf8 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs @@ -2,6 +2,7 @@ using Ryujinx.Common.Logging; using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.HOS.Kernel.Common; using Ryujinx.HLE.HOS.Kernel.Threading; +using Ryujinx.HLE.HOS.Services.Hid.HidServer; using Ryujinx.HLE.Input; using System; diff --git a/Ryujinx.HLE/HOS/Services/Hid/IHidSystemServer.cs b/Ryujinx.HLE/HOS/Services/Hid/IHidSystemServer.cs new file mode 100644 index 00000000..019e9954 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/IHidSystemServer.cs @@ -0,0 +1,8 @@ +namespace Ryujinx.HLE.HOS.Services.Hid +{ + [Service("hid:sys")] + class IHidSystemServer : IpcService + { + public IHidSystemServer(ServiceCtx context) { } + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/IHidbusServer.cs b/Ryujinx.HLE/HOS/Services/Hid/IHidbusServer.cs new file mode 100644 index 00000000..bfd1d4dc --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/IHidbusServer.cs @@ -0,0 +1,8 @@ +namespace Ryujinx.HLE.HOS.Services.Hid +{ + [Service("hidbus")] + class IHidbusServer : IpcService + { + public IHidbusServer(ServiceCtx context) { } + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/ISystemServer.cs b/Ryujinx.HLE/HOS/Services/Hid/ISystemServer.cs new file mode 100644 index 00000000..71353344 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/ISystemServer.cs @@ -0,0 +1,8 @@ +namespace Ryujinx.HLE.HOS.Services.Hid +{ + [Service("xcd:sys")] + class ISystemServer : IpcService + { + public ISystemServer(ServiceCtx context) { } + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs b/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs index d2991d0f..cd571f11 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs @@ -1,6 +1,7 @@ using Ryujinx.Common.Logging; using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.HOS.Kernel.Common; +using Ryujinx.HLE.HOS.Services.Hid.HidServer; using Ryujinx.HLE.Input; using System; @@ -56,11 +57,11 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs // GetNpadIrCameraHandle(u32) -> nn::irsensor::IrCameraHandle public ResultCode GetNpadIrCameraHandle(ServiceCtx context) { - NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32(); + HidNpadIdType npadIdType = (HidNpadIdType)context.RequestData.ReadUInt32(); - if (npadIdType > NpadIdType.Player8 && - npadIdType != NpadIdType.Unknown && - npadIdType != NpadIdType.Handheld) + if (npadIdType > HidNpadIdType.Player8 && + npadIdType != HidNpadIdType.Unknown && + npadIdType != HidNpadIdType.Handheld) { return ResultCode.NpadIdOutOfRange; } diff --git a/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorSystemServer.cs b/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorSystemServer.cs new file mode 100644 index 00000000..99fcd541 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorSystemServer.cs @@ -0,0 +1,8 @@ +namespace Ryujinx.HLE.HOS.Services.Hid.Irs +{ + [Service("irs:sys")] + class IIrSensorSystemServer : IpcService + { + public IIrSensorSystemServer(ServiceCtx context) { } + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadHandheldActivationMode.cs b/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadHandheldActivationMode.cs new file mode 100644 index 00000000..0aa8334d --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadHandheldActivationMode.cs @@ -0,0 +1,9 @@ +namespace Ryujinx.HLE.HOS.Services.Hid +{ + public enum HidNpadHandheldActivationMode + { + Dual, + Single, + None + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/NpadIdType.cs b/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadIdType.cs index 5f6a68cb..9a3989de 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/NpadIdType.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadIdType.cs @@ -1,6 +1,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid { - public enum NpadIdType + public enum HidNpadIdType { Player1 = 0, Player2 = 1, diff --git a/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadJoyAssignmentMode.cs b/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadJoyAssignmentMode.cs new file mode 100644 index 00000000..a2e22661 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadJoyAssignmentMode.cs @@ -0,0 +1,8 @@ +namespace Ryujinx.HLE.HOS.Services.Hid +{ + public enum HidNpadJoyAssignmentMode + { + Dual, + Single + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadJoyDeviceType.cs b/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadJoyDeviceType.cs new file mode 100644 index 00000000..d0b34def --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadJoyDeviceType.cs @@ -0,0 +1,8 @@ +namespace Ryujinx.HLE.HOS.Services.Hid +{ + public enum HidNpadJoyDeviceType + { + Left, + Right + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadJoyHoldType.cs b/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadJoyHoldType.cs new file mode 100644 index 00000000..3bd3aa91 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadJoyHoldType.cs @@ -0,0 +1,8 @@ +namespace Ryujinx.HLE.HOS.Services.Hid +{ + public enum HidNpadJoyHoldType + { + Vertical, + Horizontal + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadStyle.cs b/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadStyle.cs new file mode 100644 index 00000000..93717acf --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/HidNpadStyle.cs @@ -0,0 +1,16 @@ +using System; + +namespace Ryujinx.HLE.HOS.Services.Hid +{ + [Flags] + public enum HidNpadStyle + { + None, + FullKey = 1 << 0, + Handheld = 1 << 1, + Dual = 1 << 2, + Left = 1 << 3, + Right = 1 << 4, + Invalid = 1 << 5 + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/Types/SixAxis/HidAccelerometerParameters.cs b/Ryujinx.HLE/HOS/Services/Hid/Types/SixAxis/HidAccelerometerParameters.cs new file mode 100644 index 00000000..fe7e4cc9 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/Types/SixAxis/HidAccelerometerParameters.cs @@ -0,0 +1,8 @@ +namespace Ryujinx.HLE.HOS.Services.Hid +{ + public struct HidAccelerometerParameters + { + public float X; + public float Y; + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/Types/SixAxis/HidGyroscopeZeroDriftMode.cs b/Ryujinx.HLE/HOS/Services/Hid/Types/SixAxis/HidGyroscopeZeroDriftMode.cs new file mode 100644 index 00000000..cd3aa318 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/Types/SixAxis/HidGyroscopeZeroDriftMode.cs @@ -0,0 +1,9 @@ +namespace Ryujinx.HLE.HOS.Services.Hid +{ + public enum HidGyroscopeZeroDriftMode + { + Loose, + Standard, + Tight + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/Types/SixAxis/HidSensorFusionParameters.cs b/Ryujinx.HLE/HOS/Services/Hid/Types/SixAxis/HidSensorFusionParameters.cs new file mode 100644 index 00000000..cadf5ec0 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/Types/SixAxis/HidSensorFusionParameters.cs @@ -0,0 +1,8 @@ +namespace Ryujinx.HLE.HOS.Services.Hid +{ + public struct HidSensorFusionParameters + { + public float RevisePower; + public float ReviseRange; + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/Types/Vibration/HidVibrationDevicePosition.cs b/Ryujinx.HLE/HOS/Services/Hid/Types/Vibration/HidVibrationDevicePosition.cs new file mode 100644 index 00000000..0ab84af3 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/Types/Vibration/HidVibrationDevicePosition.cs @@ -0,0 +1,9 @@ +namespace Ryujinx.HLE.HOS.Services.Hid +{ + public enum HidVibrationDevicePosition + { + None, + Left, + Right + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/Types/Vibration/HidVibrationDeviceType.cs b/Ryujinx.HLE/HOS/Services/Hid/Types/Vibration/HidVibrationDeviceType.cs new file mode 100644 index 00000000..cf9e6498 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/Types/Vibration/HidVibrationDeviceType.cs @@ -0,0 +1,8 @@ +namespace Ryujinx.HLE.HOS.Services.Hid +{ + public enum HidVibrationDeviceType + { + None, + LinearResonantActuator + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/Types/Vibration/HidVibrationDeviceValue.cs b/Ryujinx.HLE/HOS/Services/Hid/Types/Vibration/HidVibrationDeviceValue.cs new file mode 100644 index 00000000..7905ecfd --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/Types/Vibration/HidVibrationDeviceValue.cs @@ -0,0 +1,8 @@ +namespace Ryujinx.HLE.HOS.Services.Hid +{ + public struct HidVibrationDeviceValue + { + public HidVibrationDeviceType DeviceType; + public HidVibrationDevicePosition Position; + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/Types/Vibration/HidVibrationValue.cs b/Ryujinx.HLE/HOS/Services/Hid/Types/Vibration/HidVibrationValue.cs new file mode 100644 index 00000000..7211396e --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/Types/Vibration/HidVibrationValue.cs @@ -0,0 +1,10 @@ +namespace Ryujinx.HLE.HOS.Services.Hid +{ + public struct HidVibrationValue + { + public float AmplitudeLow; + public float FrequencyLow; + public float AmplitudeHigh; + public float FrequencyHigh; + } +}
\ No newline at end of file |
