Refactoring result codes (#731)

* refactoring result codes

- Add a main enum who can handle some orphalin result codes and the default `ResultCode.Success` one.
- Add sub-enum by services when it's needed.
- Remove some empty line.
- Recast all service calls to ResultCode.
- Remove some unneeded static declaration.
- Delete unused `NvHelper` class.

* NvResult is back

* Fix
This commit is contained in:
Ac_K 2019-07-14 21:04:38 +02:00 committed by gdkchan
parent 4926f6523d
commit 4ad3936afd
147 changed files with 1413 additions and 1477 deletions

View file

@ -1,7 +0,0 @@
namespace Ryujinx.HLE.HOS.Services.Am
{
static class AmErr
{
public const int NoMessages = 3;
}
}

View file

@ -7,11 +7,11 @@ namespace Ryujinx.HLE.HOS.Services.Am
[Command(100)]
// OpenSystemAppletProxy(u64, pid, handle<copy>) -> object<nn::am::service::ISystemAppletProxy>
public long OpenSystemAppletProxy(ServiceCtx context)
public ResultCode OpenSystemAppletProxy(ServiceCtx context)
{
MakeObject(context, new ISystemAppletProxy());
return 0;
return ResultCode.Success;
}
}
}

View file

@ -8,17 +8,17 @@ namespace Ryujinx.HLE.HOS.Services.Am
[Command(1)]
// PopLaunchParameter(u32) -> object<nn::am::service::IStorage>
public long PopLaunchParameter(ServiceCtx context)
public ResultCode PopLaunchParameter(ServiceCtx context)
{
// Only the first 0x18 bytes of the Data seems to be actually used.
MakeObject(context, new IStorage(StorageHelper.MakeLaunchParams()));
return 0;
return ResultCode.Success;
}
[Command(20)]
// EnsureSaveData(nn::account::Uid) -> u64
public long EnsureSaveData(ServiceCtx context)
public ResultCode EnsureSaveData(ServiceCtx context)
{
long uIdLow = context.RequestData.ReadInt64();
long uIdHigh = context.RequestData.ReadInt64();
@ -27,21 +27,21 @@ namespace Ryujinx.HLE.HOS.Services.Am
context.ResponseData.Write(0L);
return 0;
return ResultCode.Success;
}
[Command(21)]
// GetDesiredLanguage() -> nn::settings::LanguageCode
public long GetDesiredLanguage(ServiceCtx context)
public ResultCode GetDesiredLanguage(ServiceCtx context)
{
context.ResponseData.Write(context.Device.System.State.DesiredLanguageCode);
return 0;
return ResultCode.Success;
}
[Command(22)]
// SetTerminateResult(u32)
public long SetTerminateResult(ServiceCtx context)
public ResultCode SetTerminateResult(ServiceCtx context)
{
int errorCode = context.RequestData.ReadInt32();
@ -49,7 +49,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
Logger.PrintInfo(LogClass.ServiceAm, $"Result = 0x{errorCode:x8} ({result}).");
return 0;
return ResultCode.Success;
}
private string GetFormattedErrorCode(int errorCode)
@ -62,54 +62,54 @@ namespace Ryujinx.HLE.HOS.Services.Am
[Command(23)]
// GetDisplayVersion() -> nn::oe::DisplayVersion
public long GetDisplayVersion(ServiceCtx context)
public ResultCode GetDisplayVersion(ServiceCtx context)
{
// FIXME: Need to check correct version on a switch.
context.ResponseData.Write(1L);
context.ResponseData.Write(0L);
return 0;
return ResultCode.Success;
}
[Command(40)]
// NotifyRunning() -> b8
public long NotifyRunning(ServiceCtx context)
public ResultCode NotifyRunning(ServiceCtx context)
{
context.ResponseData.Write(1);
return 0;
return ResultCode.Success;
}
[Command(50)] // 2.0.0+
// GetPseudoDeviceId() -> nn::util::Uuid
public long GetPseudoDeviceId(ServiceCtx context)
public ResultCode GetPseudoDeviceId(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
context.ResponseData.Write(0L);
context.ResponseData.Write(0L);
return 0;
return ResultCode.Success;
}
[Command(66)] // 3.0.0+
// InitializeGamePlayRecording(u64, handle<copy>)
public long InitializeGamePlayRecording(ServiceCtx context)
public ResultCode InitializeGamePlayRecording(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(67)] // 3.0.0+
// SetGamePlayRecordingState(u32)
public long SetGamePlayRecordingState(ServiceCtx context)
public ResultCode SetGamePlayRecordingState(ServiceCtx context)
{
int state = context.RequestData.ReadInt32();
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
}
}

