diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-08-16 20:47:36 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-16 20:47:36 -0300 |
| commit | 521751795a1c97c0d97f6f8904a3be69b13d3a9d (patch) | |
| tree | 942a05899c40e2de6d92a38b93a494bd96ee64b8 /Ryujinx.HLE/HOS/Services/Hid | |
| parent | 182d716867ae477c2b15a5332430dc2641fa1cc3 (diff) | |
Code style fixes and nits on the HLE project (#355)
* Some style fixes and nits on ITimeZoneService
* Remove some unneeded usings
* Remove the Ryujinx.HLE.OsHle.Handles namespace
* Remove hbmenu automatic load on process exit
* Rename Ns to Device, rename Os to System, rename SystemState to State
* Move Exceptions and Utilities out of OsHle
* Rename OsHle to HOS
* Rename OsHle folder to HOS
* IManagerDisplayService and ISystemDisplayService style fixes
* BsdError shouldn't be public
* Add a empty new line before using static
* Remove unused file
* Some style fixes on NPDM
* Exit gracefully when the application is closed
* Code style fixes on IGeneralService
* Add 0x prefix on values printed as hex
* Small improvements on finalization code
* Move ProcessId and ThreadId out of AThreadState
* Rename VFs to FileSystem
* FsAccessHeader shouldn't be public. Also fix file names casing
* More case changes on NPDM
* Remove unused files
* Move using to the correct place on NPDM
* Use properties on KernelAccessControlMmio
* Address PR feedback
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Hid')
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Hid/IActiveVibrationDeviceList.cs | 27 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Hid/IAppletResource.cs | 34 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs | 299 |
3 files changed, 360 insertions, 0 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Hid/IActiveVibrationDeviceList.cs b/Ryujinx.HLE/HOS/Services/Hid/IActiveVibrationDeviceList.cs new file mode 100644 index 00000000..6e666919 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/IActiveVibrationDeviceList.cs @@ -0,0 +1,27 @@ +using Ryujinx.HLE.HOS.Ipc; +using System.Collections.Generic; + +namespace Ryujinx.HLE.HOS.Services.Hid +{ + class IActiveApplicationDeviceList : IpcService + { + private Dictionary<int, ServiceProcessRequest> m_Commands; + + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + + public IActiveApplicationDeviceList() + { + m_Commands = new Dictionary<int, ServiceProcessRequest>() + { + { 0, ActivateVibrationDevice } + }; + } + + public long ActivateVibrationDevice(ServiceCtx Context) + { + int VibrationDeviceHandle = Context.RequestData.ReadInt32(); + + return 0; + } + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/IAppletResource.cs b/Ryujinx.HLE/HOS/Services/Hid/IAppletResource.cs new file mode 100644 index 00000000..012ccb40 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/IAppletResource.cs @@ -0,0 +1,34 @@ +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; +using System.Collections.Generic; + +namespace Ryujinx.HLE.HOS.Services.Hid +{ + class IAppletResource : IpcService + { + private Dictionary<int, ServiceProcessRequest> m_Commands; + + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + + private KSharedMemory HidSharedMem; + + public IAppletResource(KSharedMemory HidSharedMem) + { + m_Commands = new Dictionary<int, ServiceProcessRequest>() + { + { 0, GetSharedMemoryHandle } + }; + + this.HidSharedMem = HidSharedMem; + } + + public long GetSharedMemoryHandle(ServiceCtx Context) + { + int Handle = Context.Process.HandleTable.OpenHandle(HidSharedMem); + + Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); + + return 0; + } + } +}
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs b/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs new file mode 100644 index 00000000..70f1f1f1 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs @@ -0,0 +1,299 @@ +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; +using Ryujinx.HLE.Input; +using Ryujinx.HLE.Logging; +using System; +using System.Collections.Generic; + +namespace Ryujinx.HLE.HOS.Services.Hid +{ + class IHidServer : IpcService, IDisposable + { + private Dictionary<int, ServiceProcessRequest> m_Commands; + + private KEvent NpadStyleSetUpdateEvent; + + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + + public IHidServer() + { + m_Commands = new Dictionary<int, ServiceProcessRequest>() + { + { 0, CreateAppletResource }, + { 1, ActivateDebugPad }, + { 11, ActivateTouchScreen }, + { 21, ActivateMouse }, + { 31, ActivateKeyboard }, + { 66, StartSixAxisSensor }, + { 79, SetGyroscopeZeroDriftMode }, + { 100, SetSupportedNpadStyleSet }, + { 101, GetSupportedNpadStyleSet }, + { 102, SetSupportedNpadIdType }, + { 103, ActivateNpad }, + { 106, AcquireNpadStyleSetUpdateEventHandle }, + { 108, GetPlayerLedPattern }, + { 120, SetNpadJoyHoldType }, + { 121, GetNpadJoyHoldType }, + { 122, SetNpadJoyAssignmentModeSingleByDefault }, + { 123, SetNpadJoyAssignmentModeSingle }, + { 124, SetNpadJoyAssignmentModeDual }, + { 125, MergeSingleJoyAsDualJoy }, + { 128, SetNpadHandheldActivationMode }, + { 200, GetVibrationDeviceInfo }, + { 201, SendVibrationValue }, + { 203, CreateActiveVibrationDeviceList }, + { 206, SendVibrationValues } + }; + + NpadStyleSetUpdateEvent = new KEvent(); + } + + public long CreateAppletResource(ServiceCtx Context) + { + MakeObject(Context, new IAppletResource(Context.Device.System.HidSharedMem)); + + return 0; + } + + public long ActivateDebugPad(ServiceCtx Context) + { + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long ActivateTouchScreen(ServiceCtx Context) + { + long AppletResourceUserId = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long ActivateMouse(ServiceCtx Context) + { + long AppletResourceUserId = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long ActivateKeyboard(ServiceCtx Context) + { + long AppletResourceUserId = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long StartSixAxisSensor(ServiceCtx Context) + { + int Handle = Context.RequestData.ReadInt32(); + + long AppletResourceUserId = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long SetGyroscopeZeroDriftMode(ServiceCtx Context) + { + int Handle = Context.RequestData.ReadInt32(); + int Unknown = Context.RequestData.ReadInt32(); + long AppletResourceUserId = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long AcquireNpadStyleSetUpdateEventHandle(ServiceCtx Context) + { + int Handle = Context.Process.HandleTable.OpenHandle(NpadStyleSetUpdateEvent); + + Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); + + return 0; + } + + public long GetSupportedNpadStyleSet(ServiceCtx Context) + { + Context.ResponseData.Write(0); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long SetSupportedNpadStyleSet(ServiceCtx Context) + { + long Unknown0 = Context.RequestData.ReadInt64(); + long Unknown8 = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long SetSupportedNpadIdType(ServiceCtx Context) + { + long Unknown = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long ActivateNpad(ServiceCtx Context) + { + long Unknown = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long GetPlayerLedPattern(ServiceCtx Context) + { + long Unknown = Context.RequestData.ReadInt32(); + + Context.ResponseData.Write(0L); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long SetNpadJoyHoldType(ServiceCtx Context) + { + long Unknown0 = Context.RequestData.ReadInt64(); + long Unknown8 = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long GetNpadJoyHoldType(ServiceCtx Context) + { + Context.ResponseData.Write(0L); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long SetNpadJoyAssignmentModeSingleByDefault(ServiceCtx Context) + { + HidControllerId HidControllerId = (HidControllerId)Context.RequestData.ReadInt32(); + + long AppletUserResourceId = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long SetNpadJoyAssignmentModeSingle(ServiceCtx Context) + { + HidControllerId HidControllerId = (HidControllerId)Context.RequestData.ReadInt32(); + + long AppletUserResourceId = Context.RequestData.ReadInt64(); + long NpadJoyDeviceType = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long SetNpadJoyAssignmentModeDual(ServiceCtx Context) + { + HidControllerId HidControllerId = (HidControllerId)Context.RequestData.ReadInt32(); + + long AppletUserResourceId = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long MergeSingleJoyAsDualJoy(ServiceCtx Context) + { + long Unknown0 = Context.RequestData.ReadInt32(); + long Unknown8 = Context.RequestData.ReadInt32(); + long AppletUserResourceId = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long SetNpadHandheldActivationMode(ServiceCtx Context) + { + long AppletUserResourceId = Context.RequestData.ReadInt64(); + long Unknown = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long GetVibrationDeviceInfo(ServiceCtx Context) + { + int VibrationDeviceHandle = Context.RequestData.ReadInt32(); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + Context.ResponseData.Write(0L); //VibrationDeviceInfoForIpc + + return 0; + } + + public long SendVibrationValue(ServiceCtx Context) + { + int VibrationDeviceHandle = Context.RequestData.ReadInt32(); + + int VibrationValue1 = Context.RequestData.ReadInt32(); + int VibrationValue2 = Context.RequestData.ReadInt32(); + int VibrationValue3 = Context.RequestData.ReadInt32(); + int VibrationValue4 = Context.RequestData.ReadInt32(); + + long AppletUserResourceId = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public long CreateActiveVibrationDeviceList(ServiceCtx Context) + { + MakeObject(Context, new IActiveApplicationDeviceList()); + + return 0; + } + + public long SendVibrationValues(ServiceCtx Context) + { + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + + return 0; + } + + public void Dispose() + { + Dispose(true); + } + + protected virtual void Dispose(bool Disposing) + { + if (Disposing) + { + NpadStyleSetUpdateEvent.Dispose(); + } + } + } +} |
