diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-02-25 01:34:16 -0300 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-02-25 01:34:27 -0300 |
| commit | fba0bf873257c4ac17f4584036661be08a1694d3 (patch) | |
| tree | d1677d09fd008b2dcfa7560e979460b277f76411 /Ryujinx.Core/OsHle/Objects/Am | |
| parent | a4ff0d34848416a68dff9f165bb90afae7a4fd20 (diff) | |
Refactor IPC services to have commands into separate classes, fix readme url
Diffstat (limited to 'Ryujinx.Core/OsHle/Objects/Am')
| -rw-r--r-- | Ryujinx.Core/OsHle/Objects/Am/IApplicationFunctions.cs | 80 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Objects/Am/IApplicationProxy.cs | 85 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Objects/Am/IAudioController.cs | 20 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Objects/Am/ICommonStateGetter.cs | 74 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Objects/Am/IDebugFunctions.cs | 20 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Objects/Am/IDisplayController.cs | 20 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Objects/Am/ILibraryAppletCreator.cs | 20 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Objects/Am/IParentalControlService.cs | 20 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Objects/Am/ISelfController.cs | 61 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Objects/Am/IStorage.cs | 33 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Objects/Am/IStorageAccessor.cs | 62 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Objects/Am/IWindowController.cs | 33 |
12 files changed, 0 insertions, 528 deletions
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 |