View file

@ -6,74 +6,74 @@ namespace Ryujinx.HLE.HOS.Services.Am
[Command(0)]
// GetCommonStateGetter() -> object<nn::am::service::ICommonStateGetter>
public long GetCommonStateGetter(ServiceCtx context)
public ResultCode GetCommonStateGetter(ServiceCtx context)
{
MakeObject(context, new ICommonStateGetter(context.Device.System));
return 0;
return ResultCode.Success;
}
[Command(1)]
// GetSelfController() -> object<nn::am::service::ISelfController>
public long GetSelfController(ServiceCtx context)
public ResultCode GetSelfController(ServiceCtx context)
{
MakeObject(context, new ISelfController(context.Device.System));
return 0;
return ResultCode.Success;
}
[Command(2)]
// GetWindowController() -> object<nn::am::service::IWindowController>
public long GetWindowController(ServiceCtx context)
public ResultCode GetWindowController(ServiceCtx context)
{
MakeObject(context, new IWindowController());
return 0;
return ResultCode.Success;
}
[Command(3)]
// GetAudioController() -> object<nn::am::service::IAudioController>
public long GetAudioController(ServiceCtx context)
public ResultCode GetAudioController(ServiceCtx context)
{
MakeObject(context, new IAudioController());
return 0;
return ResultCode.Success;
}
[Command(4)]
// GetDisplayController() -> object<nn::am::service::IDisplayController>
public long GetDisplayController(ServiceCtx context)
public ResultCode GetDisplayController(ServiceCtx context)
{
MakeObject(context, new IDisplayController());
return 0;
return ResultCode.Success;
}
[Command(11)]
// GetLibraryAppletCreator() -> object<nn::am::service::ILibraryAppletCreator>
public long GetLibraryAppletCreator(ServiceCtx context)
public ResultCode GetLibraryAppletCreator(ServiceCtx context)
{
MakeObject(context, new ILibraryAppletCreator());
return 0;
return ResultCode.Success;
}
[Command(20)]
// GetApplicationFunctions() -> object<nn::am::service::IApplicationFunctions>
public long GetApplicationFunctions(ServiceCtx context)
public ResultCode GetApplicationFunctions(ServiceCtx context)
{
MakeObject(context, new IApplicationFunctions());
return 0;
return ResultCode.Success;
}
[Command(1000)]
// GetDebugFunctions() -> object<nn::am::service::IDebugFunctions>
public long GetDebugFunctions(ServiceCtx context)
public ResultCode GetDebugFunctions(ServiceCtx context)
{
MakeObject(context, new IDebugFunctions());
return 0;
return ResultCode.Success;
}
}
}

View file

@ -7,11 +7,11 @@ namespace Ryujinx.HLE.HOS.Services.Am
[Command(0)]
// OpenApplicationProxy(u64, pid, handle<copy>) -> object<nn::am::service::IApplicationProxy>
public long OpenApplicationProxy(ServiceCtx context)
public ResultCode OpenApplicationProxy(ServiceCtx context)
{
MakeObject(context, new IApplicationProxy());
return 0;
return ResultCode.Success;
}
}
}

View file

