mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-27 08:55:47 +00:00
08831eecf7
* IPC refactor part 3 + 4: New server HIPC message processor with source generator based serialization * Make types match on calls to AlignUp/AlignDown * Formatting * Address some PR feedback * Move BitfieldExtensions to Ryujinx.Common.Utilities and consolidate implementations * Rename Reader/Writer to SpanReader/SpanWriter and move to Ryujinx.Common.Memory * Implement EventType * Address more PR feedback * Log request processing errors since they are not normal * Rename waitable to multiwait and add missing lock * PR feedback * Ac_K PR feedback
106 lines
No EOL
3.4 KiB
C#
106 lines
No EOL
3.4 KiB
C#
using Ryujinx.Common.Logging;
|
|
using Ryujinx.HLE.HOS.Ipc;
|
|
using Ryujinx.HLE.HOS.Kernel.Memory;
|
|
using Ryujinx.Horizon.Common;
|
|
using System;
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
|
|
{
|
|
class IDisplayController : IpcService
|
|
{
|
|
private KTransferMemory _transferMem;
|
|
private bool _lastApplicationCaptureBufferAcquired;
|
|
private bool _callerAppletCaptureBufferAcquired;
|
|
|
|
public IDisplayController(ServiceCtx context)
|
|
{
|
|
_transferMem = context.Device.System.AppletCaptureBufferTransfer;
|
|
}
|
|
|
|
[CommandHipc(8)] // 2.0.0+
|
|
// TakeScreenShotOfOwnLayer(b8, s32)
|
|
public ResultCode TakeScreenShotOfOwnLayer(ServiceCtx context)
|
|
{
|
|
bool unknown1 = context.RequestData.ReadBoolean();
|
|
int unknown2 = context.RequestData.ReadInt32();
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceAm, new { unknown1, unknown2 });
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[CommandHipc(11)]
|
|
// ReleaseLastApplicationCaptureBuffer()
|
|
public ResultCode ReleaseLastApplicationCaptureBuffer(ServiceCtx context)
|
|
{
|
|
if (!_lastApplicationCaptureBufferAcquired)
|
|
{
|
|
return ResultCode.BufferNotAcquired;
|
|
}
|
|
|
|
_lastApplicationCaptureBufferAcquired = false;
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[CommandHipc(15)]
|
|
// ReleaseCallerAppletCaptureBuffer()
|
|
public ResultCode ReleaseCallerAppletCaptureBuffer(ServiceCtx context)
|
|
{
|
|
if (!_callerAppletCaptureBufferAcquired)
|
|
{
|
|
return ResultCode.BufferNotAcquired;
|
|
}
|
|
|
|
_callerAppletCaptureBufferAcquired = false;
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[CommandHipc(16)]
|
|
// AcquireLastApplicationCaptureBufferEx() -> (b8, handle<copy>)
|
|
public ResultCode AcquireLastApplicationCaptureBufferEx(ServiceCtx context)
|
|
{
|
|
if (_lastApplicationCaptureBufferAcquired)
|
|
{
|
|
return ResultCode.BufferAlreadyAcquired;
|
|
}
|
|
|
|
if (context.Process.HandleTable.GenerateHandle(_transferMem, out int handle) != Result.Success)
|
|
{
|
|
throw new InvalidOperationException("Out of handles!");
|
|
}
|
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
|
|
|
|
_lastApplicationCaptureBufferAcquired = true;
|
|
|
|
context.ResponseData.Write(_lastApplicationCaptureBufferAcquired);
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[CommandHipc(18)]
|
|
// AcquireCallerAppletCaptureBufferEx() -> (b8, handle<copy>)
|
|
public ResultCode AcquireCallerAppletCaptureBufferEx(ServiceCtx context)
|
|
{
|
|
if (_callerAppletCaptureBufferAcquired)
|
|
{
|
|
return ResultCode.BufferAlreadyAcquired;
|
|
}
|
|
|
|
if (context.Process.HandleTable.GenerateHandle(_transferMem, out int handle) != Result.Success)
|
|
{
|
|
throw new InvalidOperationException("Out of handles!");
|
|
}
|
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
|
|
|
|
_callerAppletCaptureBufferAcquired = true;
|
|
|
|
context.ResponseData.Write(_callerAppletCaptureBufferAcquired);
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
}
|
|
} |