Revert "Adjust naming conventions and general refactoring in HLE Project (#490)" (#526)

This reverts commit 85dbb9559a.
This commit is contained in:
gdkchan 2018-12-04 22:52:39 -02:00 committed by GitHub
parent 85dbb9559a
commit 3615a70cae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
299 changed files with 12276 additions and 12268 deletions

View file

@ -5,21 +5,21 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class IAllSystemAppletProxiesService : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public IAllSystemAppletProxiesService()
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_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;
}

View file

@ -5,13 +5,13 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class IApplicationCreator : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public IApplicationCreator()
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
//...
};

View file

@ -6,13 +6,13 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class IApplicationFunctions : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public IApplicationFunctions()
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_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.");

View file

@ -5,13 +5,13 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class IApplicationProxy : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public IApplicationProxy()
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_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;
}

View file

@ -5,21 +5,21 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class IApplicationProxyService : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public IApplicationProxyService()
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_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;
}

View file

@ -6,13 +6,13 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class IAudioController : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public IAudioController()
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_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.");

View file

@ -10,15 +10,15 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class ICommonStateGetter : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
private KEvent _displayResolutionChangeEvent;
private KEvent DisplayResolutionChangeEvent;
public ICommonStateGetter(Horizon system)
public ICommonStateGetter(Horizon System)
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_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.");

View file

@ -5,13 +5,13 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class IDebugFunctions : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public IDebugFunctions()
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
//...
};

View file

@ -5,13 +5,13 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class IDisplayController : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public IDisplayController()
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
//...
};

View file

@ -5,13 +5,13 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class IGlobalStateController : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public IGlobalStateController()
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
//...
};

View file

@ -8,39 +8,39 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class IHomeMenuFunctions : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
private KEvent _channelEvent;
private KEvent ChannelEvent;
public IHomeMenuFunctions(Horizon system)
public IHomeMenuFunctions(Horizon System)
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_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.");

View file

@ -8,15 +8,15 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class ILibraryAppletAccessor : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
private KEvent _stateChangedEvent;
private KEvent StateChangedEvent;
public ILibraryAppletAccessor(Horizon system)
public ILibraryAppletAccessor(Horizon System)
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_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;
}

View file

@ -5,31 +5,31 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class ILibraryAppletCreator : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public ILibraryAppletCreator()
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_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;
}

View file

@ -8,17 +8,17 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class ISelfController : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
private KEvent _launchableEvent;
private KEvent LaunchableEvent;
private int _idleTimeDetectionExtension;
private int IdleTimeDetectionExtension;
public ISelfController(Horizon system)
public ISelfController(Horizon System)
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_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;
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Logger.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
public long SetOperationModeChangedNotification(ServiceCtx context)
public long SetOperationModeChangedNotification(ServiceCtx Context)
{
bool enable = context.RequestData.ReadByte() != 0;
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Logger.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
public long SetPerformanceModeChangedNotification(ServiceCtx context)
public long SetPerformanceModeChangedNotification(ServiceCtx Context)
{
bool enable = context.RequestData.ReadByte() != 0;
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Logger.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
public long SetFocusHandlingMode(ServiceCtx context)
public long SetFocusHandlingMode(ServiceCtx Context)
{
bool flag1 = context.RequestData.ReadByte() != 0;
bool flag2 = context.RequestData.ReadByte() != 0;
bool flag3 = context.RequestData.ReadByte() != 0;
bool Flag1 = Context.RequestData.ReadByte() != 0 ? true : false;
bool Flag2 = Context.RequestData.ReadByte() != 0 ? true : false;
bool Flag3 = Context.RequestData.ReadByte() != 0 ? true : false;
Logger.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
public long SetRestartMessageEnabled(ServiceCtx context)
public long SetRestartMessageEnabled(ServiceCtx Context)
{
bool enable = context.RequestData.ReadByte() != 0;
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Logger.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
public long SetOutOfFocusSuspendingEnabled(ServiceCtx context)
public long SetOutOfFocusSuspendingEnabled(ServiceCtx Context)
{
bool enable = context.RequestData.ReadByte() != 0;
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
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;
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
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;
}

View file

@ -5,25 +5,25 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class IStorage : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public byte[] Data { get; }
public byte[] Data { get; private set; }
public IStorage(byte[] data)
public IStorage(byte[] Data)
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 0, Open }
};
Data = data;
this.Data = Data;
}
public long Open(ServiceCtx context)
public long Open(ServiceCtx Context)
{
MakeObject(context, new IStorageAccessor(this));
MakeObject(Context, new IStorageAccessor(this));
return 0;
}

View file

@ -6,76 +6,76 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class IStorageAccessor : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
private IStorage _storage;
private IStorage Storage;
public IStorageAccessor(IStorage storage)
public IStorageAccessor(IStorage Storage)
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 0, GetSize },
{ 10, Write },
{ 11, Read }
};
_storage = storage;
this.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;
}

View file

@ -5,13 +5,13 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class ISystemAppletProxy : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public ISystemAppletProxy()
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_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;
}

View file

@ -6,29 +6,29 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class IWindowController : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public IWindowController()
{
_commands = new Dictionary<int, ServiceProcessRequest>
m_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.");

View file

@ -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();
}
}
}