@ -8,59 +8,59 @@ namespace Ryujinx.HLE.HOS.Services.Am
[Command(0)]
// SetExpectedMasterVolume(f32, f32)
public long SetExpectedMasterVolume(ServiceCtx context)
public ResultCode SetExpectedMasterVolume(ServiceCtx context)
{
float appletVolume = context.RequestData.ReadSingle();
float libraryAppletVolume = context.RequestData.ReadSingle();
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(1)]
// GetMainAppletExpectedMasterVolume() -> f32
public long GetMainAppletExpectedMasterVolume(ServiceCtx context)
public ResultCode GetMainAppletExpectedMasterVolume(ServiceCtx context)
{
context.ResponseData.Write(1f);
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(2)]
// GetLibraryAppletExpectedMasterVolume() -> f32
public long GetLibraryAppletExpectedMasterVolume(ServiceCtx context)
public ResultCode GetLibraryAppletExpectedMasterVolume(ServiceCtx context)
{
context.ResponseData.Write(1f);
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(3)]
// ChangeMainAppletMasterVolume(f32, u64)
public long ChangeMainAppletMasterVolume(ServiceCtx context)
public ResultCode ChangeMainAppletMasterVolume(ServiceCtx context)
{
float unknown0 = context.RequestData.ReadSingle();
long unknown1 = context.RequestData.ReadInt64();
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(4)]
// SetTransparentVolumeRate(f32)
public long SetTransparentVolumeRate(ServiceCtx context)
public ResultCode SetTransparentVolumeRate(ServiceCtx context)
{
float unknown0 = context.RequestData.ReadSingle();
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
}
}

View file

@ -4,8 +4,6 @@ using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading;
using System;
using static Ryujinx.HLE.HOS.ErrorCode;
namespace Ryujinx.HLE.HOS.Services.Am
{
class ICommonStateGetter : IpcService
@ -19,7 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
[Command(0)]
// GetEventHandle() -> handle<copy>
public long GetEventHandle(ServiceCtx context)
public ResultCode GetEventHandle(ServiceCtx context)
{
KEvent Event = context.Device.System.AppletState.MessageEvent;
@ -30,26 +28,26 @@ namespace Ryujinx.HLE.HOS.Services.Am
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
return 0;
return ResultCode.Success;
}
[Command(1)]
// ReceiveMessage() -> nn::am::AppletMessage
public long ReceiveMessage(ServiceCtx context)
public ResultCode ReceiveMessage(ServiceCtx context)
{
if (!context.Device.System.AppletState.TryDequeueMessage(out MessageInfo message))
{
return MakeError(ErrorModule.Am, AmErr.NoMessages);
return ResultCode.NoMessages;
}
context.ResponseData.Write((int)message);
return 0;
return ResultCode.Success;
}
[Command(5)]
// GetOperationMode() -> u8
public long GetOperationMode(ServiceCtx context)
public ResultCode GetOperationMode(ServiceCtx context)
{
OperationMode mode = context.Device.System.State.DockedMode
? OperationMode.Docked
@ -57,12 +55,12 @@ namespace Ryujinx.HLE.HOS.Services.Am
context.ResponseData.Write((byte)mode);
return 0;
return ResultCode.Success;
}
[Command(6)]
// GetPerformanceMode() -> u32
public long GetPerformanceMode(ServiceCtx context)
public ResultCode GetPerformanceMode(ServiceCtx context)
{
Apm.PerformanceMode mode = context.Device.System.State.DockedMode
? Apm.PerformanceMode.Docked
@ -70,42 +68,42 @@ namespace Ryujinx.HLE.HOS.Services.Am
context.ResponseData.Write((int)mode);
return 0;
return ResultCode.Success;
}
[Command(8)]
// GetBootMode() -> u8
public long GetBootMode(ServiceCtx context)
public ResultCode GetBootMode(ServiceCtx context)
{
context.ResponseData.Write((byte)0); //Unknown value.
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(9)]
// GetCurrentFocusState() -> u8
public long GetCurrentFocusState(ServiceCtx context)
public ResultCode GetCurrentFocusState(ServiceCtx context)
{
context.ResponseData.Write((byte)context.Device.System.AppletState.FocusState);
return 0;
return ResultCode.Success;
}
[Command(60)] // 3.0.0+
// GetDefaultDisplayResolution() -> (u32, u32)
public long GetDefaultDisplayResolution(ServiceCtx context)
public ResultCode GetDefaultDisplayResolution(ServiceCtx context)
{
context.ResponseData.Write(1280);
context.ResponseData.Write(720);
return 0;
return ResultCode.Success;
}
[Command(61)] // 3.0.0+
// GetDefaultDisplayResolutionChangeEvent() -> handle<copy>
public long GetDefaultDisplayResolutionChangeEvent(ServiceCtx context)
public ResultCode GetDefaultDisplayResolutionChangeEvent(ServiceCtx context)
{
if (context.Process.HandleTable.GenerateHandle(_displayResolutionChangeEvent.ReadableEvent, out int handle) != KernelResult.Success)
{
@ -116,7 +114,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
}
}

View file

@ -18,16 +18,16 @@ namespace Ryujinx.HLE.HOS.Services.Am
[Command(10)]
// RequestToGetForeground()
public long RequestToGetForeground(ServiceCtx context)
public ResultCode RequestToGetForeground(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(21)]
// GetPopFromGeneralChannelEvent() -> handle<copy>
public long GetPopFromGeneralChannelEvent(ServiceCtx context)
public ResultCode GetPopFromGeneralChannelEvent(ServiceCtx context)
{
if (context.Process.HandleTable.GenerateHandle(_channelEvent.ReadableEvent, out int handle) != KernelResult.Success)
{
@ -38,7 +38,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
}
}

View file

@ -17,7 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
[Command(0)]
// GetAppletStateChangedEvent() -> handle<copy>
public long GetAppletStateChangedEvent(ServiceCtx context)
public ResultCode GetAppletStateChangedEvent(ServiceCtx context)
{
_stateChangedEvent.ReadableEvent.Signal();
@ -30,43 +30,43 @@ namespace Ryujinx.HLE.HOS.Services.Am
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(10)]
// Start()
public long Start(ServiceCtx context)
public ResultCode Start(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(30)]
// GetResult()
public long GetResult(ServiceCtx context)
public ResultCode GetResult(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(100)]
// PushInData(object<nn::am::service::IStorage>)
public long PushInData(ServiceCtx context)
public ResultCode PushInData(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(101)]
// PopOutData() -> object<nn::am::service::IStorage>
public long PopOutData(ServiceCtx context)
public ResultCode PopOutData(ServiceCtx context)
{
MakeObject(context, new IStorage(StorageHelper.MakeLaunchParams()));
return 0;
return ResultCode.Success;
}
}
}

