1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-11 23:02:02 +00:00
Ryujinx/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs

51 lines
1.4 KiB
C#
Raw Normal View History

using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel;
using System;
using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Am
{
class IHomeMenuFunctions : IpcService
{
2018-12-01 20:01:59 +00:00
private Dictionary<int, ServiceProcessRequest> _commands;
2018-12-01 20:01:59 +00:00
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
2018-12-01 20:01:59 +00:00
private KEvent _channelEvent;
2018-12-01 20:01:59 +00:00
public IHomeMenuFunctions(Horizon system)
{
2018-12-01 20:01:59 +00:00
_commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 10, RequestToGetForeground },
{ 21, GetPopFromGeneralChannelEvent }
};
//ToDo: Signal this Event somewhere in future.
2018-12-01 20:01:59 +00:00
_channelEvent = new KEvent(system);
}
2018-12-01 20:01:59 +00:00
public long RequestToGetForeground(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
2018-12-01 20:01:59 +00:00
public long GetPopFromGeneralChannelEvent(ServiceCtx context)
{
2018-12-01 20:01:59 +00:00
if (context.Process.HandleTable.GenerateHandle(_channelEvent.ReadableEvent, out int handle) != KernelResult.Success)
{
throw new InvalidOperationException("Out of handles!");
}
2018-12-01 20:01:59 +00:00
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
Logger.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
}
}