aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/IBinder.cs
diff options
context:
space:
mode:
authorTSR Berry <20988865+TSRBerry@users.noreply.github.com>2023-04-08 01:22:00 +0200
committerMary <thog@protonmail.com>2023-04-27 23:51:14 +0200
commitcee712105850ac3385cd0091a923438167433f9f (patch)
tree4a5274b21d8b7f938c0d0ce18736d3f2993b11b1 /src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/IBinder.cs
parentcd124bda587ef09668a971fa1cac1c3f0cfc9f21 (diff)
Move solution and projects to src
Diffstat (limited to 'src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/IBinder.cs')
-rw-r--r--src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/IBinder.cs41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/IBinder.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/IBinder.cs
new file mode 100644
index 00000000..9003201b
--- /dev/null
+++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/IBinder.cs
@@ -0,0 +1,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)
+ {
+ Parcel inputParcelReader = new Parcel(inputParcel.ToArray());
+
+ // TODO: support objects?
+ Parcel outputParcelWriter = new Parcel((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; }
+ }
+}