View file

@ -6,22 +6,22 @@ namespace Ryujinx.HLE.HOS.Services.Am
[Command(0)]
// CreateLibraryApplet(u32, u32) -> object<nn::am::service::ILibraryAppletAccessor>
public long CreateLibraryApplet(ServiceCtx context)
public ResultCode CreateLibraryApplet(ServiceCtx context)
{
MakeObject(context, new ILibraryAppletAccessor(context.Device.System));
return 0;
return ResultCode.Success;
}
[Command(10)]
// CreateStorage(u64) -> object<nn::am::service::IStorage>
public long CreateStorage(ServiceCtx context)
public ResultCode CreateStorage(ServiceCtx context)
{
long size = context.RequestData.ReadInt64();
MakeObject(context, new IStorage(new byte[size]));
return 0;
return ResultCode.Success;
}
}
}

View file

@ -22,34 +22,34 @@ namespace Ryujinx.HLE.HOS.Services.Am
[Command(0)]
// Exit()
public long Exit(ServiceCtx context)
public ResultCode Exit(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(1)]
// LockExit()
public long LockExit(ServiceCtx context)
public ResultCode LockExit(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(2)]
// UnlockExit()
public long UnlockExit(ServiceCtx context)
public ResultCode UnlockExit(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(9)]
// GetLibraryAppletLaunchableEvent() -> handle<copy>
public long GetLibraryAppletLaunchableEvent(ServiceCtx context)
public ResultCode GetLibraryAppletLaunchableEvent(ServiceCtx context)
{
_libraryAppletLaunchableEvent.ReadableEvent.Signal();
@ -62,45 +62,45 @@ namespace Ryujinx.HLE.HOS.Services.Am
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(10)]
// SetScreenShotPermission(u32)
public long SetScreenShotPermission(ServiceCtx context)
public ResultCode SetScreenShotPermission(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(11)]
// SetOperationModeChangedNotification(b8)
public long SetOperationModeChangedNotification(ServiceCtx context)
public ResultCode SetOperationModeChangedNotification(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(12)]
// SetPerformanceModeChangedNotification(b8)
public long SetPerformanceModeChangedNotification(ServiceCtx context)
public ResultCode SetPerformanceModeChangedNotification(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(13)]
// SetFocusHandlingMode(b8, b8, b8)
public long SetFocusHandlingMode(ServiceCtx context)
public ResultCode SetFocusHandlingMode(ServiceCtx context)
{
bool flag1 = context.RequestData.ReadByte() != 0;
bool flag2 = context.RequestData.ReadByte() != 0;
@ -108,77 +108,77 @@ namespace Ryujinx.HLE.HOS.Services.Am
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(14)]
// SetRestartMessageEnabled(b8)
public long SetRestartMessageEnabled(ServiceCtx context)
public ResultCode SetRestartMessageEnabled(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(16)] // 2.0.0+
// SetOutOfFocusSuspendingEnabled(b8)
public long SetOutOfFocusSuspendingEnabled(ServiceCtx context)
public ResultCode SetOutOfFocusSuspendingEnabled(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(19)] // 3.0.0+
public long SetScreenShotImageOrientation(ServiceCtx context)
public ResultCode SetScreenShotImageOrientation(ServiceCtx context)
{
int orientation = context.RequestData.ReadInt32();
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(50)]
// SetHandlesRequestToDisplay(b8)
public long SetHandlesRequestToDisplay(ServiceCtx context)
public ResultCode SetHandlesRequestToDisplay(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
[Command(62)]
// SetIdleTimeDetectionExtension(u32)
public long SetIdleTimeDetectionExtension(ServiceCtx context)
public ResultCode SetIdleTimeDetectionExtension(ServiceCtx context)
{
_idleTimeDetectionExtension = context.RequestData.ReadInt32();
Logger.PrintStub(LogClass.ServiceAm, new { _idleTimeDetectionExtension });
return 0;
return ResultCode.Success;
}
[Command(63)]
// GetIdleTimeDetectionExtension() -> u32
public long GetIdleTimeDetectionExtension(ServiceCtx context)
public ResultCode GetIdleTimeDetectionExtension(ServiceCtx context)
{
context.ResponseData.Write(_idleTimeDetectionExtension);
Logger.PrintStub(LogClass.ServiceAm, new { _idleTimeDetectionExtension });
return 0;
return ResultCode.Success;
}
[Command(91)] // 6.0.0+
// GetAccumulatedSuspendedTickChangedEvent() -> handle<copy>
public long GetAccumulatedSuspendedTickChangedEvent(ServiceCtx context)
public ResultCode GetAccumulatedSuspendedTickChangedEvent(ServiceCtx context)
{
if (_accumulatedSuspendedTickChangedEventHandle == 0)
{
@ -194,7 +194,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_accumulatedSuspendedTickChangedEventHandle);
return 0;
return ResultCode.Success;
}
}
}

