diff options
| author | Alex Barney <thealexbarney@gmail.com> | 2018-12-04 14:23:37 -0600 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-12-04 18:23:37 -0200 |
| commit | 85dbb9559ad317a657dafd24da27fec4b3f5250f (patch) | |
| tree | ecd92931bc2146e549484d9a3af308469089ad4e /Ryujinx.HLE/HOS/Services/Am | |
| parent | c86aacde76b5f8e503e2b412385c8491ecc86b3b (diff) | |
Adjust naming conventions and general refactoring in HLE Project (#490)
* Rename enum fields
* Naming conventions
* Remove unneeded ".this"
* Remove unneeded semicolons
* Remove unused Usings
* Don't use var
* Remove unneeded enum underlying types
* Explicitly label class visibility
* Remove unneeded @ prefixes
* Remove unneeded commas
* Remove unneeded if expressions
* Method doesn't use unsafe code
* Remove unneeded casts
* Initialized objects don't need an empty constructor
* Remove settings from DotSettings
* Revert "Explicitly label class visibility"
This reverts commit ad5eb5787cc5b27a4631cd46ef5f551c4ae95e51.
* Small changes
* Revert external enum renaming
* Changes from feedback
* Remove unneeded property setters
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Am')
19 files changed, 257 insertions, 257 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs b/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs index 2d44526a..0d067b16 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs @@ -5,21 +5,21 @@ namespace Ryujinx.HLE.HOS.Services.Am { class IAllSystemAppletProxiesService : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; public IAllSystemAppletProxiesService() { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { { 100, OpenSystemAppletProxy } }; } - public long OpenSystemAppletProxy(ServiceCtx Context) + public long OpenSystemAppletProxy(ServiceCtx context) { - MakeObject(Context, new ISystemAppletProxy()); + MakeObject(context, new ISystemAppletProxy()); return 0; } diff --git a/Ryujinx.HLE/HOS/Services/Am/IApplicationCreator.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationCreator.cs index c5ed09f5..eac609ed 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IApplicationCreator.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationCreator.cs @@ -5,13 +5,13 @@ namespace Ryujinx.HLE.HOS.Services.Am { class IApplicationCreator : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; public IApplicationCreator() { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { //... }; diff --git a/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs index 1934798b..fbc5dee5 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs @@ -6,13 +6,13 @@ namespace Ryujinx.HLE.HOS.Services.Am { class IApplicationFunctions : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; public IApplicationFunctions() { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { { 1, PopLaunchParameter }, { 20, EnsureSaveData }, @@ -26,88 +26,88 @@ namespace Ryujinx.HLE.HOS.Services.Am }; } - public long PopLaunchParameter(ServiceCtx Context) + public long PopLaunchParameter(ServiceCtx context) { //Only the first 0x18 bytes of the Data seems to be actually used. - MakeObject(Context, new IStorage(StorageHelper.MakeLaunchParams())); + MakeObject(context, new IStorage(StorageHelper.MakeLaunchParams())); return 0; } - public long EnsureSaveData(ServiceCtx Context) + public long EnsureSaveData(ServiceCtx context) { - long UIdLow = Context.RequestData.ReadInt64(); - long UIdHigh = Context.RequestData.ReadInt64(); + long uIdLow = context.RequestData.ReadInt64(); + long uIdHigh = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); - Context.ResponseData.Write(0L); + context.ResponseData.Write(0L); return 0; } - public long GetDesiredLanguage(ServiceCtx Context) + public long GetDesiredLanguage(ServiceCtx context) { - Context.ResponseData.Write(Context.Device.System.State.DesiredLanguageCode); + context.ResponseData.Write(context.Device.System.State.DesiredLanguageCode); return 0; } - public long SetTerminateResult(ServiceCtx Context) + public long SetTerminateResult(ServiceCtx context) { - int ErrorCode = Context.RequestData.ReadInt32(); + int errorCode = context.RequestData.ReadInt32(); - string Result = GetFormattedErrorCode(ErrorCode); + string result = GetFormattedErrorCode(errorCode); - Logger.PrintInfo(LogClass.ServiceAm, $"Result = 0x{ErrorCode:x8} ({Result})."); + Logger.PrintInfo(LogClass.ServiceAm, $"Result = 0x{errorCode:x8} ({result})."); return 0; } - private string GetFormattedErrorCode(int ErrorCode) + private string GetFormattedErrorCode(int errorCode) { - int Module = (ErrorCode >> 0) & 0x1ff; - int Description = (ErrorCode >> 9) & 0x1fff; + int module = (errorCode >> 0) & 0x1ff; + int description = (errorCode >> 9) & 0x1fff; - return $"{(2000 + Module):d4}-{Description:d4}"; + return $"{(2000 + module):d4}-{description:d4}"; } - public long GetDisplayVersion(ServiceCtx Context) + public long GetDisplayVersion(ServiceCtx context) { //FIXME: Need to check correct version on a switch. - Context.ResponseData.Write(1L); - Context.ResponseData.Write(0L); + context.ResponseData.Write(1L); + context.ResponseData.Write(0L); return 0; } - public long NotifyRunning(ServiceCtx Context) + public long NotifyRunning(ServiceCtx context) { - Context.ResponseData.Write(1); + context.ResponseData.Write(1); return 0; } - public long GetPseudoDeviceId(ServiceCtx Context) + public long GetPseudoDeviceId(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); - Context.ResponseData.Write(0L); - Context.ResponseData.Write(0L); + context.ResponseData.Write(0L); + context.ResponseData.Write(0L); return 0; } - public long InitializeGamePlayRecording(ServiceCtx Context) + public long InitializeGamePlayRecording(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long SetGamePlayRecordingState(ServiceCtx Context) + public long SetGamePlayRecordingState(ServiceCtx context) { - int State = Context.RequestData.ReadInt32(); + int state = context.RequestData.ReadInt32(); Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); diff --git a/Ryujinx.HLE/HOS/Services/Am/IApplicationProxy.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxy.cs index 2aaeda78..fd785a70 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IApplicationProxy.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxy.cs @@ -5,13 +5,13 @@ namespace Ryujinx.HLE.HOS.Services.Am { class IApplicationProxy : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; public IApplicationProxy() { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { { 0, GetCommonStateGetter }, { 1, GetSelfController }, @@ -24,58 +24,58 @@ namespace Ryujinx.HLE.HOS.Services.Am }; } - public long GetCommonStateGetter(ServiceCtx Context) + public long GetCommonStateGetter(ServiceCtx context) { - MakeObject(Context, new ICommonStateGetter(Context.Device.System)); + MakeObject(context, new ICommonStateGetter(context.Device.System)); return 0; } - public long GetSelfController(ServiceCtx Context) + public long GetSelfController(ServiceCtx context) { - MakeObject(Context, new ISelfController(Context.Device.System)); + MakeObject(context, new ISelfController(context.Device.System)); return 0; } - public long GetWindowController(ServiceCtx Context) + public long GetWindowController(ServiceCtx context) { - MakeObject(Context, new IWindowController()); + MakeObject(context, new IWindowController()); return 0; } - public long GetAudioController(ServiceCtx Context) + public long GetAudioController(ServiceCtx context) { - MakeObject(Context, new IAudioController()); + MakeObject(context, new IAudioController()); return 0; } - public long GetDisplayController(ServiceCtx Context) + public long GetDisplayController(ServiceCtx context) { - MakeObject(Context, new IDisplayController()); + MakeObject(context, new IDisplayController()); return 0; } - public long GetLibraryAppletCreator(ServiceCtx Context) + public long GetLibraryAppletCreator(ServiceCtx context) { - MakeObject(Context, new ILibraryAppletCreator()); + MakeObject(context, new ILibraryAppletCreator()); return 0; } - public long GetApplicationFunctions(ServiceCtx Context) + public long GetApplicationFunctions(ServiceCtx context) { - MakeObject(Context, new IApplicationFunctions()); + MakeObject(context, new IApplicationFunctions()); return 0; } - public long GetDebugFunctions(ServiceCtx Context) + public long GetDebugFunctions(ServiceCtx context) { - MakeObject(Context, new IDebugFunctions()); + MakeObject(context, new IDebugFunctions()); return 0; } diff --git a/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs index fb518af9..88792a16 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs @@ -5,21 +5,21 @@ namespace Ryujinx.HLE.HOS.Services.Am { class IApplicationProxyService : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; public IApplicationProxyService() { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { { 0, OpenApplicationProxy } }; } - public long OpenApplicationProxy(ServiceCtx Context) + public long OpenApplicationProxy(ServiceCtx context) { - MakeObject(Context, new IApplicationProxy()); + MakeObject(context, new IApplicationProxy()); return 0; } diff --git a/Ryujinx.HLE/HOS/Services/Am/IAudioController.cs b/Ryujinx.HLE/HOS/Services/Am/IAudioController.cs index 062f2d86..a03a3266 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IAudioController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IAudioController.cs @@ -6,13 +6,13 @@ namespace Ryujinx.HLE.HOS.Services.Am { class IAudioController : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; public IAudioController() { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { { 0, SetExpectedMasterVolume }, { 1, GetMainAppletExpectedMasterVolume }, @@ -22,47 +22,47 @@ namespace Ryujinx.HLE.HOS.Services.Am }; } - public long SetExpectedMasterVolume(ServiceCtx Context) + public long SetExpectedMasterVolume(ServiceCtx context) { - float AppletVolume = Context.RequestData.ReadSingle(); - float LibraryAppletVolume = Context.RequestData.ReadSingle(); + float appletVolume = context.RequestData.ReadSingle(); + float libraryAppletVolume = context.RequestData.ReadSingle(); Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long GetMainAppletExpectedMasterVolume(ServiceCtx Context) + public long GetMainAppletExpectedMasterVolume(ServiceCtx context) { - Context.ResponseData.Write(1f); + context.ResponseData.Write(1f); Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long GetLibraryAppletExpectedMasterVolume(ServiceCtx Context) + public long GetLibraryAppletExpectedMasterVolume(ServiceCtx context) { - Context.ResponseData.Write(1f); + context.ResponseData.Write(1f); Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long ChangeMainAppletMasterVolume(ServiceCtx Context) + public long ChangeMainAppletMasterVolume(ServiceCtx context) { - float Unknown0 = Context.RequestData.ReadSingle(); - long Unknown1 = Context.RequestData.ReadInt64(); + float unknown0 = context.RequestData.ReadSingle(); + long unknown1 = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long SetTransparentVolumeRate(ServiceCtx Context) + public long SetTransparentVolumeRate(ServiceCtx context) { - float Unknown0 = Context.RequestData.ReadSingle(); + float unknown0 = context.RequestData.ReadSingle(); Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); diff --git a/Ryujinx.HLE/HOS/Services/Am/ICommonStateGetter.cs b/Ryujinx.HLE/HOS/Services/Am/ICommonStateGetter.cs index 2feaf8fc..8ec42152 100644 --- a/Ryujinx.HLE/HOS/Services/Am/ICommonStateGetter.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ICommonStateGetter.cs @@ -10,15 +10,15 @@ namespace Ryujinx.HLE.HOS.Services.Am { class ICommonStateGetter : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; - private KEvent DisplayResolutionChangeEvent; + private KEvent _displayResolutionChangeEvent; - public ICommonStateGetter(Horizon System) + public ICommonStateGetter(Horizon system) { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { { 0, GetEventHandle }, { 1, ReceiveMessage }, @@ -30,89 +30,89 @@ namespace Ryujinx.HLE.HOS.Services.Am { 61, GetDefaultDisplayResolutionChangeEvent } }; - DisplayResolutionChangeEvent = new KEvent(System); + _displayResolutionChangeEvent = new KEvent(system); } - public long GetEventHandle(ServiceCtx Context) + public long GetEventHandle(ServiceCtx context) { - KEvent Event = Context.Device.System.AppletState.MessageEvent; + KEvent Event = context.Device.System.AppletState.MessageEvent; - if (Context.Process.HandleTable.GenerateHandle(Event.ReadableEvent, out int Handle) != KernelResult.Success) + if (context.Process.HandleTable.GenerateHandle(Event.ReadableEvent, out int handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } - Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); + context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); return 0; } - public long ReceiveMessage(ServiceCtx Context) + public long ReceiveMessage(ServiceCtx context) { - if (!Context.Device.System.AppletState.TryDequeueMessage(out MessageInfo Message)) + if (!context.Device.System.AppletState.TryDequeueMessage(out MessageInfo message)) { return MakeError(ErrorModule.Am, AmErr.NoMessages); } - Context.ResponseData.Write((int)Message); + context.ResponseData.Write((int)message); return 0; } - public long GetOperationMode(ServiceCtx Context) + public long GetOperationMode(ServiceCtx context) { - OperationMode Mode = Context.Device.System.State.DockedMode + OperationMode mode = context.Device.System.State.DockedMode ? OperationMode.Docked : OperationMode.Handheld; - Context.ResponseData.Write((byte)Mode); + context.ResponseData.Write((byte)mode); return 0; } - public long GetPerformanceMode(ServiceCtx Context) + public long GetPerformanceMode(ServiceCtx context) { - Apm.PerformanceMode Mode = Context.Device.System.State.DockedMode + Apm.PerformanceMode mode = context.Device.System.State.DockedMode ? Apm.PerformanceMode.Docked : Apm.PerformanceMode.Handheld; - Context.ResponseData.Write((int)Mode); + context.ResponseData.Write((int)mode); return 0; } - public long GetBootMode(ServiceCtx Context) + public long GetBootMode(ServiceCtx context) { - Context.ResponseData.Write((byte)0); //Unknown value. + context.ResponseData.Write((byte)0); //Unknown value. Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long GetCurrentFocusState(ServiceCtx Context) + public long GetCurrentFocusState(ServiceCtx context) { - Context.ResponseData.Write((byte)Context.Device.System.AppletState.FocusState); + context.ResponseData.Write((byte)context.Device.System.AppletState.FocusState); return 0; } - public long GetDefaultDisplayResolution(ServiceCtx Context) + public long GetDefaultDisplayResolution(ServiceCtx context) { - Context.ResponseData.Write(1280); - Context.ResponseData.Write(720); + context.ResponseData.Write(1280); + context.ResponseData.Write(720); return 0; } - public long GetDefaultDisplayResolutionChangeEvent(ServiceCtx Context) + public long GetDefaultDisplayResolutionChangeEvent(ServiceCtx context) { - if (Context.Process.HandleTable.GenerateHandle(DisplayResolutionChangeEvent.ReadableEvent, out int Handle) != KernelResult.Success) + if (context.Process.HandleTable.GenerateHandle(_displayResolutionChangeEvent.ReadableEvent, out int handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } - Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); + context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); diff --git a/Ryujinx.HLE/HOS/Services/Am/IDebugFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/IDebugFunctions.cs index d86743c0..f7ea253d 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IDebugFunctions.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IDebugFunctions.cs @@ -5,13 +5,13 @@ namespace Ryujinx.HLE.HOS.Services.Am { class IDebugFunctions : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; public IDebugFunctions() { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { //... }; diff --git a/Ryujinx.HLE/HOS/Services/Am/IDisplayController.cs b/Ryujinx.HLE/HOS/Services/Am/IDisplayController.cs index c4d49579..91fd864c 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IDisplayController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IDisplayController.cs @@ -5,13 +5,13 @@ namespace Ryujinx.HLE.HOS.Services.Am { class IDisplayController : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; public IDisplayController() { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { //... }; diff --git a/Ryujinx.HLE/HOS/Services/Am/IGlobalStateController.cs b/Ryujinx.HLE/HOS/Services/Am/IGlobalStateController.cs index e646327f..b9387661 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IGlobalStateController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IGlobalStateController.cs @@ -5,13 +5,13 @@ namespace Ryujinx.HLE.HOS.Services.Am { class IGlobalStateController : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; public IGlobalStateController() { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { //... }; diff --git a/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs index 3f026e2f..db116f33 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs @@ -8,39 +8,39 @@ namespace Ryujinx.HLE.HOS.Services.Am { class IHomeMenuFunctions : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; - private KEvent ChannelEvent; + private KEvent _channelEvent; - public IHomeMenuFunctions(Horizon System) + public IHomeMenuFunctions(Horizon system) { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { { 10, RequestToGetForeground }, { 21, GetPopFromGeneralChannelEvent } }; //ToDo: Signal this Event somewhere in future. - ChannelEvent = new KEvent(System); + _channelEvent = new KEvent(system); } - public long RequestToGetForeground(ServiceCtx Context) + public long RequestToGetForeground(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long GetPopFromGeneralChannelEvent(ServiceCtx Context) + public long GetPopFromGeneralChannelEvent(ServiceCtx context) { - if (Context.Process.HandleTable.GenerateHandle(ChannelEvent.ReadableEvent, out int Handle) != KernelResult.Success) + if (context.Process.HandleTable.GenerateHandle(_channelEvent.ReadableEvent, out int handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } - Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); + context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); diff --git a/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs b/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs index 9e0d0e70..7c4aa16c 100644 --- a/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs @@ -8,15 +8,15 @@ namespace Ryujinx.HLE.HOS.Services.Am { class ILibraryAppletAccessor : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; - private KEvent StateChangedEvent; + private KEvent _stateChangedEvent; - public ILibraryAppletAccessor(Horizon System) + public ILibraryAppletAccessor(Horizon system) { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { { 0, GetAppletStateChangedEvent }, { 10, Start }, @@ -25,49 +25,49 @@ namespace Ryujinx.HLE.HOS.Services.Am { 101, PopOutData } }; - StateChangedEvent = new KEvent(System); + _stateChangedEvent = new KEvent(system); } - public long GetAppletStateChangedEvent(ServiceCtx Context) + public long GetAppletStateChangedEvent(ServiceCtx context) { - StateChangedEvent.ReadableEvent.Signal(); + _stateChangedEvent.ReadableEvent.Signal(); - if (Context.Process.HandleTable.GenerateHandle(StateChangedEvent.ReadableEvent, out int Handle) != KernelResult.Success) + if (context.Process.HandleTable.GenerateHandle(_stateChangedEvent.ReadableEvent, out int handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } - Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); + context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long Start(ServiceCtx Context) + public long Start(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long GetResult(ServiceCtx Context) + public long GetResult(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long PushInData(ServiceCtx Context) + public long PushInData(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long PopOutData(ServiceCtx Context) + public long PopOutData(ServiceCtx context) { - MakeObject(Context, new IStorage(StorageHelper.MakeLaunchParams())); + MakeObject(context, new IStorage(StorageHelper.MakeLaunchParams())); return 0; } diff --git a/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletCreator.cs b/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletCreator.cs index 5535a43c..3f88c545 100644 --- a/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletCreator.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletCreator.cs @@ -5,31 +5,31 @@ namespace Ryujinx.HLE.HOS.Services.Am { class ILibraryAppletCreator : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; public ILibraryAppletCreator() { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { { 0, CreateLibraryApplet }, { 10, CreateStorage } }; } - public long CreateLibraryApplet(ServiceCtx Context) + public long CreateLibraryApplet(ServiceCtx context) { - MakeObject(Context, new ILibraryAppletAccessor(Context.Device.System)); + MakeObject(context, new ILibraryAppletAccessor(context.Device.System)); return 0; } - public long CreateStorage(ServiceCtx Context) + public long CreateStorage(ServiceCtx context) { - long Size = Context.RequestData.ReadInt64(); + long size = context.RequestData.ReadInt64(); - MakeObject(Context, new IStorage(new byte[Size])); + MakeObject(context, new IStorage(new byte[size])); return 0; } diff --git a/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs b/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs index 2abaee2e..dc922037 100644 --- a/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs @@ -8,17 +8,17 @@ namespace Ryujinx.HLE.HOS.Services.Am { class ISelfController : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; - private KEvent LaunchableEvent; + private KEvent _launchableEvent; - private int IdleTimeDetectionExtension; + private int _idleTimeDetectionExtension; - public ISelfController(Horizon System) + public ISelfController(Horizon system) { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { { 0, Exit }, { 1, LockExit }, @@ -36,114 +36,114 @@ namespace Ryujinx.HLE.HOS.Services.Am { 63, GetIdleTimeDetectionExtension } }; - LaunchableEvent = new KEvent(System); + _launchableEvent = new KEvent(system); } - public long Exit(ServiceCtx Context) + public long Exit(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long LockExit(ServiceCtx Context) + public long LockExit(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long UnlockExit(ServiceCtx Context) + public long UnlockExit(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long GetLibraryAppletLaunchableEvent(ServiceCtx Context) + public long GetLibraryAppletLaunchableEvent(ServiceCtx context) { - LaunchableEvent.ReadableEvent.Signal(); + _launchableEvent.ReadableEvent.Signal(); - if (Context.Process.HandleTable.GenerateHandle(LaunchableEvent.ReadableEvent, out int Handle) != KernelResult.Success) + if (context.Process.HandleTable.GenerateHandle(_launchableEvent.ReadableEvent, out int handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } - Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); + context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long SetScreenShotPermission(ServiceCtx Context) + public long SetScreenShotPermission(ServiceCtx context) { - bool Enable = Context.RequestData.ReadByte() != 0 ? true : false; + bool enable = context.RequestData.ReadByte() != 0; Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long SetOperationModeChangedNotification(ServiceCtx Context) + public long SetOperationModeChangedNotification(ServiceCtx context) { - bool Enable = Context.RequestData.ReadByte() != 0 ? true : false; + bool enable = context.RequestData.ReadByte() != 0; Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long SetPerformanceModeChangedNotification(ServiceCtx Context) + public long SetPerformanceModeChangedNotification(ServiceCtx context) { - bool Enable = Context.RequestData.ReadByte() != 0 ? true : false; + bool enable = context.RequestData.ReadByte() != 0; Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long SetFocusHandlingMode(ServiceCtx Context) + 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; + bool flag1 = context.RequestData.ReadByte() != 0; + bool flag2 = context.RequestData.ReadByte() != 0; + bool flag3 = context.RequestData.ReadByte() != 0; Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long SetRestartMessageEnabled(ServiceCtx Context) + public long SetRestartMessageEnabled(ServiceCtx context) { - bool Enable = Context.RequestData.ReadByte() != 0 ? true : false; + bool enable = context.RequestData.ReadByte() != 0; Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long SetOutOfFocusSuspendingEnabled(ServiceCtx Context) + public long SetOutOfFocusSuspendingEnabled(ServiceCtx context) { - bool Enable = Context.RequestData.ReadByte() != 0 ? true : false; + bool enable = context.RequestData.ReadByte() != 0; Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long SetScreenShotImageOrientation(ServiceCtx Context) + public long SetScreenShotImageOrientation(ServiceCtx context) { - int Orientation = Context.RequestData.ReadInt32(); + int orientation = context.RequestData.ReadInt32(); Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } - public long SetHandlesRequestToDisplay(ServiceCtx Context) + public long SetHandlesRequestToDisplay(ServiceCtx context) { - bool Enable = Context.RequestData.ReadByte() != 0 ? true : false; + bool enable = context.RequestData.ReadByte() != 0; Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); @@ -151,21 +151,21 @@ namespace Ryujinx.HLE.HOS.Services.Am } // SetIdleTimeDetectionExtension(u32) - public long SetIdleTimeDetectionExtension(ServiceCtx Context) + public long SetIdleTimeDetectionExtension(ServiceCtx context) { - IdleTimeDetectionExtension = Context.RequestData.ReadInt32(); + _idleTimeDetectionExtension = context.RequestData.ReadInt32(); - Logger.PrintStub(LogClass.ServiceAm, $"Stubbed. IdleTimeDetectionExtension: {IdleTimeDetectionExtension}"); + Logger.PrintStub(LogClass.ServiceAm, $"Stubbed. IdleTimeDetectionExtension: {_idleTimeDetectionExtension}"); return 0; } // GetIdleTimeDetectionExtension() -> u32 - public long GetIdleTimeDetectionExtension(ServiceCtx Context) + public long GetIdleTimeDetectionExtension(ServiceCtx context) { - Context.ResponseData.Write(IdleTimeDetectionExtension); + context.ResponseData.Write(_idleTimeDetectionExtension); - Logger.PrintStub(LogClass.ServiceAm, $"Stubbed. IdleTimeDetectionExtension: {IdleTimeDetectionExtension}"); + Logger.PrintStub(LogClass.ServiceAm, $"Stubbed. IdleTimeDetectionExtension: {_idleTimeDetectionExtension}"); return 0; } diff --git a/Ryujinx.HLE/HOS/Services/Am/IStorage.cs b/Ryujinx.HLE/HOS/Services/Am/IStorage.cs index 10778122..c39a847b 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IStorage.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IStorage.cs @@ -5,25 +5,25 @@ namespace Ryujinx.HLE.HOS.Services.Am { class IStorage : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; - public byte[] Data { get; private set; } + public byte[] Data { get; } - public IStorage(byte[] Data) + public IStorage(byte[] data) { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { { 0, Open } }; - this.Data = Data; + Data = data; } - public long Open(ServiceCtx Context) + public long Open(ServiceCtx context) { - MakeObject(Context, new IStorageAccessor(this)); + MakeObject(context, new IStorageAccessor(this)); return 0; } diff --git a/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs b/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs index a60cf149..ac54069a 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs @@ -6,76 +6,76 @@ namespace Ryujinx.HLE.HOS.Services.Am { class IStorageAccessor : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; - private IStorage Storage; + private IStorage _storage; - public IStorageAccessor(IStorage Storage) + public IStorageAccessor(IStorage storage) { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { { 0, GetSize }, { 10, Write }, { 11, Read } }; - this.Storage = Storage; + _storage = storage; } - public long GetSize(ServiceCtx Context) + public long GetSize(ServiceCtx context) { - Context.ResponseData.Write((long)Storage.Data.Length); + context.ResponseData.Write((long)_storage.Data.Length); return 0; } - public long Write(ServiceCtx Context) + public long Write(ServiceCtx context) { //TODO: Error conditions. - long WritePosition = Context.RequestData.ReadInt64(); + long writePosition = context.RequestData.ReadInt64(); - (long Position, long Size) = Context.Request.GetBufferType0x21(); + (long position, long size) = context.Request.GetBufferType0x21(); - if (Size > 0) + if (size > 0) { - long MaxSize = Storage.Data.Length - WritePosition; + long maxSize = _storage.Data.Length - writePosition; - if (Size > MaxSize) + if (size > maxSize) { - Size = MaxSize; + size = maxSize; } - byte[] Data = Context.Memory.ReadBytes(Position, Size); + byte[] data = context.Memory.ReadBytes(position, size); - Buffer.BlockCopy(Data, 0, Storage.Data, (int)WritePosition, (int)Size); + Buffer.BlockCopy(data, 0, _storage.Data, (int)writePosition, (int)size); } return 0; } - public long Read(ServiceCtx Context) + public long Read(ServiceCtx context) { //TODO: Error conditions. - long ReadPosition = Context.RequestData.ReadInt64(); + long readPosition = context.RequestData.ReadInt64(); - (long Position, long Size) = Context.Request.GetBufferType0x22(); + (long position, long size) = context.Request.GetBufferType0x22(); - byte[] Data; + byte[] data; - if (Storage.Data.Length > Size) + if (_storage.Data.Length > size) { - Data = new byte[Size]; + data = new byte[size]; - Buffer.BlockCopy(Storage.Data, 0, Data, 0, (int)Size); + Buffer.BlockCopy(_storage.Data, 0, data, 0, (int)size); } else { - Data = Storage.Data; + data = _storage.Data; } - Context.Memory.WriteBytes(Position, Data); + context.Memory.WriteBytes(position, data); return 0; } diff --git a/Ryujinx.HLE/HOS/Services/Am/ISystemAppletProxy.cs b/Ryujinx.HLE/HOS/Services/Am/ISystemAppletProxy.cs index 85e11e0f..e8a442ae 100644 --- a/Ryujinx.HLE/HOS/Services/Am/ISystemAppletProxy.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ISystemAppletProxy.cs @@ -5,13 +5,13 @@ namespace Ryujinx.HLE.HOS.Services.Am { class ISystemAppletProxy : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; public ISystemAppletProxy() { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { { 0, GetCommonStateGetter }, { 1, GetSelfController }, @@ -26,72 +26,72 @@ namespace Ryujinx.HLE.HOS.Services.Am }; } - public long GetCommonStateGetter(ServiceCtx Context) + public long GetCommonStateGetter(ServiceCtx context) { - MakeObject(Context, new ICommonStateGetter(Context.Device.System)); + MakeObject(context, new ICommonStateGetter(context.Device.System)); return 0; } - public long GetSelfController(ServiceCtx Context) + public long GetSelfController(ServiceCtx context) { - MakeObject(Context, new ISelfController(Context.Device.System)); + MakeObject(context, new ISelfController(context.Device.System)); return 0; } - public long GetWindowController(ServiceCtx Context) + public long GetWindowController(ServiceCtx context) { - MakeObject(Context, new IWindowController()); + MakeObject(context, new IWindowController()); return 0; } - public long GetAudioController(ServiceCtx Context) + public long GetAudioController(ServiceCtx context) { - MakeObject(Context, new IAudioController()); + MakeObject(context, new IAudioController()); return 0; } - public long GetDisplayController(ServiceCtx Context) + public long GetDisplayController(ServiceCtx context) { - MakeObject(Context, new IDisplayController()); + MakeObject(context, new IDisplayController()); return 0; } - public long GetLibraryAppletCreator(ServiceCtx Context) + public long GetLibraryAppletCreator(ServiceCtx context) { - MakeObject(Context, new ILibraryAppletCreator()); + MakeObject(context, new ILibraryAppletCreator()); return 0; } - public long GetHomeMenuFunctions(ServiceCtx Context) + public long GetHomeMenuFunctions(ServiceCtx context) { - MakeObject(Context, new IHomeMenuFunctions(Context.Device.System)); + MakeObject(context, new IHomeMenuFunctions(context.Device.System)); return 0; } - public long GetGlobalStateController(ServiceCtx Context) + public long GetGlobalStateController(ServiceCtx context) { - MakeObject(Context, new IGlobalStateController()); + MakeObject(context, new IGlobalStateController()); return 0; } - public long GetApplicationCreator(ServiceCtx Context) + public long GetApplicationCreator(ServiceCtx context) { - MakeObject(Context, new IApplicationCreator()); + MakeObject(context, new IApplicationCreator()); return 0; } - public long GetDebugFunctions(ServiceCtx Context) + public long GetDebugFunctions(ServiceCtx context) { - MakeObject(Context, new IDebugFunctions()); + MakeObject(context, new IDebugFunctions()); return 0; } diff --git a/Ryujinx.HLE/HOS/Services/Am/IWindowController.cs b/Ryujinx.HLE/HOS/Services/Am/IWindowController.cs index de5137d1..aca7a666 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IWindowController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IWindowController.cs @@ -6,29 +6,29 @@ namespace Ryujinx.HLE.HOS.Services.Am { class IWindowController : IpcService { - private Dictionary<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; public IWindowController() { - m_Commands = new Dictionary<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { { 1, GetAppletResourceUserId }, { 10, AcquireForegroundRights } }; } - public long GetAppletResourceUserId(ServiceCtx Context) + public long GetAppletResourceUserId(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); - Context.ResponseData.Write(0L); + context.ResponseData.Write(0L); return 0; } - public long AcquireForegroundRights(ServiceCtx Context) + public long AcquireForegroundRights(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); diff --git a/Ryujinx.HLE/HOS/Services/Am/StorageHelper.cs b/Ryujinx.HLE/HOS/Services/Am/StorageHelper.cs index b97ffc1e..39a4c6dd 100644 --- a/Ryujinx.HLE/HOS/Services/Am/StorageHelper.cs +++ b/Ryujinx.HLE/HOS/Services/Am/StorageHelper.cs @@ -9,18 +9,18 @@ namespace Ryujinx.HLE.HOS.Services.Am public static byte[] MakeLaunchParams() { //Size needs to be at least 0x88 bytes otherwise application errors. - using (MemoryStream MS = new MemoryStream()) + using (MemoryStream ms = new MemoryStream()) { - BinaryWriter Writer = new BinaryWriter(MS); + BinaryWriter writer = new BinaryWriter(ms); - MS.SetLength(0x88); + 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 + 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(); + return ms.ToArray(); } } } |
