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
This commit is contained in:
Ac_K 2019-09-19 02:45:11 +02:00 committed by jduncanator
parent 4af3101b22
commit a0720b5681
393 changed files with 2540 additions and 1299 deletions

View file

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

View file

@ -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));
}
}
}
}

View file

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.HOS.Services.Hid
namespace Ryujinx.HLE.HOS.Services.Hid.HidServer
{
class IActiveApplicationDeviceList : IpcService
{

View file

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

View file

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

View file

@ -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));
}
}
}
}

View file

@ -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;
}
}

View file

@ -0,0 +1,8 @@
namespace Ryujinx.HLE.HOS.Services.Hid
{
[Service("hid:dbg")]
class IHidDebugServer : IpcService
{
public IHidDebugServer(ServiceCtx context) { }
}
}

View file

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

View file

@ -0,0 +1,8 @@
namespace Ryujinx.HLE.HOS.Services.Hid
{
[Service("hid:sys")]
class IHidSystemServer : IpcService
{
public IHidSystemServer(ServiceCtx context) { }
}
}

View file

@ -0,0 +1,8 @@
namespace Ryujinx.HLE.HOS.Services.Hid
{
[Service("hidbus")]
class IHidbusServer : IpcService
{
public IHidbusServer(ServiceCtx context) { }
}
}

View file

@ -0,0 +1,8 @@
namespace Ryujinx.HLE.HOS.Services.Hid
{
[Service("xcd:sys")]
class ISystemServer : IpcService
{
public ISystemServer(ServiceCtx context) { }
}
}

View file

@ -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;
}

View file

@ -0,0 +1,8 @@
namespace Ryujinx.HLE.HOS.Services.Hid.Irs
{
[Service("irs:sys")]
class IIrSensorSystemServer : IpcService
{
public IIrSensorSystemServer(ServiceCtx context) { }
}
}

View file

@ -0,0 +1,9 @@
namespace Ryujinx.HLE.HOS.Services.Hid
{
public enum HidNpadHandheldActivationMode
{
Dual,
Single,
None
}
}

View file

@ -1,6 +1,6 @@
namespace Ryujinx.HLE.HOS.Services.Hid
{
public enum NpadIdType
public enum HidNpadIdType
{
Player1 = 0,
Player2 = 1,

View file

@ -0,0 +1,8 @@
namespace Ryujinx.HLE.HOS.Services.Hid
{
public enum HidNpadJoyAssignmentMode
{
Dual,
Single
}
}

View file

@ -0,0 +1,8 @@
namespace Ryujinx.HLE.HOS.Services.Hid
{
public enum HidNpadJoyDeviceType
{
Left,
Right
}
}

View file

@ -0,0 +1,8 @@
namespace Ryujinx.HLE.HOS.Services.Hid
{
public enum HidNpadJoyHoldType
{
Vertical,
Horizontal
}
}

View file

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

View file

@ -0,0 +1,8 @@
namespace Ryujinx.HLE.HOS.Services.Hid
{
public struct HidAccelerometerParameters
{
public float X;
public float Y;
}
}

View file

@ -0,0 +1,9 @@
namespace Ryujinx.HLE.HOS.Services.Hid
{
public enum HidGyroscopeZeroDriftMode
{
Loose,
Standard,
Tight
}
}

View file

@ -0,0 +1,8 @@
namespace Ryujinx.HLE.HOS.Services.Hid
{
public struct HidSensorFusionParameters
{
public float RevisePower;
public float ReviseRange;
}
}

View file

@ -0,0 +1,9 @@
namespace Ryujinx.HLE.HOS.Services.Hid
{
public enum HidVibrationDevicePosition
{
None,
Left,
Right
}
}

View file

@ -0,0 +1,8 @@
namespace Ryujinx.HLE.HOS.Services.Hid
{
public enum HidVibrationDeviceType
{
None,
LinearResonantActuator
}
}

View file

@ -0,0 +1,8 @@
namespace Ryujinx.HLE.HOS.Services.Hid
{
public struct HidVibrationDeviceValue
{
public HidVibrationDeviceType DeviceType;
public HidVibrationDevicePosition Position;
}
}

View file

@ -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;
}
}