View file

@ -11,11 +11,11 @@ namespace Ryujinx.HLE.HOS.Services.Am
[Command(0)]
// Open() -> object<nn::am::service::IStorageAccessor>
public long Open(ServiceCtx context)
public ResultCode Open(ServiceCtx context)
{
MakeObject(context, new IStorageAccessor(this));
return 0;
return ResultCode.Success;
}
}
}

View file

@ -13,16 +13,16 @@ namespace Ryujinx.HLE.HOS.Services.Am
[Command(0)]
// GetSize() -> u64
public long GetSize(ServiceCtx context)
public ResultCode GetSize(ServiceCtx context)
{
context.ResponseData.Write((long)_storage.Data.Length);
return 0;
return ResultCode.Success;
}
[Command(10)]
// Write(u64, buffer<bytes, 0x21>)
public long Write(ServiceCtx context)
public ResultCode Write(ServiceCtx context)
{
// TODO: Error conditions.
long writePosition = context.RequestData.ReadInt64();
@ -43,12 +43,12 @@ namespace Ryujinx.HLE.HOS.Services.Am
Buffer.BlockCopy(data, 0, _storage.Data, (int)writePosition, (int)size);
}
return 0;
return ResultCode.Success;
}
[Command(11)]
// Read(u64) -> buffer<bytes, 0x22>
public long Read(ServiceCtx context)
public ResultCode Read(ServiceCtx context)
{
// TODO: Error conditions.
long readPosition = context.RequestData.ReadInt64();
@ -70,7 +70,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
context.Memory.WriteBytes(position, data);
return 0;
return ResultCode.Success;
}
}
}

