aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Core/OsHle/Objects
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
parenta4ff0d34848416a68dff9f165bb90afae7a4fd20 (diff)
Refactor IPC services to have commands into separate classes, fix readme url
Diffstat (limited to 'Ryujinx.Core/OsHle/Objects')
-rw-r--r--Ryujinx.Core/OsHle/Objects/Acc/IManagerForApplication.cs33
-rw-r--r--Ryujinx.Core/OsHle/Objects/Acc/IProfile.cs33
-rw-r--r--Ryujinx.Core/OsHle/Objects/Am/IApplicationFunctions.cs80
-rw-r--r--Ryujinx.Core/OsHle/Objects/Am/IApplicationProxy.cs85
-rw-r--r--Ryujinx.Core/OsHle/Objects/Am/IAudioController.cs20
-rw-r--r--Ryujinx.Core/OsHle/Objects/Am/ICommonStateGetter.cs74
-rw-r--r--Ryujinx.Core/OsHle/Objects/Am/IDebugFunctions.cs20
-rw-r--r--Ryujinx.Core/OsHle/Objects/Am/IDisplayController.cs20
-rw-r--r--Ryujinx.Core/OsHle/Objects/Am/ILibraryAppletCreator.cs20
-rw-r--r--Ryujinx.Core/OsHle/Objects/Am/IParentalControlService.cs20
-rw-r--r--Ryujinx.Core/OsHle/Objects/Am/ISelfController.cs61
-rw-r--r--Ryujinx.Core/OsHle/Objects/Am/IStorage.cs33
-rw-r--r--Ryujinx.Core/OsHle/Objects/Am/IStorageAccessor.cs62
-rw-r--r--Ryujinx.Core/OsHle/Objects/Am/IWindowController.cs33
-rw-r--r--Ryujinx.Core/OsHle/Objects/Android/GbpBuffer.cs60
-rw-r--r--Ryujinx.Core/OsHle/Objects/Android/NvFlinger.cs395
-rw-r--r--Ryujinx.Core/OsHle/Objects/Android/Parcel.cs58
-rw-r--r--Ryujinx.Core/OsHle/Objects/Apm/ISession.cs28
-rw-r--r--Ryujinx.Core/OsHle/Objects/Aud/IAudioOut.cs180
-rw-r--r--Ryujinx.Core/OsHle/Objects/Aud/IAudioRenderer.cs66
-rw-r--r--Ryujinx.Core/OsHle/Objects/ErrorCode.cs10
-rw-r--r--Ryujinx.Core/OsHle/Objects/ErrorModule.cs7
-rw-r--r--Ryujinx.Core/OsHle/Objects/Friend/IFriendService.cs20
-rw-r--r--Ryujinx.Core/OsHle/Objects/FspSrv/FsErr.cs9
-rw-r--r--Ryujinx.Core/OsHle/Objects/FspSrv/IDirectory.cs117
-rw-r--r--Ryujinx.Core/OsHle/Objects/FspSrv/IFile.cs111
-rw-r--r--Ryujinx.Core/OsHle/Objects/FspSrv/IFileSystem.cs383
-rw-r--r--Ryujinx.Core/OsHle/Objects/FspSrv/IStorage.cs52
-rw-r--r--Ryujinx.Core/OsHle/Objects/Hid/IActiveVibrationDeviceList.cs17
-rw-r--r--Ryujinx.Core/OsHle/Objects/Hid/IAppletResource.cs32
-rw-r--r--Ryujinx.Core/OsHle/Objects/IIpcInterface.cs10
-rw-r--r--Ryujinx.Core/OsHle/Objects/ObjHelper.cs24
-rw-r--r--Ryujinx.Core/OsHle/Objects/Time/ISteadyClock.cs20
-rw-r--r--Ryujinx.Core/OsHle/Objects/Time/ISystemClock.cs42
-rw-r--r--Ryujinx.Core/OsHle/Objects/Time/ITimeZoneService.cs20
-rw-r--r--Ryujinx.Core/OsHle/Objects/Time/SystemClockType.cs9
-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
40 files changed, 0 insertions, 2574 deletions
diff --git a/Ryujinx.Core/OsHle/Objects/Acc/IManagerForApplication.cs b/Ryujinx.Core/OsHle/Objects/Acc/IManagerForApplication.cs
deleted file mode 100644
index afbfab24..00000000
--- a/Ryujinx.Core/OsHle/Objects/Acc/IManagerForApplication.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Acc
-{
- class IManagerForApplication : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public IManagerForApplication()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 0, CheckAvailability },
- { 1, GetAccountId }
- };
- }
-
- public long CheckAvailability(ServiceCtx Context)
- {
- return 0;
- }
-
- public long GetAccountId(ServiceCtx Context)
- {
- Context.ResponseData.Write(0xcafeL);
-
- return 0;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Acc/IProfile.cs b/Ryujinx.Core/OsHle/Objects/Acc/IProfile.cs
deleted file mode 100644
index 94d17183..00000000
--- a/Ryujinx.Core/OsHle/Objects/Acc/IProfile.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Acc
-{
- class IProfile : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public IProfile()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 1, GetBase }
- };
- }
-
- public long GetBase(ServiceCtx Context)
- {
- Context.ResponseData.Write(0L);
- Context.ResponseData.Write(0L);
- Context.ResponseData.Write(0L);
- Context.ResponseData.Write(0L);
- Context.ResponseData.Write(0L);
- Context.ResponseData.Write(0L);
- Context.ResponseData.Write(0L);
-
- return 0;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Am/IApplicationFunctions.cs b/Ryujinx.Core/OsHle/Objects/Am/IApplicationFunctions.cs
deleted file mode 100644
index 939ad248..00000000
--- a/Ryujinx.Core/OsHle/Objects/Am/IApplicationFunctions.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-using System.IO;
-
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
-
-namespace Ryujinx.Core.OsHle.Objects.Am
-{
- class IApplicationFunctions : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public IApplicationFunctions()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 1, PopLaunchParameter },
- { 20, EnsureSaveData },
- { 21, GetDesiredLanguage },
- { 40, NotifyRunning }
- };
- }
-
- private const uint LaunchParamsMagic = 0xc79497ca;
-
- public long PopLaunchParameter(ServiceCtx Context)
- {
- //Only the first 0x18 bytes of the Data seems to be actually used.
- MakeObject(Context, new IStorage(MakeLaunchParams()));
-
- return 0;
- }
-
- public long EnsureSaveData(ServiceCtx Context)
- {
- long UIdLow = Context.RequestData.ReadInt64();
- long UIdHigh = Context.RequestData.ReadInt64();
-
- Context.ResponseData.Write(0L);
-
- return 0;
- }
-
- public long GetDesiredLanguage(ServiceCtx Context)
- {
- //This is an enumerator where each number is a differnet language.
- //0 is Japanese and 1 is English, need to figure out the other codes.
- Context.ResponseData.Write(1L);
-
- return 0;
- }
-
- public long NotifyRunning(ServiceCtx Context)
- {
- Context.ResponseData.Write(1);
-
- return 0;
- }
-
- private byte[] MakeLaunchParams()
- {
- //Size needs to be at least 0x88 bytes otherwise application errors.
- using (MemoryStream MS = new MemoryStream())
- {
- BinaryWriter Writer = new BinaryWriter(MS);
-
- MS.SetLength(0x88);
-
- Writer.Write(LaunchParamsMagic);
- Writer.Write(1); //IsAccountSelected? Only lower 8 bits actually used.
- Writer.Write(1L); //User Id Low (note: User Id needs to be != 0)
- Writer.Write(0L); //User Id High
-
- return MS.ToArray();
- }
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Am/IApplicationProxy.cs b/Ryujinx.Core/OsHle/Objects/Am/IApplicationProxy.cs
deleted file mode 100644
index 4a164daf..00000000
--- a/Ryujinx.Core/OsHle/Objects/Am/IApplicationProxy.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
-
-namespace Ryujinx.Core.OsHle.Objects.Am
-{
- class IApplicationProxy : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public IApplicationProxy()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 0, GetCommonStateGetter },
- { 1, GetSelfController },
- { 2, GetWindowController },
- { 3, GetAudioController },
- { 4, GetDisplayController },
- { 11, GetLibraryAppletCreator },
- { 20, GetApplicationFunctions },
- { 1000, GetDebugFunctions }
- };
- }
-
- public long GetCommonStateGetter(ServiceCtx Context)
- {
- MakeObject(Context, new ICommonStateGetter());
-
- return 0;
- }
-
- public long GetSelfController(ServiceCtx Context)
- {
- MakeObject(Context, new ISelfController());
-
- return 0;
- }
-
- public long GetWindowController(ServiceCtx Context)
- {
- MakeObject(Context, new IWindowController());
-
- return 0;
- }
-
- public long GetAudioController(ServiceCtx Context)
- {
- MakeObject(Context, new IAudioController());
-
- return 0;
- }
-
- public long GetDisplayController(ServiceCtx Context)
- {
- MakeObject(Context, new IDisplayController());
-
- return 0;
- }
-
- public long GetLibraryAppletCreator(ServiceCtx Context)
- {
- MakeObject(Context, new ILibraryAppletCreator());
-
- return 0;
- }
-
- public long GetApplicationFunctions(ServiceCtx Context)
- {
- MakeObject(Context, new IApplicationFunctions());
-
- return 0;
- }
-
- public long GetDebugFunctions(ServiceCtx Context)
- {
- MakeObject(Context, new IDebugFunctions());
-
- return 0;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Am/IAudioController.cs b/Ryujinx.Core/OsHle/Objects/Am/IAudioController.cs
deleted file mode 100644
index c37042fd..00000000
--- a/Ryujinx.Core/OsHle/Objects/Am/IAudioController.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Am
-{
- class IAudioController : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public IAudioController()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- //...
- };
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Am/ICommonStateGetter.cs b/Ryujinx.Core/OsHle/Objects/Am/ICommonStateGetter.cs
deleted file mode 100644
index 83d61fa6..00000000
--- a/Ryujinx.Core/OsHle/Objects/Am/ICommonStateGetter.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Am
-{
- class ICommonStateGetter : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public ICommonStateGetter()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 0, GetEventHandle },
- { 1, ReceiveMessage },
- { 5, GetOperationMode },
- { 6, GetPerformanceMode },
- { 9, GetCurrentFocusState },
- };
- }
-
- private enum FocusState
- {
- InFocus = 1,
- OutOfFocus = 2
- }
-
- private enum OperationMode
- {
- Handheld = 0,
- Docked = 1
- }
-
- public long GetEventHandle(ServiceCtx Context)
- {
- Context.ResponseData.Write(0L);
-
- return 0;
- }
-
- public long ReceiveMessage(ServiceCtx Context)
- {
- //Program expects 0xF at 0x17ae70 on puyo sdk,
- //otherwise runs on a infinite loop until it reads said value.
- //What it means is still unknown.
- Context.ResponseData.Write(0xfL);
-
- return 0; //0x680;
- }
-
- public long GetOperationMode(ServiceCtx Context)
- {
- Context.ResponseData.Write((byte)OperationMode.Handheld);
-
- return 0;
- }
-
- public long GetPerformanceMode(ServiceCtx Context)
- {
- Context.ResponseData.Write((byte)0);
-
- return 0;
- }
-
- public long GetCurrentFocusState(ServiceCtx Context)
- {
- Context.ResponseData.Write((byte)FocusState.InFocus);
-
- return 0;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Am/IDebugFunctions.cs b/Ryujinx.Core/OsHle/Objects/Am/IDebugFunctions.cs
deleted file mode 100644
index d04d8363..00000000
--- a/Ryujinx.Core/OsHle/Objects/Am/IDebugFunctions.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Am
-{
- class IDebugFunctions : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public IDebugFunctions()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- //...
- };
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Am/IDisplayController.cs b/Ryujinx.Core/OsHle/Objects/Am/IDisplayController.cs
deleted file mode 100644
index 9eafa70d..00000000
--- a/Ryujinx.Core/OsHle/Objects/Am/IDisplayController.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Am
-{
- class IDisplayController : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public IDisplayController()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- //...
- };
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Am/ILibraryAppletCreator.cs b/Ryujinx.Core/OsHle/Objects/Am/ILibraryAppletCreator.cs
deleted file mode 100644
index 10e0f4f4..00000000
--- a/Ryujinx.Core/OsHle/Objects/Am/ILibraryAppletCreator.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Am
-{
- class ILibraryAppletCreator : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public ILibraryAppletCreator()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- //...
- };
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Am/IParentalControlService.cs b/Ryujinx.Core/OsHle/Objects/Am/IParentalControlService.cs
deleted file mode 100644
index 1feacfa6..00000000
--- a/Ryujinx.Core/OsHle/Objects/Am/IParentalControlService.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Am
-{
- class IParentalControlService : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public IParentalControlService()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- //...
- };
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Am/ISelfController.cs b/Ryujinx.Core/OsHle/Objects/Am/ISelfController.cs
deleted file mode 100644
index 712874e8..00000000
--- a/Ryujinx.Core/OsHle/Objects/Am/ISelfController.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Am
-{
- class ISelfController : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public ISelfController()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 10, SetScreenShotPermission },
- { 11, SetOperationModeChangedNotification },
- { 12, SetPerformanceModeChangedNotification },
- { 13, SetFocusHandlingMode },
- { 16, SetOutOfFocusSuspendingEnabled }
- };
- }
-
- public long SetScreenShotPermission(ServiceCtx Context)
- {
- bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
-
- return 0;
- }
-
- public long SetOperationModeChangedNotification(ServiceCtx Context)
- {
- bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
-
- return 0;
- }
-
- public long SetPerformanceModeChangedNotification(ServiceCtx Context)
- {
- bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
-
- return 0;
- }
-
- public long SetFocusHandlingMode(ServiceCtx Context)
- {
- bool Flag1 = Context.RequestData.ReadByte() != 0 ? true : false;
- bool Flag2 = Context.RequestData.ReadByte() != 0 ? true : false;
- bool Flag3 = Context.RequestData.ReadByte() != 0 ? true : false;
-
- return 0;
- }
-
- public long SetOutOfFocusSuspendingEnabled(ServiceCtx Context)
- {
- bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
-
- return 0;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Am/IStorage.cs b/Ryujinx.Core/OsHle/Objects/Am/IStorage.cs
deleted file mode 100644
index b30059ba..00000000
--- a/Ryujinx.Core/OsHle/Objects/Am/IStorage.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
-
-namespace Ryujinx.Core.OsHle.Objects.Am
-{
- class IStorage : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public byte[] Data { get; private set; }
-
- public IStorage(byte[] Data)
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 0, Open }
- };
-
- this.Data = Data;
- }
-
- public long Open(ServiceCtx Context)
- {
- MakeObject(Context, new IStorageAccessor(this));
-
- return 0;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Am/IStorageAccessor.cs b/Ryujinx.Core/OsHle/Objects/Am/IStorageAccessor.cs
deleted file mode 100644
index df260cc3..00000000
--- a/Ryujinx.Core/OsHle/Objects/Am/IStorageAccessor.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-using ChocolArm64.Memory;
-using Ryujinx.Core.OsHle.Ipc;
-using System;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Am
-{
- class IStorageAccessor : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- private IStorage Storage;
-
- public IStorageAccessor(IStorage Storage)
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 0, GetSize },
- { 11, Read }
- };
-
- this.Storage = Storage;
- }
-
- public long GetSize(ServiceCtx Context)
- {
- Context.ResponseData.Write((long)Storage.Data.Length);
-
- return 0;
- }
-
- public long Read(ServiceCtx Context)
- {
- long ReadPosition = Context.RequestData.ReadInt64();
-
- if (Context.Request.RecvListBuff.Count > 0)
- {
- long Position = Context.Request.RecvListBuff[0].Position;
- short Size = Context.Request.RecvListBuff[0].Size;
-
- byte[] Data;
-
- if (Storage.Data.Length > Size)
- {
- Data = new byte[Size];
-
- Buffer.BlockCopy(Storage.Data, 0, Data, 0, Size);
- }
- else
- {
- Data = Storage.Data;
- }
-
- AMemoryHelper.WriteBytes(Context.Memory, Position, Data);
- }
-
- return 0;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Am/IWindowController.cs b/Ryujinx.Core/OsHle/Objects/Am/IWindowController.cs
deleted file mode 100644
index aa6e961e..00000000
--- a/Ryujinx.Core/OsHle/Objects/Am/IWindowController.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Am
-{
- class IWindowController : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public IWindowController()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 1, GetAppletResourceUserId },
- { 10, AcquireForegroundRights }
- };
- }
-
- public long GetAppletResourceUserId(ServiceCtx Context)
- {
- Context.ResponseData.Write(0L);
-
- return 0;
- }
-
- public long AcquireForegroundRights(ServiceCtx Context)
- {
- return 0;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Android/GbpBuffer.cs b/Ryujinx.Core/OsHle/Objects/Android/GbpBuffer.cs
deleted file mode 100644
index edd11523..00000000
--- a/Ryujinx.Core/OsHle/Objects/Android/GbpBuffer.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-using System.IO;
-
-namespace Ryujinx.Core.OsHle.Objects.Android
-{
- struct GbpBuffer
- {
- public int Magic { get; private set; }
- public int Width { get; private set; }
- public int Height { get; private set; }
- public int Stride { get; private set; }
- public int Format { get; private set; }
- public int Usage { get; private set; }
-
- public int Pid { get; private set; }
- public int RefCount { get; private set; }
-
- public int FdsCount { get; private set; }
- public int IntsCount { get; private set; }
-
- public byte[] RawData { get; private set; }
-
- public int Size => RawData.Length + 10 * 4;
-
- public GbpBuffer(BinaryReader Reader)
- {
- Magic = Reader.ReadInt32();
- Width = Reader.ReadInt32();
- Height = Reader.ReadInt32();
- Stride = Reader.ReadInt32();
- Format = Reader.ReadInt32();
- Usage = Reader.ReadInt32();
-
- Pid = Reader.ReadInt32();
- RefCount = Reader.ReadInt32();
-
- FdsCount = Reader.ReadInt32();
- IntsCount = Reader.ReadInt32();
-
- RawData = Reader.ReadBytes((FdsCount + IntsCount) * 4);
- }
-
- public void Write(BinaryWriter Writer)
- {
- Writer.Write(Magic);
- Writer.Write(Width);
- Writer.Write(Height);
- Writer.Write(Stride);
- Writer.Write(Format);
- Writer.Write(Usage);
-
- Writer.Write(Pid);
- Writer.Write(RefCount);
-
- Writer.Write(FdsCount);
- Writer.Write(IntsCount);
-
- Writer.Write(RawData);
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Android/NvFlinger.cs b/Ryujinx.Core/OsHle/Objects/Android/NvFlinger.cs
deleted file mode 100644
index 11069cb2..00000000
--- a/Ryujinx.Core/OsHle/Objects/Android/NvFlinger.cs
+++ /dev/null
@@ -1,395 +0,0 @@
-using ChocolArm64.Memory;
-using Ryujinx.Core.OsHle.Handles;
-using System;
-using System.IO;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading;
-
-using static Ryujinx.Core.OsHle.Objects.Android.Parcel;
-
-namespace Ryujinx.Core.OsHle.Objects.Android
-{
- class NvFlinger : IDisposable
- {
- private delegate long ServiceProcessParcel(ServiceCtx Context, BinaryReader ParcelReader);
-
- private Dictionary<(string, int), ServiceProcessParcel> Commands;
-
- private const int BufferQueueCount = 0x40;
- private const int BufferQueueMask = BufferQueueCount - 1;
-
- [Flags]
- private enum HalTransform
- {
- FlipX = 1 << 0,
- FlipY = 1 << 1,
- Rotate90 = 1 << 2
- }
-
- private enum BufferState
- {
- Free,
- Dequeued,
- Queued,
- Acquired
- }
-
- private struct BufferEntry
- {
- public BufferState State;
-
- public HalTransform Transform;
-
- public GbpBuffer Data;
- }
-
- private BufferEntry[] BufferQueue;
-
- private ManualResetEvent WaitBufferFree;
-
- private bool KeepRunning;
-
- public NvFlinger()
- {
- Commands = new Dictionary<(string, int), ServiceProcessParcel>()
- {
- { ("android.gui.IGraphicBufferProducer", 0x1), GbpRequestBuffer },
- { ("android.gui.IGraphicBufferProducer", 0x3), GbpDequeueBuffer },
- { ("android.gui.IGraphicBufferProducer", 0x7), GbpQueueBuffer },
- { ("android.gui.IGraphicBufferProducer", 0x8), GbpCancelBuffer },
- { ("android.gui.IGraphicBufferProducer", 0x9), GbpQuery },
- { ("android.gui.IGraphicBufferProducer", 0xa), GbpConnect },
- { ("android.gui.IGraphicBufferProducer", 0xe), GbpPreallocBuffer }
- };
-
- BufferQueue = new BufferEntry[0x40];
-
- WaitBufferFree = new ManualResetEvent(false);
-
- KeepRunning = true;
- }
-
- public long ProcessParcelRequest(ServiceCtx Context, byte[] ParcelData, int Code)
- {
- using (MemoryStream MS = new MemoryStream(ParcelData))
- {
- BinaryReader Reader = new BinaryReader(MS);
-
- MS.Seek(4, SeekOrigin.Current);
-
- int StrSize = Reader.ReadInt32();
-
- string InterfaceName = Encoding.Unicode.GetString(Reader.ReadBytes(StrSize * 2));
-
- long Remainder = MS.Position & 0xf;
-
- if (Remainder != 0)
- {
- MS.Seek(0x10 - Remainder, SeekOrigin.Current);
- }
-
- MS.Seek(0x50, SeekOrigin.Begin);
-
- if (Commands.TryGetValue((InterfaceName, Code), out ServiceProcessParcel ProcReq))
- {
- Logging.Debug($"{InterfaceName} {ProcReq.Method.Name}");
-
- return ProcReq(Context, Reader);
- }
- else
- {
- throw new NotImplementedException($"{InterfaceName} {Code}");
- }
- }
- }
-
- private long GbpRequestBuffer(ServiceCtx Context, BinaryReader ParcelReader)
- {
- int Slot = ParcelReader.ReadInt32();
-
- using (MemoryStream MS = new MemoryStream())
- {
- BinaryWriter Writer = new BinaryWriter(MS);
-
- BufferEntry Entry = BufferQueue[Slot];
-
- int BufferCount = 1; //?
- long BufferSize = Entry.Data.Size;
-
- Writer.Write(BufferCount);
- Writer.Write(BufferSize);
-
- Entry.Data.Write(Writer);
-
- Writer.Write(0);
-
- return MakeReplyParcel(Context, MS.ToArray());
- }
- }
-
- private long GbpDequeueBuffer(ServiceCtx Context, BinaryReader ParcelReader)
- {
- //TODO: Errors.
- int Format = ParcelReader.ReadInt32();
- int Width = ParcelReader.ReadInt32();
- int Height = ParcelReader.ReadInt32();
- int GetTimestamps = ParcelReader.ReadInt32();
- int Usage = ParcelReader.ReadInt32();
-
- int Slot = GetFreeSlotBlocking(Width, Height);
-
- return MakeReplyParcel(Context, Slot, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
- }
-
- private long GbpQueueBuffer(ServiceCtx Context, BinaryReader ParcelReader)
- {
- //TODO: Errors.
- int Slot = ParcelReader.ReadInt32();
- int Unknown4 = ParcelReader.ReadInt32();
- int Unknown8 = ParcelReader.ReadInt32();
- int Unknownc = ParcelReader.ReadInt32();
- int Timestamp = ParcelReader.ReadInt32();
- int IsAutoTimestamp = ParcelReader.ReadInt32();
- int CropTop = ParcelReader.ReadInt32();
- int CropLeft = ParcelReader.ReadInt32();
- int CropRight = ParcelReader.ReadInt32();
- int CropBottom = ParcelReader.ReadInt32();
- int ScalingMode = ParcelReader.ReadInt32();
- int Transform = ParcelReader.ReadInt32();
- int StickyTransform = ParcelReader.ReadInt32();
- int Unknown34 = ParcelReader.ReadInt32();
- int Unknown38 = ParcelReader.ReadInt32();
- int IsFenceValid = ParcelReader.ReadInt32();
- int Fence0Id = ParcelReader.ReadInt32();
- int Fence0Value = ParcelReader.ReadInt32();
- int Fence1Id = ParcelReader.ReadInt32();
- int Fence1Value = ParcelReader.ReadInt32();
-
- BufferQueue[Slot].Transform = (HalTransform)Transform;
-
- BufferQueue[Slot].State = BufferState.Queued;
-
- SendFrameBuffer(Context, Slot);
-
- return MakeReplyParcel(Context, 1280, 720, 0, 0, 0);
- }
-
- private long GbpCancelBuffer(ServiceCtx Context, BinaryReader ParcelReader)
- {
- //TODO: Errors.
- int Slot = ParcelReader.ReadInt32();
-
- BufferQueue[Slot].State = BufferState.Free;
-
- return MakeReplyParcel(Context, 0);
- }
-
- private long GbpQuery(ServiceCtx Context, BinaryReader ParcelReader)
- {
- return MakeReplyParcel(Context, 0, 0);
- }
-
- private long GbpConnect(ServiceCtx Context, BinaryReader ParcelReader)
- {
- return MakeReplyParcel(Context, 1280, 720, 0, 0, 0);
- }
-
- private long GbpPreallocBuffer(ServiceCtx Context, BinaryReader ParcelReader)
- {
- int Slot = ParcelReader.ReadInt32();
-
- int BufferCount = ParcelReader.ReadInt32();
- long BufferSize = ParcelReader.ReadInt64();
-
- BufferQueue[Slot].State = BufferState.Free;
-
- BufferQueue[Slot].Data = new GbpBuffer(ParcelReader);
-
- return MakeReplyParcel(Context, 0);
- }
-
- private long MakeReplyParcel(ServiceCtx Context, params int[] Ints)
- {
- using (MemoryStream MS = new MemoryStream())
- {
- BinaryWriter Writer = new BinaryWriter(MS);
-
- foreach (int Int in Ints)
- {
- Writer.Write(Int);
- }
-
- return MakeReplyParcel(Context, MS.ToArray());
- }
- }
-
- private long MakeReplyParcel(ServiceCtx Context, byte[] Data)
- {
- long ReplyPos = Context.Request.ReceiveBuff[0].Position;
- long ReplySize = Context.Request.ReceiveBuff[0].Size;
-
- byte[] Reply = MakeParcel(Data, new byte[0]);
-
- AMemoryHelper.WriteBytes(Context.Memory, ReplyPos, Reply);
-
- return 0;
- }
-
- private unsafe void SendFrameBuffer(ServiceCtx Context, int Slot)
- {
- int FbWidth = BufferQueue[Slot].Data.Width;
- int FbHeight = BufferQueue[Slot].Data.Height;
-
- int FbSize = FbWidth * FbHeight * 4;
-
- HNvMap NvMap = GetNvMap(Context, Slot);
-
- if (FbSize < 0 || NvMap.Address < 0 || NvMap.Address + FbSize > AMemoryMgr.AddrSize)
- {
- Logging.Error($"Frame buffer address {NvMap.Address:x16} is invalid!");
-
- BufferQueue[Slot].State = BufferState.Free;
-
- WaitBufferFree.Set();
-
- return;
- }
-
- BufferQueue[Slot].State = BufferState.Acquired;
-
- float ScaleX = 1;
- float ScaleY = 1;
- float Rotate = 0;
-
- if (BufferQueue[Slot].Transform.HasFlag(HalTransform.FlipX))
- {
- ScaleX = -1;
- }
-
- if (BufferQueue[Slot].Transform.HasFlag(HalTransform.FlipY))
- {
- ScaleY = -1;
- }
-
- if (BufferQueue[Slot].Transform.HasFlag(HalTransform.Rotate90))
- {
- Rotate = MathF.PI * 0.5f;
- }
-
- byte* Fb = (byte*)Context.Ns.Ram + NvMap.Address;
-
- Context.Ns.Gpu.Renderer.QueueAction(delegate()
- {
- Context.Ns.Gpu.Renderer.SetFrameBuffer(
- Fb,
- FbWidth,
- FbHeight,
- ScaleX,
- ScaleY,
- Rotate);
-
- BufferQueue[Slot].State = BufferState.Free;
-
- lock (WaitBufferFree)
- {
- WaitBufferFree.Set();
- }
- });
- }
-
- private HNvMap GetNvMap(ServiceCtx Context, int Slot)
- {
- int NvMapHandle = BitConverter.ToInt32(BufferQueue[Slot].Data.RawData, 0x4c);
-
- if (!BitConverter.IsLittleEndian)
- {
- byte[] RawValue = BitConverter.GetBytes(NvMapHandle);
-
- Array.Reverse(RawValue);
-
- NvMapHandle = BitConverter.ToInt32(RawValue, 0);
- }
-
- return Context.Ns.Os.Handles.GetData<HNvMap>(NvMapHandle);
- }
-
- private int GetFreeSlotBlocking(int Width, int Height)
- {
- int Slot;
-
- do
- {
- lock (WaitBufferFree)
- {
- if ((Slot = GetFreeSlot(Width, Height)) != -1)
- {
- break;
- }
-
- Logging.Debug("Waiting for a free BufferQueue slot...");
-
- if (!KeepRunning)
- {
- break;
- }
-
- WaitBufferFree.Reset();
- }
-
- WaitBufferFree.WaitOne();
- }
- while (KeepRunning);
-
- Logging.Debug($"Found free BufferQueue slot {Slot}!");
-
- return Slot;
- }
-
- private int GetFreeSlot(int Width, int Height)
- {
- lock (BufferQueue)
- {
- for (int Slot = 0; Slot < BufferQueue.Length; Slot++)
- {
- if (BufferQueue[Slot].State != BufferState.Free)
- {
- continue;
- }
-
- GbpBuffer Data = BufferQueue[Slot].Data;
-
- if (Data.Width == Width &&
- Data.Height == Height)
- {
- BufferQueue[Slot].State = BufferState.Dequeued;
-
- return Slot;
- }
- }
- }
-
- return -1;
- }
-
- public void Dispose()
- {
- Dispose(true);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- lock (WaitBufferFree)
- {
- KeepRunning = false;
-
- WaitBufferFree.Set();
- }
-
- WaitBufferFree.Dispose();
- }
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Android/Parcel.cs b/Ryujinx.Core/OsHle/Objects/Android/Parcel.cs
deleted file mode 100644
index cd7179e1..00000000
--- a/Ryujinx.Core/OsHle/Objects/Android/Parcel.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System;
-using System.IO;
-
-namespace Ryujinx.Core.OsHle.Objects.Android
-{
- static class Parcel
- {
- public static byte[] GetParcelData(byte[] Parcel)
- {
- if (Parcel == null)
- {
- throw new ArgumentNullException(nameof(Parcel));
- }
-
- using (MemoryStream MS = new MemoryStream(Parcel))
- {
- BinaryReader Reader = new BinaryReader(MS);
-
- int DataSize = Reader.ReadInt32();
- int DataOffset = Reader.ReadInt32();
- int ObjsSize = Reader.ReadInt32();
- int ObjsOffset = Reader.ReadInt32();
-
- MS.Seek(DataOffset - 0x10, SeekOrigin.Current);
-
- return Reader.ReadBytes(DataSize);
- }
- }
-
- public static byte[] MakeParcel(byte[] Data, byte[] Objs)
- {
- if (Data == null)
- {
- throw new ArgumentNullException(nameof(Data));
- }
-
- if (Objs == null)
- {
- throw new ArgumentNullException(nameof(Objs));
- }
-
- using (MemoryStream MS = new MemoryStream())
- {
- BinaryWriter Writer = new BinaryWriter(MS);
-
- Writer.Write(Data.Length);
- Writer.Write(0x10);
- Writer.Write(Objs.Length);
- Writer.Write(Data.Length + 0x10);
-
- Writer.Write(Data);
- Writer.Write(Objs);
-
- return MS.ToArray();
- }
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Apm/ISession.cs b/Ryujinx.Core/OsHle/Objects/Apm/ISession.cs
deleted file mode 100644
index 3ab33005..00000000
--- a/Ryujinx.Core/OsHle/Objects/Apm/ISession.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Apm
-{
- class ISession : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public ISession()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 0, SetPerformanceConfiguration }
- };
- }
-
- public long SetPerformanceConfiguration(ServiceCtx Context)
- {
- int PerfMode = Context.RequestData.ReadInt32();
- int PerfConfig = Context.RequestData.ReadInt32();
-
- return 0;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Aud/IAudioOut.cs b/Ryujinx.Core/OsHle/Objects/Aud/IAudioOut.cs
deleted file mode 100644
index 061c6376..00000000
--- a/Ryujinx.Core/OsHle/Objects/Aud/IAudioOut.cs
+++ /dev/null
@@ -1,180 +0,0 @@
-using ChocolArm64.Memory;
-using Ryujinx.Core.OsHle.Handles;
-using Ryujinx.Core.OsHle.Ipc;
-using OpenTK.Audio;
-using OpenTK.Audio.OpenAL;
-using System;
-using System.Collections.Generic;
-using System.IO;
-
-namespace Ryujinx.Core.OsHle.Objects.Aud
-{
- class IAudioOut : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public IAudioOut()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 0, GetAudioOutState },
- { 1, StartAudioOut },
- { 2, StopAudioOut },
- { 3, AppendAudioOutBuffer },
- { 4, RegisterBufferEvent },
- { 5, GetReleasedAudioOutBuffer },
- { 6, ContainsAudioOutBuffer },
- { 7, AppendAudioOutBuffer_ex },
- { 8, GetReleasedAudioOutBuffer_ex }
- };
- }
-
- enum AudioOutState
- {
- Started,
- Stopped
- };
-
- //IAudioOut
- private AudioOutState State = AudioOutState.Stopped;
- private Queue<long> KeysQueue = new Queue<long>();
-
- //OpenAL
- private bool OpenALInstalled = true;
- private AudioContext AudioCtx;
- private int Source;
- private int Buffer;
-
- //Return State of IAudioOut
- public long GetAudioOutState(ServiceCtx Context)
- {
- Context.ResponseData.Write((int)State);
-
- return 0;
- }
-
- public long StartAudioOut(ServiceCtx Context)
- {
- if (State == AudioOutState.Stopped)
- {
- State = AudioOutState.Started;
-
- try
- {
- AudioCtx = new AudioContext(); //Create the audio context
- }
- catch (Exception)
- {
- Logging.Warn("OpenAL Error! PS: Install OpenAL Core SDK!");
- OpenALInstalled = false;
- }
-
- if (OpenALInstalled) AL.Listener(ALListenerf.Gain, (float)8.0); //Add more gain to it
- }
-
- return 0;
- }
-
- public long StopAudioOut(ServiceCtx Context)
- {
- if (State == AudioOutState.Started)
- {
- if (OpenALInstalled)
- {
- if (AudioCtx == null) //Needed to call the instance of AudioContext()
- return 0;
-
- AL.SourceStop(Source);
- AL.DeleteSource(Source);
- }
- State = AudioOutState.Stopped;
- }
-
- return 0;
- }
-
- public long AppendAudioOutBuffer(ServiceCtx Context)
- {
- long BufferId = Context.RequestData.ReadInt64();
-
- KeysQueue.Enqueue(BufferId);
-
- byte[] AudioOutBuffer = AMemoryHelper.ReadBytes(Context.Memory, Context.Request.SendBuff[0].Position, sizeof(long) * 5);
- using (MemoryStream MS = new MemoryStream(AudioOutBuffer))
- {
- BinaryReader Reader = new BinaryReader(MS);
- long PointerNextBuffer = Reader.ReadInt64();
- long PointerSampleBuffer = Reader.ReadInt64();
- long CapacitySampleBuffer = Reader.ReadInt64();
- long SizeDataInSampleBuffer = Reader.ReadInt64();
- long OffsetDataInSampleBuffer = Reader.ReadInt64();
-
- byte[] AudioSampleBuffer = AMemoryHelper.ReadBytes(Context.Memory, PointerSampleBuffer + OffsetDataInSampleBuffer, (int)SizeDataInSampleBuffer);
-
- if (OpenALInstalled)
- {
- if (AudioCtx == null) //Needed to call the instance of AudioContext()
- return 0;
-
- Buffer = AL.GenBuffer();
- AL.BufferData(Buffer, ALFormat.Stereo16, AudioSampleBuffer, AudioSampleBuffer.Length, 48000);
-
- Source = AL.GenSource();
- AL.SourceQueueBuffer(Source, Buffer);
- }
- }
-
- return 0;
- }
-
- public long RegisterBufferEvent(ServiceCtx Context)
- {
- int Handle = Context.Ns.Os.Handles.GenerateId(new HEvent());
-
- Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
-
- return 0;
- }
-
- public long GetReleasedAudioOutBuffer(ServiceCtx Context)
- {
- long TempKey = 0;
-
- if (KeysQueue.Count > 0) TempKey = KeysQueue.Dequeue();
-
- AMemoryHelper.WriteBytes(Context.Memory, Context.Request.ReceiveBuff[0].Position, BitConverter.GetBytes(TempKey));
-
- int ReleasedBuffersCount = 1;
- Context.ResponseData.Write(ReleasedBuffersCount);
-
- if (OpenALInstalled)
- {
- if (AudioCtx == null) //Needed to call the instance of AudioContext()
- return 0;
-
- AL.SourcePlay(Source);
- int[] FreeBuffers = AL.SourceUnqueueBuffers(Source, 1);
- AL.DeleteBuffers(FreeBuffers);
- }
-
- return 0;
- }
-
- public long ContainsAudioOutBuffer(ServiceCtx Context)
- {
- return 0;
- }
-
- public long AppendAudioOutBuffer_ex(ServiceCtx Context)
- {
- return 0;
- }
-
- public long GetReleasedAudioOutBuffer_ex(ServiceCtx Context)
- {
- return 0;
- }
- }
-}
diff --git a/Ryujinx.Core/OsHle/Objects/Aud/IAudioRenderer.cs b/Ryujinx.Core/OsHle/Objects/Aud/IAudioRenderer.cs
deleted file mode 100644
index 05356477..00000000
--- a/Ryujinx.Core/OsHle/Objects/Aud/IAudioRenderer.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-using Ryujinx.Core.OsHle.Handles;
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Aud
-{
- class IAudioRenderer : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public IAudioRenderer()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 4, RequestUpdateAudioRenderer },
- { 5, StartAudioRenderer },
- { 6, StopAudioRenderer },
- { 7, QuerySystemEvent }
- };
- }
-
- public long RequestUpdateAudioRenderer(ServiceCtx Context)
- {
- //(buffer<unknown, 5, 0>) -> (buffer<unknown, 6, 0>, buffer<unknown, 6, 0>)
-
- long Position = Context.Request.ReceiveBuff[0].Position;
-
- //0x40 bytes header
- Context.Memory.WriteInt32(Position + 0x4, 0xb0); //Behavior Out State Size? (note: this is the last section)
- Context.Memory.WriteInt32(Position + 0x8, 0x18e0); //Memory Pool Out State Size?
- Context.Memory.WriteInt32(Position + 0xc, 0x600); //Voice Out State Size?
- Context.Memory.WriteInt32(Position + 0x14, 0xe0); //Effect Out State Size?
- Context.Memory.WriteInt32(Position + 0x1c, 0x20); //Sink Out State Size?
- Context.Memory.WriteInt32(Position + 0x20, 0x10); //Performance Out State Size?
- Context.Memory.WriteInt32(Position + 0x3c, 0x20e0); //Total Size (including 0x40 bytes header)
-
- for (int Offset = 0x40; Offset < 0x40 + 0x18e0; Offset += 0x10)
- {
- Context.Memory.WriteInt32(Position + Offset, 5);
- }
-
- return 0;
- }
-
- public long StartAudioRenderer(ServiceCtx Context)
- {
- return 0;
- }
-
- public long StopAudioRenderer(ServiceCtx Context)
- {
- return 0;
- }
-
- public long QuerySystemEvent(ServiceCtx Context)
- {
- int Handle = Context.Ns.Os.Handles.GenerateId(new HEvent());
-
- Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
-
- return 0;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/ErrorCode.cs b/Ryujinx.Core/OsHle/Objects/ErrorCode.cs
deleted file mode 100644
index 659ed8b9..00000000
--- a/Ryujinx.Core/OsHle/Objects/ErrorCode.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace Ryujinx.Core.OsHle.Objects
-{
- static class ErrorCode
- {
- public static long MakeError(ErrorModule Module, int Code)
- {
- return (int)Module | (Code << 9);
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/ErrorModule.cs b/Ryujinx.Core/OsHle/Objects/ErrorModule.cs
deleted file mode 100644
index 0221031b..00000000
--- a/Ryujinx.Core/OsHle/Objects/ErrorModule.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Ryujinx.Core.OsHle.Objects
-{
- enum ErrorModule
- {
- Fs = 2,
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Friend/IFriendService.cs b/Ryujinx.Core/OsHle/Objects/Friend/IFriendService.cs
deleted file mode 100644
index e98e27ca..00000000
--- a/Ryujinx.Core/OsHle/Objects/Friend/IFriendService.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Friend
-{
- class IFriendService : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public IFriendService()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- //...
- };
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/FspSrv/FsErr.cs b/Ryujinx.Core/OsHle/Objects/FspSrv/FsErr.cs
deleted file mode 100644
index d9aa60ae..00000000
--- a/Ryujinx.Core/OsHle/Objects/FspSrv/FsErr.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace Ryujinx.Core.OsHle.Objects.FspSrv
-{
- static class FsErr
- {
- public const int PathDoesNotExist = 1;
- public const int PathAlreadyExists = 2;
- public const int PathAlreadyInUse = 7;
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/FspSrv/IDirectory.cs b/Ryujinx.Core/OsHle/Objects/FspSrv/IDirectory.cs
deleted file mode 100644
index 785b1ba3..00000000
--- a/Ryujinx.Core/OsHle/Objects/FspSrv/IDirectory.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-using ChocolArm64.Memory;
-using Ryujinx.Core.OsHle.Ipc;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-
-namespace Ryujinx.Core.OsHle.Objects.FspSrv
-{
- class IDirectory : IIpcInterface, IDisposable
- {
- private const int DirectoryEntrySize = 0x310;
-
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- private List<string> DirectoryEntries;
-
- private int CurrentItemIndex;
-
- public event EventHandler<EventArgs> Disposed;
-
- public string HostPath { get; private set; }
-
- public IDirectory(string HostPath, int Flags)
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 0, Read },
- { 1, GetEntryCount }
- };
-
- this.HostPath = HostPath;
-
- DirectoryEntries = new List<string>();
-
- if ((Flags & 1) != 0)
- {
- DirectoryEntries.AddRange(Directory.GetDirectories(HostPath));
- }
-
- if ((Flags & 2) != 0)
- {
- DirectoryEntries.AddRange(Directory.GetFiles(HostPath));
- }
-
- CurrentItemIndex = 0;
- }
-
- public long Read(ServiceCtx Context)
- {
- long BufferPosition = Context.Request.ReceiveBuff[0].Position;
- long BufferLen = Context.Request.ReceiveBuff[0].Size;
-
- int MaxReadCount = (int)(BufferLen / DirectoryEntrySize);
-
- int Count = Math.Min(DirectoryEntries.Count - CurrentItemIndex, MaxReadCount);
-
- for (int Index = 0; Index < Count; Index++)
- {
- long Position = BufferPosition + Index * DirectoryEntrySize;
-
- WriteDirectoryEntry(Context, Position, DirectoryEntries[CurrentItemIndex++]);
- }
-
- Context.ResponseData.Write((long)Count);
-
- return 0;
- }
-
- private void WriteDirectoryEntry(ServiceCtx Context, long Position, string FullPath)
- {
- for (int Offset = 0; Offset < 0x300; Offset += 8)
- {
- Context.Memory.WriteInt64(Position + Offset, 0);
- }
-
- byte[] NameBuffer = Encoding.UTF8.GetBytes(Path.GetFileName(FullPath));
-
- AMemoryHelper.WriteBytes(Context.Memory, Position, NameBuffer);
-
- int Type = 0;
- long Size = 0;
-
- if (File.Exists(FullPath))
- {
- Type = 1;
- Size = new FileInfo(FullPath).Length;
- }
-
- Context.Memory.WriteInt32(Position + 0x300, 0); //Padding?
- Context.Memory.WriteInt32(Position + 0x304, Type);
- Context.Memory.WriteInt64(Position + 0x308, Size);
- }
-
- public long GetEntryCount(ServiceCtx Context)
- {
- Context.ResponseData.Write((long)DirectoryEntries.Count);
-
- return 0;
- }
-
- public void Dispose()
- {
- Dispose(true);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- Disposed?.Invoke(this, EventArgs.Empty);
- }
- }
- }
-}
diff --git a/Ryujinx.Core/OsHle/Objects/FspSrv/IFile.cs b/Ryujinx.Core/OsHle/Objects/FspSrv/IFile.cs
deleted file mode 100644
index 82706f60..00000000
--- a/Ryujinx.Core/OsHle/Objects/FspSrv/IFile.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-using ChocolArm64.Memory;
-using Ryujinx.Core.OsHle.Ipc;
-using System;
-using System.Collections.Generic;
-using System.IO;
-
-namespace Ryujinx.Core.OsHle.Objects.FspSrv
-{
- class IFile : IIpcInterface, IDisposable
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- private Stream BaseStream;
-
- public event EventHandler<EventArgs> Disposed;
-
- public string HostPath { get; private set; }
-
- public IFile(Stream BaseStream, string HostPath)
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 0, Read },
- { 1, Write },
- { 2, Flush },
- { 3, SetSize },
- { 4, GetSize }
- };
-
- this.BaseStream = BaseStream;
- this.HostPath = HostPath;
- }
-
- public long Read(ServiceCtx Context)
- {
- long Position = Context.Request.ReceiveBuff[0].Position;
-
- long Zero = Context.RequestData.ReadInt64();
- long Offset = Context.RequestData.ReadInt64();
- long Size = Context.RequestData.ReadInt64();
-
- byte[] Data = new byte[Size];
-
- BaseStream.Seek(Offset, SeekOrigin.Begin);
-
- int ReadSize = BaseStream.Read(Data, 0, (int)Size);
-
- AMemoryHelper.WriteBytes(Context.Memory, Position, Data);
-
- Context.ResponseData.Write((long)ReadSize);
-
- return 0;
- }
-
- public long Write(ServiceCtx Context)
- {
- long Position = Context.Request.SendBuff[0].Position;
-
- long Zero = Context.RequestData.ReadInt64();
- long Offset = Context.RequestData.ReadInt64();
- long Size = Context.RequestData.ReadInt64();
-
- byte[] Data = AMemoryHelper.ReadBytes(Context.Memory, Position, (int)Size);
-
- BaseStream.Seek(Offset, SeekOrigin.Begin);
- BaseStream.Write(Data, 0, (int)Size);
-
- return 0;
- }
-
- public long Flush(ServiceCtx Context)
- {
- BaseStream.Flush();
-
- return 0;
- }
-
- public long SetSize(ServiceCtx Context)
- {
- long Size = Context.RequestData.ReadInt64();
-
- BaseStream.SetLength(Size);
-
- return 0;
- }
-
- public long GetSize(ServiceCtx Context)
- {
- Context.ResponseData.Write(BaseStream.Length);
-
- return 0;
- }
-
- public void Dispose()
- {
- Dispose(true);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (disposing && BaseStream != null)
- {
- BaseStream.Dispose();
-
- Disposed?.Invoke(this, EventArgs.Empty);
- }
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/FspSrv/IFileSystem.cs b/Ryujinx.Core/OsHle/Objects/FspSrv/IFileSystem.cs
deleted file mode 100644
index 6b86a473..00000000
--- a/Ryujinx.Core/OsHle/Objects/FspSrv/IFileSystem.cs
+++ /dev/null
@@ -1,383 +0,0 @@
-using ChocolArm64.Memory;
-using Ryujinx.Core.OsHle.Ipc;
-using System;
-using System.Collections.Generic;
-using System.IO;
-
-using static Ryujinx.Core.OsHle.Objects.ErrorCode;
-using static Ryujinx.Core.OsHle.Objects.ObjHelper;
-
-namespace Ryujinx.Core.OsHle.Objects.FspSrv
-{
- class IFileSystem : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- private HashSet<string> OpenPaths;
-
- private string Path;
-
- public IFileSystem(string Path)
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 0, CreateFile },
- { 1, DeleteFile },
- { 2, CreateDirectory },
- { 3, DeleteDirectory },
- { 4, DeleteDirectoryRecursively },
- { 5, RenameFile },
- { 6, RenameDirectory },
- { 7, GetEntryType },
- { 8, OpenFile },
- { 9, OpenDirectory },
- { 10, Commit },
- { 11, GetFreeSpaceSize },
- { 12, GetTotalSpaceSize },
- //{ 13, CleanDirectoryRecursively },
- //{ 14, GetFileTimeStampRaw }
- };
-
- OpenPaths = new HashSet<string>();
-
- this.Path = Path;
- }
-
- public long CreateFile(ServiceCtx Context)
- {
- long Position = Context.Request.PtrBuff[0].Position;
-
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
-
- long Mode = Context.RequestData.ReadInt64();
- int Size = Context.RequestData.ReadInt32();
-
- string FileName = Context.Ns.VFs.GetFullPath(Path, Name);
-
- if (FileName == null)
- {
- return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
- }
-
- if (File.Exists(FileName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathAlreadyExists);
- }
-
- if (IsPathAlreadyInUse(FileName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
- }
-
- using (FileStream NewFile = File.Create(FileName))
- {
- NewFile.SetLength(Size);
- }
-
- return 0;
- }
-
- public long DeleteFile(ServiceCtx Context)
- {
- long Position = Context.Request.PtrBuff[0].Position;
-
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
-
- string FileName = Context.Ns.VFs.GetFullPath(Path, Name);
-
- if (!File.Exists(FileName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
- }
-
- if (IsPathAlreadyInUse(FileName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
- }
-
- File.Delete(FileName);
-
- return 0;
- }
-
- public long CreateDirectory(ServiceCtx Context)
- {
- long Position = Context.Request.PtrBuff[0].Position;
-
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
-
- string DirName = Context.Ns.VFs.GetFullPath(Path, Name);
-
- if (DirName == null)
- {
- return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
- }
-
- if (Directory.Exists(DirName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathAlreadyExists);
- }
-
- if (IsPathAlreadyInUse(DirName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
- }
-
- Directory.CreateDirectory(DirName);
-
- return 0;
- }
-
- public long DeleteDirectory(ServiceCtx Context)
- {
- return DeleteDirectory(Context, false);
- }
-
- public long DeleteDirectoryRecursively(ServiceCtx Context)
- {
- return DeleteDirectory(Context, true);
- }
-
- private long DeleteDirectory(ServiceCtx Context, bool Recursive)
- {
- long Position = Context.Request.PtrBuff[0].Position;
-
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
-
- string DirName = Context.Ns.VFs.GetFullPath(Path, Name);
-
- if (!Directory.Exists(DirName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
- }
-
- if (IsPathAlreadyInUse(DirName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
- }
-
- Directory.Delete(DirName, Recursive);
-
- return 0;
- }
-
- public long RenameFile(ServiceCtx Context)
- {
- long OldPosition = Context.Request.PtrBuff[0].Position;
- long NewPosition = Context.Request.PtrBuff[0].Position;
-
- string OldName = AMemoryHelper.ReadAsciiString(Context.Memory, OldPosition);
- string NewName = AMemoryHelper.ReadAsciiString(Context.Memory, NewPosition);
-
- string OldFileName = Context.Ns.VFs.GetFullPath(Path, OldName);
- string NewFileName = Context.Ns.VFs.GetFullPath(Path, NewName);
-
- if (!File.Exists(OldFileName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
- }
-
- if (File.Exists(NewFileName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathAlreadyExists);
- }
-
- if (IsPathAlreadyInUse(OldFileName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
- }
-
- File.Move(OldFileName, NewFileName);
-
- return 0;
- }
-
- public long RenameDirectory(ServiceCtx Context)
- {
- long OldPosition = Context.Request.PtrBuff[0].Position;
- long NewPosition = Context.Request.PtrBuff[0].Position;
-
- string OldName = AMemoryHelper.ReadAsciiString(Context.Memory, OldPosition);
- string NewName = AMemoryHelper.ReadAsciiString(Context.Memory, NewPosition);
-
- string OldDirName = Context.Ns.VFs.GetFullPath(Path, OldName);
- string NewDirName = Context.Ns.VFs.GetFullPath(Path, NewName);
-
- if (!Directory.Exists(OldDirName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
- }
-
- if (Directory.Exists(NewDirName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathAlreadyExists);
- }
-
- if (IsPathAlreadyInUse(OldDirName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
- }
-
- Directory.Move(OldDirName, NewDirName);
-
- return 0;
- }
-
- public long GetEntryType(ServiceCtx Context)
- {
- long Position = Context.Request.PtrBuff[0].Position;
-
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
-
- string FileName = Context.Ns.VFs.GetFullPath(Path, Name);
-
- if (File.Exists(FileName))
- {
- Context.ResponseData.Write(1);
- }
- else if (Directory.Exists(FileName))
- {
- Context.ResponseData.Write(0);
- }
- else
- {
- Context.ResponseData.Write(0);
-
- return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
- }
-
- return 0;
- }
-
- public long OpenFile(ServiceCtx Context)
- {
- long Position = Context.Request.PtrBuff[0].Position;
-
- int FilterFlags = Context.RequestData.ReadInt32();
-
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
-
- string FileName = Context.Ns.VFs.GetFullPath(Path, Name);
-
- if (!File.Exists(FileName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
- }
-
- if (IsPathAlreadyInUse(FileName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
- }
-
- FileStream Stream = new FileStream(FileName, FileMode.Open);
-
- IFile FileInterface = new IFile(Stream, FileName);
-
- FileInterface.Disposed += RemoveFileInUse;
-
- lock (OpenPaths)
- {
- OpenPaths.Add(FileName);
- }
-
- MakeObject(Context, FileInterface);
-
- return 0;
- }
-
- public long OpenDirectory(ServiceCtx Context)
- {
- long Position = Context.Request.PtrBuff[0].Position;
-
- int FilterFlags = Context.RequestData.ReadInt32();
-
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
-
- string DirName = Context.Ns.VFs.GetFullPath(Path, Name);
-
- if (!Directory.Exists(DirName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
- }
-
- if (IsPathAlreadyInUse(DirName))
- {
- return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
- }
-
- IDirectory DirInterface = new IDirectory(DirName, FilterFlags);
-
- DirInterface.Disposed += RemoveDirectoryInUse;
-
- lock (OpenPaths)
- {
- OpenPaths.Add(DirName);
- }
-
- MakeObject(Context, DirInterface);
-
- return 0;
- }
-
- public long Commit(ServiceCtx Context)
- {
- return 0;
- }
-
- public long GetFreeSpaceSize(ServiceCtx Context)
- {
- long Position = Context.Request.PtrBuff[0].Position;
-
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
-
- Context.ResponseData.Write(Context.Ns.VFs.GetDrive().AvailableFreeSpace);
-
- return 0;
- }
-
- public long GetTotalSpaceSize(ServiceCtx Context)
- {
- long Position = Context.Request.PtrBuff[0].Position;
-
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
-
- Context.ResponseData.Write(Context.Ns.VFs.GetDrive().TotalSize);
-
- return 0;
- }
-
- private bool IsPathAlreadyInUse(string Path)
- {
- lock (OpenPaths)
- {
- return OpenPaths.Contains(Path);
- }
- }
-
- private void RemoveFileInUse(object sender, EventArgs e)
- {
- IFile FileInterface = (IFile)sender;
-
- lock (OpenPaths)
- {
- FileInterface.Disposed -= RemoveFileInUse;
-
- OpenPaths.Remove(FileInterface.HostPath);
- }
- }
-
- private void RemoveDirectoryInUse(object sender, EventArgs e)
- {
- IDirectory DirInterface = (IDirectory)sender;
-
- lock (OpenPaths)
- {
- DirInterface.Disposed -= RemoveDirectoryInUse;
-
- OpenPaths.Remove(DirInterface.HostPath);
- }
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/FspSrv/IStorage.cs b/Ryujinx.Core/OsHle/Objects/FspSrv/IStorage.cs
deleted file mode 100644
index 4eca37e8..00000000
--- a/Ryujinx.Core/OsHle/Objects/FspSrv/IStorage.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using ChocolArm64.Memory;
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-using System.IO;
-
-namespace Ryujinx.Core.OsHle.Objects.FspSrv
-{
- class IStorage : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- private Stream BaseStream;
-
- public IStorage(Stream BaseStream)
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 0, Read }
- };
-
- this.BaseStream = BaseStream;
- }
-
- public long Read(ServiceCtx Context)
- {
- long Offset = Context.RequestData.ReadInt64();
- long Size = Context.RequestData.ReadInt64();
-
- if (Context.Request.ReceiveBuff.Count > 0)
- {
- IpcBuffDesc BuffDesc = Context.Request.ReceiveBuff[0];
-
- //Use smaller length to avoid overflows.
- if (Size > BuffDesc.Size)
- {
- Size = BuffDesc.Size;
- }
-
- byte[] Data = new byte[Size];
-
- BaseStream.Seek(Offset, SeekOrigin.Begin);
- BaseStream.Read(Data, 0, Data.Length);
-
- AMemoryHelper.WriteBytes(Context.Memory, BuffDesc.Position, Data);
- }
-
- return 0;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Hid/IActiveVibrationDeviceList.cs b/Ryujinx.Core/OsHle/Objects/Hid/IActiveVibrationDeviceList.cs
deleted file mode 100644
index aae3c38d..00000000
--- a/Ryujinx.Core/OsHle/Objects/Hid/IActiveVibrationDeviceList.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Hid
-{
- class IActiveApplicationDeviceList : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public IActiveApplicationDeviceList()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>() { };
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Hid/IAppletResource.cs b/Ryujinx.Core/OsHle/Objects/Hid/IAppletResource.cs
deleted file mode 100644
index 7d56d04b..00000000
--- a/Ryujinx.Core/OsHle/Objects/Hid/IAppletResource.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using Ryujinx.Core.OsHle.Handles;
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Hid
-{
- class IAppletResource : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- private HSharedMem Handle;
-
- public IAppletResource(HSharedMem Handle)
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 0, GetSharedMemoryHandle }
- };
-
- this.Handle = Handle;
- }
-
- public static long GetSharedMemoryHandle(ServiceCtx Context)
- {
- Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Context.Ns.Os.HidHandle);
-
- return 0;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/IIpcInterface.cs b/Ryujinx.Core/OsHle/Objects/IIpcInterface.cs
deleted file mode 100644
index c57a0974..00000000
--- a/Ryujinx.Core/OsHle/Objects/IIpcInterface.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects
-{
- interface IIpcInterface
- {
- IReadOnlyDictionary<int, ServiceProcessRequest> Commands { get; }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/ObjHelper.cs b/Ryujinx.Core/OsHle/Objects/ObjHelper.cs
deleted file mode 100644
index a151a287..00000000
--- a/Ryujinx.Core/OsHle/Objects/ObjHelper.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using Ryujinx.Core.OsHle.Handles;
-using Ryujinx.Core.OsHle.Ipc;
-
-namespace Ryujinx.Core.OsHle.Objects
-{
- static class ObjHelper
- {
- public static void MakeObject(ServiceCtx Context, object Obj)
- {
- if (Context.Session is HDomain Dom)
- {
- Context.Response.ResponseObjIds.Add(Dom.GenerateObjectId(Obj));
- }
- else
- {
- HSessionObj HndData = new HSessionObj(Context.Session, Obj);
-
- int VHandle = Context.Ns.Os.Handles.GenerateId(HndData);
-
- Context.Response.HandleDesc = IpcHandleDesc.MakeMove(VHandle);
- }
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Time/ISteadyClock.cs b/Ryujinx.Core/OsHle/Objects/Time/ISteadyClock.cs
deleted file mode 100644
index 1116b849..00000000
--- a/Ryujinx.Core/OsHle/Objects/Time/ISteadyClock.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Time
-{
- class ISteadyClock : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public ISteadyClock()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- //...
- };
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Time/ISystemClock.cs b/Ryujinx.Core/OsHle/Objects/Time/ISystemClock.cs
deleted file mode 100644
index 3aa70691..00000000
--- a/Ryujinx.Core/OsHle/Objects/Time/ISystemClock.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Time
-{
- class ISystemClock : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- private static DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
-
- private SystemClockType ClockType;
-
- public ISystemClock(SystemClockType ClockType)
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- { 0, GetCurrentTime }
- };
-
- this.ClockType = ClockType;
- }
-
- public long GetCurrentTime(ServiceCtx Context)
- {
- DateTime CurrentTime = DateTime.Now;
-
- if (ClockType == SystemClockType.User ||
- ClockType == SystemClockType.Network)
- {
- CurrentTime = CurrentTime.ToUniversalTime();
- }
-
- Context.ResponseData.Write((long)(DateTime.Now - Epoch).TotalSeconds);
-
- return 0;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Time/ITimeZoneService.cs b/Ryujinx.Core/OsHle/Objects/Time/ITimeZoneService.cs
deleted file mode 100644
index c083628b..00000000
--- a/Ryujinx.Core/OsHle/Objects/Time/ITimeZoneService.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Ryujinx.Core.OsHle.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.Core.OsHle.Objects.Time
-{
- class ITimeZoneService : IIpcInterface
- {
- private Dictionary<int, ServiceProcessRequest> m_Commands;
-
- public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
-
- public ITimeZoneService()
- {
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
- {
- //...
- };
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Core/OsHle/Objects/Time/SystemClockType.cs b/Ryujinx.Core/OsHle/Objects/Time/SystemClockType.cs
deleted file mode 100644
index f447ca1c..00000000
--- a/Ryujinx.Core/OsHle/Objects/Time/SystemClockType.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace Ryujinx.Core.OsHle.Objects.Time
-{
- enum SystemClockType
- {
- User,
- Network,
- Local
- }
-} \ No newline at end of file
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