aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Core/OsHle/Objects/Vi
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-02-25 01:34:16 -0300
committergdkchan <gab.dark.100@gmail.com>2018-02-25 01:34:27 -0300
commitfba0bf873257c4ac17f4584036661be08a1694d3 (patch)
treed1677d09fd008b2dcfa7560e979460b277f76411 /Ryujinx.Core/OsHle/Objects/Vi
parenta4ff0d34848416a68dff9f165bb90afae7a4fd20 (diff)
Refactor IPC services to have commands into separate classes, fix readme url
Diffstat (limited to 'Ryujinx.Core/OsHle/Objects/Vi')
-rw-r--r--Ryujinx.Core/OsHle/Objects/Vi/IApplicationDisplayService.cs176
-rw-r--r--Ryujinx.Core/OsHle/Objects/Vi/IHOSBinderDriver.cs76
-rw-r--r--Ryujinx.Core/OsHle/Objects/Vi/IManagerDisplayService.cs33
-rw-r--r--Ryujinx.Core/OsHle/Objects/Vi/ISystemDisplayService.cs25
4 files changed, 0 insertions, 310 deletions
diff --git a/Ryujinx.Core/OsHle/Objects/Vi/IApplicationDisplayService.cs b/Ryujinx.Core/OsHle/Objects/Vi/IApplicationDisplayService.cs
deleted file mode 100644
index b3ec0e90..00000000
--- a/Ryujinx.Core/OsHle/Objects/Vi/IApplicationDisplayService.cs
+++ /dev/null
@@ -1,176 +0,0 @@
-using ChocolArm64.Memory;
-using Ryujinx.Core.OsHle.Handles;
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-using System.IO;
-
-using static Ryujinx.Core.OsHle.Objects.Android.Parcel;
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
-
-namespace Ryujinx.Core.OsHle.Objects.Vi
-{
- class IApplicationDisplayService : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public IApplicationDisplayService()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 100, GetRelayService },
- { 101, GetSystemDisplayService },
- { 102, GetManagerDisplayService },
- { 103, GetIndirectDisplayTransactionService },
- { 1010, OpenDisplay },
- { 2020, OpenLayer },
- { 2030, CreateStrayLayer },
- { 2101, SetLayerScalingMode },
- { 5202, GetDisplayVSyncEvent }
- };
- }
-
- public long GetRelayService(ServiceCtx Context)
- {
- MakeObject(Context, new IHOSBinderDriver());
-
- return 0;
- }
-
- public long GetSystemDisplayService(ServiceCtx Context)
- {
- MakeObject(Context, new ISystemDisplayService());
-
- return 0;
- }
-
- public long GetManagerDisplayService(ServiceCtx Context)
- {
- MakeObject(Context, new IManagerDisplayService());
-
- return 0;
- }
-
- public long GetIndirectDisplayTransactionService(ServiceCtx Context)
- {
- MakeObject(Context, new IHOSBinderDriver());
-
- return 0;
- }
-
- public long OpenDisplay(ServiceCtx Context)
- {
- string Name = GetDisplayName(Context);
-
- long DisplayId = Context.Ns.Os.Displays.GenerateId(new Display(Name));
-
- Context.ResponseData.Write(DisplayId);
-
- return 0;
- }
-
- public long OpenLayer(ServiceCtx Context)
- {
- long LayerId = Context.RequestData.ReadInt64();
- long UserId = Context.RequestData.ReadInt64();
-
- long ParcelPtr = Context.Request.ReceiveBuff[0].Position;
-
- byte[] Parcel = MakeIGraphicsBufferProducer(ParcelPtr);
-
- AMemoryHelper.WriteBytes(Context.Memory, ParcelPtr, Parcel);
-
- Context.ResponseData.Write((long)Parcel.Length);
-
- return 0;
- }
-
- public long CreateStrayLayer(ServiceCtx Context)
- {
- long LayerFlags = Context.RequestData.ReadInt64();
- long DisplayId = Context.RequestData.ReadInt64();
-
- long ParcelPtr = Context.Request.ReceiveBuff[0].Position;
-
- Display Disp = Context.Ns.Os.Displays.GetData<Display>((int)DisplayId);
-
- byte[] Parcel = MakeIGraphicsBufferProducer(ParcelPtr);
-
- AMemoryHelper.WriteBytes(Context.Memory, ParcelPtr, Parcel);
-
- Context.ResponseData.Write(0L);
- Context.ResponseData.Write((long)Parcel.Length);
-
- return 0;
- }
-
- public long SetLayerScalingMode(ServiceCtx Context)
- {
- int ScalingMode = Context.RequestData.ReadInt32();
- long Unknown = Context.RequestData.ReadInt64();
-
- return 0;
- }
-
- public long GetDisplayVSyncEvent(ServiceCtx Context)
- {
- string Name = GetDisplayName(Context);
-
- int Handle = Context.Ns.Os.Handles.GenerateId(new HEvent());
-
- Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
-
- return 0;
- }
-
- private byte[] MakeIGraphicsBufferProducer(long BasePtr)
- {
- long Id = 0x20;
- long CookiePtr = 0L;
-
- using (MemoryStream MS = new MemoryStream())
- {
- BinaryWriter Writer = new BinaryWriter(MS);
-
- //flat_binder_object (size is 0x28)
- Writer.Write(2); //Type (BINDER_TYPE_WEAK_BINDER)
- Writer.Write(0); //Flags
- Writer.Write((int)(Id >> 0));
- Writer.Write((int)(Id >> 32));
- Writer.Write((int)(CookiePtr >> 0));
- Writer.Write((int)(CookiePtr >> 32));
- Writer.Write((byte)'d');
- Writer.Write((byte)'i');
- Writer.Write((byte)'s');
- Writer.Write((byte)'p');
- Writer.Write((byte)'d');
- Writer.Write((byte)'r');
- Writer.Write((byte)'v');
- Writer.Write((byte)'\0');
- Writer.Write(0L); //Pad
-
- return MakeParcel(MS.ToArray(), new byte[] { 0, 0, 0, 0 });
- }
- }
-
- private string GetDisplayName(ServiceCtx Context)
- {
- string Name = string.Empty;
-
- for (int Index = 0; Index < 8 &&
- Context.RequestData.BaseStream.Position <
- Context.RequestData.BaseStream.Length; Index++)
- {
- byte Chr = Context.RequestData.ReadByte();
-
- if (Chr >= 0x20 && Chr < 0x7f)
- {
- Name += (char)Chr;
- }
- }
-
- return Name;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Vi/IHOSBinderDriver.cs b/Ryujinx.Core/OsHle/Objects/Vi/IHOSBinderDriver.cs
deleted file mode 100644
index bbea3368..00000000
--- a/Ryujinx.Core/OsHle/Objects/Vi/IHOSBinderDriver.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using ChocolArm64.Memory;
-using Ryujinx.Core.OsHle.Ipc;
-using Ryujinx.Core.OsHle.Objects.Android;
-using System;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Vi
-{
- class IHOSBinderDriver : IIpcInterface, IDisposable
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- private NvFlinger Flinger;
-
- public IHOSBinderDriver()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 0, TransactParcel },
- { 1, AdjustRefcount },
- { 2, GetNativeHandle }
- };
-
- Flinger = new NvFlinger();
- }
-
- public long TransactParcel(ServiceCtx Context)
- {
- int Id = Context.RequestData.ReadInt32();
- int Code = Context.RequestData.ReadInt32();
-
- long DataPos = Context.Request.SendBuff[0].Position;
- long DataSize = Context.Request.SendBuff[0].Size;
-
- byte[] Data = AMemoryHelper.ReadBytes(Context.Memory, DataPos, (int)DataSize);
-
- Data = Parcel.GetParcelData(Data);
-
- return Flinger.ProcessParcelRequest(Context, Data, Code);
- }
-
- public long AdjustRefcount(ServiceCtx Context)
- {
- int Id = Context.RequestData.ReadInt32();
- int AddVal = Context.RequestData.ReadInt32();
- int Type = Context.RequestData.ReadInt32();
-
- return 0;
- }
-
- public long GetNativeHandle(ServiceCtx Context)
- {
- int Id = Context.RequestData.ReadInt32();
- uint Unk = Context.RequestData.ReadUInt32();
-
- Context.Response.HandleDesc = IpcHandleDesc.MakeMove(0xbadcafe);
-
- return 0;
- }
-
- public void Dispose()
- {
- Dispose(true);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- Flinger.Dispose();
- }
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Vi/IManagerDisplayService.cs b/Ryujinx.Core/OsHle/Objects/Vi/IManagerDisplayService.cs
deleted file mode 100644
index f1b3cdd0..00000000
--- a/Ryujinx.Core/OsHle/Objects/Vi/IManagerDisplayService.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Vi
-{
- class IManagerDisplayService : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public IManagerDisplayService()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 2010, CreateManagedLayer },
- { 6000, AddToLayerStack }
- };
- }
-
- public static long CreateManagedLayer(ServiceCtx Context)
- {
- Context.ResponseData.Write(0L); //LayerId
-
- return 0;
- }
-
- public static long AddToLayerStack(ServiceCtx Context)
- {
- return 0;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Vi/ISystemDisplayService.cs b/Ryujinx.Core/OsHle/Objects/Vi/ISystemDisplayService.cs
deleted file mode 100644
index 4c83c25f..00000000
--- a/Ryujinx.Core/OsHle/Objects/Vi/ISystemDisplayService.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Vi
-{
- class ISystemDisplayService : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public ISystemDisplayService()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 2205, SetLayerZ }
- };
- }
-
- public static long SetLayerZ(ServiceCtx Context)
- {
- return 0;
- }
- }
-} \ No newline at end of file