View file

@ -6,92 +6,92 @@ namespace Ryujinx.HLE.HOS.Services.Am
[Command(0)]
// GetCommonStateGetter() -> object<nn::am::service::ICommonStateGetter>
public long GetCommonStateGetter(ServiceCtx context)
public ResultCode GetCommonStateGetter(ServiceCtx context)
{
MakeObject(context, new ICommonStateGetter(context.Device.System));
return 0;
return ResultCode.Success;
}
[Command(1)]
// GetSelfController() -> object<nn::am::service::ISelfController>
public long GetSelfController(ServiceCtx context)
public ResultCode GetSelfController(ServiceCtx context)
{
MakeObject(context, new ISelfController(context.Device.System));
return 0;
return ResultCode.Success;
}
[Command(2)]
// GetWindowController() -> object<nn::am::service::IWindowController>
public long GetWindowController(ServiceCtx context)
public ResultCode GetWindowController(ServiceCtx context)
{
MakeObject(context, new IWindowController());
return 0;
return ResultCode.Success;
}
[Command(3)]
// GetAudioController() -> object<nn::am::service::IAudioController>
public long GetAudioController(ServiceCtx context)
public ResultCode GetAudioController(ServiceCtx context)
{
MakeObject(context, new IAudioController());
return 0;
return ResultCode.Success;
}
[Command(4)]
// GetDisplayController() -> object<nn::am::service::IDisplayController>
public long GetDisplayController(ServiceCtx context)
public ResultCode GetDisplayController(ServiceCtx context)
{
MakeObject(context, new IDisplayController());
return 0;
return ResultCode.Success;
}
[Command(11)]
// GetLibraryAppletCreator() -> object<nn::am::service::ILibraryAppletCreator>
public long GetLibraryAppletCreator(ServiceCtx context)
public ResultCode GetLibraryAppletCreator(ServiceCtx context)
{
MakeObject(context, new ILibraryAppletCreator());
return 0;
return ResultCode.Success;
}
[Command(20)]
// GetHomeMenuFunctions() -> object<nn::am::service::IHomeMenuFunctions>
public long GetHomeMenuFunctions(ServiceCtx context)
public ResultCode GetHomeMenuFunctions(ServiceCtx context)
{
MakeObject(context, new IHomeMenuFunctions(context.Device.System));
return 0;
return ResultCode.Success;
}
[Command(21)]
// GetGlobalStateController() -> object<nn::am::service::IGlobalStateController>
public long GetGlobalStateController(ServiceCtx context)
public ResultCode GetGlobalStateController(ServiceCtx context)
{
MakeObject(context, new IGlobalStateController());
return 0;
return ResultCode.Success;
}
[Command(22)]
// GetApplicationCreator() -> object<nn::am::service::IApplicationCreator>
public long GetApplicationCreator(ServiceCtx context)
public ResultCode GetApplicationCreator(ServiceCtx context)
{
MakeObject(context, new IApplicationCreator());
return 0;
return ResultCode.Success;
}
[Command(1000)]
// GetDebugFunctions() -> object<nn::am::service::IDebugFunctions>
public long GetDebugFunctions(ServiceCtx context)
public ResultCode GetDebugFunctions(ServiceCtx context)
{
MakeObject(context, new IDebugFunctions());
return 0;
return ResultCode.Success;
}
}
}

View file

@ -8,22 +8,22 @@ namespace Ryujinx.HLE.HOS.Services.Am
[Command(1)]
// GetAppletResourceUserId() -> nn::applet::AppletResourceUserId
public long GetAppletResourceUserId(ServiceCtx context)
public ResultCode GetAppletResourceUserId(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
context.ResponseData.Write(0L);
return 0;
return ResultCode.Success;
}
[Command(10)]
// AcquireForegroundRights()
public long AcquireForegroundRights(ServiceCtx context)
public ResultCode AcquireForegroundRights(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
return 0;
return ResultCode.Success;
}
}
}

View file

@ -0,0 +1,12 @@
namespace Ryujinx.HLE.HOS.Services.Am
{
enum ResultCode
{
ModuleId = 128,
ErrorCodeShift = 9,
Success = 0,
NoMessages = (3 << ErrorCodeShift) | ModuleId
}
}