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
This commit is contained in:
emmauss 2018-08-14 00:31:09 +03:00 committed by gdkchan
parent 09593ae6d8
commit 6e48312052
2 changed files with 31 additions and 2 deletions

View file

@ -1,14 +1,18 @@
using Ryujinx.HLE.Input; using Ryujinx.HLE.Input;
using Ryujinx.HLE.Logging; using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Ipc; using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.OsHle.Handles;
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Hid namespace Ryujinx.HLE.OsHle.Services.Hid
{ {
class IHidServer : IpcService class IHidServer : IpcService, IDisposable
{ {
private Dictionary<int, ServiceProcessRequest> m_Commands; private Dictionary<int, ServiceProcessRequest> m_Commands;
private KEvent NpadStyleSetUpdateEvent;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public IHidServer() public IHidServer()
@ -26,6 +30,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid
{ 101, GetSupportedNpadStyleSet }, { 101, GetSupportedNpadStyleSet },
{ 102, SetSupportedNpadIdType }, { 102, SetSupportedNpadIdType },
{ 103, ActivateNpad }, { 103, ActivateNpad },
{ 106, AcquireNpadStyleSetUpdateEventHandle },
{ 108, GetPlayerLedPattern }, { 108, GetPlayerLedPattern },
{ 120, SetNpadJoyHoldType }, { 120, SetNpadJoyHoldType },
{ 121, GetNpadJoyHoldType }, { 121, GetNpadJoyHoldType },
@ -39,6 +44,8 @@ namespace Ryujinx.HLE.OsHle.Services.Hid
{ 203, CreateActiveVibrationDeviceList }, { 203, CreateActiveVibrationDeviceList },
{ 206, SendVibrationValues } { 206, SendVibrationValues }
}; };
NpadStyleSetUpdateEvent = new KEvent();
} }
public long CreateAppletResource(ServiceCtx Context) public long CreateAppletResource(ServiceCtx Context)
@ -104,6 +111,15 @@ namespace Ryujinx.HLE.OsHle.Services.Hid
return 0; 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) public long GetSupportedNpadStyleSet(ServiceCtx Context)
{ {
Context.ResponseData.Write(0); Context.ResponseData.Write(0);
@ -266,5 +282,18 @@ namespace Ryujinx.HLE.OsHle.Services.Hid
return 0; return 0;
} }
public void Dispose()
{
Dispose(true);
}
protected virtual void Dispose(bool Disposing)
{
if (Disposing)
{
NpadStyleSetUpdateEvent.Dispose();
}
}
} }
} }