From 6e483120527c749854066b1ab0c5a1d53d49f0e3 Mon Sep 17 00:00:00 2001 From: emmauss Date: Tue, 14 Aug 2018 00:31:09 +0300 Subject: [PATCH] Implement AcquireNpadStyleSetUpdate event (#306) * implement get npad set event * move npad style set event to hid service * fix spacing * change event to field * dispose event --- Ryujinx.HLE/OsHle/Horizon.cs | 2 +- Ryujinx.HLE/OsHle/Services/Hid/IHidServer.cs | 31 +++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/Ryujinx.HLE/OsHle/Horizon.cs b/Ryujinx.HLE/OsHle/Horizon.cs index f420dc0d..f12bf37d 100644 --- a/Ryujinx.HLE/OsHle/Horizon.cs +++ b/Ryujinx.HLE/OsHle/Horizon.cs @@ -233,4 +233,4 @@ namespace Ryujinx.HLE.OsHle } } } -} \ No newline at end of file +} diff --git a/Ryujinx.HLE/OsHle/Services/Hid/IHidServer.cs b/Ryujinx.HLE/OsHle/Services/Hid/IHidServer.cs index 79d37fd4..f23164ce 100644 --- a/Ryujinx.HLE/OsHle/Services/Hid/IHidServer.cs +++ b/Ryujinx.HLE/OsHle/Services/Hid/IHidServer.cs @@ -1,14 +1,18 @@ using Ryujinx.HLE.Input; using Ryujinx.HLE.Logging; using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.OsHle.Handles; +using System; using System.Collections.Generic; namespace Ryujinx.HLE.OsHle.Services.Hid { - class IHidServer : IpcService + class IHidServer : IpcService, IDisposable { private Dictionary m_Commands; + private KEvent NpadStyleSetUpdateEvent; + public override IReadOnlyDictionary Commands => m_Commands; public IHidServer() @@ -26,6 +30,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid { 101, GetSupportedNpadStyleSet }, { 102, SetSupportedNpadIdType }, { 103, ActivateNpad }, + { 106, AcquireNpadStyleSetUpdateEventHandle }, { 108, GetPlayerLedPattern }, { 120, SetNpadJoyHoldType }, { 121, GetNpadJoyHoldType }, @@ -39,6 +44,8 @@ namespace Ryujinx.HLE.OsHle.Services.Hid { 203, CreateActiveVibrationDeviceList }, { 206, SendVibrationValues } }; + + NpadStyleSetUpdateEvent = new KEvent(); } public long CreateAppletResource(ServiceCtx Context) @@ -104,6 +111,15 @@ namespace Ryujinx.HLE.OsHle.Services.Hid 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); @@ -266,5 +282,18 @@ namespace Ryujinx.HLE.OsHle.Services.Hid return 0; } + + public void Dispose() + { + Dispose(true); + } + + protected virtual void Dispose(bool Disposing) + { + if (Disposing) + { + NpadStyleSetUpdateEvent.Dispose(); + } + } } }