blob: 54aac48ae341d42a6bf37147ea200ebdc7021a5f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Kernel.Threading;
using System;
using System.Runtime.CompilerServices;
namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
{
interface IBinder
{
ResultCode AdjustRefcount(int addVal, int type);
void GetNativeHandle(uint typeId, out KReadableEvent readableEvent);
ResultCode OnTransact(uint code, uint flags, ReadOnlySpan<byte> inputParcel, Span<byte> outputParcel)
{
using Parcel inputParcelReader = new(inputParcel);
// TODO: support objects?
using Parcel outputParcelWriter = new((uint)(outputParcel.Length - Unsafe.SizeOf<ParcelHeader>()), 0);
string inputInterfaceToken = inputParcelReader.ReadInterfaceToken();
if (!InterfaceToken.Equals(inputInterfaceToken))
{
Logger.Error?.Print(LogClass.SurfaceFlinger, $"Invalid interface token {inputInterfaceToken} (expected: {InterfaceToken}");
return ResultCode.Success;
}
OnTransact(code, flags, inputParcelReader, outputParcelWriter);
outputParcelWriter.Finish().CopyTo(outputParcel);
return ResultCode.Success;
}
void OnTransact(uint code, uint flags, Parcel inputParcel, Parcel outputParcel);
string InterfaceToken { get; }
}
}
|