From 4ad3936afd4ca393a05b330e3848958e9598e910 Mon Sep 17 00:00:00 2001 From: Ac_K Date: Sun, 14 Jul 2019 21:04:38 +0200 Subject: [PATCH] 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 --- Ryujinx.HLE/HOS/ErrorCode.cs | 10 - Ryujinx.HLE/HOS/ErrorModule.cs | 101 ----- Ryujinx.HLE/HOS/ResultCode.cs | 12 + Ryujinx.HLE/HOS/Services/Acc/AccErr.cs | 15 - .../HOS/Services/Acc/Account/AccountState.cs | 2 +- .../HOS/Services/Acc/Account/UserProfile.cs | 2 +- .../HOS/Services/Acc/IAccountService.cs | 84 ++-- .../Services/Acc/IManagerForApplication.cs | 8 +- Ryujinx.HLE/HOS/Services/Acc/IProfile.cs | 14 +- Ryujinx.HLE/HOS/Services/Acc/ResultCode.cs | 20 + Ryujinx.HLE/HOS/Services/Am/AmErr.cs | 7 - .../Am/IAllSystemAppletProxiesService.cs | 4 +- .../HOS/Services/Am/IApplicationFunctions.cs | 36 +- .../HOS/Services/Am/IApplicationProxy.cs | 32 +- .../Services/Am/IApplicationProxyService.cs | 4 +- .../HOS/Services/Am/IAudioController.cs | 20 +- .../HOS/Services/Am/ICommonStateGetter.cs | 36 +- .../HOS/Services/Am/IHomeMenuFunctions.cs | 8 +- .../HOS/Services/Am/ILibraryAppletAccessor.cs | 20 +- .../HOS/Services/Am/ILibraryAppletCreator.cs | 8 +- .../HOS/Services/Am/ISelfController.cs | 60 +-- Ryujinx.HLE/HOS/Services/Am/IStorage.cs | 4 +- .../HOS/Services/Am/IStorageAccessor.cs | 12 +- .../HOS/Services/Am/ISystemAppletProxy.cs | 40 +- .../HOS/Services/Am/IWindowController.cs | 8 +- Ryujinx.HLE/HOS/Services/Am/ResultCode.cs | 12 + Ryujinx.HLE/HOS/Services/Apm/IManager.cs | 4 +- Ryujinx.HLE/HOS/Services/Apm/ISession.cs | 8 +- .../Services/Apm/PerformanceConfiguration.cs | 2 +- .../HOS/Services/Apm/PerformanceMode.cs | 2 +- Ryujinx.HLE/HOS/Services/Aud/AudErr.cs | 10 - .../HOS/Services/Aud/AudioOut/IAudioOut.cs | 34 +- .../Services/Aud/AudioRenderer/AudioConsts.cs | 2 +- .../Aud/AudioRenderer/BiquadFilter.cs | 2 +- .../Aud/AudioRenderer/IAudioRenderer.cs | 32 +- .../Aud/AudioRenderer/MemoryPoolContext.cs | 2 +- .../Aud/AudioRenderer/MemoryPoolIn.cs | 2 +- .../Aud/AudioRenderer/MemoryPoolOut.cs | 2 +- .../Aud/AudioRenderer/MemoryPoolState.cs | 2 +- .../Services/Aud/AudioRenderer/PlayState.cs | 2 +- .../Aud/AudioRenderer/UpdateDataHeader.cs | 2 +- .../AudioRenderer/VoiceChannelResourceIn.cs | 2 +- .../Aud/AudioRenderer/VoiceContext.cs | 2 +- .../HOS/Services/Aud/AudioRenderer/VoiceIn.cs | 2 +- .../Services/Aud/AudioRenderer/VoiceOut.cs | 2 +- .../Services/Aud/AudioRenderer/WaveBuffer.cs | 2 +- .../Services/Aud/AudioRendererParameter.cs | 2 +- Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs | 44 +- .../HOS/Services/Aud/IAudioOutManager.cs | 22 +- .../HOS/Services/Aud/IAudioRendererManager.cs | 18 +- .../HOS/Services/Aud/IHardwareOpusDecoder.cs | 14 +- .../Aud/IHardwareOpusDecoderManager.cs | 8 +- Ryujinx.HLE/HOS/Services/Aud/ResultCode.cs | 15 + .../HOS/Services/Bcat/IServiceCreator.cs | 10 +- Ryujinx.HLE/HOS/Services/Bsd/BsdIoctl.cs | 2 +- Ryujinx.HLE/HOS/Services/Bsd/IClient.cs | 76 ++-- Ryujinx.HLE/HOS/Services/Bsd/PollEvent.cs | 2 +- .../HOS/Services/Friend/FriendError.cs | 8 - .../Friend/FriendServicePermissionLevel.cs | 2 +- .../HOS/Services/Friend/IFriendService.cs | 32 +- .../Services/Friend/IFriendServiceTypes.cs | 2 +- .../Services/Friend/INotificationService.cs | 16 +- .../HOS/Services/Friend/IServiceCreator.cs | 16 +- Ryujinx.HLE/HOS/Services/Friend/ResultCode.cs | 13 + .../HOS/Services/FspSrv/FileSystemType.cs | 2 +- Ryujinx.HLE/HOS/Services/FspSrv/FsErr.cs | 11 - Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs | 12 +- Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs | 30 +- .../HOS/Services/FspSrv/IFileSystem.cs | 93 ++-- .../HOS/Services/FspSrv/IFileSystemProxy.cs | 71 ++- Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs | 12 +- Ryujinx.HLE/HOS/Services/FspSrv/ResultCode.cs | 16 + Ryujinx.HLE/HOS/Services/Hid/HidNpad.cs | 2 +- Ryujinx.HLE/HOS/Services/Hid/HidSixAxis.cs | 2 +- Ryujinx.HLE/HOS/Services/Hid/HidVibration.cs | 2 +- .../Hid/IActiveVibrationDeviceList.cs | 4 +- .../HOS/Services/Hid/IAppletResource.cs | 4 +- Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs | 408 +++++++++--------- .../HOS/Services/Hid/Irs/IIrSensorServer.cs | 24 +- Ryujinx.HLE/HOS/Services/Hid/Irs/IrsError.cs | 8 - .../HOS/Services/Hid/Irs/ResultCode.cs | 13 + Ryujinx.HLE/HOS/Services/IpcService.cs | 6 +- Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs | 88 ++-- Ryujinx.HLE/HOS/Services/Ldr/LoaderErr.cs | 18 - Ryujinx.HLE/HOS/Services/Ldr/ResultCode.cs | 23 + Ryujinx.HLE/HOS/Services/Lm/ILogService.cs | 4 +- Ryujinx.HLE/HOS/Services/Lm/ILogger.cs | 4 +- .../HOS/Services/Lr/ILocationResolver.cs | 75 ++-- .../Services/Lr/ILocationResolverManager.cs | 4 +- Ryujinx.HLE/HOS/Services/Lr/LrErr.cs | 8 - Ryujinx.HLE/HOS/Services/Lr/ResultCode.cs | 13 + Ryujinx.HLE/HOS/Services/Mm/IRequest.cs | 32 +- Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUser.cs | 80 ++-- .../HOS/Services/Nfc/Nfp/IUserManager.cs | 4 +- Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpError.cs | 8 - .../HOS/Services/Nfc/Nfp/ResultCode.cs | 13 + .../HOS/Services/Nifm/IGeneralService.cs | 12 +- Ryujinx.HLE/HOS/Services/Nifm/IRequest.cs | 24 +- .../HOS/Services/Nifm/IStaticService.cs | 8 +- Ryujinx.HLE/HOS/Services/Nifm/NifmErr.cs | 7 - Ryujinx.HLE/HOS/Services/Nifm/ResultCode.cs | 12 + .../HOS/Services/Ns/IAddOnContentManager.cs | 8 +- .../Ns/IApplicationManagerInterface.cs | 5 +- .../Services/Ns/IServiceGetterInterface.cs | 4 +- Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs | 32 +- Ryujinx.HLE/HOS/Services/Nv/NvHelper.cs | 10 - Ryujinx.HLE/HOS/Services/Nv/NvResult.cs | 2 +- .../Services/Pctl/IParentalControlService.cs | 8 +- .../Pctl/IParentalControlServiceFactory.cs | 8 +- .../HOS/Services/Pl/ISharedFontManager.cs | 24 +- .../HOS/Services/Pm/IShellInterface.cs | 4 +- .../HOS/Services/Prepo/IPrepoService.cs | 4 +- Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs | 12 +- Ryujinx.HLE/HOS/Services/Psm/IPsmSession.cs | 22 +- .../HOS/Services/Set/ISettingsServer.cs | 32 +- .../HOS/Services/Set/ISystemSettingsServer.cs | 22 +- Ryujinx.HLE/HOS/Services/Set/NxSettings.cs | 2 +- Ryujinx.HLE/HOS/Services/Set/ResultCode.cs | 12 + Ryujinx.HLE/HOS/Services/Set/SettingsError.cs | 7 - Ryujinx.HLE/HOS/Services/Sfdnsres/GaiError.cs | 2 +- .../HOS/Services/Sfdnsres/IResolver.cs | 42 +- .../HOS/Services/Sfdnsres/NetDBError.cs | 2 +- Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs | 32 +- Ryujinx.HLE/HOS/Services/Sm/ResultCode.cs | 15 + Ryujinx.HLE/HOS/Services/Sm/SmErr.cs | 10 - .../HOS/Services/Spl/IRandomInterface.cs | 4 +- Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs | 8 +- .../HOS/Services/Time/IStaticService.cs | 29 +- Ryujinx.HLE/HOS/Services/Time/ISteadyClock.cs | 12 +- Ryujinx.HLE/HOS/Services/Time/ISystemClock.cs | 16 +- .../HOS/Services/Time/ITimeZoneService.cs | 40 +- .../Services/Time/ITimeZoneServiceTypes.cs | 2 +- Ryujinx.HLE/HOS/Services/Time/ResultCode.cs | 17 + Ryujinx.HLE/HOS/Services/Time/TimeError.cs | 12 - .../HOS/Services/Time/TimeZone/TimeZone.cs | 56 +-- .../Services/Time/TimeZone/TimeZoneManager.cs | 47 +- Ryujinx.HLE/HOS/Services/Vi/ColorFormat.cs | 2 +- .../Services/Vi/IApplicationDisplayService.cs | 65 ++- .../Services/Vi/IApplicationRootService.cs | 4 +- .../HOS/Services/Vi/IHOSBinderDriver.cs | 16 +- .../HOS/Services/Vi/IManagerDisplayService.cs | 18 +- .../HOS/Services/Vi/IManagerRootService.cs | 4 +- .../HOS/Services/Vi/ISystemDisplayService.cs | 14 +- .../HOS/Services/Vi/ISystemRootService.cs | 4 +- Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs | 28 +- Ryujinx.HLE/HOS/Services/Vi/ResultCode.cs | 13 + Ryujinx.HLE/HOS/Services/Vi/ScalingMode.cs | 2 +- 147 files changed, 1413 insertions(+), 1477 deletions(-) delete mode 100644 Ryujinx.HLE/HOS/ErrorCode.cs delete mode 100644 Ryujinx.HLE/HOS/ErrorModule.cs create mode 100644 Ryujinx.HLE/HOS/ResultCode.cs delete mode 100644 Ryujinx.HLE/HOS/Services/Acc/AccErr.cs create mode 100644 Ryujinx.HLE/HOS/Services/Acc/ResultCode.cs delete mode 100644 Ryujinx.HLE/HOS/Services/Am/AmErr.cs create mode 100644 Ryujinx.HLE/HOS/Services/Am/ResultCode.cs delete mode 100644 Ryujinx.HLE/HOS/Services/Aud/AudErr.cs create mode 100644 Ryujinx.HLE/HOS/Services/Aud/ResultCode.cs delete mode 100644 Ryujinx.HLE/HOS/Services/Friend/FriendError.cs create mode 100644 Ryujinx.HLE/HOS/Services/Friend/ResultCode.cs delete mode 100644 Ryujinx.HLE/HOS/Services/FspSrv/FsErr.cs create mode 100644 Ryujinx.HLE/HOS/Services/FspSrv/ResultCode.cs delete mode 100644 Ryujinx.HLE/HOS/Services/Hid/Irs/IrsError.cs create mode 100644 Ryujinx.HLE/HOS/Services/Hid/Irs/ResultCode.cs delete mode 100644 Ryujinx.HLE/HOS/Services/Ldr/LoaderErr.cs create mode 100644 Ryujinx.HLE/HOS/Services/Ldr/ResultCode.cs delete mode 100644 Ryujinx.HLE/HOS/Services/Lr/LrErr.cs create mode 100644 Ryujinx.HLE/HOS/Services/Lr/ResultCode.cs delete mode 100644 Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpError.cs create mode 100644 Ryujinx.HLE/HOS/Services/Nfc/Nfp/ResultCode.cs delete mode 100644 Ryujinx.HLE/HOS/Services/Nifm/NifmErr.cs create mode 100644 Ryujinx.HLE/HOS/Services/Nifm/ResultCode.cs delete mode 100644 Ryujinx.HLE/HOS/Services/Nv/NvHelper.cs create mode 100644 Ryujinx.HLE/HOS/Services/Set/ResultCode.cs delete mode 100644 Ryujinx.HLE/HOS/Services/Set/SettingsError.cs create mode 100644 Ryujinx.HLE/HOS/Services/Sm/ResultCode.cs delete mode 100644 Ryujinx.HLE/HOS/Services/Sm/SmErr.cs create mode 100644 Ryujinx.HLE/HOS/Services/Time/ResultCode.cs delete mode 100644 Ryujinx.HLE/HOS/Services/Time/TimeError.cs create mode 100644 Ryujinx.HLE/HOS/Services/Vi/ResultCode.cs diff --git a/Ryujinx.HLE/HOS/ErrorCode.cs b/Ryujinx.HLE/HOS/ErrorCode.cs deleted file mode 100644 index 564fa91d..00000000 --- a/Ryujinx.HLE/HOS/ErrorCode.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Ryujinx.HLE.HOS -{ - static class ErrorCode - { - public static uint MakeError(ErrorModule module, int code) - { - return (uint)module | ((uint)code << 9); - } - } -} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/ErrorModule.cs b/Ryujinx.HLE/HOS/ErrorModule.cs deleted file mode 100644 index e13d5e84..00000000 --- a/Ryujinx.HLE/HOS/ErrorModule.cs +++ /dev/null @@ -1,101 +0,0 @@ -namespace Ryujinx.HLE.HOS -{ - enum ErrorModule - { - Kernel = 1, - Fs = 2, - Os = 3, // (Memory, Thread, Mutex, NVIDIA) - Htcs = 4, - Ncm = 5, - Dd = 6, - DebugMonitor = 7, - Lr = 8, - Loader = 9, - IpcCommandInterface = 10, - Ipc = 11, - Pm = 15, - Ns = 16, - Socket = 17, - Htc = 18, - NcmContent = 20, - Sm = 21, - RoUserland = 22, - SdMmc = 24, - Ovln = 25, - Spl = 26, - Ethc = 100, - I2C = 101, - Gpio = 102, - Uart = 103, - Settings = 105, - Wlan = 107, - Xcd = 108, - Nifm = 110, - Hwopus = 111, - Bluetooth = 113, - Vi = 114, - Nfp = 115, - Time = 116, - Fgm = 117, - Oe = 118, - Pcie = 120, - Friends = 121, - Bcat = 122, - Ssl = 123, - Account = 124, - News = 125, - Mii = 126, - Nfc = 127, - Am = 128, - PlayReport = 129, - Ahid = 130, - Qlaunch = 132, - Pcv = 133, - Omm = 134, - Bpc = 135, - Psm = 136, - Nim = 137, - Psc = 138, - Tc = 139, - Usb = 140, - Nsd = 141, - Pctl = 142, - Btm = 143, - Ec = 144, - ETicket = 145, - Ngc = 146, - ErrorReport = 147, - Apm = 148, - Profiler = 150, - ErrorUpload = 151, - Audio = 153, - Npns = 154, - NpnsHttpStream = 155, - Arp = 157, - Swkbd = 158, - Boot = 159, - NfcMifare = 161, - UserlandAssert = 162, - Fatal = 163, - NimShop = 164, - Spsm = 165, - Bgtc = 167, - UserlandCrash = 168, - SRepo = 180, - Dauth = 181, - Hid = 202, - Ldn = 203, - Irsensor = 205, - Capture = 206, - Manu = 208, - Atk = 209, - Web = 210, - Grc = 212, - Migration = 216, - MigrationLdcServer = 217, - GeneralWebApplet = 800, - WifiWebAuthApplet = 809, - WhitelistedApplet = 810, - ShopN = 811 - } -} diff --git a/Ryujinx.HLE/HOS/ResultCode.cs b/Ryujinx.HLE/HOS/ResultCode.cs new file mode 100644 index 00000000..4004357b --- /dev/null +++ b/Ryujinx.HLE/HOS/ResultCode.cs @@ -0,0 +1,12 @@ +namespace Ryujinx.HLE.HOS +{ + public enum ResultCode + { + OsModuleId = 3, + ErrorCodeShift = 9, + + Success = 0, + + NotAllocated = (1023 << ErrorCodeShift) | OsModuleId + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Acc/AccErr.cs b/Ryujinx.HLE/HOS/Services/Acc/AccErr.cs deleted file mode 100644 index 6d770760..00000000 --- a/Ryujinx.HLE/HOS/Services/Acc/AccErr.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Ryujinx.HLE.HOS.Services.Acc -{ - static class AccErr - { - public const int NullArgument = 20; - public const int InvalidArgument = 22; - public const int NullInputBuffer = 30; - public const int InvalidInputBufferSize = 31; - public const int InvalidInputBuffer = 32; - public const int ApplicationLaunchPropertyAlreadyInit = 41; - public const int UserNotFound = 100; - public const int NullObject = 302; - public const int UnknownError1 = 341; - } -} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Acc/Account/AccountState.cs b/Ryujinx.HLE/HOS/Services/Acc/Account/AccountState.cs index 7e7dd841..7ed3c26e 100644 --- a/Ryujinx.HLE/HOS/Services/Acc/Account/AccountState.cs +++ b/Ryujinx.HLE/HOS/Services/Acc/Account/AccountState.cs @@ -5,4 +5,4 @@ namespace Ryujinx.HLE.HOS.SystemState Closed, Open } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Acc/Account/UserProfile.cs b/Ryujinx.HLE/HOS/Services/Acc/Account/UserProfile.cs index 179d6925..d201d6e7 100644 --- a/Ryujinx.HLE/HOS/Services/Acc/Account/UserProfile.cs +++ b/Ryujinx.HLE/HOS/Services/Acc/Account/UserProfile.cs @@ -34,4 +34,4 @@ namespace Ryujinx.HLE.HOS.SystemState LastModifiedTimestamp = (long)(DateTime.Now - Epoch).TotalSeconds; } } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs b/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs index 7176240a..f1f56a18 100644 --- a/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs +++ b/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs @@ -6,8 +6,6 @@ using Ryujinx.HLE.Utilities; using System; using System.Collections.Generic; -using static Ryujinx.HLE.HOS.ErrorCode; - namespace Ryujinx.HLE.HOS.Services.Acc { [Service("acc:u0")] @@ -22,48 +20,48 @@ namespace Ryujinx.HLE.HOS.Services.Acc [Command(0)] // GetUserCount() -> i32 - public long GetUserCount(ServiceCtx context) + public ResultCode GetUserCount(ServiceCtx context) { context.ResponseData.Write(context.Device.System.State.Account.GetUserCount()); - return 0; + return ResultCode.Success; } [Command(1)] // GetUserExistence(nn::account::Uid) -> bool - public long GetUserExistence(ServiceCtx context) + public ResultCode GetUserExistence(ServiceCtx context) { UInt128 userId = new UInt128(context.RequestData.ReadBytes(0x10)); if (userId.IsNull) { - return MakeError(ErrorModule.Account, AccErr.NullArgument); + return ResultCode.NullArgument; } context.ResponseData.Write(context.Device.System.State.Account.TryGetUser(userId, out _)); - return 0; + return ResultCode.Success; } [Command(2)] // ListAllUsers() -> array - public long ListAllUsers(ServiceCtx context) + public ResultCode ListAllUsers(ServiceCtx context) { return WriteUserList(context, context.Device.System.State.Account.GetAllUsers()); } [Command(3)] // ListOpenUsers() -> array - public long ListOpenUsers(ServiceCtx context) + public ResultCode ListOpenUsers(ServiceCtx context) { return WriteUserList(context, context.Device.System.State.Account.GetOpenedUsers()); } - private long WriteUserList(ServiceCtx context, IEnumerable profiles) + private ResultCode WriteUserList(ServiceCtx context, IEnumerable profiles) { if (context.Request.RecvListBuff.Count == 0) { - return MakeError(ErrorModule.Account, AccErr.InvalidInputBuffer); + return ResultCode.InvalidInputBuffer; } long outputPosition = context.Request.RecvListBuff[0].Position; @@ -84,21 +82,21 @@ namespace Ryujinx.HLE.HOS.Services.Acc offset += 0x10; } - return 0; + return ResultCode.Success; } [Command(4)] // GetLastOpenedUser() -> nn::account::Uid - public long GetLastOpenedUser(ServiceCtx context) + public ResultCode GetLastOpenedUser(ServiceCtx context) { context.Device.System.State.Account.LastOpenedUser.UserId.Write(context.ResponseData); - return 0; + return ResultCode.Success; } [Command(5)] // GetProfile(nn::account::Uid) -> object - public long GetProfile(ServiceCtx context) + public ResultCode GetProfile(ServiceCtx context) { UInt128 userId = new UInt128(context.RequestData.ReadBytes(0x10)); @@ -106,7 +104,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc { Logger.PrintWarning(LogClass.ServiceAcc, $"User 0x{userId} not found!"); - return MakeError(ErrorModule.Account, AccErr.UserNotFound); + return ResultCode.UserNotFound; } MakeObject(context, new IProfile(userProfile)); @@ -114,22 +112,22 @@ namespace Ryujinx.HLE.HOS.Services.Acc // Doesn't occur in our case. // return MakeError(ErrorModule.Account, AccErr.NullObject); - return 0; + return ResultCode.Success; } [Command(50)] // IsUserRegistrationRequestPermitted(u64, pid) -> bool - public long IsUserRegistrationRequestPermitted(ServiceCtx context) + public ResultCode IsUserRegistrationRequestPermitted(ServiceCtx context) { // The u64 argument seems to be unused by account. context.ResponseData.Write(_userRegistrationRequestPermitted); - return 0; + return ResultCode.Success; } [Command(51)] // TrySelectUserWithoutInteraction(bool) -> nn::account::Uid - public long TrySelectUserWithoutInteraction(ServiceCtx context) + public ResultCode TrySelectUserWithoutInteraction(ServiceCtx context) { if (context.Device.System.State.Account.GetUserCount() != 1) { @@ -152,18 +150,18 @@ namespace Ryujinx.HLE.HOS.Services.Acc // As we returned an invalid UserId if there is more than one user earlier, now we can return only the first one. context.Device.System.State.Account.GetFirst().UserId.Write(context.ResponseData); - return 0; + return ResultCode.Success; } [Command(100)] [Command(140)] // 6.0.0+ // InitializeApplicationInfo(u64, pid) // Both calls (100, 140) use the same submethod, maybe there's something different further along when arp:r is called? - public long InitializeApplicationInfo(ServiceCtx context) + public ResultCode InitializeApplicationInfo(ServiceCtx context) { if (_applicationLaunchProperty != null) { - return MakeError(ErrorModule.Account, AccErr.ApplicationLaunchPropertyAlreadyInit); + return ResultCode.ApplicationLaunchPropertyAlreadyInit; } // The u64 argument seems to be unused by account. @@ -183,7 +181,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc UpdateGameStorageId = 0x00; } - return MakeError(ErrorModule.Account, AccErr.InvalidArgument); + return ResultCode.InvalidArgument; } else */ @@ -199,52 +197,52 @@ namespace Ryujinx.HLE.HOS.Services.Acc Logger.PrintStub(LogClass.ServiceAcc, new { unknown }); - return 0; + return ResultCode.Success; } [Command(101)] // GetBaasAccountManagerForApplication(nn::account::Uid) -> object - public long GetBaasAccountManagerForApplication(ServiceCtx context) + public ResultCode GetBaasAccountManagerForApplication(ServiceCtx context) { UInt128 userId = new UInt128(context.RequestData.ReadBytes(0x10)); if (userId.IsNull) { - return MakeError(ErrorModule.Account, AccErr.NullArgument); + return ResultCode.NullArgument; } if (_applicationLaunchProperty == null) { - return MakeError(ErrorModule.Account, AccErr.InvalidArgument); + return ResultCode.InvalidArgument; } MakeObject(context, new IManagerForApplication(userId, _applicationLaunchProperty)); // Doesn't occur in our case. - // return MakeError(ErrorModule.Account, AccErr.NullObject); + // return ResultCode.NullObject; - return 0; + return ResultCode.Success; } [Command(110)] // StoreSaveDataThumbnail(nn::account::Uid, buffer) - public long StoreSaveDataThumbnail(ServiceCtx context) + public ResultCode StoreSaveDataThumbnail(ServiceCtx context) { if (_applicationLaunchProperty == null) { - return MakeError(ErrorModule.Account, AccErr.InvalidArgument); + return ResultCode.InvalidArgument; } UInt128 userId = new UInt128(context.RequestData.ReadBytes(0x10)); if (userId.IsNull) { - return MakeError(ErrorModule.Account, AccErr.NullArgument); + return ResultCode.NullArgument; } if (context.Request.SendBuff.Count == 0) { - return MakeError(ErrorModule.Account, AccErr.InvalidInputBuffer); + return ResultCode.InvalidInputBuffer; } long inputPosition = context.Request.SendBuff[0].Position; @@ -252,7 +250,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc if (inputSize != 0x24000) { - return MakeError(ErrorModule.Account, AccErr.InvalidInputBufferSize); + return ResultCode.InvalidInputBufferSize; } byte[] thumbnailBuffer = context.Memory.ReadBytes(inputPosition, inputSize); @@ -261,41 +259,41 @@ namespace Ryujinx.HLE.HOS.Services.Acc Logger.PrintStub(LogClass.ServiceAcc); - return 0; + return ResultCode.Success; } [Command(111)] // ClearSaveDataThumbnail(nn::account::Uid) - public long ClearSaveDataThumbnail(ServiceCtx context) + public ResultCode ClearSaveDataThumbnail(ServiceCtx context) { if (_applicationLaunchProperty == null) { - return MakeError(ErrorModule.Account, AccErr.InvalidArgument); + return ResultCode.InvalidArgument; } UInt128 userId = new UInt128(context.RequestData.ReadBytes(0x10)); if (userId.IsNull) { - return MakeError(ErrorModule.Account, AccErr.NullArgument); + return ResultCode.NullArgument; } // TODO: Clear the Thumbnail somewhere, in save data 0x8000000000000010 ? Logger.PrintStub(LogClass.ServiceAcc); - return 0; + return ResultCode.Success; } [Command(150)] // 6.0.0+ // IsUserAccountSwitchLocked() -> bool - public long IsUserAccountSwitchLocked(ServiceCtx context) + public ResultCode IsUserAccountSwitchLocked(ServiceCtx context) { // TODO : Validate the following check. /* if (_applicationLaunchProperty != null) { - return MakeError(ErrorModule.Account, AccErr.ApplicationLaunchPropertyAlreadyInit); + return ResultCode.ApplicationLaunchPropertyAlreadyInit; } */ @@ -306,7 +304,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc Logger.PrintStub(LogClass.ServiceAcc); - return 0; + return ResultCode.Success; } } } diff --git a/Ryujinx.HLE/HOS/Services/Acc/IManagerForApplication.cs b/Ryujinx.HLE/HOS/Services/Acc/IManagerForApplication.cs index d4e753f4..02cafd25 100644 --- a/Ryujinx.HLE/HOS/Services/Acc/IManagerForApplication.cs +++ b/Ryujinx.HLE/HOS/Services/Acc/IManagerForApplication.cs @@ -17,16 +17,16 @@ namespace Ryujinx.HLE.HOS.Services.Acc [Command(0)] // CheckAvailability() - public long CheckAvailability(ServiceCtx context) + public ResultCode CheckAvailability(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAcc); - return 0; + return ResultCode.Success; } [Command(1)] // GetAccountId() -> nn::account::NetworkServiceAccountId - public long GetAccountId(ServiceCtx context) + public ResultCode GetAccountId(ServiceCtx context) { long networkServiceAccountId = 0xcafe; @@ -34,7 +34,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc context.ResponseData.Write(networkServiceAccountId); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Acc/IProfile.cs b/Ryujinx.HLE/HOS/Services/Acc/IProfile.cs index 6a346068..336aa40d 100644 --- a/Ryujinx.HLE/HOS/Services/Acc/IProfile.cs +++ b/Ryujinx.HLE/HOS/Services/Acc/IProfile.cs @@ -21,7 +21,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc [Command(0)] // Get() -> (nn::account::profile::ProfileBase, buffer) - public long Get(ServiceCtx context) + public ResultCode Get(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAcc); @@ -38,7 +38,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc [Command(1)] // GetBase() -> nn::account::profile::ProfileBase - public long GetBase(ServiceCtx context) + public ResultCode GetBase(ServiceCtx context) { _profile.UserId.Write(context.ResponseData); @@ -48,21 +48,21 @@ namespace Ryujinx.HLE.HOS.Services.Acc context.ResponseData.Write(username); - return 0; + return ResultCode.Success; } [Command(10)] // GetImageSize() -> u32 - private long GetImageSize(ServiceCtx context) + private ResultCode GetImageSize(ServiceCtx context) { context.ResponseData.Write(_profilePictureStream.Length); - return 0; + return ResultCode.Success; } [Command(11)] // LoadImage() -> (u32, buffer) - private long LoadImage(ServiceCtx context) + private ResultCode LoadImage(ServiceCtx context) { long bufferPosition = context.Request.ReceiveBuff[0].Position; long bufferLen = context.Request.ReceiveBuff[0].Size; @@ -75,7 +75,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc context.ResponseData.Write(_profilePictureStream.Length); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Acc/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Acc/ResultCode.cs new file mode 100644 index 00000000..3991875a --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Acc/ResultCode.cs @@ -0,0 +1,20 @@ +namespace Ryujinx.HLE.HOS.Services.Acc +{ + enum ResultCode + { + ModuleId = 124, + ErrorCodeShift = 9, + + Success = 0, + + NullArgument = (20 << ErrorCodeShift) | ModuleId, + InvalidArgument = (22 << ErrorCodeShift) | ModuleId, + NullInputBuffer = (30 << ErrorCodeShift) | ModuleId, + InvalidInputBufferSize = (31 << ErrorCodeShift) | ModuleId, + InvalidInputBuffer = (32 << ErrorCodeShift) | ModuleId, + ApplicationLaunchPropertyAlreadyInit = (41 << ErrorCodeShift) | ModuleId, + UserNotFound = (100 << ErrorCodeShift) | ModuleId, + NullObject = (302 << ErrorCodeShift) | ModuleId, + UnknownError1 = (341 << ErrorCodeShift) | ModuleId + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/AmErr.cs b/Ryujinx.HLE/HOS/Services/Am/AmErr.cs deleted file mode 100644 index 4e7771b8..00000000 --- a/Ryujinx.HLE/HOS/Services/Am/AmErr.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Ryujinx.HLE.HOS.Services.Am -{ - static class AmErr - { - public const int NoMessages = 3; - } -} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs b/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs index 4b712a38..0b667347 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs @@ -7,11 +7,11 @@ namespace Ryujinx.HLE.HOS.Services.Am [Command(100)] // OpenSystemAppletProxy(u64, pid, handle) -> object - public long OpenSystemAppletProxy(ServiceCtx context) + public ResultCode OpenSystemAppletProxy(ServiceCtx context) { MakeObject(context, new ISystemAppletProxy()); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs index a0083b85..03e97dfe 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs @@ -8,17 +8,17 @@ namespace Ryujinx.HLE.HOS.Services.Am [Command(1)] // PopLaunchParameter(u32) -> object - 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) - 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; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/IApplicationProxy.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxy.cs index 2c877b93..0e8e3423 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IApplicationProxy.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxy.cs @@ -6,74 +6,74 @@ namespace Ryujinx.HLE.HOS.Services.Am [Command(0)] // GetCommonStateGetter() -> object - 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 - 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 - public long GetWindowController(ServiceCtx context) + public ResultCode GetWindowController(ServiceCtx context) { MakeObject(context, new IWindowController()); - return 0; + return ResultCode.Success; } [Command(3)] // GetAudioController() -> object - public long GetAudioController(ServiceCtx context) + public ResultCode GetAudioController(ServiceCtx context) { MakeObject(context, new IAudioController()); - return 0; + return ResultCode.Success; } [Command(4)] // GetDisplayController() -> object - public long GetDisplayController(ServiceCtx context) + public ResultCode GetDisplayController(ServiceCtx context) { MakeObject(context, new IDisplayController()); - return 0; + return ResultCode.Success; } [Command(11)] // GetLibraryAppletCreator() -> object - public long GetLibraryAppletCreator(ServiceCtx context) + public ResultCode GetLibraryAppletCreator(ServiceCtx context) { MakeObject(context, new ILibraryAppletCreator()); - return 0; + return ResultCode.Success; } [Command(20)] // GetApplicationFunctions() -> object - public long GetApplicationFunctions(ServiceCtx context) + public ResultCode GetApplicationFunctions(ServiceCtx context) { MakeObject(context, new IApplicationFunctions()); - return 0; + return ResultCode.Success; } [Command(1000)] // GetDebugFunctions() -> object - public long GetDebugFunctions(ServiceCtx context) + public ResultCode GetDebugFunctions(ServiceCtx context) { MakeObject(context, new IDebugFunctions()); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs index 631e2a37..e0e1e107 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs @@ -7,11 +7,11 @@ namespace Ryujinx.HLE.HOS.Services.Am [Command(0)] // OpenApplicationProxy(u64, pid, handle) -> object - public long OpenApplicationProxy(ServiceCtx context) + public ResultCode OpenApplicationProxy(ServiceCtx context) { MakeObject(context, new IApplicationProxy()); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/IAudioController.cs b/Ryujinx.HLE/HOS/Services/Am/IAudioController.cs index 24d0c3d3..f41ed6a0 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IAudioController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IAudioController.cs @@ -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; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/ICommonStateGetter.cs b/Ryujinx.HLE/HOS/Services/Am/ICommonStateGetter.cs index 117d068a..59474126 100644 --- a/Ryujinx.HLE/HOS/Services/Am/ICommonStateGetter.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ICommonStateGetter.cs @@ -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 - 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 - 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; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs index 7ab088da..01a68475 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs @@ -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 - 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; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs b/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs index 947114f3..ec4e23ec 100644 --- a/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs @@ -17,7 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Am [Command(0)] // GetAppletStateChangedEvent() -> handle - 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) - public long PushInData(ServiceCtx context) + public ResultCode PushInData(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAm); - return 0; + return ResultCode.Success; } [Command(101)] // PopOutData() -> object - public long PopOutData(ServiceCtx context) + public ResultCode PopOutData(ServiceCtx context) { MakeObject(context, new IStorage(StorageHelper.MakeLaunchParams())); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletCreator.cs b/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletCreator.cs index 785472a7..27ae947e 100644 --- a/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletCreator.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletCreator.cs @@ -6,22 +6,22 @@ namespace Ryujinx.HLE.HOS.Services.Am [Command(0)] // CreateLibraryApplet(u32, u32) -> object - 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 - 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; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs b/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs index 6207cd12..b256e59f 100644 --- a/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs @@ -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 - 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 - 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; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/IStorage.cs b/Ryujinx.HLE/HOS/Services/Am/IStorage.cs index edc196af..3d351fc1 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IStorage.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IStorage.cs @@ -11,11 +11,11 @@ namespace Ryujinx.HLE.HOS.Services.Am [Command(0)] // Open() -> object - public long Open(ServiceCtx context) + public ResultCode Open(ServiceCtx context) { MakeObject(context, new IStorageAccessor(this)); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs b/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs index 8bb5805e..76f6caf5 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs @@ -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) - 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 - 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; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/ISystemAppletProxy.cs b/Ryujinx.HLE/HOS/Services/Am/ISystemAppletProxy.cs index b7f97a3b..1aa42857 100644 --- a/Ryujinx.HLE/HOS/Services/Am/ISystemAppletProxy.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ISystemAppletProxy.cs @@ -6,92 +6,92 @@ namespace Ryujinx.HLE.HOS.Services.Am [Command(0)] // GetCommonStateGetter() -> object - 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 - 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 - public long GetWindowController(ServiceCtx context) + public ResultCode GetWindowController(ServiceCtx context) { MakeObject(context, new IWindowController()); - return 0; + return ResultCode.Success; } [Command(3)] // GetAudioController() -> object - public long GetAudioController(ServiceCtx context) + public ResultCode GetAudioController(ServiceCtx context) { MakeObject(context, new IAudioController()); - return 0; + return ResultCode.Success; } [Command(4)] // GetDisplayController() -> object - public long GetDisplayController(ServiceCtx context) + public ResultCode GetDisplayController(ServiceCtx context) { MakeObject(context, new IDisplayController()); - return 0; + return ResultCode.Success; } [Command(11)] // GetLibraryAppletCreator() -> object - public long GetLibraryAppletCreator(ServiceCtx context) + public ResultCode GetLibraryAppletCreator(ServiceCtx context) { MakeObject(context, new ILibraryAppletCreator()); - return 0; + return ResultCode.Success; } [Command(20)] // GetHomeMenuFunctions() -> object - 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 - public long GetGlobalStateController(ServiceCtx context) + public ResultCode GetGlobalStateController(ServiceCtx context) { MakeObject(context, new IGlobalStateController()); - return 0; + return ResultCode.Success; } [Command(22)] // GetApplicationCreator() -> object - public long GetApplicationCreator(ServiceCtx context) + public ResultCode GetApplicationCreator(ServiceCtx context) { MakeObject(context, new IApplicationCreator()); - return 0; + return ResultCode.Success; } [Command(1000)] // GetDebugFunctions() -> object - public long GetDebugFunctions(ServiceCtx context) + public ResultCode GetDebugFunctions(ServiceCtx context) { MakeObject(context, new IDebugFunctions()); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/IWindowController.cs b/Ryujinx.HLE/HOS/Services/Am/IWindowController.cs index 5d05356e..68d0954d 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IWindowController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IWindowController.cs @@ -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; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Am/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Am/ResultCode.cs new file mode 100644 index 00000000..3fc76ae6 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Am/ResultCode.cs @@ -0,0 +1,12 @@ +namespace Ryujinx.HLE.HOS.Services.Am +{ + enum ResultCode + { + ModuleId = 128, + ErrorCodeShift = 9, + + Success = 0, + + NoMessages = (3 << ErrorCodeShift) | ModuleId + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Apm/IManager.cs b/Ryujinx.HLE/HOS/Services/Apm/IManager.cs index 46328610..1458ac58 100644 --- a/Ryujinx.HLE/HOS/Services/Apm/IManager.cs +++ b/Ryujinx.HLE/HOS/Services/Apm/IManager.cs @@ -8,11 +8,11 @@ namespace Ryujinx.HLE.HOS.Services.Apm [Command(0)] // OpenSession() -> object - public long OpenSession(ServiceCtx context) + public ResultCode OpenSession(ServiceCtx context) { MakeObject(context, new ISession()); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Apm/ISession.cs b/Ryujinx.HLE/HOS/Services/Apm/ISession.cs index c9defefc..10c92e40 100644 --- a/Ryujinx.HLE/HOS/Services/Apm/ISession.cs +++ b/Ryujinx.HLE/HOS/Services/Apm/ISession.cs @@ -8,17 +8,17 @@ namespace Ryujinx.HLE.HOS.Services.Apm [Command(0)] // SetPerformanceConfiguration(nn::apm::PerformanceMode, nn::apm::PerformanceConfiguration) - public long SetPerformanceConfiguration(ServiceCtx context) + public ResultCode SetPerformanceConfiguration(ServiceCtx context) { PerformanceMode perfMode = (PerformanceMode)context.RequestData.ReadInt32(); PerformanceConfiguration perfConfig = (PerformanceConfiguration)context.RequestData.ReadInt32(); - return 0; + return ResultCode.Success; } [Command(1)] // GetPerformanceConfiguration(nn::apm::PerformanceMode) -> nn::apm::PerformanceConfiguration - public long GetPerformanceConfiguration(ServiceCtx context) + public ResultCode GetPerformanceConfiguration(ServiceCtx context) { PerformanceMode perfMode = (PerformanceMode)context.RequestData.ReadInt32(); @@ -26,7 +26,7 @@ namespace Ryujinx.HLE.HOS.Services.Apm Logger.PrintStub(LogClass.ServiceApm); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Apm/PerformanceConfiguration.cs b/Ryujinx.HLE/HOS/Services/Apm/PerformanceConfiguration.cs index b24adfb3..d091ef3b 100644 --- a/Ryujinx.HLE/HOS/Services/Apm/PerformanceConfiguration.cs +++ b/Ryujinx.HLE/HOS/Services/Apm/PerformanceConfiguration.cs @@ -15,4 +15,4 @@ PerformanceConfiguration11 = 0x92220007, PerformanceConfiguration12 = 0x92220008 } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Apm/PerformanceMode.cs b/Ryujinx.HLE/HOS/Services/Apm/PerformanceMode.cs index c4ab3cf2..a7a0dfad 100644 --- a/Ryujinx.HLE/HOS/Services/Apm/PerformanceMode.cs +++ b/Ryujinx.HLE/HOS/Services/Apm/PerformanceMode.cs @@ -5,4 +5,4 @@ Handheld = 0, Docked = 1 } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudErr.cs b/Ryujinx.HLE/HOS/Services/Aud/AudErr.cs deleted file mode 100644 index 675ea8c7..00000000 --- a/Ryujinx.HLE/HOS/Services/Aud/AudErr.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Ryujinx.HLE.HOS.Services.Aud -{ - static class AudErr - { - public const int DeviceNotFound = 1; - public const int UnsupportedRevision = 2; - public const int UnsupportedSampleRate = 3; - public const int OpusInvalidInput = 6; - } -} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioOut/IAudioOut.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioOut/IAudioOut.cs index 1c078fba..4191dfd6 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioOut/IAudioOut.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioOut/IAudioOut.cs @@ -22,41 +22,41 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioOut [Command(0)] // GetAudioOutState() -> u32 state - public long GetAudioOutState(ServiceCtx context) + public ResultCode GetAudioOutState(ServiceCtx context) { context.ResponseData.Write((int)_audioOut.GetState(_track)); - return 0; + return ResultCode.Success; } [Command(1)] // StartAudioOut() - public long StartAudioOut(ServiceCtx context) + public ResultCode StartAudioOut(ServiceCtx context) { _audioOut.Start(_track); - return 0; + return ResultCode.Success; } [Command(2)] // StopAudioOut() - public long StopAudioOut(ServiceCtx context) + public ResultCode StopAudioOut(ServiceCtx context) { _audioOut.Stop(_track); - return 0; + return ResultCode.Success; } [Command(3)] // AppendAudioOutBuffer(u64 tag, buffer) - public long AppendAudioOutBuffer(ServiceCtx context) + public ResultCode AppendAudioOutBuffer(ServiceCtx context) { return AppendAudioOutBufferImpl(context, context.Request.SendBuff[0].Position); } [Command(4)] // RegisterBufferEvent() -> handle - public long RegisterBufferEvent(ServiceCtx context) + public ResultCode RegisterBufferEvent(ServiceCtx context) { if (context.Process.HandleTable.GenerateHandle(_releaseEvent.ReadableEvent, out int handle) != KernelResult.Success) { @@ -65,12 +65,12 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioOut context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); - return 0; + return ResultCode.Success; } [Command(5)] // GetReleasedAudioOutBuffer() -> (u32 count, buffer) - public long GetReleasedAudioOutBuffer(ServiceCtx context) + public ResultCode GetReleasedAudioOutBuffer(ServiceCtx context) { long position = context.Request.ReceiveBuff[0].Position; long size = context.Request.ReceiveBuff[0].Size; @@ -80,7 +80,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioOut [Command(6)] // ContainsAudioOutBuffer(u64 tag) -> b8 - public long ContainsAudioOutBuffer(ServiceCtx context) + public ResultCode ContainsAudioOutBuffer(ServiceCtx context) { long tag = context.RequestData.ReadInt64(); @@ -91,14 +91,14 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioOut [Command(7)] // 3.0.0+ // AppendAudioOutBufferAuto(u64 tag, buffer) - public long AppendAudioOutBufferAuto(ServiceCtx context) + public ResultCode AppendAudioOutBufferAuto(ServiceCtx context) { (long position, long size) = context.Request.GetBufferType0x21(); return AppendAudioOutBufferImpl(context, position); } - public long AppendAudioOutBufferImpl(ServiceCtx context, long position) + public ResultCode AppendAudioOutBufferImpl(ServiceCtx context, long position) { long tag = context.RequestData.ReadInt64(); @@ -112,19 +112,19 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioOut _audioOut.AppendBuffer(_track, tag, buffer); - return 0; + return ResultCode.Success; } [Command(8)] // 3.0.0+ // GetReleasedAudioOutBufferAuto() -> (u32 count, buffer) - public long GetReleasedAudioOutBufferAuto(ServiceCtx context) + public ResultCode GetReleasedAudioOutBufferAuto(ServiceCtx context) { (long position, long size) = context.Request.GetBufferType0x22(); return GetReleasedAudioOutBufferImpl(context, position, size); } - public long GetReleasedAudioOutBufferImpl(ServiceCtx context, long position, long size) + public ResultCode GetReleasedAudioOutBufferImpl(ServiceCtx context, long position, long size) { uint count = (uint)((ulong)size >> 3); @@ -144,7 +144,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioOut context.ResponseData.Write(releasedBuffers.Length); - return 0; + return ResultCode.Success; } public void Dispose() diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/AudioConsts.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/AudioConsts.cs index 773ef6dd..40788ff3 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/AudioConsts.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/AudioConsts.cs @@ -5,4 +5,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer public const int HostSampleRate = 48000; public const int HostChannelsCount = 2; } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/BiquadFilter.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/BiquadFilter.cs index 51dddf20..4e0c7c4f 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/BiquadFilter.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/BiquadFilter.cs @@ -13,4 +13,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer public short A1; public short A2; } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs index e01e4520..a07b9063 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs @@ -66,40 +66,40 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer [Command(0)] // GetSampleRate() -> u32 - public long GetSampleRate(ServiceCtx context) + public ResultCode GetSampleRate(ServiceCtx context) { context.ResponseData.Write(_params.SampleRate); - return 0; + return ResultCode.Success; } [Command(1)] // GetSampleCount() -> u32 - public long GetSampleCount(ServiceCtx context) + public ResultCode GetSampleCount(ServiceCtx context) { context.ResponseData.Write(_params.SampleCount); - return 0; + return ResultCode.Success; } [Command(2)] // GetMixBufferCount() -> u32 - public long GetMixBufferCount(ServiceCtx context) + public ResultCode GetMixBufferCount(ServiceCtx context) { context.ResponseData.Write(_params.MixCount); - return 0; + return ResultCode.Success; } [Command(3)] // GetState() -> u32 - private long GetState(ServiceCtx context) + private ResultCode GetState(ServiceCtx context) { context.ResponseData.Write((int)_playState); Logger.PrintStub(LogClass.ServiceAudio, new { State = Enum.GetName(typeof(PlayState), _playState) }); - return 0; + return ResultCode.Success; } private void AudioCallback() @@ -131,7 +131,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer [Command(4)] // RequestUpdateAudioRenderer(buffer) // -> (buffer, buffer) - public long RequestUpdateAudioRenderer(ServiceCtx context) + public ResultCode RequestUpdateAudioRenderer(ServiceCtx context) { long outputPosition = context.Request.ReceiveBuff[0].Position; long outputSize = context.Request.ReceiveBuff[0].Size; @@ -234,34 +234,34 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer writer.Write(voice.OutStatus); } - return 0; + return ResultCode.Success; } [Command(5)] // Start() - public long StartAudioRenderer(ServiceCtx context) + public ResultCode StartAudioRenderer(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAudio); _playState = PlayState.Playing; - return 0; + return ResultCode.Success; } [Command(6)] // Stop() - public long StopAudioRenderer(ServiceCtx context) + public ResultCode StopAudioRenderer(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAudio); _playState = PlayState.Stopped; - return 0; + return ResultCode.Success; } [Command(7)] // QuerySystemEvent() -> handle - public long QuerySystemEvent(ServiceCtx context) + public ResultCode QuerySystemEvent(ServiceCtx context) { if (context.Process.HandleTable.GenerateHandle(_updateEvent.ReadableEvent, out int handle) != KernelResult.Success) { @@ -270,7 +270,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); - return 0; + return ResultCode.Success; } private AdpcmDecoderContext GetAdpcmDecoderContext(long position, long size) diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolContext.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolContext.cs index 2b68c40d..c1646065 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolContext.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolContext.cs @@ -9,4 +9,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer OutStatus.State = MemoryPoolState.Detached; } } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolIn.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolIn.cs index f6e424ee..b4e6594c 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolIn.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolIn.cs @@ -11,4 +11,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer public int Unknown14; public long Unknown18; } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolOut.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolOut.cs index f0621e3e..6ae583b8 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolOut.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolOut.cs @@ -9,4 +9,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer public int Unknown14; public long Unknown18; } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolState.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolState.cs index 6a37c1af..7b672dc9 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolState.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolState.cs @@ -10,4 +10,4 @@ Attached = 5, Released = 6 } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/PlayState.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/PlayState.cs index f09bf46e..922a9dc2 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/PlayState.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/PlayState.cs @@ -6,4 +6,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer Stopped = 1, Paused = 2 } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/UpdateDataHeader.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/UpdateDataHeader.cs index a71e865d..04fe422c 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/UpdateDataHeader.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/UpdateDataHeader.cs @@ -19,4 +19,4 @@ public int Unknown38; public int TotalSize; } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceChannelResourceIn.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceChannelResourceIn.cs index 4933a79b..124d31be 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceChannelResourceIn.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceChannelResourceIn.cs @@ -7,4 +7,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { // ??? } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceContext.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceContext.cs index 971563dc..93a16a61 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceContext.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceContext.cs @@ -196,4 +196,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer _bufferReload = true; } } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceIn.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceIn.cs index fc83b65b..143cf4d8 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceIn.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceIn.cs @@ -46,4 +46,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer public WaveBuffer WaveBuffer2; public WaveBuffer WaveBuffer3; } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceOut.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceOut.cs index 6551acdb..5332631d 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceOut.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceOut.cs @@ -9,4 +9,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer public int PlayedWaveBuffersCount; public int VoiceDropsCount; //? } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/WaveBuffer.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/WaveBuffer.cs index bb188877..89137ec0 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/WaveBuffer.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/WaveBuffer.cs @@ -17,4 +17,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer public long AdpcmLoopContextSize; public long Unknown30; } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRendererParameter.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRendererParameter.cs index 4d01a0de..812ef8cf 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRendererParameter.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRendererParameter.cs @@ -19,4 +19,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud public int Unknown2C; public int Revision; } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs b/Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs index f6c0b9d8..48a2fb74 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs @@ -22,7 +22,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud [Command(0)] // ListAudioDeviceName() -> (u32, buffer) - public long ListAudioDeviceName(ServiceCtx context) + public ResultCode ListAudioDeviceName(ServiceCtx context) { string[] deviceNames = SystemStateMgr.AudioOutputs; @@ -49,12 +49,12 @@ namespace Ryujinx.HLE.HOS.Services.Aud position += buffer.Length; } - return 0; + return ResultCode.Success; } [Command(1)] // SetAudioDeviceOutputVolume(u32, buffer) - public long SetAudioDeviceOutputVolume(ServiceCtx context) + public ResultCode SetAudioDeviceOutputVolume(ServiceCtx context) { float volume = context.RequestData.ReadSingle(); @@ -67,12 +67,12 @@ namespace Ryujinx.HLE.HOS.Services.Aud Logger.PrintStub(LogClass.ServiceAudio); - return 0; + return ResultCode.Success; } [Command(3)] // GetActiveAudioDeviceName() -> buffer - public long GetActiveAudioDeviceName(ServiceCtx context) + public ResultCode GetActiveAudioDeviceName(ServiceCtx context) { string name = context.Device.System.State.ActiveAudioOutput; @@ -90,12 +90,12 @@ namespace Ryujinx.HLE.HOS.Services.Aud Logger.PrintError(LogClass.ServiceAudio, $"Output buffer size {size} too small!"); } - return 0; + return ResultCode.Success; } [Command(4)] // QueryAudioDeviceSystemEvent() -> handle - public long QueryAudioDeviceSystemEvent(ServiceCtx context) + public ResultCode QueryAudioDeviceSystemEvent(ServiceCtx context) { if (context.Process.HandleTable.GenerateHandle(_systemEvent.ReadableEvent, out int handle) != KernelResult.Success) { @@ -106,23 +106,23 @@ namespace Ryujinx.HLE.HOS.Services.Aud Logger.PrintStub(LogClass.ServiceAudio); - return 0; + return ResultCode.Success; } [Command(5)] // GetActiveChannelCount() -> u32 - public long GetActiveChannelCount(ServiceCtx context) + public ResultCode GetActiveChannelCount(ServiceCtx context) { context.ResponseData.Write(2); Logger.PrintStub(LogClass.ServiceAudio); - return 0; + return ResultCode.Success; } [Command(6)] // ListAudioDeviceNameAuto() -> (u32, buffer) - public long ListAudioDeviceNameAuto(ServiceCtx context) + public ResultCode ListAudioDeviceNameAuto(ServiceCtx context) { string[] deviceNames = SystemStateMgr.AudioOutputs; @@ -148,12 +148,12 @@ namespace Ryujinx.HLE.HOS.Services.Aud position += buffer.Length; } - return 0; + return ResultCode.Success; } [Command(7)] // SetAudioDeviceOutputVolumeAuto(u32, buffer) - public long SetAudioDeviceOutputVolumeAuto(ServiceCtx context) + public ResultCode SetAudioDeviceOutputVolumeAuto(ServiceCtx context) { float volume = context.RequestData.ReadSingle(); @@ -165,23 +165,23 @@ namespace Ryujinx.HLE.HOS.Services.Aud Logger.PrintStub(LogClass.ServiceAudio); - return 0; + return ResultCode.Success; } [Command(8)] // GetAudioDeviceOutputVolumeAuto(buffer) -> u32 - public long GetAudioDeviceOutputVolumeAuto(ServiceCtx context) + public ResultCode GetAudioDeviceOutputVolumeAuto(ServiceCtx context) { context.ResponseData.Write(1f); Logger.PrintStub(LogClass.ServiceAudio); - return 0; + return ResultCode.Success; } [Command(10)] // GetActiveAudioDeviceNameAuto() -> buffer - public long GetActiveAudioDeviceNameAuto(ServiceCtx context) + public ResultCode GetActiveAudioDeviceNameAuto(ServiceCtx context) { string name = context.Device.System.State.ActiveAudioOutput; @@ -198,12 +198,12 @@ namespace Ryujinx.HLE.HOS.Services.Aud Logger.PrintError(LogClass.ServiceAudio, $"Output buffer size {size} too small!"); } - return 0; + return ResultCode.Success; } [Command(11)] // QueryAudioDeviceInputEvent() -> handle - public long QueryAudioDeviceInputEvent(ServiceCtx context) + public ResultCode QueryAudioDeviceInputEvent(ServiceCtx context) { if (context.Process.HandleTable.GenerateHandle(_systemEvent.ReadableEvent, out int handle) != KernelResult.Success) { @@ -214,12 +214,12 @@ namespace Ryujinx.HLE.HOS.Services.Aud Logger.PrintStub(LogClass.ServiceAudio); - return 0; + return ResultCode.Success; } [Command(12)] // QueryAudioDeviceOutputEvent() -> handle - public long QueryAudioDeviceOutputEvent(ServiceCtx context) + public ResultCode QueryAudioDeviceOutputEvent(ServiceCtx context) { if (context.Process.HandleTable.GenerateHandle(_systemEvent.ReadableEvent, out int handle) != KernelResult.Success) { @@ -230,7 +230,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud Logger.PrintStub(LogClass.ServiceAudio); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs b/Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs index 88d180fc..ad0dd044 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs @@ -5,8 +5,6 @@ using Ryujinx.HLE.HOS.Kernel.Threading; using Ryujinx.HLE.HOS.Services.Aud.AudioOut; using System.Text; -using static Ryujinx.HLE.HOS.ErrorCode; - namespace Ryujinx.HLE.HOS.Services.Aud { [Service("audout:u")] @@ -20,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud [Command(0)] // ListAudioOuts() -> (u32 count, buffer) - public long ListAudioOuts(ServiceCtx context) + public ResultCode ListAudioOuts(ServiceCtx context) { return ListAudioOutsImpl( context, @@ -31,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud [Command(1)] // OpenAudioOut(u32 sample_rate, u16 unused, u16 channel_count, nn::applet::AppletResourceUserId, pid, handle, buffer name_in) // -> (u32 sample_rate, u32 channel_count, u32 pcm_format, u32, object, buffer name_out) - public long OpenAudioOut(ServiceCtx context) + public ResultCode OpenAudioOut(ServiceCtx context) { return OpenAudioOutImpl( context, @@ -43,7 +41,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud [Command(2)] // 3.0.0+ // ListAudioOutsAuto() -> (u32 count, buffer) - public long ListAudioOutsAuto(ServiceCtx context) + public ResultCode ListAudioOutsAuto(ServiceCtx context) { (long recvPosition, long recvSize) = context.Request.GetBufferType0x22(); @@ -53,7 +51,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud [Command(3)] // 3.0.0+ // OpenAudioOutAuto(u32 sample_rate, u16 unused, u16 channel_count, nn::applet::AppletResourceUserId, pid, handle, buffer) // -> (u32 sample_rate, u32 channel_count, u32 pcm_format, u32, object, buffer name_out) - public long OpenAudioOutAuto(ServiceCtx context) + public ResultCode OpenAudioOutAuto(ServiceCtx context) { (long sendPosition, long sendSize) = context.Request.GetBufferType0x21(); (long recvPosition, long recvSize) = context.Request.GetBufferType0x22(); @@ -66,7 +64,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud recvSize); } - private long ListAudioOutsImpl(ServiceCtx context, long position, long size) + private ResultCode ListAudioOutsImpl(ServiceCtx context, long position, long size) { int nameCount = 0; @@ -85,10 +83,10 @@ namespace Ryujinx.HLE.HOS.Services.Aud context.ResponseData.Write(nameCount); - return 0; + return ResultCode.Success; } - private long OpenAudioOutImpl(ServiceCtx context, long sendPosition, long sendSize, long receivePosition, long receiveSize) + private ResultCode OpenAudioOutImpl(ServiceCtx context, long sendPosition, long sendSize, long receivePosition, long receiveSize) { string deviceName = MemoryHelper.ReadAsciiString( context.Memory, @@ -104,7 +102,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud { Logger.PrintWarning(LogClass.Audio, "Invalid device name!"); - return MakeError(ErrorModule.Audio, AudErr.DeviceNotFound); + return ResultCode.DeviceNotFound; } byte[] deviceNameBuffer = Encoding.ASCII.GetBytes(deviceName + "\0"); @@ -130,7 +128,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud { Logger.PrintWarning(LogClass.Audio, "Invalid sample rate!"); - return MakeError(ErrorModule.Audio, AudErr.UnsupportedSampleRate); + return ResultCode.UnsupportedSampleRate; } channels = (ushort)channels; @@ -158,7 +156,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud context.ResponseData.Write((int)SampleFormat.PcmInt16); context.ResponseData.Write((int)PlaybackState.Stopped); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs b/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs index 812617d6..ec0c7501 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs @@ -3,8 +3,6 @@ using Ryujinx.Common.Logging; using Ryujinx.HLE.HOS.Services.Aud.AudioRenderer; using Ryujinx.HLE.Utilities; -using static Ryujinx.HLE.HOS.ErrorCode; - namespace Ryujinx.HLE.HOS.Services.Aud { [Service("audren:u")] @@ -24,7 +22,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud [Command(0)] // OpenAudioRenderer(nn::audio::detail::AudioRendererParameterInternal, u64, nn::applet::AppletResourceUserId, pid, handle, handle) // -> object - public long OpenAudioRenderer(ServiceCtx context) + public ResultCode OpenAudioRenderer(ServiceCtx context) { IAalOutput audioOut = context.Device.AudioOut; @@ -36,12 +34,12 @@ namespace Ryujinx.HLE.HOS.Services.Aud audioOut, Params)); - return 0; + return ResultCode.Success; } [Command(1)] // GetWorkBufferSize(nn::audio::detail::AudioRendererParameterInternal) -> u64 - public long GetAudioRendererWorkBufferSize(ServiceCtx context) + public ResultCode GetAudioRendererWorkBufferSize(ServiceCtx context) { AudioRendererParameter Params = GetAudioRendererParameter(context); @@ -111,7 +109,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud Logger.PrintDebug(LogClass.ServiceAudio, $"WorkBufferSize is 0x{size:x16}."); - return 0; + return ResultCode.Success; } else { @@ -119,7 +117,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud Logger.PrintWarning(LogClass.ServiceAudio, $"Library Revision 0x{Params.Revision:x8} is not supported!"); - return MakeError(ErrorModule.Audio, AudErr.UnsupportedRevision); + return ResultCode.UnsupportedRevision; } } @@ -170,18 +168,18 @@ namespace Ryujinx.HLE.HOS.Services.Aud [Command(2)] // GetAudioDeviceService(nn::applet::AppletResourceUserId) -> object - public long GetAudioDeviceService(ServiceCtx context) + public ResultCode GetAudioDeviceService(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); MakeObject(context, new IAudioDevice(context.Device.System)); - return 0; + return ResultCode.Success; } [Command(4)] // 4.0.0+ // GetAudioDeviceServiceWithRevisionInfo(nn::applet::AppletResourceUserId, u32) -> object - private long GetAudioDeviceServiceWithRevisionInfo(ServiceCtx context) + private ResultCode GetAudioDeviceServiceWithRevisionInfo(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); int revisionInfo = context.RequestData.ReadInt32(); diff --git a/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs index 1c48cfe2..148a69a8 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs @@ -1,7 +1,5 @@ using Concentus.Structs; -using static Ryujinx.HLE.HOS.ErrorCode; - namespace Ryujinx.HLE.HOS.Services.Aud { class IHardwareOpusDecoder : IpcService @@ -23,14 +21,14 @@ namespace Ryujinx.HLE.HOS.Services.Aud [Command(0)] // DecodeInterleaved(buffer) -> (u32, u32, buffer) - public long DecodeInterleaved(ServiceCtx context) + public ResultCode DecodeInterleaved(ServiceCtx context) { long inPosition = context.Request.SendBuff[0].Position; long inSize = context.Request.SendBuff[0].Size; if (inSize < 8) { - return MakeError(ErrorModule.Audio, AudErr.OpusInvalidInput); + return ResultCode.OpusInvalidInput; } long outPosition = context.Request.ReceiveBuff[0].Position; @@ -45,7 +43,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud if ((uint)processed > (ulong)inSize) { - return MakeError(ErrorModule.Audio, AudErr.OpusInvalidInput); + return ResultCode.OpusInvalidInput; } short[] pcm = new short[outSize / 2]; @@ -64,14 +62,14 @@ namespace Ryujinx.HLE.HOS.Services.Aud context.ResponseData.Write(processed); context.ResponseData.Write(samples); - return 0; + return ResultCode.Success; } [Command(4)] // DecodeInterleavedWithPerf(buffer) -> (u32, u32, u64, buffer) - public long DecodeInterleavedWithPerf(ServiceCtx context) + public ResultCode DecodeInterleavedWithPerf(ServiceCtx context) { - long result = DecodeInterleaved(context); + ResultCode result = DecodeInterleaved(context); // TODO: Figure out what this value is. // According to switchbrew, it is now used. diff --git a/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs index 2724fb29..042be626 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs @@ -7,19 +7,19 @@ namespace Ryujinx.HLE.HOS.Services.Aud [Command(0)] // Initialize(bytes<8, 4>, u32, handle) -> object - public long Initialize(ServiceCtx context) + public ResultCode Initialize(ServiceCtx context) { int sampleRate = context.RequestData.ReadInt32(); int channelsCount = context.RequestData.ReadInt32(); MakeObject(context, new IHardwareOpusDecoder(sampleRate, channelsCount)); - return 0; + return ResultCode.Success; } [Command(1)] // GetWorkBufferSize(bytes<8, 4>) -> u32 - public long GetWorkBufferSize(ServiceCtx context) + public ResultCode GetWorkBufferSize(ServiceCtx context) { // Note: The sample rate is ignored because it is fixed to 48KHz. int sampleRate = context.RequestData.ReadInt32(); @@ -27,7 +27,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud context.ResponseData.Write(GetOpusDecoderSize(channelsCount)); - return 0; + return ResultCode.Success; } private static int GetOpusDecoderSize(int channelsCount) diff --git a/Ryujinx.HLE/HOS/Services/Aud/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Aud/ResultCode.cs new file mode 100644 index 00000000..d49964d6 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Aud/ResultCode.cs @@ -0,0 +1,15 @@ +namespace Ryujinx.HLE.HOS.Services.Aud +{ + enum ResultCode + { + ModuleId = 153, + ErrorCodeShift = 9, + + Success = 0, + + DeviceNotFound = (1 << ErrorCodeShift) | ModuleId, + UnsupportedRevision = (2 << ErrorCodeShift) | ModuleId, + UnsupportedSampleRate = (3 << ErrorCodeShift) | ModuleId, + OpusInvalidInput = (6 << ErrorCodeShift) | ModuleId + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs b/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs index 0d1e1411..e2a3b352 100644 --- a/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs +++ b/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs @@ -10,24 +10,24 @@ namespace Ryujinx.HLE.HOS.Services.Bcat [Command(0)] // CreateBcatService(u64, pid) -> object - public long CreateBcatService(ServiceCtx context) + public ResultCode CreateBcatService(ServiceCtx context) { long id = context.RequestData.ReadInt64(); MakeObject(context, new IBcatService()); - return 0; + return ResultCode.Success; } [Command(1)] // CreateDeliveryCacheStorageService(u64, pid) -> object - public long CreateDeliveryCacheStorageService(ServiceCtx context) + public ResultCode CreateDeliveryCacheStorageService(ServiceCtx context) { long id = context.RequestData.ReadInt64(); MakeObject(context, new IDeliveryCacheStorageService()); - return 0; + return ResultCode.Success; } } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Bsd/BsdIoctl.cs b/Ryujinx.HLE/HOS/Services/Bsd/BsdIoctl.cs index de6fa73f..76713b25 100644 --- a/Ryujinx.HLE/HOS/Services/Bsd/BsdIoctl.cs +++ b/Ryujinx.HLE/HOS/Services/Bsd/BsdIoctl.cs @@ -4,4 +4,4 @@ { AtMark = 0x40047307 } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Bsd/IClient.cs b/Ryujinx.HLE/HOS/Services/Bsd/IClient.cs index 09f59b65..03399372 100644 --- a/Ryujinx.HLE/HOS/Services/Bsd/IClient.cs +++ b/Ryujinx.HLE/HOS/Services/Bsd/IClient.cs @@ -114,12 +114,12 @@ namespace Ryujinx.HLE.HOS.Services.Bsd return errno; } - private long WriteWinSock2Error(ServiceCtx context, WsaError errorCode) + private ResultCode WriteWinSock2Error(ServiceCtx context, WsaError errorCode) { return WriteBsdResult(context, -1, ConvertError(errorCode)); } - private long WriteBsdResult(ServiceCtx context, int result, LinuxError errorCode = 0) + private ResultCode WriteBsdResult(ServiceCtx context, int result, LinuxError errorCode = 0) { if (errorCode != LinuxError.SUCCESS) { @@ -129,7 +129,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd context.ResponseData.Write(result); context.ResponseData.Write((int)errorCode); - return 0; + return ResultCode.Success; } private BsdSocket RetrieveSocket(int socketFd) @@ -158,7 +158,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd return AddressFamily.Unknown; } - private long SocketInternal(ServiceCtx context, bool exempt) + private ResultCode SocketInternal(ServiceCtx context, bool exempt) { AddressFamily domain = (AddressFamily)context.RequestData.ReadInt32(); SocketType type = (SocketType)context.RequestData.ReadInt32(); @@ -222,7 +222,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(0)] // Initialize(nn::socket::BsdBufferConfig config, u64 pid, u64 transferMemorySize, KObject, pid) -> u32 bsd_errno - public long RegisterClient(ServiceCtx context) + public ResultCode RegisterClient(ServiceCtx context) { /* typedef struct { @@ -242,37 +242,37 @@ namespace Ryujinx.HLE.HOS.Services.Bsd Logger.PrintStub(LogClass.ServiceBsd); - return 0; + return ResultCode.Success; } [Command(1)] // StartMonitoring(u64, pid) - public long StartMonitoring(ServiceCtx context) + public ResultCode StartMonitoring(ServiceCtx context) { ulong unknown0 = context.RequestData.ReadUInt64(); Logger.PrintStub(LogClass.ServiceBsd, new { unknown0 }); - return 0; + return ResultCode.Success; } [Command(2)] // Socket(u32 domain, u32 type, u32 protocol) -> (i32 ret, u32 bsd_errno) - public long Socket(ServiceCtx context) + public ResultCode Socket(ServiceCtx context) { return SocketInternal(context, false); } [Command(3)] // SocketExempt(u32 domain, u32 type, u32 protocol) -> (i32 ret, u32 bsd_errno) - public long SocketExempt(ServiceCtx context) + public ResultCode SocketExempt(ServiceCtx context) { return SocketInternal(context, true); } [Command(4)] // Open(u32 flags, array path) -> (i32 ret, u32 bsd_errno) - public long Open(ServiceCtx context) + public ResultCode Open(ServiceCtx context) { (long bufferPosition, long bufferSize) = context.Request.GetBufferType0x21(); @@ -285,23 +285,23 @@ namespace Ryujinx.HLE.HOS.Services.Bsd Logger.PrintStub(LogClass.ServiceBsd, new { path, flags }); - return 0; + return ResultCode.Success; } [Command(5)] // Select(u32 nfds, nn::socket::timeout timeout, buffer readfds_in, buffer writefds_in, buffer errorfds_in) -> (i32 ret, u32 bsd_errno, buffer readfds_out, buffer writefds_out, buffer errorfds_out) - public long Select(ServiceCtx context) + public ResultCode Select(ServiceCtx context) { WriteBsdResult(context, -1, LinuxError.EOPNOTSUPP); Logger.PrintStub(LogClass.ServiceBsd); - return 0; + return ResultCode.Success; } [Command(6)] // Poll(u32 nfds, u32 timeout, buffer fds) -> (i32 ret, u32 bsd_errno, buffer) - public long Poll(ServiceCtx context) + public ResultCode Poll(ServiceCtx context) { int fdsCount = context.RequestData.ReadInt32(); int timeout = context.RequestData.ReadInt32(); @@ -427,18 +427,18 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(7)] // Sysctl(buffer, buffer) -> (i32 ret, u32 bsd_errno, u32, buffer) - public long Sysctl(ServiceCtx context) + public ResultCode Sysctl(ServiceCtx context) { WriteBsdResult(context, -1, LinuxError.EOPNOTSUPP); Logger.PrintStub(LogClass.ServiceBsd); - return 0; + return ResultCode.Success; } [Command(8)] // Recv(u32 socket, u32 flags) -> (i32 ret, u32 bsd_errno, array message) - public long Recv(ServiceCtx context) + public ResultCode Recv(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); SocketFlags socketFlags = (SocketFlags)context.RequestData.ReadInt32(); @@ -478,7 +478,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(9)] // RecvFrom(u32 sock, u32 flags) -> (i32 ret, u32 bsd_errno, u32 addrlen, buffer message, buffer) - public long RecvFrom(ServiceCtx context) + public ResultCode RecvFrom(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); SocketFlags socketFlags = (SocketFlags)context.RequestData.ReadInt32(); @@ -522,7 +522,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(10)] // Send(u32 socket, u32 flags, buffer) -> (i32 ret, u32 bsd_errno) - public long Send(ServiceCtx context) + public ResultCode Send(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); SocketFlags socketFlags = (SocketFlags)context.RequestData.ReadInt32(); @@ -562,7 +562,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(11)] // SendTo(u32 socket, u32 flags, buffer, buffer) -> (i32 ret, u32 bsd_errno) - public long SendTo(ServiceCtx context) + public ResultCode SendTo(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); SocketFlags socketFlags = (SocketFlags)context.RequestData.ReadInt32(); @@ -604,7 +604,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(12)] // Accept(u32 socket) -> (i32 ret, u32 bsd_errno, u32 addrlen, buffer addr) - public long Accept(ServiceCtx context) + public ResultCode Accept(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); @@ -650,7 +650,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd context.ResponseData.Write(0x10); - return 0; + return ResultCode.Success; } } @@ -659,7 +659,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(13)] // Bind(u32 socket, buffer addr) -> (i32 ret, u32 bsd_errno) - public long Bind(ServiceCtx context) + public ResultCode Bind(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); @@ -689,7 +689,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(14)] // Connect(u32 socket, buffer) -> (i32 ret, u32 bsd_errno) - public long Connect(ServiceCtx context) + public ResultCode Connect(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); @@ -718,7 +718,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(15)] // GetPeerName(u32 socket) -> (i32 ret, u32 bsd_errno, u32 addrlen, buffer addr) - public long GetPeerName(ServiceCtx context) + public ResultCode GetPeerName(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); @@ -741,7 +741,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(16)] // GetSockName(u32 socket) -> (i32 ret, u32 bsd_errno, u32 addrlen, buffer addr) - public long GetSockName(ServiceCtx context) + public ResultCode GetSockName(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); @@ -764,7 +764,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(17)] // GetSockOpt(u32 socket, u32 level, u32 option_name) -> (i32 ret, u32 bsd_errno, u32, buffer) - public long GetSockOpt(ServiceCtx context) + public ResultCode GetSockOpt(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); int level = context.RequestData.ReadInt32(); @@ -794,7 +794,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(18)] // Listen(u32 socket, u32 backlog) -> (i32 ret, u32 bsd_errno) - public long Listen(ServiceCtx context) + public ResultCode Listen(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); int backlog = context.RequestData.ReadInt32(); @@ -821,7 +821,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(19)] // Ioctl(u32 fd, u32 request, u32 bufcount, buffer, buffer, buffer, buffer) -> (i32 ret, u32 bsd_errno, buffer, buffer, buffer, buffer) - public long Ioctl(ServiceCtx context) + public ResultCode Ioctl(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); BsdIoctl cmd = (BsdIoctl)context.RequestData.ReadInt32(); @@ -856,7 +856,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(20)] // Fcntl(u32 socket, u32 cmd, u32 arg) -> (i32 ret, u32 bsd_errno) - public long Fcntl(ServiceCtx context) + public ResultCode Fcntl(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); int cmd = context.RequestData.ReadInt32(); @@ -978,7 +978,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(21)] // SetSockOpt(u32 socket, u32 level, u32 option_name, buffer option_value) -> (i32 ret, u32 bsd_errno) - public long SetSockOpt(ServiceCtx context) + public ResultCode SetSockOpt(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); int level = context.RequestData.ReadInt32(); @@ -1008,7 +1008,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(22)] // Shutdown(u32 socket, u32 how) -> (i32 ret, u32 bsd_errno) - public long Shutdown(ServiceCtx context) + public ResultCode Shutdown(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); int how = context.RequestData.ReadInt32(); @@ -1040,7 +1040,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(23)] // ShutdownAllSockets(u32 how) -> (i32 ret, u32 bsd_errno) - public long ShutdownAllSockets(ServiceCtx context) + public ResultCode ShutdownAllSockets(ServiceCtx context) { int how = context.RequestData.ReadInt32(); @@ -1072,7 +1072,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(24)] // Write(u32 socket, buffer message) -> (i32 ret, u32 bsd_errno) - public long Write(ServiceCtx context) + public ResultCode Write(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); @@ -1102,7 +1102,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(25)] // Read(u32 socket) -> (i32 ret, u32 bsd_errno, buffer message) - public long Read(ServiceCtx context) + public ResultCode Read(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); @@ -1132,7 +1132,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(26)] // Close(u32 socket) -> (i32 ret, u32 bsd_errno) - public long Close(ServiceCtx context) + public ResultCode Close(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); @@ -1153,7 +1153,7 @@ namespace Ryujinx.HLE.HOS.Services.Bsd [Command(27)] // DuplicateSocket(u32 socket, u64 reserved) -> (i32 ret, u32 bsd_errno) - public long DuplicateSocket(ServiceCtx context) + public ResultCode DuplicateSocket(ServiceCtx context) { int socketFd = context.RequestData.ReadInt32(); ulong reserved = context.RequestData.ReadUInt64(); diff --git a/Ryujinx.HLE/HOS/Services/Bsd/PollEvent.cs b/Ryujinx.HLE/HOS/Services/Bsd/PollEvent.cs index c4ed6045..b1e6ccc7 100644 --- a/Ryujinx.HLE/HOS/Services/Bsd/PollEvent.cs +++ b/Ryujinx.HLE/HOS/Services/Bsd/PollEvent.cs @@ -25,4 +25,4 @@ OutputEvents = outputEvents; } } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Friend/FriendError.cs b/Ryujinx.HLE/HOS/Services/Friend/FriendError.cs deleted file mode 100644 index 49bc4c67..00000000 --- a/Ryujinx.HLE/HOS/Services/Friend/FriendError.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Ryujinx.HLE.HOS.Services.Friend -{ - static class FriendError - { - public const int InvalidArgument = 2; - public const int NotificationQueueEmpty = 15; - } -} diff --git a/Ryujinx.HLE/HOS/Services/Friend/FriendServicePermissionLevel.cs b/Ryujinx.HLE/HOS/Services/Friend/FriendServicePermissionLevel.cs index 2ddb0b85..a2a4031a 100644 --- a/Ryujinx.HLE/HOS/Services/Friend/FriendServicePermissionLevel.cs +++ b/Ryujinx.HLE/HOS/Services/Friend/FriendServicePermissionLevel.cs @@ -16,4 +16,4 @@ namespace Ryujinx.HLE.HOS.Services.Friend Manager = UserMask | OverlayMask | ManagerMask, System = UserMask | SystemMask } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs b/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs index 40a54ee2..ed3bc284 100644 --- a/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs +++ b/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs @@ -5,8 +5,6 @@ using Ryujinx.HLE.Utilities; using System.IO; using System.Runtime.InteropServices; -using static Ryujinx.HLE.HOS.ErrorCode; - namespace Ryujinx.HLE.HOS.Services.Friend { class IFriendService : IpcService @@ -21,7 +19,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend [Command(10100)] // nn::friends::GetFriendListIds(int offset, nn::account::Uid userUUID, nn::friends::detail::ipc::SizedFriendFilter friendFilter, ulong pidPlaceHolder, pid) // -> int outCount, array - public long GetFriendListIds(ServiceCtx context) + public ResultCode GetFriendListIds(ServiceCtx context) { int offset = context.RequestData.ReadInt32(); @@ -36,7 +34,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend if (uuid.IsNull) { - return MakeError(ErrorModule.Friends, FriendError.InvalidArgument); + return ResultCode.InvalidArgument; } // There are no friends online, so we return 0 because the nn::account::NetworkServiceAccountId array is empty. @@ -54,13 +52,13 @@ namespace Ryujinx.HLE.HOS.Services.Friend filter.PresenceGroupId, }); - return 0; + return ResultCode.Success; } [Command(10101)] // nn::friends::GetFriendList(int offset, nn::account::Uid userUUID, nn::friends::detail::ipc::SizedFriendFilter friendFilter, ulong pidPlaceHolder, pid) // -> int outCount, array - public long GetFriendList(ServiceCtx context) + public ResultCode GetFriendList(ServiceCtx context) { int offset = context.RequestData.ReadInt32(); @@ -75,7 +73,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend if (uuid.IsNull) { - return MakeError(ErrorModule.Friends, FriendError.InvalidArgument); + return ResultCode.InvalidArgument; } // There are no friends online, so we return 0 because the nn::account::NetworkServiceAccountId array is empty. @@ -92,18 +90,18 @@ namespace Ryujinx.HLE.HOS.Services.Friend filter.PresenceGroupId, }); - return 0; + return ResultCode.Success; } [Command(10600)] // nn::friends::DeclareOpenOnlinePlaySession(nn::account::Uid) - public long DeclareOpenOnlinePlaySession(ServiceCtx context) + public ResultCode DeclareOpenOnlinePlaySession(ServiceCtx context) { UInt128 uuid = context.RequestData.ReadStruct(); if (uuid.IsNull) { - return MakeError(ErrorModule.Friends, FriendError.InvalidArgument); + return ResultCode.InvalidArgument; } if (context.Device.System.State.Account.TryGetUser(uuid, out UserProfile profile)) @@ -113,18 +111,18 @@ namespace Ryujinx.HLE.HOS.Services.Friend Logger.PrintStub(LogClass.ServiceFriend, new { UserId = uuid.ToString(), profile.OnlinePlayState }); - return 0; + return ResultCode.Success; } [Command(10601)] // nn::friends::DeclareCloseOnlinePlaySession(nn::account::Uid) - public long DeclareCloseOnlinePlaySession(ServiceCtx context) + public ResultCode DeclareCloseOnlinePlaySession(ServiceCtx context) { UInt128 uuid = context.RequestData.ReadStruct(); if (uuid.IsNull) { - return MakeError(ErrorModule.Friends, FriendError.InvalidArgument); + return ResultCode.InvalidArgument; } if (context.Device.System.State.Account.TryGetUser(uuid, out UserProfile profile)) @@ -134,12 +132,12 @@ namespace Ryujinx.HLE.HOS.Services.Friend Logger.PrintStub(LogClass.ServiceFriend, new { UserId = uuid.ToString(), profile.OnlinePlayState }); - return 0; + return ResultCode.Success; } [Command(10610)] // nn::friends::UpdateUserPresence(nn::account::Uid, u64, pid, buffer) - public long UpdateUserPresence(ServiceCtx context) + public ResultCode UpdateUserPresence(ServiceCtx context) { UInt128 uuid = context.RequestData.ReadStruct(); @@ -153,7 +151,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend if (uuid.IsNull) { - return MakeError(ErrorModule.Friends, FriendError.InvalidArgument); + return ResultCode.InvalidArgument; } int elementCount = bufferContent.Length / Marshal.SizeOf(); @@ -165,7 +163,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend Logger.PrintStub(LogClass.ServiceFriend, new { UserId = uuid.ToString(), userPresenceInputArray }); } - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Friend/IFriendServiceTypes.cs b/Ryujinx.HLE/HOS/Services/Friend/IFriendServiceTypes.cs index 7eb1b43b..5a5238f5 100644 --- a/Ryujinx.HLE/HOS/Services/Friend/IFriendServiceTypes.cs +++ b/Ryujinx.HLE/HOS/Services/Friend/IFriendServiceTypes.cs @@ -101,4 +101,4 @@ namespace Ryujinx.HLE.HOS.Services.Friend public long NetworkUserIdPlaceholder; } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Friend/INotificationService.cs b/Ryujinx.HLE/HOS/Services/Friend/INotificationService.cs index 87abc839..7cff84bd 100644 --- a/Ryujinx.HLE/HOS/Services/Friend/INotificationService.cs +++ b/Ryujinx.HLE/HOS/Services/Friend/INotificationService.cs @@ -6,8 +6,6 @@ using Ryujinx.HLE.Utilities; using System; using System.Collections.Generic; -using static Ryujinx.HLE.HOS.ErrorCode; - namespace Ryujinx.HLE.HOS.Services.Friend { class INotificationService : IpcService, IDisposable @@ -40,7 +38,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend [Command(0)] //2.0.0+ // nn::friends::detail::ipc::INotificationService::GetEvent() -> handle - public long GetEvent(ServiceCtx context) + public ResultCode GetEvent(ServiceCtx context) { if (_notificationEventHandle == 0) { @@ -52,12 +50,12 @@ namespace Ryujinx.HLE.HOS.Services.Friend context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_notificationEventHandle); - return 0; + return ResultCode.Success; } [Command(1)] //2.0.0+ // nn::friends::detail::ipc::INotificationService::Clear() - public long Clear(ServiceCtx context) + public ResultCode Clear(ServiceCtx context) { lock (_lock) { @@ -67,12 +65,12 @@ namespace Ryujinx.HLE.HOS.Services.Friend _notifications.Clear(); } - return 0; + return ResultCode.Success; } [Command(2)] // 2.0.0+ // nn::friends::detail::ipc::INotificationService::Pop() -> nn::friends::detail::ipc::SizedNotificationInfo - public long Pop(ServiceCtx context) + public ResultCode Pop(ServiceCtx context) { lock (_lock) { @@ -92,11 +90,11 @@ namespace Ryujinx.HLE.HOS.Services.Friend context.ResponseData.WriteStruct(notificationInfo); - return 0; + return ResultCode.Success; } } - return MakeError(ErrorModule.Friends, FriendError.NotificationQueueEmpty); + return ResultCode.NotificationQueueEmpty; } public void SignalFriendListUpdate(UInt128 targetId) diff --git a/Ryujinx.HLE/HOS/Services/Friend/IServiceCreator.cs b/Ryujinx.HLE/HOS/Services/Friend/IServiceCreator.cs index 2f798769..c907a2ed 100644 --- a/Ryujinx.HLE/HOS/Services/Friend/IServiceCreator.cs +++ b/Ryujinx.HLE/HOS/Services/Friend/IServiceCreator.cs @@ -1,8 +1,6 @@ using Ryujinx.Common; using Ryujinx.HLE.Utilities; -using static Ryujinx.HLE.HOS.ErrorCode; - namespace Ryujinx.HLE.HOS.Services.Friend { [Service("friend:a", FriendServicePermissionLevel.Admin)] @@ -21,36 +19,36 @@ namespace Ryujinx.HLE.HOS.Services.Friend [Command(0)] // CreateFriendService() -> object - public long CreateFriendService(ServiceCtx context) + public ResultCode CreateFriendService(ServiceCtx context) { MakeObject(context, new IFriendService(_permissionLevel)); - return 0; + return ResultCode.Success; } [Command(1)] // 2.0.0+ // CreateNotificationService(nn::account::Uid) -> object - public long CreateNotificationService(ServiceCtx context) + public ResultCode CreateNotificationService(ServiceCtx context) { UInt128 userId = context.RequestData.ReadStruct(); if (userId.IsNull) { - return MakeError(ErrorModule.Friends, FriendError.InvalidArgument); + return ResultCode.InvalidArgument; } MakeObject(context, new INotificationService(context, userId, _permissionLevel)); - return 0; + return ResultCode.Success; } [Command(2)] // 4.0.0+ // CreateDaemonSuspendSessionService() -> object - public long CreateDaemonSuspendSessionService(ServiceCtx context) + public ResultCode CreateDaemonSuspendSessionService(ServiceCtx context) { MakeObject(context, new IDaemonSuspendSessionService(_permissionLevel)); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Friend/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Friend/ResultCode.cs new file mode 100644 index 00000000..2edc20cb --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Friend/ResultCode.cs @@ -0,0 +1,13 @@ +namespace Ryujinx.HLE.HOS.Services.Friend +{ + enum ResultCode + { + ModuleId = 121, + ErrorCodeShift = 9, + + Success = 0, + + InvalidArgument = (2 << ErrorCodeShift) | ModuleId, + NotificationQueueEmpty = (15 << ErrorCodeShift) | ModuleId + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/FileSystemType.cs b/Ryujinx.HLE/HOS/Services/FspSrv/FileSystemType.cs index 20fc9bdc..4b2d0ccd 100644 --- a/Ryujinx.HLE/HOS/Services/FspSrv/FileSystemType.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/FileSystemType.cs @@ -9,4 +9,4 @@ ContentData = 6, ApplicationPackage = 7 } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/FsErr.cs b/Ryujinx.HLE/HOS/Services/FspSrv/FsErr.cs deleted file mode 100644 index 16ef03be..00000000 --- a/Ryujinx.HLE/HOS/Services/FspSrv/FsErr.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Ryujinx.HLE.HOS.Services.FspSrv -{ - static class FsErr - { - public const int PathDoesNotExist = 1; - public const int PathAlreadyExists = 2; - public const int PathAlreadyInUse = 7; - public const int PartitionNotFound = 1001; - public const int InvalidInput = 6001; - } -} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs index 87d85bcc..57d9142c 100644 --- a/Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs @@ -20,7 +20,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv [Command(0)] // Read() -> (u64 count, buffer entries) - public long Read(ServiceCtx context) + public ResultCode Read(ServiceCtx context) { long bufferPosition = context.Request.ReceiveBuff[0].Position; long bufferLen = context.Request.ReceiveBuff[0].Size; @@ -41,12 +41,12 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } context.ResponseData.Write((long)readCount); - return 0; + return ResultCode.Success; } private void WriteDirectoryEntry(ServiceCtx context, long position, LibHac.Fs.DirectoryEntry entry) @@ -67,7 +67,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv [Command(1)] // GetEntryCount() -> u64 - public long GetEntryCount(ServiceCtx context) + public ResultCode GetEntryCount(ServiceCtx context) { try { @@ -75,10 +75,10 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } } } diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs index 99277ae3..7200611b 100644 --- a/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs @@ -15,7 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv [Command(0)] // Read(u32 readOption, u64 offset, u64 size) -> (u64 out_size, buffer out_buf) - public long Read(ServiceCtx context) + public ResultCode Read(ServiceCtx context) { long position = context.Request.ReceiveBuff[0].Position; @@ -34,19 +34,19 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } context.Memory.WriteBytes(position, data); context.ResponseData.Write((long)readSize); - return 0; + return ResultCode.Success; } [Command(1)] // Write(u32 writeOption, u64 offset, u64 size, buffer) - public long Write(ServiceCtx context) + public ResultCode Write(ServiceCtx context) { long position = context.Request.SendBuff[0].Position; @@ -64,15 +64,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(2)] // Flush() - public long Flush(ServiceCtx context) + public ResultCode Flush(ServiceCtx context) { try { @@ -80,15 +80,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(3)] // SetSize(u64 size) - public long SetSize(ServiceCtx context) + public ResultCode SetSize(ServiceCtx context) { try { @@ -98,15 +98,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(4)] // GetSize() -> u64 fileSize - public long GetSize(ServiceCtx context) + public ResultCode GetSize(ServiceCtx context) { try { @@ -114,10 +114,10 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } public void Dispose() diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs index 473a2487..bcdc6fc3 100644 --- a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs @@ -1,7 +1,6 @@ using LibHac; using LibHac.Fs; -using static Ryujinx.HLE.HOS.ErrorCode; using static Ryujinx.HLE.Utilities.StringUtils; namespace Ryujinx.HLE.HOS.Services.FspSrv @@ -17,7 +16,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv [Command(0)] // CreateFile(u32 createOption, u64 size, buffer, 0x19, 0x301> path) - public long CreateFile(ServiceCtx context) + public ResultCode CreateFile(ServiceCtx context) { string name = ReadUtf8String(context); @@ -32,15 +31,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(1)] // DeleteFile(buffer, 0x19, 0x301> path) - public long DeleteFile(ServiceCtx context) + public ResultCode DeleteFile(ServiceCtx context) { string name = ReadUtf8String(context); @@ -50,15 +49,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(2)] // CreateDirectory(buffer, 0x19, 0x301> path) - public long CreateDirectory(ServiceCtx context) + public ResultCode CreateDirectory(ServiceCtx context) { string name = ReadUtf8String(context); @@ -68,15 +67,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(3)] // DeleteDirectory(buffer, 0x19, 0x301> path) - public long DeleteDirectory(ServiceCtx context) + public ResultCode DeleteDirectory(ServiceCtx context) { string name = ReadUtf8String(context); @@ -86,15 +85,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(4)] // DeleteDirectoryRecursively(buffer, 0x19, 0x301> path) - public long DeleteDirectoryRecursively(ServiceCtx context) + public ResultCode DeleteDirectoryRecursively(ServiceCtx context) { string name = ReadUtf8String(context); @@ -104,15 +103,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(5)] // RenameFile(buffer, 0x19, 0x301> oldPath, buffer, 0x19, 0x301> newPath) - public long RenameFile(ServiceCtx context) + public ResultCode RenameFile(ServiceCtx context) { string oldName = ReadUtf8String(context, 0); string newName = ReadUtf8String(context, 1); @@ -123,15 +122,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(6)] // RenameDirectory(buffer, 0x19, 0x301> oldPath, buffer, 0x19, 0x301> newPath) - public long RenameDirectory(ServiceCtx context) + public ResultCode RenameDirectory(ServiceCtx context) { string oldName = ReadUtf8String(context, 0); string newName = ReadUtf8String(context, 1); @@ -142,15 +141,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(7)] // GetEntryType(buffer, 0x19, 0x301> path) -> nn::fssrv::sf::DirectoryEntryType - public long GetEntryType(ServiceCtx context) + public ResultCode GetEntryType(ServiceCtx context) { string name = ReadUtf8String(context); @@ -164,20 +163,20 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } else { - return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist); + return ResultCode.PathDoesNotExist; } } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(8)] // OpenFile(u32 mode, buffer, 0x19, 0x301> path) -> object file - public long OpenFile(ServiceCtx context) + public ResultCode OpenFile(ServiceCtx context) { OpenMode mode = (OpenMode)context.RequestData.ReadInt32(); @@ -193,15 +192,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(9)] // OpenDirectory(u32 filter_flags, buffer, 0x19, 0x301> path) -> object directory - public long OpenDirectory(ServiceCtx context) + public ResultCode OpenDirectory(ServiceCtx context) { OpenDirectoryMode mode = (OpenDirectoryMode)context.RequestData.ReadInt32(); @@ -217,15 +216,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(10)] // Commit() - public long Commit(ServiceCtx context) + public ResultCode Commit(ServiceCtx context) { try { @@ -233,15 +232,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(11)] // GetFreeSpaceSize(buffer, 0x19, 0x301> path) -> u64 totalFreeSpace - public long GetFreeSpaceSize(ServiceCtx context) + public ResultCode GetFreeSpaceSize(ServiceCtx context) { string name = ReadUtf8String(context); @@ -251,15 +250,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(12)] // GetTotalSpaceSize(buffer, 0x19, 0x301> path) -> u64 totalSize - public long GetTotalSpaceSize(ServiceCtx context) + public ResultCode GetTotalSpaceSize(ServiceCtx context) { string name = ReadUtf8String(context); @@ -269,15 +268,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(13)] // CleanDirectoryRecursively(buffer, 0x19, 0x301> path) - public long CleanDirectoryRecursively(ServiceCtx context) + public ResultCode CleanDirectoryRecursively(ServiceCtx context) { string name = ReadUtf8String(context); @@ -287,15 +286,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } [Command(14)] // GetFileTimeStampRaw(buffer, 0x19, 0x301> path) -> bytes<0x20> timestamp - public long GetFileTimeStampRaw(ServiceCtx context) + public ResultCode GetFileTimeStampRaw(ServiceCtx context) { string name = ReadUtf8String(context); @@ -316,10 +315,10 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs index f1cb6c2a..16bfc00e 100644 --- a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs @@ -8,7 +8,6 @@ using Ryujinx.HLE.Utilities; using System.IO; using static Ryujinx.HLE.FileSystem.VirtualFileSystem; -using static Ryujinx.HLE.HOS.ErrorCode; using static Ryujinx.HLE.Utilities.StringUtils; namespace Ryujinx.HLE.HOS.Services.FspSrv @@ -20,15 +19,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv [Command(1)] // Initialize(u64, pid) - public long Initialize(ServiceCtx context) + public ResultCode Initialize(ServiceCtx context) { - return 0; + return ResultCode.Success; } [Command(8)] // OpenFileSystemWithId(nn::fssrv::sf::FileSystemType filesystem_type, nn::ApplicationId tid, buffer, 0x19, 0x301> path) // -> object contentFs - public long OpenFileSystemWithId(ServiceCtx context) + public ResultCode OpenFileSystemWithId(ServiceCtx context) { FileSystemType fileSystemType = (FileSystemType)context.RequestData.ReadInt32(); long titleId = context.RequestData.ReadInt64(); @@ -42,7 +41,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv return OpenFileSystemFromInternalFile(context, fullPath); } - return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist); + return ResultCode.PathDoesNotExist; } FileStream fileStream = new FileStream(fullPath, FileMode.Open, FileAccess.Read); @@ -57,12 +56,12 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv return OpenNsp(context, fullPath); } - return MakeError(ErrorModule.Fs, FsErr.InvalidInput); + return ResultCode.InvalidInput; } [Command(11)] // OpenBisFileSystem(nn::fssrv::sf::Partition partitionID, buffer, 0x19, 0x301>) -> object Bis - public long OpenBisFileSystem(ServiceCtx context) + public ResultCode OpenBisFileSystem(ServiceCtx context) { int bisPartitionId = context.RequestData.ReadInt32(); string partitionString = ReadUtf8String(context); @@ -81,7 +80,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv bisPartitionPath = UserNandPath; break; default: - return MakeError(ErrorModule.Fs, FsErr.InvalidInput); + return ResultCode.InvalidInput; } string fullPath = context.Device.FileSystem.GetFullPartitionPath(bisPartitionPath); @@ -90,12 +89,12 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv MakeObject(context, new IFileSystem(fileSystem)); - return 0; + return ResultCode.Success; } [Command(18)] // OpenSdCardFileSystem() -> object - public long OpenSdCardFileSystem(ServiceCtx context) + public ResultCode OpenSdCardFileSystem(ServiceCtx context) { string sdCardPath = context.Device.FileSystem.GetSdCardPath(); @@ -103,26 +102,26 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv MakeObject(context, new IFileSystem(fileSystem)); - return 0; + return ResultCode.Success; } [Command(51)] // OpenSaveDataFileSystem(u8 save_data_space_id, nn::fssrv::sf::SaveStruct saveStruct) -> object saveDataFs - public long OpenSaveDataFileSystem(ServiceCtx context) + public ResultCode OpenSaveDataFileSystem(ServiceCtx context) { return LoadSaveDataFileSystem(context); } [Command(52)] // OpenSaveDataFileSystemBySystemSaveDataId(u8 save_data_space_id, nn::fssrv::sf::SaveStruct saveStruct) -> object systemSaveDataFs - public long OpenSaveDataFileSystemBySystemSaveDataId(ServiceCtx context) + public ResultCode OpenSaveDataFileSystemBySystemSaveDataId(ServiceCtx context) { return LoadSaveDataFileSystem(context); } [Command(200)] // OpenDataStorageByCurrentProcess() -> object dataStorage - public long OpenDataStorageByCurrentProcess(ServiceCtx context) + public ResultCode OpenDataStorageByCurrentProcess(ServiceCtx context) { MakeObject(context, new IStorage(context.Device.FileSystem.RomFs.AsStorage())); @@ -131,7 +130,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv [Command(202)] // OpenDataStorageByDataId(u8 storageId, nn::ApplicationId tid) -> object dataStorage - public long OpenDataStorageByDataId(ServiceCtx context) + public ResultCode OpenDataStorageByDataId(ServiceCtx context) { StorageId storageId = (StorageId)context.RequestData.ReadByte(); byte[] padding = context.RequestData.ReadBytes(7); @@ -171,10 +170,10 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } else { @@ -192,37 +191,37 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv [Command(203)] // OpenPatchDataStorageByCurrentProcess() -> object - public long OpenPatchDataStorageByCurrentProcess(ServiceCtx context) + public ResultCode OpenPatchDataStorageByCurrentProcess(ServiceCtx context) { MakeObject(context, new IStorage(context.Device.FileSystem.RomFs.AsStorage())); - return 0; + return ResultCode.Success; } [Command(1005)] // GetGlobalAccessLogMode() -> u32 logMode - public long GetGlobalAccessLogMode(ServiceCtx context) + public ResultCode GetGlobalAccessLogMode(ServiceCtx context) { int mode = context.Device.System.GlobalAccessLogMode; context.ResponseData.Write(mode); - return 0; + return ResultCode.Success; } [Command(1006)] // OutputAccessLogToSdCard(buffer log_text) - public long OutputAccessLogToSdCard(ServiceCtx context) + public ResultCode OutputAccessLogToSdCard(ServiceCtx context) { string message = ReadUtf8StringSend(context); // FS ends each line with a newline. Remove it because Ryujinx logging adds its own newline Logger.PrintAccessLog(LogClass.ServiceFs, message.TrimEnd('\n')); - return 0; + return ResultCode.Success; } - public long LoadSaveDataFileSystem(ServiceCtx context) + public ResultCode LoadSaveDataFileSystem(ServiceCtx context) { SaveSpaceId saveSpaceId = (SaveSpaceId)context.RequestData.ReadInt64(); @@ -244,13 +243,13 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } - private long OpenNsp(ServiceCtx context, string pfsPath) + private ResultCode OpenNsp(ServiceCtx context, string pfsPath) { try { @@ -265,13 +264,13 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } - private long OpenNcaFs(ServiceCtx context, string ncaPath, LibHac.Fs.IStorage ncaStorage) + private ResultCode OpenNcaFs(ServiceCtx context, string ncaPath, LibHac.Fs.IStorage ncaStorage) { try { @@ -279,7 +278,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv if (!nca.SectionExists(NcaSectionType.Data)) { - return MakeError(ErrorModule.Fs, FsErr.PartitionNotFound); + return ResultCode.PartitionNotFound; } LibHac.Fs.IFileSystem fileSystem = nca.OpenFileSystem(NcaSectionType.Data, context.Device.System.FsIntegrityCheckLevel); @@ -288,13 +287,13 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } - private long OpenFileSystemFromInternalFile(ServiceCtx context, string fullPath) + private ResultCode OpenFileSystemFromInternalFile(ServiceCtx context, string fullPath) { DirectoryInfo archivePath = new DirectoryInfo(fullPath).Parent; @@ -325,11 +324,11 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } } - return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist); + return ResultCode.PathDoesNotExist; } private void ImportTitleKeysFromNsp(LibHac.Fs.IFileSystem nsp, Keyset keySet) diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs index afb55c5e..d13a12db 100644 --- a/Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs @@ -14,7 +14,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv [Command(0)] // Read(u64 offset, u64 length) -> buffer buffer - public long Read(ServiceCtx context) + public ResultCode Read(ServiceCtx context) { long offset = context.RequestData.ReadInt64(); long size = context.RequestData.ReadInt64(); @@ -37,18 +37,18 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } context.Memory.WriteBytes(buffDesc.Position, data); } - return 0; + return ResultCode.Success; } [Command(4)] // GetSize() -> u64 size - public long GetSize(ServiceCtx context) + public ResultCode GetSize(ServiceCtx context) { try { @@ -56,10 +56,10 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv } catch (HorizonResultException ex) { - return ex.ResultValue.Value; + return (ResultCode)ex.ResultValue.Value; } - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/ResultCode.cs b/Ryujinx.HLE/HOS/Services/FspSrv/ResultCode.cs new file mode 100644 index 00000000..b2be9293 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/FspSrv/ResultCode.cs @@ -0,0 +1,16 @@ +namespace Ryujinx.HLE.HOS.Services.FspSrv +{ + enum ResultCode + { + ModuleId = 2, + ErrorCodeShift = 9, + + Success = 0, + + PathDoesNotExist = (1 << ErrorCodeShift) | ModuleId, + PathAlreadyExists = (2 << ErrorCodeShift) | ModuleId, + PathAlreadyInUse = (7 << ErrorCodeShift) | ModuleId, + PartitionNotFound = (1001 << ErrorCodeShift) | ModuleId, + InvalidInput = (6001 << ErrorCodeShift) | ModuleId + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/HidNpad.cs b/Ryujinx.HLE/HOS/Services/Hid/HidNpad.cs index 14bff315..b2581202 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/HidNpad.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/HidNpad.cs @@ -38,4 +38,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid Right = 1 << 4, Invalid = 1 << 5 } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/HidSixAxis.cs b/Ryujinx.HLE/HOS/Services/Hid/HidSixAxis.cs index bd064762..7c7ebcc4 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/HidSixAxis.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/HidSixAxis.cs @@ -18,4 +18,4 @@ Standard, Tight } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/HidVibration.cs b/Ryujinx.HLE/HOS/Services/Hid/HidVibration.cs index 9a22ff01..635c356c 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/HidVibration.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/HidVibration.cs @@ -26,4 +26,4 @@ public float AmplitudeHigh; public float FrequencyHigh; } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/IActiveVibrationDeviceList.cs b/Ryujinx.HLE/HOS/Services/Hid/IActiveVibrationDeviceList.cs index 742681b4..8aa623ee 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/IActiveVibrationDeviceList.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/IActiveVibrationDeviceList.cs @@ -6,11 +6,11 @@ namespace Ryujinx.HLE.HOS.Services.Hid [Command(0)] // ActivateVibrationDevice(nn::hid::VibrationDeviceHandle) - public long ActivateVibrationDevice(ServiceCtx context) + public ResultCode ActivateVibrationDevice(ServiceCtx context) { int vibrationDeviceHandle = context.RequestData.ReadInt32(); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/IAppletResource.cs b/Ryujinx.HLE/HOS/Services/Hid/IAppletResource.cs index cf852593..437ef082 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/IAppletResource.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/IAppletResource.cs @@ -16,7 +16,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid [Command(0)] // GetSharedMemoryHandle() -> handle - public long GetSharedMemoryHandle(ServiceCtx context) + public ResultCode GetSharedMemoryHandle(ServiceCtx context) { if (context.Process.HandleTable.GenerateHandle(_hidSharedMem, out int handle) != KernelResult.Success) { @@ -25,7 +25,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs b/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs index 543b2582..22bd28f3 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs @@ -58,62 +58,62 @@ namespace Ryujinx.HLE.HOS.Services.Hid [Command(0)] // CreateAppletResource(nn::applet::AppletResourceUserId) -> object - public long CreateAppletResource(ServiceCtx context) + public ResultCode CreateAppletResource(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); MakeObject(context, new IAppletResource(context.Device.System.HidSharedMem)); - return 0; + return ResultCode.Success; } [Command(1)] // ActivateDebugPad(nn::applet::AppletResourceUserId) - public long ActivateDebugPad(ServiceCtx context) + public ResultCode ActivateDebugPad(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - return 0; + return ResultCode.Success; } [Command(11)] // ActivateTouchScreen(nn::applet::AppletResourceUserId) - public long ActivateTouchScreen(ServiceCtx context) + public ResultCode ActivateTouchScreen(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - return 0; + return ResultCode.Success; } [Command(21)] // ActivateMouse(nn::applet::AppletResourceUserId) - public long ActivateMouse(ServiceCtx context) + public ResultCode ActivateMouse(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - return 0; + return ResultCode.Success; } [Command(31)] // ActivateKeyboard(nn::applet::AppletResourceUserId) - public long ActivateKeyboard(ServiceCtx context) + public ResultCode ActivateKeyboard(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - return 0; + return ResultCode.Success; } [Command(40)] // AcquireXpadIdEventHandle(ulong XpadId) -> nn::sf::NativeHandle - public long AcquireXpadIdEventHandle(ServiceCtx context) + public ResultCode AcquireXpadIdEventHandle(ServiceCtx context) { long xpadId = context.RequestData.ReadInt64(); @@ -126,12 +126,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { xpadId }); - return 0; + return ResultCode.Success; } [Command(41)] // ReleaseXpadIdEventHandle(ulong XpadId) - public long ReleaseXpadIdEventHandle(ServiceCtx context) + public ResultCode ReleaseXpadIdEventHandle(ServiceCtx context) { long xpadId = context.RequestData.ReadInt64(); @@ -139,47 +139,47 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { xpadId }); - return 0; + return ResultCode.Success; } [Command(51)] // ActivateXpad(nn::hid::BasicXpadId, nn::applet::AppletResourceUserId) - public long ActivateXpad(ServiceCtx context) + public ResultCode ActivateXpad(ServiceCtx context) { int basicXpadId = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, basicXpadId }); - return 0; + return ResultCode.Success; } [Command(55)] // GetXpadIds() -> long IdsCount, buffer, type: 0xa> - public long GetXpadIds(ServiceCtx context) + public ResultCode GetXpadIds(ServiceCtx context) { // There is any Xpad, so we return 0 and write nothing inside the type-0xa buffer. context.ResponseData.Write(0L); Logger.PrintStub(LogClass.ServiceHid); - return 0; + return ResultCode.Success; } [Command(56)] // ActivateJoyXpad(nn::hid::JoyXpadId) - public long ActivateJoyXpad(ServiceCtx context) + public ResultCode ActivateJoyXpad(ServiceCtx context) { int joyXpadId = context.RequestData.ReadInt32(); Logger.PrintStub(LogClass.ServiceHid, new { joyXpadId }); - return 0; + return ResultCode.Success; } [Command(58)] // GetJoyXpadLifoHandle(nn::hid::JoyXpadId) -> nn::sf::NativeHandle - public long GetJoyXpadLifoHandle(ServiceCtx context) + public ResultCode GetJoyXpadLifoHandle(ServiceCtx context) { int joyXpadId = context.RequestData.ReadInt32(); @@ -189,46 +189,46 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { joyXpadId }); - return 0; + return ResultCode.Success; } [Command(59)] // GetJoyXpadIds() -> long IdsCount, buffer, type: 0xa> - public long GetJoyXpadIds(ServiceCtx context) + public ResultCode GetJoyXpadIds(ServiceCtx context) { // There is any JoyXpad, so we return 0 and write nothing inside the type-0xa buffer. context.ResponseData.Write(0L); Logger.PrintStub(LogClass.ServiceHid); - return 0; + return ResultCode.Success; } [Command(60)] // ActivateSixAxisSensor(nn::hid::BasicXpadId) - public long ActivateSixAxisSensor(ServiceCtx context) + public ResultCode ActivateSixAxisSensor(ServiceCtx context) { int basicXpadId = context.RequestData.ReadInt32(); Logger.PrintStub(LogClass.ServiceHid, new { basicXpadId }); - return 0; + return ResultCode.Success; } [Command(61)] // DeactivateSixAxisSensor(nn::hid::BasicXpadId) - public long DeactivateSixAxisSensor(ServiceCtx context) + public ResultCode DeactivateSixAxisSensor(ServiceCtx context) { int basicXpadId = context.RequestData.ReadInt32(); Logger.PrintStub(LogClass.ServiceHid, new { basicXpadId }); - return 0; + return ResultCode.Success; } [Command(62)] // GetSixAxisSensorLifoHandle(nn::hid::BasicXpadId) -> nn::sf::NativeHandle - public long GetSixAxisSensorLifoHandle(ServiceCtx context) + public ResultCode GetSixAxisSensorLifoHandle(ServiceCtx context) { int basicXpadId = context.RequestData.ReadInt32(); @@ -238,34 +238,34 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { basicXpadId }); - return 0; + return ResultCode.Success; } [Command(63)] // ActivateJoySixAxisSensor(nn::hid::JoyXpadId) - public long ActivateJoySixAxisSensor(ServiceCtx context) + public ResultCode ActivateJoySixAxisSensor(ServiceCtx context) { int joyXpadId = context.RequestData.ReadInt32(); Logger.PrintStub(LogClass.ServiceHid, new { joyXpadId }); - return 0; + return ResultCode.Success; } [Command(64)] // DeactivateJoySixAxisSensor(nn::hid::JoyXpadId) - public long DeactivateJoySixAxisSensor(ServiceCtx context) + public ResultCode DeactivateJoySixAxisSensor(ServiceCtx context) { int joyXpadId = context.RequestData.ReadInt32(); Logger.PrintStub(LogClass.ServiceHid, new { joyXpadId }); - return 0; + return ResultCode.Success; } [Command(65)] // GetJoySixAxisSensorLifoHandle(nn::hid::JoyXpadId) -> nn::sf::NativeHandle - public long GetJoySixAxisSensorLifoHandle(ServiceCtx context) + public ResultCode GetJoySixAxisSensorLifoHandle(ServiceCtx context) { int joyXpadId = context.RequestData.ReadInt32(); @@ -275,36 +275,36 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { joyXpadId }); - return 0; + return ResultCode.Success; } [Command(66)] // StartSixAxisSensor(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) - public long StartSixAxisSensor(ServiceCtx context) + public ResultCode StartSixAxisSensor(ServiceCtx context) { int sixAxisSensorHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle }); - return 0; + return ResultCode.Success; } [Command(67)] // StopSixAxisSensor(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) - public long StopSixAxisSensor(ServiceCtx context) + public ResultCode StopSixAxisSensor(ServiceCtx context) { int sixAxisSensorHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle }); - return 0; + return ResultCode.Success; } [Command(68)] // IsSixAxisSensorFusionEnabled(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) -> bool IsEnabled - public long IsSixAxisSensorFusionEnabled(ServiceCtx context) + public ResultCode IsSixAxisSensorFusionEnabled(ServiceCtx context) { int sixAxisSensorHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -313,12 +313,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _sixAxisSensorFusionEnabled }); - return 0; + return ResultCode.Success; } [Command(69)] // EnableSixAxisSensorFusion(bool Enabled, nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) - public long EnableSixAxisSensorFusion(ServiceCtx context) + public ResultCode EnableSixAxisSensorFusion(ServiceCtx context) { _sixAxisSensorFusionEnabled = context.RequestData.ReadBoolean(); int sixAxisSensorHandle = context.RequestData.ReadInt32(); @@ -326,12 +326,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _sixAxisSensorFusionEnabled }); - return 0; + return ResultCode.Success; } [Command(70)] // SetSixAxisSensorFusionParameters(nn::hid::SixAxisSensorHandle, float RevisePower, float ReviseRange, nn::applet::AppletResourceUserId) - public long SetSixAxisSensorFusionParameters(ServiceCtx context) + public ResultCode SetSixAxisSensorFusionParameters(ServiceCtx context) { int sixAxisSensorHandle = context.RequestData.ReadInt32(); @@ -345,12 +345,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _sensorFusionParams.RevisePower, _sensorFusionParams.ReviseRange }); - return 0; + return ResultCode.Success; } [Command(71)] // GetSixAxisSensorFusionParameters(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) -> float RevisePower, float ReviseRange) - public long GetSixAxisSensorFusionParameters(ServiceCtx context) + public ResultCode GetSixAxisSensorFusionParameters(ServiceCtx context) { int sixAxisSensorHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -360,12 +360,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _sensorFusionParams.RevisePower, _sensorFusionParams.ReviseRange }); - return 0; + return ResultCode.Success; } [Command(72)] // ResetSixAxisSensorFusionParameters(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) - public long ResetSixAxisSensorFusionParameters(ServiceCtx context) + public ResultCode ResetSixAxisSensorFusionParameters(ServiceCtx context) { int sixAxisSensorHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -375,12 +375,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _sensorFusionParams.RevisePower, _sensorFusionParams.ReviseRange }); - return 0; + return ResultCode.Success; } [Command(73)] // SetAccelerometerParameters(nn::hid::SixAxisSensorHandle, float X, float Y, nn::applet::AppletResourceUserId) - public long SetAccelerometerParameters(ServiceCtx context) + public ResultCode SetAccelerometerParameters(ServiceCtx context) { int sixAxisSensorHandle = context.RequestData.ReadInt32(); @@ -394,12 +394,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _accelerometerParams.X, _accelerometerParams.Y }); - return 0; + return ResultCode.Success; } [Command(74)] // GetAccelerometerParameters(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) -> float X, float Y - public long GetAccelerometerParameters(ServiceCtx context) + public ResultCode GetAccelerometerParameters(ServiceCtx context) { int sixAxisSensorHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -409,12 +409,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _accelerometerParams.X, _accelerometerParams.Y }); - return 0; + return ResultCode.Success; } [Command(75)] // ResetAccelerometerParameters(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) - public long ResetAccelerometerParameters(ServiceCtx context) + public ResultCode ResetAccelerometerParameters(ServiceCtx context) { int sixAxisSensorHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -424,12 +424,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _accelerometerParams.X, _accelerometerParams.Y }); - return 0; + return ResultCode.Success; } [Command(76)] // SetAccelerometerPlayMode(nn::hid::SixAxisSensorHandle, uint PlayMode, nn::applet::AppletResourceUserId) - public long SetAccelerometerPlayMode(ServiceCtx context) + public ResultCode SetAccelerometerPlayMode(ServiceCtx context) { int sixAxisSensorHandle = context.RequestData.ReadInt32(); _accelerometerPlayMode = context.RequestData.ReadUInt32(); @@ -437,12 +437,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _accelerometerPlayMode }); - return 0; + return ResultCode.Success; } [Command(77)] // GetAccelerometerPlayMode(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) -> uint PlayMode - public long GetAccelerometerPlayMode(ServiceCtx context) + public ResultCode GetAccelerometerPlayMode(ServiceCtx context) { int sixAxisSensorHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -451,12 +451,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _accelerometerPlayMode }); - return 0; + return ResultCode.Success; } [Command(78)] // ResetAccelerometerPlayMode(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) - public long ResetAccelerometerPlayMode(ServiceCtx context) + public ResultCode ResetAccelerometerPlayMode(ServiceCtx context) { int sixAxisSensorHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -465,12 +465,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _accelerometerPlayMode }); - return 0; + return ResultCode.Success; } [Command(79)] // SetGyroscopeZeroDriftMode(nn::hid::SixAxisSensorHandle, uint GyroscopeZeroDriftMode, nn::applet::AppletResourceUserId) - public long SetGyroscopeZeroDriftMode(ServiceCtx context) + public ResultCode SetGyroscopeZeroDriftMode(ServiceCtx context) { int sixAxisSensorHandle = context.RequestData.ReadInt32(); _gyroscopeZeroDriftMode = (HidGyroscopeZeroDriftMode)context.RequestData.ReadInt32(); @@ -478,12 +478,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _gyroscopeZeroDriftMode }); - return 0; + return ResultCode.Success; } [Command(80)] // GetGyroscopeZeroDriftMode(nn::applet::AppletResourceUserId, nn::hid::SixAxisSensorHandle) -> int GyroscopeZeroDriftMode - public long GetGyroscopeZeroDriftMode(ServiceCtx context) + public ResultCode GetGyroscopeZeroDriftMode(ServiceCtx context) { int sixAxisSensorHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -492,12 +492,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _gyroscopeZeroDriftMode }); - return 0; + return ResultCode.Success; } [Command(81)] // ResetGyroscopeZeroDriftMode(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) - public long ResetGyroscopeZeroDriftMode(ServiceCtx context) + public ResultCode ResetGyroscopeZeroDriftMode(ServiceCtx context) { int sixAxisSensorHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -506,12 +506,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _gyroscopeZeroDriftMode }); - return 0; + return ResultCode.Success; } [Command(82)] // IsSixAxisSensorAtRest(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) -> bool IsAsRest - public long IsSixAxisSensorAtRest(ServiceCtx context) + public ResultCode IsSixAxisSensorAtRest(ServiceCtx context) { int sixAxisSensorHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -522,24 +522,24 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, isAtRest }); - return 0; + return ResultCode.Success; } [Command(91)] // ActivateGesture(nn::applet::AppletResourceUserId, int Unknown0) - public long ActivateGesture(ServiceCtx context) + public ResultCode ActivateGesture(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); int unknown0 = context.RequestData.ReadInt32(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, unknown0 }); - return 0; + return ResultCode.Success; } [Command(100)] // SetSupportedNpadStyleSet(nn::applet::AppletResourceUserId, nn::hid::NpadStyleTag) - public long SetSupportedNpadStyleSet(ServiceCtx context) + public ResultCode SetSupportedNpadStyleSet(ServiceCtx context) { _npadStyleSet = (HidNpadStyle)context.RequestData.ReadInt32(); @@ -549,12 +549,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid _npadStyleSetUpdateEvent.ReadableEvent.Signal(); - return 0; + return ResultCode.Success; } [Command(101)] // GetSupportedNpadStyleSet(nn::applet::AppletResourceUserId) -> uint nn::hid::NpadStyleTag - public long GetSupportedNpadStyleSet(ServiceCtx context) + public ResultCode GetSupportedNpadStyleSet(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); @@ -562,46 +562,46 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadStyleSet }); - return 0; + return ResultCode.Success; } [Command(102)] // SetSupportedNpadIdType(nn::applet::AppletResourceUserId, array) - public long SetSupportedNpadIdType(ServiceCtx context) + public ResultCode SetSupportedNpadIdType(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); HidControllerId npadIdType = (HidControllerId)context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, npadIdType }); - return 0; + return ResultCode.Success; } [Command(103)] // ActivateNpad(nn::applet::AppletResourceUserId) - public long ActivateNpad(ServiceCtx context) + public ResultCode ActivateNpad(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - return 0; + return ResultCode.Success; } [Command(104)] // DeactivateNpad(nn::applet::AppletResourceUserId) - public long DeactivateNpad(ServiceCtx context) + public ResultCode DeactivateNpad(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - return 0; + return ResultCode.Success; } [Command(106)] // AcquireNpadStyleSetUpdateEventHandle(nn::applet::AppletResourceUserId, uint, ulong) -> nn::sf::NativeHandle - public long AcquireNpadStyleSetUpdateEventHandle(ServiceCtx context) + public ResultCode AcquireNpadStyleSetUpdateEventHandle(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); int npadId = context.RequestData.ReadInt32(); @@ -616,24 +616,24 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, npadId, npadStyleSet }); - return 0; + return ResultCode.Success; } [Command(107)] // DisconnectNpad(nn::applet::AppletResourceUserId, uint NpadIdType) - public long DisconnectNpad(ServiceCtx context) + public ResultCode DisconnectNpad(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); int npadIdType = context.RequestData.ReadInt32(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, npadIdType }); - return 0; + return ResultCode.Success; } [Command(108)] // GetPlayerLedPattern(uint NpadId) -> ulong LedPattern - public long GetPlayerLedPattern(ServiceCtx context) + public ResultCode GetPlayerLedPattern(ServiceCtx context) { int npadId = context.RequestData.ReadInt32(); @@ -643,36 +643,36 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { npadId, ledPattern }); - return 0; + return ResultCode.Success; } [Command(109)] // 5.0.0+ // ActivateNpadWithRevision(nn::applet::AppletResourceUserId, int Unknown) - public long ActivateNpadWithRevision(ServiceCtx context) + public ResultCode ActivateNpadWithRevision(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); int unknown = context.RequestData.ReadInt32(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, unknown }); - return 0; + return ResultCode.Success; } [Command(120)] // SetNpadJoyHoldType(nn::applet::AppletResourceUserId, long NpadJoyHoldType) - public long SetNpadJoyHoldType(ServiceCtx context) + public ResultCode SetNpadJoyHoldType(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); _npadJoyHoldType = (HidNpadJoyHoldType)context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadJoyHoldType }); - return 0; + return ResultCode.Success; } [Command(121)] // GetNpadJoyHoldType(nn::applet::AppletResourceUserId) -> long NpadJoyHoldType - public long GetNpadJoyHoldType(ServiceCtx context) + public ResultCode GetNpadJoyHoldType(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); @@ -680,12 +680,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadJoyHoldType }); - return 0; + return ResultCode.Success; } [Command(122)] // SetNpadJoyAssignmentModeSingleByDefault(uint HidControllerId, nn::applet::AppletResourceUserId) - public long SetNpadJoyAssignmentModeSingleByDefault(ServiceCtx context) + public ResultCode SetNpadJoyAssignmentModeSingleByDefault(ServiceCtx context) { HidControllerId hidControllerId = (HidControllerId)context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -694,12 +694,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, hidControllerId, _npadJoyAssignmentMode }); - return 0; + return ResultCode.Success; } [Command(123)] // SetNpadJoyAssignmentModeSingle(uint HidControllerId, nn::applet::AppletResourceUserId, long HidNpadJoyDeviceType) - public long SetNpadJoyAssignmentModeSingle(ServiceCtx context) + public ResultCode SetNpadJoyAssignmentModeSingle(ServiceCtx context) { HidControllerId hidControllerId = (HidControllerId)context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -709,12 +709,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, hidControllerId, hidNpadJoyDeviceType, _npadJoyAssignmentMode }); - return 0; + return ResultCode.Success; } [Command(124)] // SetNpadJoyAssignmentModeDual(uint HidControllerId, nn::applet::AppletResourceUserId) - public long SetNpadJoyAssignmentModeDual(ServiceCtx context) + public ResultCode SetNpadJoyAssignmentModeDual(ServiceCtx context) { HidControllerId hidControllerId = (HidControllerId)context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -723,12 +723,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, hidControllerId, _npadJoyAssignmentMode }); - return 0; + return ResultCode.Success; } [Command(125)] // MergeSingleJoyAsDualJoy(uint SingleJoyId0, uint SingleJoyId1, nn::applet::AppletResourceUserId) - public long MergeSingleJoyAsDualJoy(ServiceCtx context) + public ResultCode MergeSingleJoyAsDualJoy(ServiceCtx context) { long singleJoyId0 = context.RequestData.ReadInt32(); long singleJoyId1 = context.RequestData.ReadInt32(); @@ -736,46 +736,46 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, singleJoyId0, singleJoyId1 }); - return 0; + return ResultCode.Success; } [Command(126)] // StartLrAssignmentMode(nn::applet::AppletResourceUserId) - public long StartLrAssignmentMode(ServiceCtx context) + public ResultCode StartLrAssignmentMode(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - return 0; + return ResultCode.Success; } [Command(127)] // StopLrAssignmentMode(nn::applet::AppletResourceUserId) - public long StopLrAssignmentMode(ServiceCtx context) + public ResultCode StopLrAssignmentMode(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - return 0; + return ResultCode.Success; } [Command(128)] // SetNpadHandheldActivationMode(nn::applet::AppletResourceUserId, long HidNpadHandheldActivationMode) - public long SetNpadHandheldActivationMode(ServiceCtx context) + public ResultCode SetNpadHandheldActivationMode(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); _npadHandheldActivationMode = (HidNpadHandheldActivationMode)context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadHandheldActivationMode }); - return 0; + return ResultCode.Success; } [Command(129)] // GetNpadHandheldActivationMode(nn::applet::AppletResourceUserId) -> long HidNpadHandheldActivationMode - public long GetNpadHandheldActivationMode(ServiceCtx context) + public ResultCode GetNpadHandheldActivationMode(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); @@ -783,12 +783,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadHandheldActivationMode }); - return 0; + return ResultCode.Success; } [Command(130)] // SwapNpadAssignment(uint OldNpadAssignment, uint NewNpadAssignment, nn::applet::AppletResourceUserId) - public long SwapNpadAssignment(ServiceCtx context) + public ResultCode SwapNpadAssignment(ServiceCtx context) { int oldNpadAssignment = context.RequestData.ReadInt32(); int newNpadAssignment = context.RequestData.ReadInt32(); @@ -796,12 +796,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, oldNpadAssignment, newNpadAssignment }); - return 0; + return ResultCode.Success; } [Command(131)] // IsUnintendedHomeButtonInputProtectionEnabled(uint Unknown0, nn::applet::AppletResourceUserId) -> bool IsEnabled - public long IsUnintendedHomeButtonInputProtectionEnabled(ServiceCtx context) + public ResultCode IsUnintendedHomeButtonInputProtectionEnabled(ServiceCtx context) { uint unknown0 = context.RequestData.ReadUInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -810,12 +810,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, unknown0, _unintendedHomeButtonInputProtectionEnabled }); - return 0; + return ResultCode.Success; } [Command(132)] // EnableUnintendedHomeButtonInputProtection(bool Enable, uint Unknown0, nn::applet::AppletResourceUserId) - public long EnableUnintendedHomeButtonInputProtection(ServiceCtx context) + public ResultCode EnableUnintendedHomeButtonInputProtection(ServiceCtx context) { _unintendedHomeButtonInputProtectionEnabled = context.RequestData.ReadBoolean(); uint unknown0 = context.RequestData.ReadUInt32(); @@ -823,12 +823,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, unknown0, _unintendedHomeButtonInputProtectionEnabled }); - return 0; + return ResultCode.Success; } [Command(133)] // 5.0.0+ // SetNpadJoyAssignmentModeSingleWithDestination(uint HidControllerId, long HidNpadJoyDeviceType, nn::applet::AppletResourceUserId) -> bool Unknown0, uint Unknown1 - public long SetNpadJoyAssignmentModeSingleWithDestination(ServiceCtx context) + public ResultCode SetNpadJoyAssignmentModeSingleWithDestination(ServiceCtx context) { HidControllerId hidControllerId = (HidControllerId)context.RequestData.ReadInt32(); HidNpadJoyDeviceType hidNpadJoyDeviceType = (HidNpadJoyDeviceType)context.RequestData.ReadInt64(); @@ -848,12 +848,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Unknown1 = 0 }); - return 0; + return ResultCode.Success; } [Command(200)] // GetVibrationDeviceInfo(nn::hid::VibrationDeviceHandle) -> nn::hid::VibrationDeviceInfo - public long GetVibrationDeviceInfo(ServiceCtx context) + public ResultCode GetVibrationDeviceInfo(ServiceCtx context) { int vibrationDeviceHandle = context.RequestData.ReadInt32(); @@ -868,12 +868,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { vibrationDeviceHandle, deviceInfo.DeviceType, deviceInfo.Position }); - return 0; + return ResultCode.Success; } [Command(201)] // SendVibrationValue(nn::hid::VibrationDeviceHandle, nn::hid::VibrationValue, nn::applet::AppletResourceUserId) - public long SendVibrationValue(ServiceCtx context) + public ResultCode SendVibrationValue(ServiceCtx context) { int vibrationDeviceHandle = context.RequestData.ReadInt32(); @@ -896,12 +896,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid _vibrationValue.FrequencyHigh }); - return 0; + return ResultCode.Success; } [Command(202)] // GetActualVibrationValue(nn::hid::VibrationDeviceHandle, nn::applet::AppletResourceUserId) -> nn::hid::VibrationValue - public long GetActualVibrationValue(ServiceCtx context) + public ResultCode GetActualVibrationValue(ServiceCtx context) { int vibrationDeviceHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -920,43 +920,43 @@ namespace Ryujinx.HLE.HOS.Services.Hid _vibrationValue.FrequencyHigh }); - return 0; + return ResultCode.Success; } [Command(203)] // CreateActiveVibrationDeviceList() -> object - public long CreateActiveVibrationDeviceList(ServiceCtx context) + public ResultCode CreateActiveVibrationDeviceList(ServiceCtx context) { MakeObject(context, new IActiveApplicationDeviceList()); - return 0; + return ResultCode.Success; } [Command(204)] // PermitVibration(bool Enable) - public long PermitVibration(ServiceCtx context) + public ResultCode PermitVibration(ServiceCtx context) { _vibrationPermitted = context.RequestData.ReadBoolean(); Logger.PrintStub(LogClass.ServiceHid, new { _vibrationPermitted }); - return 0; + return ResultCode.Success; } [Command(205)] // IsVibrationPermitted() -> bool IsEnabled - public long IsVibrationPermitted(ServiceCtx context) + public ResultCode IsVibrationPermitted(ServiceCtx context) { context.ResponseData.Write(_vibrationPermitted); Logger.PrintStub(LogClass.ServiceHid, new { _vibrationPermitted }); - return 0; + return ResultCode.Success; } [Command(206)] // SendVibrationValues(nn::applet::AppletResourceUserId, buffer, type: 9>, buffer, type: 9>) - public long SendVibrationValues(ServiceCtx context) + public ResultCode SendVibrationValues(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); @@ -976,12 +976,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid VibrationValueBufferLength = vibrationValueBuffer.Length }); - return 0; + return ResultCode.Success; } [Command(207)] // 4.0.0+ // SendVibrationGcErmCommand(nn::hid::VibrationDeviceHandle, nn::hid::VibrationGcErmCommand, nn::applet::AppletResourceUserId) - public long SendVibrationGcErmCommand(ServiceCtx context) + public ResultCode SendVibrationGcErmCommand(ServiceCtx context) { int vibrationDeviceHandle = context.RequestData.ReadInt32(); long vibrationGcErmCommand = context.RequestData.ReadInt64(); @@ -989,12 +989,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, vibrationDeviceHandle, vibrationGcErmCommand }); - return 0; + return ResultCode.Success; } [Command(208)] // 4.0.0+ // GetActualVibrationGcErmCommand(nn::hid::VibrationDeviceHandle, nn::applet::AppletResourceUserId) -> nn::hid::VibrationGcErmCommand - public long GetActualVibrationGcErmCommand(ServiceCtx context) + public ResultCode GetActualVibrationGcErmCommand(ServiceCtx context) { int vibrationDeviceHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -1003,100 +1003,100 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, vibrationDeviceHandle, _vibrationGcErmCommand }); - return 0; + return ResultCode.Success; } [Command(209)] // 4.0.0+ // BeginPermitVibrationSession(nn::applet::AppletResourceUserId) - public long BeginPermitVibrationSession(ServiceCtx context) + public ResultCode BeginPermitVibrationSession(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - return 0; + return ResultCode.Success; } [Command(210)] // 4.0.0+ // EndPermitVibrationSession() - public long EndPermitVibrationSession(ServiceCtx context) + public ResultCode EndPermitVibrationSession(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceHid); - return 0; + return ResultCode.Success; } [Command(300)] // ActivateConsoleSixAxisSensor(nn::applet::AppletResourceUserId) - public long ActivateConsoleSixAxisSensor(ServiceCtx context) + public ResultCode ActivateConsoleSixAxisSensor(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - return 0; + return ResultCode.Success; } [Command(301)] // StartConsoleSixAxisSensor(nn::hid::ConsoleSixAxisSensorHandle, nn::applet::AppletResourceUserId) - public long StartConsoleSixAxisSensor(ServiceCtx context) + public ResultCode StartConsoleSixAxisSensor(ServiceCtx context) { int consoleSixAxisSensorHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, consoleSixAxisSensorHandle }); - return 0; + return ResultCode.Success; } [Command(302)] // StopConsoleSixAxisSensor(nn::hid::ConsoleSixAxisSensorHandle, nn::applet::AppletResourceUserId) - public long StopConsoleSixAxisSensor(ServiceCtx context) + public ResultCode StopConsoleSixAxisSensor(ServiceCtx context) { int consoleSixAxisSensorHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, consoleSixAxisSensorHandle }); - return 0; + return ResultCode.Success; } [Command(303)] // 5.0.0+ // ActivateSevenSixAxisSensor(nn::applet::AppletResourceUserId) - public long ActivateSevenSixAxisSensor(ServiceCtx context) + public ResultCode ActivateSevenSixAxisSensor(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - return 0; + return ResultCode.Success; } [Command(304)] // 5.0.0+ // StartSevenSixAxisSensor(nn::applet::AppletResourceUserId) - public long StartSevenSixAxisSensor(ServiceCtx context) + public ResultCode StartSevenSixAxisSensor(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - return 0; + return ResultCode.Success; } [Command(305)] // 5.0.0+ // StopSevenSixAxisSensor(nn::applet::AppletResourceUserId) - public long StopSevenSixAxisSensor(ServiceCtx context) + public ResultCode StopSevenSixAxisSensor(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - return 0; + return ResultCode.Success; } [Command(306)] // 5.0.0+ // InitializeSevenSixAxisSensor(array, ulong Counter0, array, ulong Counter1, nn::applet::AppletResourceUserId) - public long InitializeSevenSixAxisSensor(ServiceCtx context) + public ResultCode InitializeSevenSixAxisSensor(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); long counter0 = context.RequestData.ReadInt64(); @@ -1106,35 +1106,35 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, counter0, counter1 }); - return 0; + return ResultCode.Success; } [Command(307)] // 5.0.0+ // FinalizeSevenSixAxisSensor(nn::applet::AppletResourceUserId) - public long FinalizeSevenSixAxisSensor(ServiceCtx context) + public ResultCode FinalizeSevenSixAxisSensor(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - return 0; + return ResultCode.Success; } [Command(308)] // 5.0.0+ // SetSevenSixAxisSensorFusionStrength(float Strength, nn::applet::AppletResourceUserId) - public long SetSevenSixAxisSensorFusionStrength(ServiceCtx context) + public ResultCode SetSevenSixAxisSensorFusionStrength(ServiceCtx context) { _sevenSixAxisSensorFusionStrength = context.RequestData.ReadSingle(); long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _sevenSixAxisSensorFusionStrength }); - return 0; + return ResultCode.Success; } [Command(309)] // 5.0.0+ // GetSevenSixAxisSensorFusionStrength(nn::applet::AppletResourceUserId) -> float Strength - public long GetSevenSixAxisSensorFusionStrength(ServiceCtx context) + public ResultCode GetSevenSixAxisSensorFusionStrength(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); @@ -1142,34 +1142,34 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _sevenSixAxisSensorFusionStrength }); - return 0; + return ResultCode.Success; } [Command(400)] // IsUsbFullKeyControllerEnabled() -> bool IsEnabled - public long IsUsbFullKeyControllerEnabled(ServiceCtx context) + public ResultCode IsUsbFullKeyControllerEnabled(ServiceCtx context) { context.ResponseData.Write(_usbFullKeyControllerEnabled); Logger.PrintStub(LogClass.ServiceHid, new { _usbFullKeyControllerEnabled }); - return 0; + return ResultCode.Success; } [Command(401)] // EnableUsbFullKeyController(bool Enable) - public long EnableUsbFullKeyController(ServiceCtx context) + public ResultCode EnableUsbFullKeyController(ServiceCtx context) { _usbFullKeyControllerEnabled = context.RequestData.ReadBoolean(); Logger.PrintStub(LogClass.ServiceHid, new { _usbFullKeyControllerEnabled }); - return 0; + return ResultCode.Success; } [Command(402)] // IsUsbFullKeyControllerConnected(uint Unknown0) -> bool Connected - public long IsUsbFullKeyControllerConnected(ServiceCtx context) + public ResultCode IsUsbFullKeyControllerConnected(ServiceCtx context) { int unknown0 = context.RequestData.ReadInt32(); @@ -1177,12 +1177,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { unknown0, Connected = true }); - return 0; + return ResultCode.Success; } [Command(403)] // 4.0.0+ // HasBattery(uint NpadId) -> bool HasBattery - public long HasBattery(ServiceCtx context) + public ResultCode HasBattery(ServiceCtx context) { int npadId = context.RequestData.ReadInt32(); @@ -1190,12 +1190,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { npadId, HasBattery = true }); - return 0; + return ResultCode.Success; } [Command(404)] // 4.0.0+ // HasLeftRightBattery(uint NpadId) -> bool HasLeftBattery, bool HasRightBattery - public long HasLeftRightBattery(ServiceCtx context) + public ResultCode HasLeftRightBattery(ServiceCtx context) { int npadId = context.RequestData.ReadInt32(); @@ -1204,12 +1204,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { npadId, HasLeftBattery = true, HasRightBattery = true }); - return 0; + return ResultCode.Success; } [Command(405)] // 4.0.0+ // GetNpadInterfaceType(uint NpadId) -> uchar InterfaceType - public long GetNpadInterfaceType(ServiceCtx context) + public ResultCode GetNpadInterfaceType(ServiceCtx context) { int npadId = context.RequestData.ReadInt32(); @@ -1217,12 +1217,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { npadId, NpadInterfaceType = 0 }); - return 0; + return ResultCode.Success; } [Command(406)] // 4.0.0+ // GetNpadLeftRightInterfaceType(uint NpadId) -> uchar LeftInterfaceType, uchar RightInterfaceType - public long GetNpadLeftRightInterfaceType(ServiceCtx context) + public ResultCode GetNpadLeftRightInterfaceType(ServiceCtx context) { int npadId = context.RequestData.ReadInt32(); @@ -1231,12 +1231,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { npadId, LeftInterfaceType = 0, RightInterfaceType = 0 }); - return 0; + return ResultCode.Success; } [Command(500)] // 5.0.0+ // GetPalmaConnectionHandle(uint Unknown0, nn::applet::AppletResourceUserId) -> nn::hid::PalmaConnectionHandle - public long GetPalmaConnectionHandle(ServiceCtx context) + public ResultCode GetPalmaConnectionHandle(ServiceCtx context) { int unknown0 = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); @@ -1247,12 +1247,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId , unknown0, palmaConnectionHandle }); - return 0; + return ResultCode.Success; } [Command(501)] // 5.0.0+ // InitializePalma(nn::hid::PalmaConnectionHandle) - public long InitializePalma(ServiceCtx context) + public ResultCode InitializePalma(ServiceCtx context) { int palmaConnectionHandle = context.RequestData.ReadInt32(); @@ -1260,12 +1260,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid _palmaOperationCompleteEvent.ReadableEvent.Signal(); - return 0; + return ResultCode.Success; } [Command(502)] // 5.0.0+ // AcquirePalmaOperationCompleteEvent(nn::hid::PalmaConnectionHandle) -> nn::sf::NativeHandle - public long AcquirePalmaOperationCompleteEvent(ServiceCtx context) + public ResultCode AcquirePalmaOperationCompleteEvent(ServiceCtx context) { int palmaConnectionHandle = context.RequestData.ReadInt32(); @@ -1278,12 +1278,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle }); - return 0; + return ResultCode.Success; } [Command(503)] // 5.0.0+ // GetPalmaOperationInfo(nn::hid::PalmaConnectionHandle) -> long Unknown0, buffer - public long GetPalmaOperationInfo(ServiceCtx context) + public ResultCode GetPalmaOperationInfo(ServiceCtx context) { int palmaConnectionHandle = context.RequestData.ReadInt32(); @@ -1293,12 +1293,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, unknown0 }); - return 0; + return ResultCode.Success; } [Command(504)] // 5.0.0+ // PlayPalmaActivity(nn::hid::PalmaConnectionHandle, ulong Unknown0) - public long PlayPalmaActivity(ServiceCtx context) + public ResultCode PlayPalmaActivity(ServiceCtx context) { int palmaConnectionHandle = context.RequestData.ReadInt32(); long unknown0 = context.RequestData.ReadInt64(); @@ -1307,12 +1307,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid _palmaOperationCompleteEvent.ReadableEvent.Signal(); - return 0; + return ResultCode.Success; } [Command(505)] // 5.0.0+ // SetPalmaFrModeType(nn::hid::PalmaConnectionHandle, ulong FrModeType) - public long SetPalmaFrModeType(ServiceCtx context) + public ResultCode SetPalmaFrModeType(ServiceCtx context) { int palmaConnectionHandle = context.RequestData.ReadInt32(); long frModeType = context.RequestData.ReadInt64(); @@ -1321,23 +1321,23 @@ namespace Ryujinx.HLE.HOS.Services.Hid _palmaOperationCompleteEvent.ReadableEvent.Signal(); - return 0; + return ResultCode.Success; } [Command(506)] // 5.0.0+ // ReadPalmaStep(nn::hid::PalmaConnectionHandle) - public long ReadPalmaStep(ServiceCtx context) + public ResultCode ReadPalmaStep(ServiceCtx context) { int palmaConnectionHandle = context.RequestData.ReadInt32(); Logger.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle }); - return 0; + return ResultCode.Success; } [Command(507)] // 5.0.0+ // EnablePalmaStep(nn::hid::PalmaConnectionHandle, bool Enable) - public long EnablePalmaStep(ServiceCtx context) + public ResultCode EnablePalmaStep(ServiceCtx context) { int palmaConnectionHandle = context.RequestData.ReadInt32(); bool enabledPalmaStep = context.RequestData.ReadBoolean(); @@ -1346,12 +1346,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid _palmaOperationCompleteEvent.ReadableEvent.Signal(); - return 0; + return ResultCode.Success; } [Command(508)] // 5.0.0+ // ResetPalmaStep(nn::hid::PalmaConnectionHandle) - public long ResetPalmaStep(ServiceCtx context) + public ResultCode ResetPalmaStep(ServiceCtx context) { int palmaConnectionHandle = context.RequestData.ReadInt32(); @@ -1359,12 +1359,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid _palmaOperationCompleteEvent.ReadableEvent.Signal(); - return 0; + return ResultCode.Success; } [Command(509)] // 5.0.0+ // ReadPalmaApplicationSection(nn::hid::PalmaConnectionHandle, ulong Unknown0, ulong Unknown1) - public long ReadPalmaApplicationSection(ServiceCtx context) + public ResultCode ReadPalmaApplicationSection(ServiceCtx context) { int palmaConnectionHandle = context.RequestData.ReadInt32(); long unknown0 = context.RequestData.ReadInt64(); @@ -1372,12 +1372,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid Logger.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, unknown0, unknown1 }); - return 0; + return ResultCode.Success; } [Command(510)] // 5.0.0+ // WritePalmaApplicationSection(nn::hid::PalmaConnectionHandle, ulong Unknown0, ulong Unknown1, nn::hid::PalmaApplicationSectionAccessBuffer) - public long WritePalmaApplicationSection(ServiceCtx context) + public ResultCode WritePalmaApplicationSection(ServiceCtx context) { int palmaConnectionHandle = context.RequestData.ReadInt32(); long unknown0 = context.RequestData.ReadInt64(); @@ -1388,52 +1388,52 @@ namespace Ryujinx.HLE.HOS.Services.Hid _palmaOperationCompleteEvent.ReadableEvent.Signal(); - return 0; + return ResultCode.Success; } [Command(511)] // 5.0.0+ // ReadPalmaUniqueCode(nn::hid::PalmaConnectionHandle) - public long ReadPalmaUniqueCode(ServiceCtx context) + public ResultCode ReadPalmaUniqueCode(ServiceCtx context) { int palmaConnectionHandle = context.RequestData.ReadInt32(); Logger.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle }); - return 0; + return ResultCode.Success; } [Command(512)] // 5.0.0+ // SetPalmaUniqueCodeInvalid(nn::hid::PalmaConnectionHandle) - public long SetPalmaUniqueCodeInvalid(ServiceCtx context) + public ResultCode SetPalmaUniqueCodeInvalid(ServiceCtx context) { int palmaConnectionHandle = context.RequestData.ReadInt32(); Logger.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle }); - return 0; + return ResultCode.Success; } [Command(1000)] // SetNpadCommunicationMode(long CommunicationMode, nn::applet::AppletResourceUserId) - public long SetNpadCommunicationMode(ServiceCtx context) + public ResultCode SetNpadCommunicationMode(ServiceCtx context) { _npadCommunicationMode = context.RequestData.ReadInt64(); long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadCommunicationMode }); - return 0; + return ResultCode.Success; } [Command(1001)] // GetNpadCommunicationMode() -> long CommunicationMode - public long GetNpadCommunicationMode(ServiceCtx context) + public ResultCode GetNpadCommunicationMode(ServiceCtx context) { context.ResponseData.Write(_npadCommunicationMode); Logger.PrintStub(LogClass.ServiceHid, new { _npadCommunicationMode }); - return 0; + return ResultCode.Success; } } } diff --git a/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs b/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs index b47aea7f..d6659fd8 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs @@ -15,29 +15,29 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs [Command(302)] // ActivateIrsensor(nn::applet::AppletResourceUserId, pid) - public long ActivateIrsensor(ServiceCtx context) + public ResultCode ActivateIrsensor(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId }); - return 0; + return ResultCode.Success; } [Command(303)] // DeactivateIrsensor(nn::applet::AppletResourceUserId, pid) - public long DeactivateIrsensor(ServiceCtx context) + public ResultCode DeactivateIrsensor(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId }); - return 0; + return ResultCode.Success; } [Command(304)] // GetIrsensorSharedMemoryHandle(nn::applet::AppletResourceUserId, pid) -> handle - public long GetIrsensorSharedMemoryHandle(ServiceCtx context) + public ResultCode GetIrsensorSharedMemoryHandle(ServiceCtx context) { if (_irsensorSharedMemoryHandle == 0) { @@ -49,12 +49,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_irsensorSharedMemoryHandle); - return 0; + return ResultCode.Success; } [Command(311)] // GetNpadIrCameraHandle(u32) -> nn::irsensor::IrCameraHandle - public long GetNpadIrCameraHandle(ServiceCtx context) + public ResultCode GetNpadIrCameraHandle(ServiceCtx context) { NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32(); @@ -62,7 +62,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs npadIdType != NpadIdType.Unknown && npadIdType != NpadIdType.Handheld) { - return ErrorCode.MakeError(ErrorModule.Irsensor, IrsError.NpadIdOutOfRange); + return ResultCode.NpadIdOutOfRange; } HidControllerId irCameraHandle = HidUtils.GetIndexFromNpadIdType(npadIdType); @@ -70,21 +70,21 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs context.ResponseData.Write((int)irCameraHandle); // NOTE: If the irCameraHandle pointer is null this error is returned, Doesn't occur in our case. - // return ErrorCode.MakeError(ErrorModule.Irsensor, IrsError.HandlePointerIsNull); + // return ResultCode.HandlePointerIsNull; - return 0; + return ResultCode.Success; } [Command(319)] // 4.0.0+ // ActivateIrsensorWithFunctionLevel(nn::applet::AppletResourceUserId, nn::irsensor::PackedFunctionLevel, pid) - public long ActivateIrsensorWithFunctionLevel(ServiceCtx context) + public ResultCode ActivateIrsensorWithFunctionLevel(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); long packedFunctionLevel = context.RequestData.ReadInt64(); Logger.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, packedFunctionLevel }); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/Irs/IrsError.cs b/Ryujinx.HLE/HOS/Services/Hid/Irs/IrsError.cs deleted file mode 100644 index fca38507..00000000 --- a/Ryujinx.HLE/HOS/Services/Hid/Irs/IrsError.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Ryujinx.HLE.HOS.Services.Hid.Irs -{ - static class IrsError - { - public const int HandlePointerIsNull = 212; - public const int NpadIdOutOfRange = 709; - } -} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Hid/Irs/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Hid/Irs/ResultCode.cs new file mode 100644 index 00000000..016f6402 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Hid/Irs/ResultCode.cs @@ -0,0 +1,13 @@ +namespace Ryujinx.HLE.HOS.Services.Hid.Irs +{ + public enum ResultCode + { + ModuleId = 205, + ErrorCodeShift = 9, + + Success = 0, + + HandlePointerIsNull = (212 << ErrorCodeShift) | ModuleId, + NpadIdOutOfRange = (709 << ErrorCodeShift) | ModuleId + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/IpcService.cs b/Ryujinx.HLE/HOS/Services/IpcService.cs index 5fec1d3e..00907f88 100644 --- a/Ryujinx.HLE/HOS/Services/IpcService.cs +++ b/Ryujinx.HLE/HOS/Services/IpcService.cs @@ -103,7 +103,7 @@ namespace Ryujinx.HLE.HOS.Services if (ServiceConfiguration.IgnoreMissingServices || serviceExists) { - long result = 0; + ResultCode result = ResultCode.Success; context.ResponseData.BaseStream.Seek(_isDomain ? 0x20 : 0x10, SeekOrigin.Begin); @@ -118,7 +118,7 @@ namespace Ryujinx.HLE.HOS.Services Profile.Begin(profile); - result = (long)processRequest.Invoke(service, new object[] { context }); + result = (ResultCode)processRequest.Invoke(service, new object[] { context }); Profile.End(profile); } @@ -148,7 +148,7 @@ namespace Ryujinx.HLE.HOS.Services context.ResponseData.BaseStream.Seek(_isDomain ? 0x10 : 0, SeekOrigin.Begin); context.ResponseData.Write(IpcMagic.Sfco); - context.ResponseData.Write(result); + context.ResponseData.Write((long)result); } else { diff --git a/Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs b/Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs index b1de4e07..b8780730 100644 --- a/Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs @@ -12,8 +12,6 @@ using System.Linq; using System.Runtime.InteropServices; using System.Security.Cryptography; -using static Ryujinx.HLE.HOS.ErrorCode; - namespace Ryujinx.HLE.HOS.Services.Ldr { [StructLayout(LayoutKind.Explicit, Size = 0x350)] @@ -115,17 +113,17 @@ namespace Ryujinx.HLE.HOS.Services.Ldr _nroInfos = new List(MaxNro); } - private long ParseNrr(out NrrInfo nrrInfo, ServiceCtx context, long nrrAddress, long nrrSize) + private ResultCode ParseNrr(out NrrInfo nrrInfo, ServiceCtx context, long nrrAddress, long nrrSize) { nrrInfo = null; if (nrrSize == 0 || nrrAddress + nrrSize <= nrrAddress || (nrrSize & 0xFFF) != 0) { - return MakeError(ErrorModule.Loader, LoaderErr.BadSize); + return ResultCode.BadSize; } else if ((nrrAddress & 0xFFF) != 0) { - return MakeError(ErrorModule.Loader, LoaderErr.UnalignedAddress); + return ResultCode.UnalignedAddress; } StructReader reader = new StructReader(context.Memory, nrrAddress); @@ -133,11 +131,11 @@ namespace Ryujinx.HLE.HOS.Services.Ldr if (header.Magic != NrrMagic) { - return MakeError(ErrorModule.Loader, LoaderErr.InvalidNrr); + return ResultCode.InvalidNrr; } else if (header.NrrSize != nrrSize) { - return MakeError(ErrorModule.Loader, LoaderErr.BadSize); + return ResultCode.BadSize; } List hashes = new List(); @@ -149,7 +147,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldr nrrInfo = new NrrInfo(nrrAddress, header, hashes); - return 0; + return ResultCode.Success; } public bool IsNroHashPresent(byte[] nroHash) @@ -181,25 +179,25 @@ namespace Ryujinx.HLE.HOS.Services.Ldr return false; } - public long ParseNro(out NroInfo res, ServiceCtx context, ulong nroAddress, ulong nroSize, ulong bssAddress, ulong bssSize) + public ResultCode ParseNro(out NroInfo res, ServiceCtx context, ulong nroAddress, ulong nroSize, ulong bssAddress, ulong bssSize) { res = null; if (_nroInfos.Count >= MaxNro) { - return MakeError(ErrorModule.Loader, LoaderErr.MaxNro); + return ResultCode.MaxNro; } else if (nroSize == 0 || nroAddress + nroSize <= nroAddress || (nroSize & 0xFFF) != 0) { - return MakeError(ErrorModule.Loader, LoaderErr.BadSize); + return ResultCode.BadSize; } else if (bssSize != 0 && bssAddress + bssSize <= bssAddress) { - return MakeError(ErrorModule.Loader, LoaderErr.BadSize); + return ResultCode.BadSize; } else if ((nroAddress & 0xFFF) != 0) { - return MakeError(ErrorModule.Loader, LoaderErr.UnalignedAddress); + return ResultCode.UnalignedAddress; } uint magic = context.Memory.ReadUInt32((long)nroAddress + 0x10); @@ -207,7 +205,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldr if (magic != NroMagic || nroSize != nroFileSize) { - return MakeError(ErrorModule.Loader, LoaderErr.InvalidNro); + return ResultCode.InvalidNro; } byte[] nroData = context.Memory.ReadBytes((long)nroAddress, (long)nroSize); @@ -222,12 +220,12 @@ namespace Ryujinx.HLE.HOS.Services.Ldr if (!IsNroHashPresent(nroHash)) { - return MakeError(ErrorModule.Loader, LoaderErr.NroHashNotPresent); + return ResultCode.NroHashNotPresent; } if (IsNroLoaded(nroHash)) { - return MakeError(ErrorModule.Loader, LoaderErr.NroAlreadyLoaded); + return ResultCode.NroAlreadyLoaded; } stream.Position = 0; @@ -238,7 +236,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldr if ((executable.Text.Length & 0xFFF) != 0 || (executable.Ro.Length & 0xFFF) != 0 || (executable.Data.Length & 0xFFF) != 0 || (executable.BssSize & 0xFFF) != 0) { - return MakeError(ErrorModule.Loader, LoaderErr.InvalidNro); + return ResultCode.InvalidNro; } // check if everything is contiguous. @@ -246,13 +244,13 @@ namespace Ryujinx.HLE.HOS.Services.Ldr executable.DataOffset != executable.RoOffset + executable.Ro.Length || nroFileSize != executable.DataOffset + executable.Data.Length) { - return MakeError(ErrorModule.Loader, LoaderErr.InvalidNro); + return ResultCode.InvalidNro; } // finally check the bss size match. if ((ulong)executable.BssSize != bssSize) { - return MakeError(ErrorModule.Loader, LoaderErr.InvalidNro); + return ResultCode.InvalidNro; } int totalSize = executable.Text.Length + executable.Ro.Length + executable.Data.Length + executable.BssSize; @@ -266,10 +264,10 @@ namespace Ryujinx.HLE.HOS.Services.Ldr bssSize, (ulong)totalSize); - return 0; + return ResultCode.Success; } - private long MapNro(ServiceCtx context, NroInfo info, out ulong nroMappedAddress) + private ResultCode MapNro(ServiceCtx context, NroInfo info, out ulong nroMappedAddress) { nroMappedAddress = 0; @@ -281,7 +279,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldr { if (targetAddress + info.TotalSize >= memMgr.AddrSpaceEnd) { - return MakeError(ErrorModule.Loader, LoaderErr.InvalidMemoryState); + return ResultCode.InvalidMemoryState; } KMemoryInfo memInfo = memMgr.QueryMemory(targetAddress); @@ -302,7 +300,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldr if (result != KernelResult.Success) { - return MakeError(ErrorModule.Loader, LoaderErr.InvalidMemoryState); + return ResultCode.InvalidMemoryState; } ulong bssTargetAddress = targetAddress + info.NroSize; @@ -315,7 +313,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldr { memMgr.UnmapProcessCodeMemory(targetAddress, info.NroAddress, info.NroSize); - return MakeError(ErrorModule.Loader, LoaderErr.InvalidMemoryState); + return ResultCode.InvalidMemoryState; } } @@ -330,13 +328,13 @@ namespace Ryujinx.HLE.HOS.Services.Ldr memMgr.UnmapProcessCodeMemory(bssTargetAddress, info.BssAddress, info.BssSize); } - return 0; + return ResultCode.Success; } info.NroMappedAddress = targetAddress; nroMappedAddress = targetAddress; - return 0; + return ResultCode.Success; } private KernelResult LoadNroIntoMemory(KProcess process, IExecutable relocatableObject, ulong baseAddress) @@ -374,7 +372,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldr return process.MemoryManager.SetProcessMemoryPermission(dataStart, bssEnd - dataStart, MemoryPermission.ReadAndWrite); } - private long RemoveNrrInfo(long nrrAddress) + private ResultCode RemoveNrrInfo(long nrrAddress) { foreach (NrrInfo info in _nrrInfos) { @@ -382,14 +380,14 @@ namespace Ryujinx.HLE.HOS.Services.Ldr { _nrrInfos.Remove(info); - return 0; + return ResultCode.Success; } } - return MakeError(ErrorModule.Loader, LoaderErr.BadNrrAddress); + return ResultCode.BadNrrAddress; } - private long RemoveNroInfo(ServiceCtx context, ulong nroMappedAddress) + private ResultCode RemoveNroInfo(ServiceCtx context, ulong nroMappedAddress) { foreach (NroInfo info in _nroInfos) { @@ -428,18 +426,18 @@ namespace Ryujinx.HLE.HOS.Services.Ldr } } - return (long)result; + return (ResultCode)result; } } - return MakeError(ErrorModule.Loader, LoaderErr.BadNroAddress); + return ResultCode.BadNroAddress; } [Command(0)] // LoadNro(u64, u64, u64, u64, u64, pid) -> u64 - public long LoadNro(ServiceCtx context) + public ResultCode LoadNro(ServiceCtx context) { - long result = MakeError(ErrorModule.Loader, LoaderErr.BadInitialization); + ResultCode result = ResultCode.BadInitialization; // Zero context.RequestData.ReadUInt64(); @@ -475,9 +473,9 @@ namespace Ryujinx.HLE.HOS.Services.Ldr [Command(1)] // UnloadNro(u64, u64, pid) - public long UnloadNro(ServiceCtx context) + public ResultCode UnloadNro(ServiceCtx context) { - long result = MakeError(ErrorModule.Loader, LoaderErr.BadInitialization); + ResultCode result = ResultCode.BadInitialization; // Zero context.RequestData.ReadUInt64(); @@ -488,7 +486,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldr { if ((nroMappedAddress & 0xFFF) != 0) { - return MakeError(ErrorModule.Loader, LoaderErr.UnalignedAddress); + return ResultCode.UnalignedAddress; } result = RemoveNroInfo(context, nroMappedAddress); @@ -499,9 +497,9 @@ namespace Ryujinx.HLE.HOS.Services.Ldr [Command(2)] // LoadNrr(u64, u64, u64, pid) - public long LoadNrr(ServiceCtx context) + public ResultCode LoadNrr(ServiceCtx context) { - long result = MakeError(ErrorModule.Loader, LoaderErr.BadInitialization); + ResultCode result = ResultCode.BadInitialization; // Zero context.RequestData.ReadUInt64(); @@ -518,7 +516,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldr { if (_nrrInfos.Count >= MaxNrr) { - result = MakeError(ErrorModule.Loader, LoaderErr.MaxNrr); + result = ResultCode.MaxNrr; } else { @@ -532,9 +530,9 @@ namespace Ryujinx.HLE.HOS.Services.Ldr [Command(3)] // UnloadNrr(u64, u64, pid) - public long UnloadNrr(ServiceCtx context) + public ResultCode UnloadNrr(ServiceCtx context) { - long result = MakeError(ErrorModule.Loader, LoaderErr.BadInitialization); + ResultCode result = ResultCode.BadInitialization; // Zero context.RequestData.ReadUInt64(); @@ -545,7 +543,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldr { if ((nrrHeapAddress & 0xFFF) != 0) { - return MakeError(ErrorModule.Loader, LoaderErr.UnalignedAddress); + return ResultCode.UnalignedAddress; } result = RemoveNrrInfo(nrrHeapAddress); @@ -556,12 +554,12 @@ namespace Ryujinx.HLE.HOS.Services.Ldr [Command(4)] // Initialize(u64, pid, KObject) - public long Initialize(ServiceCtx context) + public ResultCode Initialize(ServiceCtx context) { // TODO: we actually ignore the pid and process handle receive, we will need to use them when we will have multi process support. _isInitialized = true; - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Ldr/LoaderErr.cs b/Ryujinx.HLE/HOS/Services/Ldr/LoaderErr.cs deleted file mode 100644 index ba77a5cc..00000000 --- a/Ryujinx.HLE/HOS/Services/Ldr/LoaderErr.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Ryujinx.HLE.HOS.Services.Ldr -{ - static class LoaderErr - { - public const int InvalidMemoryState = 51; - public const int InvalidNro = 52; - public const int InvalidNrr = 53; - public const int MaxNro = 55; - public const int MaxNrr = 56; - public const int NroAlreadyLoaded = 57; - public const int NroHashNotPresent = 54; - public const int UnalignedAddress = 81; - public const int BadSize = 82; - public const int BadNroAddress = 84; - public const int BadNrrAddress = 85; - public const int BadInitialization = 87; - } -} diff --git a/Ryujinx.HLE/HOS/Services/Ldr/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Ldr/ResultCode.cs new file mode 100644 index 00000000..8bef26b5 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Ldr/ResultCode.cs @@ -0,0 +1,23 @@ +namespace Ryujinx.HLE.HOS.Services.Ldr +{ + enum ResultCode + { + ModuleId = 9, + ErrorCodeShift = 9, + + Success = 0, + + InvalidMemoryState = (51 << ErrorCodeShift) | ModuleId, + InvalidNro = (52 << ErrorCodeShift) | ModuleId, + InvalidNrr = (53 << ErrorCodeShift) | ModuleId, + MaxNro = (55 << ErrorCodeShift) | ModuleId, + MaxNrr = (56 << ErrorCodeShift) | ModuleId, + NroAlreadyLoaded = (57 << ErrorCodeShift) | ModuleId, + NroHashNotPresent = (54 << ErrorCodeShift) | ModuleId, + UnalignedAddress = (81 << ErrorCodeShift) | ModuleId, + BadSize = (82 << ErrorCodeShift) | ModuleId, + BadNroAddress = (84 << ErrorCodeShift) | ModuleId, + BadNrrAddress = (85 << ErrorCodeShift) | ModuleId, + BadInitialization = (87 << ErrorCodeShift) | ModuleId + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Lm/ILogService.cs b/Ryujinx.HLE/HOS/Services/Lm/ILogService.cs index 575331eb..019cd7d4 100644 --- a/Ryujinx.HLE/HOS/Services/Lm/ILogService.cs +++ b/Ryujinx.HLE/HOS/Services/Lm/ILogService.cs @@ -7,11 +7,11 @@ namespace Ryujinx.HLE.HOS.Services.Lm [Command(0)] // Initialize(u64, pid) -> object - public long Initialize(ServiceCtx context) + public ResultCode Initialize(ServiceCtx context) { MakeObject(context, new ILogger()); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Lm/ILogger.cs b/Ryujinx.HLE/HOS/Services/Lm/ILogger.cs index a221b462..4b297760 100644 --- a/Ryujinx.HLE/HOS/Services/Lm/ILogger.cs +++ b/Ryujinx.HLE/HOS/Services/Lm/ILogger.cs @@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.Lm [Command(0)] // Log(buffer) - public long Log(ServiceCtx context) + public ResultCode Log(ServiceCtx context) { (long bufPos, long bufSize) = context.Request.GetBufferType0x21(); byte[] logBuffer = context.Memory.ReadBytes(bufPos, bufSize); @@ -80,7 +80,7 @@ namespace Ryujinx.HLE.HOS.Services.Lm Logger.PrintGuest(LogClass.ServiceLm, text); } - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Lr/ILocationResolver.cs b/Ryujinx.HLE/HOS/Services/Lr/ILocationResolver.cs index 329f2888..1eb38d05 100644 --- a/Ryujinx.HLE/HOS/Services/Lr/ILocationResolver.cs +++ b/Ryujinx.HLE/HOS/Services/Lr/ILocationResolver.cs @@ -3,7 +3,6 @@ using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.FileSystem.Content; using System.Text; -using static Ryujinx.HLE.HOS.ErrorCode; using static Ryujinx.HLE.Utilities.StringUtils; namespace Ryujinx.HLE.HOS.Services.Lr @@ -19,199 +18,199 @@ namespace Ryujinx.HLE.HOS.Services.Lr [Command(0)] // ResolveProgramPath() - public long ResolveProgramPath(ServiceCtx context) + public ResultCode ResolveProgramPath(ServiceCtx context) { long titleId = context.RequestData.ReadInt64(); if (ResolvePath(context, titleId, ContentType.Program)) { - return 0; + return ResultCode.Success; } else { - return MakeError(ErrorModule.Lr, LrErr.ProgramLocationEntryNotFound); + return ResultCode.ProgramLocationEntryNotFound; } } [Command(1)] // RedirectProgramPath() - public long RedirectProgramPath(ServiceCtx context) + public ResultCode RedirectProgramPath(ServiceCtx context) { long titleId = context.RequestData.ReadInt64(); RedirectPath(context, titleId, 0, ContentType.Program); - return 0; + return ResultCode.Success; } [Command(2)] // ResolveApplicationControlPath() - public long ResolveApplicationControlPath(ServiceCtx context) + public ResultCode ResolveApplicationControlPath(ServiceCtx context) { long titleId = context.RequestData.ReadInt64(); if (ResolvePath(context, titleId, ContentType.Control)) { - return 0; + return ResultCode.Success; } else { - return MakeError(ErrorModule.Lr, LrErr.AccessDenied); + return ResultCode.AccessDenied; } } [Command(3)] // ResolveApplicationHtmlDocumentPath() - public long ResolveApplicationHtmlDocumentPath(ServiceCtx context) + public ResultCode ResolveApplicationHtmlDocumentPath(ServiceCtx context) { long titleId = context.RequestData.ReadInt64(); if (ResolvePath(context, titleId, ContentType.Manual)) { - return 0; + return ResultCode.Success; } else { - return MakeError(ErrorModule.Lr, LrErr.AccessDenied); + return ResultCode.AccessDenied; } } [Command(4)] // ResolveDataPath() - public long ResolveDataPath(ServiceCtx context) + public ResultCode ResolveDataPath(ServiceCtx context) { long titleId = context.RequestData.ReadInt64(); if (ResolvePath(context, titleId, ContentType.Data) || ResolvePath(context, titleId, ContentType.PublicData)) { - return 0; + return ResultCode.Success; } else { - return MakeError(ErrorModule.Lr, LrErr.AccessDenied); + return ResultCode.AccessDenied; } } [Command(5)] // RedirectApplicationControlPath() - public long RedirectApplicationControlPath(ServiceCtx context) + public ResultCode RedirectApplicationControlPath(ServiceCtx context) { long titleId = context.RequestData.ReadInt64(); RedirectPath(context, titleId, 1, ContentType.Control); - return 0; + return ResultCode.Success; } [Command(6)] // RedirectApplicationHtmlDocumentPath() - public long RedirectApplicationHtmlDocumentPath(ServiceCtx context) + public ResultCode RedirectApplicationHtmlDocumentPath(ServiceCtx context) { long titleId = context.RequestData.ReadInt64(); RedirectPath(context, titleId, 1, ContentType.Manual); - return 0; + return ResultCode.Success; } [Command(7)] // ResolveApplicationLegalInformationPath() - public long ResolveApplicationLegalInformationPath(ServiceCtx context) + public ResultCode ResolveApplicationLegalInformationPath(ServiceCtx context) { long titleId = context.RequestData.ReadInt64(); if (ResolvePath(context, titleId, ContentType.Manual)) { - return 0; + return ResultCode.Success; } else { - return MakeError(ErrorModule.Lr, LrErr.AccessDenied); + return ResultCode.AccessDenied; } } [Command(8)] // RedirectApplicationLegalInformationPath() - public long RedirectApplicationLegalInformationPath(ServiceCtx context) + public ResultCode RedirectApplicationLegalInformationPath(ServiceCtx context) { long titleId = context.RequestData.ReadInt64(); RedirectPath(context, titleId, 1, ContentType.Manual); - return 0; + return ResultCode.Success; } [Command(9)] // Refresh() - public long Refresh(ServiceCtx context) + public ResultCode Refresh(ServiceCtx context) { context.Device.System.ContentManager.RefreshEntries(_storageId, 1); - return 0; + return ResultCode.Success; } [Command(10)] // SetProgramNcaPath2() - public long SetProgramNcaPath2(ServiceCtx context) + public ResultCode SetProgramNcaPath2(ServiceCtx context) { long titleId = context.RequestData.ReadInt64(); RedirectPath(context, titleId, 1, ContentType.Program); - return 0; + return ResultCode.Success; } [Command(11)] // ClearLocationResolver2() - public long ClearLocationResolver2(ServiceCtx context) + public ResultCode ClearLocationResolver2(ServiceCtx context) { context.Device.System.ContentManager.RefreshEntries(_storageId, 1); - return 0; + return ResultCode.Success; } [Command(12)] // DeleteProgramNcaPath() - public long DeleteProgramNcaPath(ServiceCtx context) + public ResultCode DeleteProgramNcaPath(ServiceCtx context) { long titleId = context.RequestData.ReadInt64(); DeleteContentPath(context, titleId, ContentType.Program); - return 0; + return ResultCode.Success; } [Command(13)] // DeleteControlNcaPath() - public long DeleteControlNcaPath(ServiceCtx context) + public ResultCode DeleteControlNcaPath(ServiceCtx context) { long titleId = context.RequestData.ReadInt64(); DeleteContentPath(context, titleId, ContentType.Control); - return 0; + return ResultCode.Success; } [Command(14)] // DeleteDocHtmlNcaPath() - public long DeleteDocHtmlNcaPath(ServiceCtx context) + public ResultCode DeleteDocHtmlNcaPath(ServiceCtx context) { long titleId = context.RequestData.ReadInt64(); DeleteContentPath(context, titleId, ContentType.Manual); - return 0; + return ResultCode.Success; } [Command(15)] // DeleteInfoHtmlNcaPath() - public long DeleteInfoHtmlNcaPath(ServiceCtx context) + public ResultCode DeleteInfoHtmlNcaPath(ServiceCtx context) { long titleId = context.RequestData.ReadInt64(); DeleteContentPath(context, titleId, ContentType.Manual); - return 0; + return ResultCode.Success; } private void RedirectPath(ServiceCtx context, long titleId, int flag, ContentType contentType) diff --git a/Ryujinx.HLE/HOS/Services/Lr/ILocationResolverManager.cs b/Ryujinx.HLE/HOS/Services/Lr/ILocationResolverManager.cs index d5a59a68..188a1720 100644 --- a/Ryujinx.HLE/HOS/Services/Lr/ILocationResolverManager.cs +++ b/Ryujinx.HLE/HOS/Services/Lr/ILocationResolverManager.cs @@ -9,13 +9,13 @@ namespace Ryujinx.HLE.HOS.Services.Lr [Command(0)] // OpenLocationResolver() - private long OpenLocationResolver(ServiceCtx context) + private ResultCode OpenLocationResolver(ServiceCtx context) { StorageId storageId = (StorageId)context.RequestData.ReadByte(); MakeObject(context, new ILocationResolver(storageId)); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Lr/LrErr.cs b/Ryujinx.HLE/HOS/Services/Lr/LrErr.cs deleted file mode 100644 index 5c87b73b..00000000 --- a/Ryujinx.HLE/HOS/Services/Lr/LrErr.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Ryujinx.HLE.HOS.Services.Lr -{ - class LrErr - { - public const int ProgramLocationEntryNotFound = 2; - public const int AccessDenied = 5; - } -} diff --git a/Ryujinx.HLE/HOS/Services/Lr/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Lr/ResultCode.cs new file mode 100644 index 00000000..10c42cd6 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Lr/ResultCode.cs @@ -0,0 +1,13 @@ +namespace Ryujinx.HLE.HOS.Services.Lr +{ + enum ResultCode + { + ModuleId = 8, + ErrorCodeShift = 9, + + Success = 0, + + ProgramLocationEntryNotFound = (2 << ErrorCodeShift) | ModuleId, + AccessDenied = (5 << ErrorCodeShift) | ModuleId + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs b/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs index 6b724a59..5a3132e2 100644 --- a/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs +++ b/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs @@ -9,7 +9,7 @@ namespace Ryujinx.HLE.HOS.Services.Mm [Command(0)] // InitializeOld(u32, u32, u32) - public long InitializeOld(ServiceCtx context) + public ResultCode InitializeOld(ServiceCtx context) { int unknown0 = context.RequestData.ReadInt32(); int unknown1 = context.RequestData.ReadInt32(); @@ -17,35 +17,35 @@ namespace Ryujinx.HLE.HOS.Services.Mm Logger.PrintStub(LogClass.ServiceMm, new { unknown0, unknown1, unknown2 }); - return 0; + return ResultCode.Success; } [Command(1)] // FinalizeOld(u32) - public long FinalizeOld(ServiceCtx context) + public ResultCode FinalizeOld(ServiceCtx context) { context.Device.Gpu.UninitializeVideoDecoder(); Logger.PrintStub(LogClass.ServiceMm); - return 0; + return ResultCode.Success; } [Command(2)] // SetAndWaitOld(u32, u32, u32) - public long SetAndWaitOld(ServiceCtx context) + public ResultCode SetAndWaitOld(ServiceCtx context) { int unknown0 = context.RequestData.ReadInt32(); int unknown1 = context.RequestData.ReadInt32(); int unknown2 = context.RequestData.ReadInt32(); Logger.PrintStub(LogClass.ServiceMm, new { unknown0, unknown1, unknown2 }); - return 0; + return ResultCode.Success; } [Command(3)] // GetOld(u32) -> u32 - public long GetOld(ServiceCtx context) + public ResultCode GetOld(ServiceCtx context) { int unknown0 = context.RequestData.ReadInt32(); @@ -53,32 +53,32 @@ namespace Ryujinx.HLE.HOS.Services.Mm context.ResponseData.Write(0); - return 0; + return ResultCode.Success; } [Command(4)] // Initialize() - public long Initialize(ServiceCtx context) + public ResultCode Initialize(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceMm); - return 0; + return ResultCode.Success; } [Command(5)] // Finalize(u32) - public long Finalize(ServiceCtx context) + public ResultCode Finalize(ServiceCtx context) { context.Device.Gpu.UninitializeVideoDecoder(); Logger.PrintStub(LogClass.ServiceMm); - return 0; + return ResultCode.Success; } [Command(6)] // SetAndWait(u32, u32, u32) - public long SetAndWait(ServiceCtx context) + public ResultCode SetAndWait(ServiceCtx context) { int unknown0 = context.RequestData.ReadInt32(); int unknown1 = context.RequestData.ReadInt32(); @@ -86,12 +86,12 @@ namespace Ryujinx.HLE.HOS.Services.Mm Logger.PrintStub(LogClass.ServiceMm, new { unknown0, unknown1, unknown2 }); - return 0; + return ResultCode.Success; } [Command(7)] // Get(u32) -> u32 - public long Get(ServiceCtx context) + public ResultCode Get(ServiceCtx context) { int unknown0 = context.RequestData.ReadInt32(); @@ -99,7 +99,7 @@ namespace Ryujinx.HLE.HOS.Services.Mm context.ResponseData.Write(0); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUser.cs b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUser.cs index 32aaacac..c8a7ae4b 100644 --- a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUser.cs +++ b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUser.cs @@ -21,7 +21,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp [Command(0)] // Initialize(u64, u64, pid, buffer) - public long Initialize(ServiceCtx context) + public ResultCode Initialize(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); long mcuVersionData = context.RequestData.ReadInt64(); @@ -50,12 +50,12 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp _state = State.Initialized; - return 0; + return ResultCode.Success; } [Command(1)] // Finalize() - public long Finalize(ServiceCtx context) + public ResultCode Finalize(ServiceCtx context) { // TODO: Call StopDetection() and Unmount() when they will be implemented. // Remove the instance of nn::nfc::server::Manager when it will be implemented. @@ -65,16 +65,16 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp _state = State.NonInitialized; - return 0; + return ResultCode.Success; } [Command(2)] // ListDevices() -> (u32, buffer) - public long ListDevices(ServiceCtx context) + public ResultCode ListDevices(ServiceCtx context) { if (context.Request.RecvListBuff.Count == 0) { - return ErrorCode.MakeError(ErrorModule.Nfp, NfpError.DevicesBufferIsNull); + return ResultCode.DevicesBufferIsNull; } long outputPosition = context.Request.RecvListBuff[0].Position; @@ -82,7 +82,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp if (_devices.Count == 0) { - return ErrorCode.MakeError(ErrorModule.Nfp, NfpError.DeviceNotFound); + return ResultCode.DeviceNotFound; } for (int i = 0; i < _devices.Count; i++) @@ -92,110 +92,110 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp context.ResponseData.Write(_devices.Count); - return 0; + return ResultCode.Success; } [Command(3)] // StartDetection(bytes<8, 4>) - public long StartDetection(ServiceCtx context) + public ResultCode StartDetection(ServiceCtx context) { throw new ServiceNotImplementedException(context); } [Command(4)] // StopDetection(bytes<8, 4>) - public long StopDetection(ServiceCtx context) + public ResultCode StopDetection(ServiceCtx context) { throw new ServiceNotImplementedException(context); } [Command(5)] // Mount(bytes<8, 4>, u32, u32) - public long Mount(ServiceCtx context) + public ResultCode Mount(ServiceCtx context) { throw new ServiceNotImplementedException(context); } [Command(6)] // Unmount(bytes<8, 4>) - public long Unmount(ServiceCtx context) + public ResultCode Unmount(ServiceCtx context) { throw new ServiceNotImplementedException(context); } [Command(7)] // OpenApplicationArea(bytes<8, 4>, u32) - public long OpenApplicationArea(ServiceCtx context) + public ResultCode OpenApplicationArea(ServiceCtx context) { throw new ServiceNotImplementedException(context); } [Command(8)] // GetApplicationArea(bytes<8, 4>) -> (u32, buffer) - public long GetApplicationArea(ServiceCtx context) + public ResultCode GetApplicationArea(ServiceCtx context) { throw new ServiceNotImplementedException(context); } [Command(9)] // SetApplicationArea(bytes<8, 4>, buffer) - public long SetApplicationArea(ServiceCtx context) + public ResultCode SetApplicationArea(ServiceCtx context) { throw new ServiceNotImplementedException(context); } [Command(10)] // Flush(bytes<8, 4>) - public long Flush(ServiceCtx context) + public ResultCode Flush(ServiceCtx context) { throw new ServiceNotImplementedException(context); } [Command(11)] // Restore(bytes<8, 4>) - public long Restore(ServiceCtx context) + public ResultCode Restore(ServiceCtx context) { throw new ServiceNotImplementedException(context); } [Command(12)] // CreateApplicationArea(bytes<8, 4>, u32, buffer) - public long CreateApplicationArea(ServiceCtx context) + public ResultCode CreateApplicationArea(ServiceCtx context) { throw new ServiceNotImplementedException(context); } [Command(13)] // GetTagInfo(bytes<8, 4>) -> buffer, 0x1a> - public long GetTagInfo(ServiceCtx context) + public ResultCode GetTagInfo(ServiceCtx context) { throw new ServiceNotImplementedException(context); } [Command(14)] // GetRegisterInfo(bytes<8, 4>) -> buffer, 0x1a> - public long GetRegisterInfo(ServiceCtx context) + public ResultCode GetRegisterInfo(ServiceCtx context) { throw new ServiceNotImplementedException(context); } [Command(15)] // GetCommonInfo(bytes<8, 4>) -> buffer, 0x1a> - public long GetCommonInfo(ServiceCtx context) + public ResultCode GetCommonInfo(ServiceCtx context) { throw new ServiceNotImplementedException(context); } [Command(16)] // GetModelInfo(bytes<8, 4>) -> buffer, 0x1a> - public long GetModelInfo(ServiceCtx context) + public ResultCode GetModelInfo(ServiceCtx context) { throw new ServiceNotImplementedException(context); } [Command(17)] // AttachActivateEvent(bytes<8, 4>) -> handle - public long AttachActivateEvent(ServiceCtx context) + public ResultCode AttachActivateEvent(ServiceCtx context) { uint deviceHandle = context.RequestData.ReadUInt32(); @@ -215,16 +215,16 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_devices[i].ActivateEventHandle); - return 0; + return ResultCode.Success; } } - return ErrorCode.MakeError(ErrorModule.Nfp, NfpError.DeviceNotFound); + return ResultCode.DeviceNotFound; } [Command(18)] // AttachDeactivateEvent(bytes<8, 4>) -> handle - public long AttachDeactivateEvent(ServiceCtx context) + public ResultCode AttachDeactivateEvent(ServiceCtx context) { uint deviceHandle = context.RequestData.ReadUInt32(); @@ -244,25 +244,25 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_devices[i].DeactivateEventHandle); - return 0; + return ResultCode.Success; } } - return ErrorCode.MakeError(ErrorModule.Nfp, NfpError.DeviceNotFound); + return ResultCode.DeviceNotFound; } [Command(19)] // GetState() -> u32 - public long GetState(ServiceCtx context) + public ResultCode GetState(ServiceCtx context) { context.ResponseData.Write((int)_state); - return 0; + return ResultCode.Success; } [Command(20)] // GetDeviceState(bytes<8, 4>) -> u32 - public long GetDeviceState(ServiceCtx context) + public ResultCode GetDeviceState(ServiceCtx context) { uint deviceHandle = context.RequestData.ReadUInt32(); @@ -272,18 +272,18 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp { context.ResponseData.Write((uint)_devices[i].State); - return 0; + return ResultCode.Success; } } context.ResponseData.Write((uint)DeviceState.Unavailable); - return ErrorCode.MakeError(ErrorModule.Nfp, NfpError.DeviceNotFound); + return ResultCode.DeviceNotFound; } [Command(21)] // GetNpadId(bytes<8, 4>) -> u32 - public long GetNpadId(ServiceCtx context) + public ResultCode GetNpadId(ServiceCtx context) { uint deviceHandle = context.RequestData.ReadUInt32(); @@ -293,23 +293,23 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp { context.ResponseData.Write((uint)HidUtils.GetNpadIdTypeFromIndex(_devices[i].Handle)); - return 0; + return ResultCode.Success; } } - return ErrorCode.MakeError(ErrorModule.Nfp, NfpError.DeviceNotFound); + return ResultCode.DeviceNotFound; } [Command(22)] // GetApplicationAreaSize(bytes<8, 4>) -> u32 - public long GetApplicationAreaSize(ServiceCtx context) + public ResultCode GetApplicationAreaSize(ServiceCtx context) { throw new ServiceNotImplementedException(context); } [Command(23)] // 3.0.0+ // AttachAvailabilityChangeEvent() -> handle - public long AttachAvailabilityChangeEvent(ServiceCtx context) + public ResultCode AttachAvailabilityChangeEvent(ServiceCtx context) { if (_availabilityChangeEventHandle == 0) { @@ -323,12 +323,12 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_availabilityChangeEventHandle); - return 0; + return ResultCode.Success; } [Command(24)] // 3.0.0+ // RecreateApplicationArea(bytes<8, 4>, u32, buffer) - public long RecreateApplicationArea(ServiceCtx context) + public ResultCode RecreateApplicationArea(ServiceCtx context) { throw new ServiceNotImplementedException(context); } diff --git a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUserManager.cs b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUserManager.cs index d33c3a32..f7439686 100644 --- a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUserManager.cs +++ b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUserManager.cs @@ -7,11 +7,11 @@ [Command(0)] // CreateUserInterface() -> object - public long GetUserInterface(ServiceCtx context) + public ResultCode GetUserInterface(ServiceCtx context) { MakeObject(context, new IUser()); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpError.cs b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpError.cs deleted file mode 100644 index f9bfecc0..00000000 --- a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpError.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp -{ - static class NfpError - { - public const int DeviceNotFound = 64; - public const int DevicesBufferIsNull = 65; - } -} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/ResultCode.cs new file mode 100644 index 00000000..b42a28a9 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/ResultCode.cs @@ -0,0 +1,13 @@ +namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp +{ + public enum ResultCode + { + ModuleId = 115, + ErrorCodeShift = 9, + + Success = 0, + + DeviceNotFound = (64 << ErrorCodeShift) | ModuleId, + DevicesBufferIsNull = (65 << ErrorCodeShift) | ModuleId + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Nifm/IGeneralService.cs b/Ryujinx.HLE/HOS/Services/Nifm/IGeneralService.cs index 71dfe1d1..ba6a2b5d 100644 --- a/Ryujinx.HLE/HOS/Services/Nifm/IGeneralService.cs +++ b/Ryujinx.HLE/HOS/Services/Nifm/IGeneralService.cs @@ -5,8 +5,6 @@ using System.Net; using System.Net.NetworkInformation; using System.Net.Sockets; -using static Ryujinx.HLE.HOS.ErrorCode; - namespace Ryujinx.HLE.HOS.Services.Nifm { class IGeneralService : IpcService @@ -15,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm [Command(4)] // CreateRequest(u32) -> object - public long CreateRequest(ServiceCtx context) + public ResultCode CreateRequest(ServiceCtx context) { int unknown = context.RequestData.ReadInt32(); @@ -23,16 +21,16 @@ namespace Ryujinx.HLE.HOS.Services.Nifm Logger.PrintStub(LogClass.ServiceNifm); - return 0; + return ResultCode.Success; } [Command(12)] // GetCurrentIpAddress() -> nn::nifm::IpV4Address - public long GetCurrentIpAddress(ServiceCtx context) + public ResultCode GetCurrentIpAddress(ServiceCtx context) { if (!NetworkInterface.GetIsNetworkAvailable()) { - return MakeError(ErrorModule.Nifm, NifmErr.NoInternetConnection); + return ResultCode.NoInternetConnection; } IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); @@ -43,7 +41,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm Logger.PrintInfo(LogClass.ServiceNifm, $"Console's local IP is \"{address}\"."); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Nifm/IRequest.cs b/Ryujinx.HLE/HOS/Services/Nifm/IRequest.cs index ac3170a4..efdb5cdb 100644 --- a/Ryujinx.HLE/HOS/Services/Nifm/IRequest.cs +++ b/Ryujinx.HLE/HOS/Services/Nifm/IRequest.cs @@ -19,27 +19,27 @@ namespace Ryujinx.HLE.HOS.Services.Nifm [Command(0)] // GetRequestState() -> u32 - public long GetRequestState(ServiceCtx context) + public ResultCode GetRequestState(ServiceCtx context) { context.ResponseData.Write(1); Logger.PrintStub(LogClass.ServiceNifm); - return 0; + return ResultCode.Success; } [Command(1)] // GetResult() - public long GetResult(ServiceCtx context) + public ResultCode GetResult(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceNifm); - return 0; + return ResultCode.Success; } [Command(2)] // GetSystemEventReadableHandles() -> (handle, handle) - public long GetSystemEventReadableHandles(ServiceCtx context) + public ResultCode GetSystemEventReadableHandles(ServiceCtx context) { if (context.Process.HandleTable.GenerateHandle(_event0.ReadableEvent, out int handle0) != KernelResult.Success) { @@ -53,34 +53,34 @@ namespace Ryujinx.HLE.HOS.Services.Nifm context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle0, handle1); - return 0; + return ResultCode.Success; } [Command(3)] // Cancel() - public long Cancel(ServiceCtx context) + public ResultCode Cancel(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceNifm); - return 0; + return ResultCode.Success; } [Command(4)] // Submit() - public long Submit(ServiceCtx context) + public ResultCode Submit(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceNifm); - return 0; + return ResultCode.Success; } [Command(11)] // SetConnectionConfirmationOption(i8) - public long SetConnectionConfirmationOption(ServiceCtx context) + public ResultCode SetConnectionConfirmationOption(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceNifm); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs b/Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs index 72ba2b7e..c3f32c2f 100644 --- a/Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs +++ b/Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs @@ -7,20 +7,20 @@ namespace Ryujinx.HLE.HOS.Services.Nifm [Command(4)] // CreateGeneralServiceOld() -> object - public long CreateGeneralServiceOld(ServiceCtx context) + public ResultCode CreateGeneralServiceOld(ServiceCtx context) { MakeObject(context, new IGeneralService()); - return 0; + return ResultCode.Success; } [Command(5)] // 3.0.0+ // CreateGeneralService(u64, pid) -> object - public long CreateGeneralService(ServiceCtx context) + public ResultCode CreateGeneralService(ServiceCtx context) { MakeObject(context, new IGeneralService()); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Nifm/NifmErr.cs b/Ryujinx.HLE/HOS/Services/Nifm/NifmErr.cs deleted file mode 100644 index 3abeb838..00000000 --- a/Ryujinx.HLE/HOS/Services/Nifm/NifmErr.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Ryujinx.HLE.HOS.Services.Nifm -{ - static class NifmErr - { - public const int NoInternetConnection = 300; - } -} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Nifm/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Nifm/ResultCode.cs new file mode 100644 index 00000000..a265c048 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Nifm/ResultCode.cs @@ -0,0 +1,12 @@ +namespace Ryujinx.HLE.HOS.Services.Nifm +{ + enum ResultCode + { + ModuleId = 110, + ErrorCodeShift = 9, + + Success = 0, + + NoInternetConnection = (300 << ErrorCodeShift) | ModuleId + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs b/Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs index 3357bce1..13d56934 100644 --- a/Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs @@ -9,18 +9,18 @@ namespace Ryujinx.HLE.HOS.Services.Ns [Command(2)] // CountAddOnContent(u64, pid) -> u32 - public static long CountAddOnContent(ServiceCtx context) + public static ResultCode CountAddOnContent(ServiceCtx context) { context.ResponseData.Write(0); Logger.PrintStub(LogClass.ServiceNs); - return 0; + return ResultCode.Success; } [Command(3)] // ListAddOnContent(u32, u32, u64, pid) -> (u32, buffer) - public static long ListAddOnContent(ServiceCtx context) + public static ResultCode ListAddOnContent(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceNs); @@ -28,7 +28,7 @@ namespace Ryujinx.HLE.HOS.Services.Ns // It's unknown what it contains. context.ResponseData.Write(0); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs index 50d181b7..d09403f9 100644 --- a/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs @@ -11,7 +11,7 @@ namespace Ryujinx.HLE.HOS.Services.Ns [Command(400)] // GetApplicationControlData(unknown<0x10>) -> (unknown<4>, buffer) - public long GetApplicationControlData(ServiceCtx context) + public ResultCode GetApplicationControlData(ServiceCtx context) { long position = context.Request.ReceiveBuff[0].Position; @@ -189,7 +189,6 @@ namespace Ryujinx.HLE.HOS.Services.Ns context.Memory.WriteBytes(position, reserved03); position += reserved03.Length; - for (int i = 0; i < 16; i++) { ulong value = 0; @@ -207,7 +206,7 @@ namespace Ryujinx.HLE.HOS.Services.Ns context.Memory.WriteByte(position++, nacp.RepairFlag); context.Memory.WriteByte(position++, nacp.ProgramIndex); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs index c1ca8f07..a8c9ff9a 100644 --- a/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs @@ -8,11 +8,11 @@ namespace Ryujinx.HLE.HOS.Services.Ns [Command(7996)] // GetApplicationManagerInterface() -> object - public long GetApplicationManagerInterface(ServiceCtx context) + public ResultCode GetApplicationManagerInterface(ServiceCtx context) { MakeObject(context, new IApplicationManagerInterface(context)); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs b/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs index 32cdee74..50ab7e01 100644 --- a/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs @@ -48,7 +48,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv [Command(0)] // Open(buffer path) -> (u32 fd, u32 error_code) - public long Open(ServiceCtx context) + public ResultCode Open(ServiceCtx context) { long namePtr = context.Request.SendBuff[0].Position; @@ -59,14 +59,14 @@ namespace Ryujinx.HLE.HOS.Services.Nv context.ResponseData.Write(fd); context.ResponseData.Write(0); - return 0; + return ResultCode.Success; } [Command(1)] // Ioctl(u32 fd, u32 rq_id, buffer) -> (u32 error_code, buffer) [Command(11)] // 3.0.0+ // Ioctl2(u32, u32, buffer, buffer) -> (u32, buffer) - public long Ioctl(ServiceCtx context) + public ResultCode Ioctl(ServiceCtx context) { int fd = context.RequestData.ReadInt32(); int cmd = context.RequestData.ReadInt32(); @@ -87,12 +87,12 @@ namespace Ryujinx.HLE.HOS.Services.Nv // TODO: Verify if the error codes needs to be translated. context.ResponseData.Write(result); - return 0; + return ResultCode.Success; } [Command(2)] // Close(u32 fd) -> u32 error_code - public long Close(ServiceCtx context) + public ResultCode Close(ServiceCtx context) { int fd = context.RequestData.ReadInt32(); @@ -100,12 +100,12 @@ namespace Ryujinx.HLE.HOS.Services.Nv context.ResponseData.Write(0); - return 0; + return ResultCode.Success; } [Command(3)] // Initialize(u32 transfer_memory_size, handle current_process, handle transfer_memory) -> u32 error_code - public long Initialize(ServiceCtx context) + public ResultCode Initialize(ServiceCtx context) { long transferMemSize = context.RequestData.ReadInt64(); int transferMemHandle = context.Request.HandleDesc.ToCopy[0]; @@ -114,12 +114,12 @@ namespace Ryujinx.HLE.HOS.Services.Nv context.ResponseData.Write(0); - return 0; + return ResultCode.Success; } [Command(4)] // QueryEvent(u32 fd, u32 event_id) -> (u32, handle) - public long QueryEvent(ServiceCtx context) + public ResultCode QueryEvent(ServiceCtx context) { int fd = context.RequestData.ReadInt32(); int eventId = context.RequestData.ReadInt32(); @@ -134,36 +134,36 @@ namespace Ryujinx.HLE.HOS.Services.Nv context.ResponseData.Write(0); - return 0; + return ResultCode.Success; } [Command(8)] // SetClientPID(u64, pid) -> u32 error_code - public long SetClientPid(ServiceCtx context) + public ResultCode SetClientPid(ServiceCtx context) { long pid = context.RequestData.ReadInt64(); context.ResponseData.Write(0); - return 0; + return ResultCode.Success; } [Command(9)] // DumpGraphicsMemoryInfo() - public long DumpGraphicsMemoryInfo(ServiceCtx context) + public ResultCode DumpGraphicsMemoryInfo(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceNv); - return 0; + return ResultCode.Success; } [Command(13)] // FinishInitialize(unknown<8>) - public long FinishInitialize(ServiceCtx context) + public ResultCode FinishInitialize(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceNv); - return 0; + return ResultCode.Success; } private static int ProcessIoctlNvGpuAS(ServiceCtx context, int cmd) diff --git a/Ryujinx.HLE/HOS/Services/Nv/NvHelper.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHelper.cs deleted file mode 100644 index d9a1c452..00000000 --- a/Ryujinx.HLE/HOS/Services/Nv/NvHelper.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Ryujinx.HLE.HOS.Services.Nv -{ - static class NvHelper - { - public static void Crash() - { - - } - } -} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Nv/NvResult.cs b/Ryujinx.HLE/HOS/Services/Nv/NvResult.cs index 86ecd975..362a0450 100644 --- a/Ryujinx.HLE/HOS/Services/Nv/NvResult.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvResult.cs @@ -11,4 +11,4 @@ namespace Ryujinx.HLE.HOS.Services.Nv public const int Restart = -85; public const int TimedOut = -110; } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlService.cs b/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlService.cs index 27401fe5..e9cc72c1 100644 --- a/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlService.cs +++ b/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlService.cs @@ -15,7 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.Pctl [Command(1)] // 4.0.0+ // Initialize() - public long Initialize(ServiceCtx context) + public ResultCode Initialize(ServiceCtx context) { if (_needInitialize && !_initialized) { @@ -26,16 +26,16 @@ namespace Ryujinx.HLE.HOS.Services.Pctl Logger.PrintWarning(LogClass.ServicePctl, "Service is already initialized!"); } - return 0; + return ResultCode.Success; } [Command(1001)] // CheckFreeCommunicationPermission() - public long CheckFreeCommunicationPermission(ServiceCtx context) + public ResultCode CheckFreeCommunicationPermission(ServiceCtx context) { Logger.PrintStub(LogClass.ServicePctl); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlServiceFactory.cs b/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlServiceFactory.cs index 742a95e0..b67543dd 100644 --- a/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlServiceFactory.cs +++ b/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlServiceFactory.cs @@ -10,20 +10,20 @@ namespace Ryujinx.HLE.HOS.Services.Pctl [Command(0)] // CreateService(u64, pid) -> object - public long CreateService(ServiceCtx context) + public ResultCode CreateService(ServiceCtx context) { MakeObject(context, new IParentalControlService()); - return 0; + return ResultCode.Success; } [Command(1)] // 4.0.0+ // CreateServiceWithoutInitialize(u64, pid) -> object - public long CreateServiceWithoutInitialize(ServiceCtx context) + public ResultCode CreateServiceWithoutInitialize(ServiceCtx context) { MakeObject(context, new IParentalControlService(false)); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs b/Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs index 36b840e4..a5e3e52a 100644 --- a/Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs +++ b/Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs @@ -12,18 +12,18 @@ namespace Ryujinx.HLE.HOS.Services.Pl [Command(0)] // RequestLoad(u32) - public long RequestLoad(ServiceCtx context) + public ResultCode RequestLoad(ServiceCtx context) { SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32(); // We don't need to do anything here because we do lazy initialization // on SharedFontManager (the font is loaded when necessary). - return 0; + return ResultCode.Success; } [Command(1)] // GetLoadState(u32) -> u32 - public long GetLoadState(ServiceCtx context) + public ResultCode GetLoadState(ServiceCtx context) { SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32(); @@ -31,34 +31,34 @@ namespace Ryujinx.HLE.HOS.Services.Pl // All fonts are already loaded. context.ResponseData.Write(1); - return 0; + return ResultCode.Success; } [Command(2)] // GetFontSize(u32) -> u32 - public long GetFontSize(ServiceCtx context) + public ResultCode GetFontSize(ServiceCtx context) { SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32(); context.ResponseData.Write(context.Device.System.Font.GetFontSize(fontType)); - return 0; + return ResultCode.Success; } [Command(3)] // GetSharedMemoryAddressOffset(u32) -> u32 - public long GetSharedMemoryAddressOffset(ServiceCtx context) + public ResultCode GetSharedMemoryAddressOffset(ServiceCtx context) { SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32(); context.ResponseData.Write(context.Device.System.Font.GetSharedMemoryAddressOffset(fontType)); - return 0; + return ResultCode.Success; } [Command(4)] // GetSharedMemoryNativeHandle() -> handle - public long GetSharedMemoryNativeHandle(ServiceCtx context) + public ResultCode GetSharedMemoryNativeHandle(ServiceCtx context) { context.Device.System.Font.EnsureInitialized(context.Device.System.ContentManager); @@ -69,12 +69,12 @@ namespace Ryujinx.HLE.HOS.Services.Pl context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); - return 0; + return ResultCode.Success; } [Command(5)] // GetSharedFontInOrderOfPriority(bytes<8, 1>) -> (u8, u32, buffer, buffer, buffer) - public long GetSharedFontInOrderOfPriority(ServiceCtx context) + public ResultCode GetSharedFontInOrderOfPriority(ServiceCtx context) { long languageCode = context.RequestData.ReadInt64(); int loadedCount = 0; @@ -94,7 +94,7 @@ namespace Ryujinx.HLE.HOS.Services.Pl context.ResponseData.Write(loadedCount); context.ResponseData.Write((int)SharedFontType.Count); - return 0; + return ResultCode.Success; } private bool AddFontToOrderOfPriorityList(ServiceCtx context, SharedFontType fontType, int offset) diff --git a/Ryujinx.HLE/HOS/Services/Pm/IShellInterface.cs b/Ryujinx.HLE/HOS/Services/Pm/IShellInterface.cs index 61fb0f31..c6eec2e8 100644 --- a/Ryujinx.HLE/HOS/Services/Pm/IShellInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Pm/IShellInterface.cs @@ -7,7 +7,7 @@ [Command(6)] // GetApplicationPid() -> u64 - public long GetApplicationPid(ServiceCtx context) + public ResultCode GetApplicationPid(ServiceCtx context) { // FIXME: This is wrong but needed to make hb loader works // TODO: Change this when we will have a way to process via a PM like interface. @@ -15,7 +15,7 @@ context.ResponseData.Write(pid); - return 0; + return ResultCode.Success; } } } diff --git a/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs b/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs index 7f5cbfb6..9fc9c115 100644 --- a/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs +++ b/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs @@ -10,11 +10,11 @@ namespace Ryujinx.HLE.HOS.Services.Prepo [Command(10101)] // SaveReportWithUser(nn::account::Uid, u64, pid, buffer, buffer) - public static long SaveReportWithUser(ServiceCtx context) + public static ResultCode SaveReportWithUser(ServiceCtx context) { Logger.PrintStub(LogClass.ServicePrepo); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs b/Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs index 002cc61c..8dab66a1 100644 --- a/Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs +++ b/Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs @@ -16,7 +16,7 @@ namespace Ryujinx.HLE.HOS.Services.Psm [Command(0)] // GetBatteryChargePercentage() -> u32 - public static long GetBatteryChargePercentage(ServiceCtx context) + public static ResultCode GetBatteryChargePercentage(ServiceCtx context) { int chargePercentage = 100; @@ -24,12 +24,12 @@ namespace Ryujinx.HLE.HOS.Services.Psm Logger.PrintStub(LogClass.ServicePsm, new { chargePercentage }); - return 0; + return ResultCode.Success; } [Command(1)] // GetChargerType() -> u32 - public static long GetChargerType(ServiceCtx context) + public static ResultCode GetChargerType(ServiceCtx context) { ChargerType chargerType = ChargerType.ChargerOrDock; @@ -37,16 +37,16 @@ namespace Ryujinx.HLE.HOS.Services.Psm Logger.PrintStub(LogClass.ServicePsm, new { chargerType }); - return 0; + return ResultCode.Success; } [Command(7)] // OpenSession() -> IPsmSession - public long OpenSession(ServiceCtx context) + public ResultCode OpenSession(ServiceCtx context) { MakeObject(context, new IPsmSession(context.Device.System)); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Psm/IPsmSession.cs b/Ryujinx.HLE/HOS/Services/Psm/IPsmSession.cs index de86ed73..db4e0b75 100644 --- a/Ryujinx.HLE/HOS/Services/Psm/IPsmSession.cs +++ b/Ryujinx.HLE/HOS/Services/Psm/IPsmSession.cs @@ -18,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Psm [Command(0)] // BindStateChangeEvent() -> KObject - public long BindStateChangeEvent(ServiceCtx context) + public ResultCode BindStateChangeEvent(ServiceCtx context) { if (_stateChangeEventHandle == -1) { @@ -26,7 +26,7 @@ namespace Ryujinx.HLE.HOS.Services.Psm if (resultCode != KernelResult.Success) { - return (long)resultCode; + return (ResultCode)resultCode; } } @@ -34,12 +34,12 @@ namespace Ryujinx.HLE.HOS.Services.Psm Logger.PrintStub(LogClass.ServicePsm); - return 0; + return ResultCode.Success; } [Command(1)] // UnbindStateChangeEvent() - public long UnbindStateChangeEvent(ServiceCtx context) + public ResultCode UnbindStateChangeEvent(ServiceCtx context) { if (_stateChangeEventHandle != -1) { @@ -49,40 +49,40 @@ namespace Ryujinx.HLE.HOS.Services.Psm Logger.PrintStub(LogClass.ServicePsm); - return 0; + return ResultCode.Success; } [Command(2)] // SetChargerTypeChangeEventEnabled(u8) - public long SetChargerTypeChangeEventEnabled(ServiceCtx context) + public ResultCode SetChargerTypeChangeEventEnabled(ServiceCtx context) { bool chargerTypeChangeEventEnabled = context.RequestData.ReadBoolean(); Logger.PrintStub(LogClass.ServicePsm, new { chargerTypeChangeEventEnabled }); - return 0; + return ResultCode.Success; } [Command(3)] // SetPowerSupplyChangeEventEnabled(u8) - public long SetPowerSupplyChangeEventEnabled(ServiceCtx context) + public ResultCode SetPowerSupplyChangeEventEnabled(ServiceCtx context) { bool powerSupplyChangeEventEnabled = context.RequestData.ReadBoolean(); Logger.PrintStub(LogClass.ServicePsm, new { powerSupplyChangeEventEnabled }); - return 0; + return ResultCode.Success; } [Command(4)] // SetBatteryVoltageStateChangeEventEnabled(u8) - public long SetBatteryVoltageStateChangeEventEnabled(ServiceCtx context) + public ResultCode SetBatteryVoltageStateChangeEventEnabled(ServiceCtx context) { bool batteryVoltageStateChangeEventEnabled = context.RequestData.ReadBoolean(); Logger.PrintStub(LogClass.ServicePsm, new { batteryVoltageStateChangeEventEnabled }); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Set/ISettingsServer.cs b/Ryujinx.HLE/HOS/Services/Set/ISettingsServer.cs index b3f1571c..6fb923cc 100644 --- a/Ryujinx.HLE/HOS/Services/Set/ISettingsServer.cs +++ b/Ryujinx.HLE/HOS/Services/Set/ISettingsServer.cs @@ -2,8 +2,6 @@ using Ryujinx.Common.Logging; using Ryujinx.HLE.HOS.SystemState; using System; -using static Ryujinx.HLE.HOS.ErrorCode; - namespace Ryujinx.HLE.HOS.Services.Set { [Service("set")] @@ -13,16 +11,16 @@ namespace Ryujinx.HLE.HOS.Services.Set [Command(0)] // GetLanguageCode() -> nn::settings::LanguageCode - public static long GetLanguageCode(ServiceCtx context) + public ResultCode GetLanguageCode(ServiceCtx context) { context.ResponseData.Write(context.Device.System.State.DesiredLanguageCode); - return 0; + return ResultCode.Success; } [Command(1)] // GetAvailableLanguageCodes() -> (u32, buffer) - public static long GetAvailableLanguageCodes(ServiceCtx context) + public ResultCode GetAvailableLanguageCodes(ServiceCtx context) { return GetAvailableLanguagesCodesImpl( context, @@ -33,32 +31,32 @@ namespace Ryujinx.HLE.HOS.Services.Set [Command(2)] // 4.0.0+ // MakeLanguageCode(nn::settings::Language language_index) -> nn::settings::LanguageCode - public static long MakeLanguageCode(ServiceCtx context) + public ResultCode MakeLanguageCode(ServiceCtx context) { int languageIndex = context.RequestData.ReadInt32(); if ((uint)languageIndex >= (uint)SystemStateMgr.LanguageCodes.Length) { - return MakeError(ErrorModule.Settings, SettingsError.LanguageOutOfRange); + return ResultCode.LanguageOutOfRange; } context.ResponseData.Write(SystemStateMgr.GetLanguageCode(languageIndex)); - return 0; + return ResultCode.Success; } [Command(3)] // GetAvailableLanguageCodeCount() -> u32 - public static long GetAvailableLanguageCodeCount(ServiceCtx context) + public ResultCode GetAvailableLanguageCodeCount(ServiceCtx context) { context.ResponseData.Write(Math.Min(SystemStateMgr.LanguageCodes.Length, 0xF)); - return 0; + return ResultCode.Success; } [Command(5)] // GetAvailableLanguageCodes2() -> (u32, buffer) - public static long GetAvailableLanguageCodes2(ServiceCtx context) + public ResultCode GetAvailableLanguageCodes2(ServiceCtx context) { return GetAvailableLanguagesCodesImpl( context, @@ -69,25 +67,25 @@ namespace Ryujinx.HLE.HOS.Services.Set [Command(6)] // GetAvailableLanguageCodeCount2() -> u32 - public static long GetAvailableLanguageCodeCount2(ServiceCtx context) + public ResultCode GetAvailableLanguageCodeCount2(ServiceCtx context) { context.ResponseData.Write(SystemStateMgr.LanguageCodes.Length); - return 0; + return ResultCode.Success; } [Command(8)] // 5.0.0+ // GetQuestFlag() -> bool - public static long GetQuestFlag(ServiceCtx context) + public ResultCode GetQuestFlag(ServiceCtx context) { context.ResponseData.Write(false); Logger.PrintStub(LogClass.ServiceSet); - return 0; + return ResultCode.Success; } - public static long GetAvailableLanguagesCodesImpl(ServiceCtx context, long position, long size, int maxSize) + public ResultCode GetAvailableLanguagesCodesImpl(ServiceCtx context, long position, long size, int maxSize) { int count = (int)(size / 8); @@ -105,7 +103,7 @@ namespace Ryujinx.HLE.HOS.Services.Set context.ResponseData.Write(count); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs b/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs index 5128d792..7a2f0672 100644 --- a/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs +++ b/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs @@ -16,14 +16,14 @@ namespace Ryujinx.HLE.HOS.Services.Set [Command(3)] // GetFirmwareVersion() -> buffer - public static long GetFirmwareVersion(ServiceCtx context) + public ResultCode GetFirmwareVersion(ServiceCtx context) { return GetFirmwareVersion2(context); } [Command(4)] // GetFirmwareVersion2() -> buffer - public static long GetFirmwareVersion2(ServiceCtx context) + public ResultCode GetFirmwareVersion2(ServiceCtx context) { long replyPos = context.Request.RecvListBuff[0].Position; long replySize = context.Request.RecvListBuff[0].Size; @@ -34,7 +34,7 @@ namespace Ryujinx.HLE.HOS.Services.Set { context.Memory.WriteBytes(replyPos, firmwareData); - return 0; + return ResultCode.Success; } const byte majorFwVersion = 0x03; @@ -78,32 +78,32 @@ namespace Ryujinx.HLE.HOS.Services.Set context.Memory.WriteBytes(replyPos, ms.ToArray()); } - return 0; + return ResultCode.Success; } [Command(23)] // GetColorSetId() -> i32 - public static long GetColorSetId(ServiceCtx context) + public ResultCode GetColorSetId(ServiceCtx context) { context.ResponseData.Write((int)context.Device.System.State.ThemeColor); - return 0; + return ResultCode.Success; } [Command(24)] // GetColorSetId() -> i32 - public static long SetColorSetId(ServiceCtx context) + public ResultCode SetColorSetId(ServiceCtx context) { int colorSetId = context.RequestData.ReadInt32(); context.Device.System.State.ThemeColor = (ColorSet)colorSetId; - return 0; + return ResultCode.Success; } [Command(38)] // GetSettingsItemValue(buffer, buffer) -> (u64, buffer) - public static long GetSettingsItemValue(ServiceCtx context) + public ResultCode GetSettingsItemValue(ServiceCtx context) { long classPos = context.Request.PtrBuff[0].Position; long classSize = context.Request.PtrBuff[0].Size; @@ -159,10 +159,10 @@ namespace Ryujinx.HLE.HOS.Services.Set Logger.PrintError(LogClass.ServiceSet, $"{askedSetting} not found!"); } - return 0; + return ResultCode.Success; } - public static byte[] GetFirmwareData(Switch device) + public byte[] GetFirmwareData(Switch device) { long titleId = 0x0100000000000809; string contentPath = device.System.ContentManager.GetInstalledContentPath(titleId, StorageId.NandSystem, ContentType.Data); diff --git a/Ryujinx.HLE/HOS/Services/Set/NxSettings.cs b/Ryujinx.HLE/HOS/Services/Set/NxSettings.cs index b47a5390..46350743 100644 --- a/Ryujinx.HLE/HOS/Services/Set/NxSettings.cs +++ b/Ryujinx.HLE/HOS/Services/Set/NxSettings.cs @@ -1708,4 +1708,4 @@ namespace Ryujinx.HLE.HOS.Services.Set { "wlan_debug!skip_wlan_boot", false } }; } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Set/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Set/ResultCode.cs new file mode 100644 index 00000000..60d3e690 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Set/ResultCode.cs @@ -0,0 +1,12 @@ +namespace Ryujinx.HLE.HOS.Services.Set +{ + enum ResultCode + { + ModuleId = 105, + ErrorCodeShift = 9, + + Success = 0, + + LanguageOutOfRange = (625 << ErrorCodeShift) | ModuleId + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Set/SettingsError.cs b/Ryujinx.HLE/HOS/Services/Set/SettingsError.cs deleted file mode 100644 index 03257ca0..00000000 --- a/Ryujinx.HLE/HOS/Services/Set/SettingsError.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Ryujinx.HLE.HOS.Services.Set -{ - static class SettingsError - { - public const int LanguageOutOfRange = 625; - } -} diff --git a/Ryujinx.HLE/HOS/Services/Sfdnsres/GaiError.cs b/Ryujinx.HLE/HOS/Services/Sfdnsres/GaiError.cs index 2d3d8e9b..dc724b4d 100644 --- a/Ryujinx.HLE/HOS/Services/Sfdnsres/GaiError.cs +++ b/Ryujinx.HLE/HOS/Services/Sfdnsres/GaiError.cs @@ -19,4 +19,4 @@ Overflow, Max } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Sfdnsres/IResolver.cs b/Ryujinx.HLE/HOS/Services/Sfdnsres/IResolver.cs index 0a595127..0e42ee3b 100644 --- a/Ryujinx.HLE/HOS/Services/Sfdnsres/IResolver.cs +++ b/Ryujinx.HLE/HOS/Services/Sfdnsres/IResolver.cs @@ -5,8 +5,6 @@ using System.Net; using System.Net.Sockets; using System.Text; -using static Ryujinx.HLE.HOS.ErrorCode; - namespace Ryujinx.HLE.HOS.Services.Sfdnsres { [Service("sfdnsres")] @@ -142,7 +140,7 @@ namespace Ryujinx.HLE.HOS.Services.Sfdnsres [Command(0)] // SetDnsAddressesPrivate(u32, buffer) - public long SetDnsAddressesPrivate(ServiceCtx context) + public ResultCode SetDnsAddressesPrivate(ServiceCtx context) { uint unknown0 = context.RequestData.ReadUInt32(); long bufferPosition = context.Request.SendBuff[0].Position; @@ -151,24 +149,24 @@ namespace Ryujinx.HLE.HOS.Services.Sfdnsres // TODO: This is stubbed in 2.0.0+, reverse 1.0.0 version for the sake completeness. Logger.PrintStub(LogClass.ServiceSfdnsres, new { unknown0 }); - return MakeError(ErrorModule.Os, 1023); + return ResultCode.NotAllocated; } [Command(1)] // GetDnsAddressPrivate(u32) -> buffer - public long GetDnsAddressesPrivate(ServiceCtx context) + public ResultCode GetDnsAddressesPrivate(ServiceCtx context) { uint unknown0 = context.RequestData.ReadUInt32(); // TODO: This is stubbed in 2.0.0+, reverse 1.0.0 version for the sake completeness. Logger.PrintStub(LogClass.ServiceSfdnsres, new { unknown0 }); - return MakeError(ErrorModule.Os, 1023); + return ResultCode.NotAllocated; } [Command(2)] // GetHostByName(u8, u32, u64, pid, buffer) -> (u32, u32, u32, buffer) - public long GetHostByName(ServiceCtx context) + public ResultCode GetHostByName(ServiceCtx context) { byte[] rawName = context.Memory.ReadBytes(context.Request.SendBuff[0].Position, context.Request.SendBuff[0].Size); string name = Encoding.ASCII.GetString(rawName).TrimEnd('\0'); @@ -243,12 +241,12 @@ namespace Ryujinx.HLE.HOS.Services.Sfdnsres context.ResponseData.Write((int)errno); context.ResponseData.Write(serializedSize); - return 0; + return ResultCode.Success; } [Command(3)] // GetHostByAddr(u32, u32, u32, u64, pid, buffer) -> (u32, u32, u32, buffer) - public long GetHostByAddress(ServiceCtx context) + public ResultCode GetHostByAddress(ServiceCtx context) { byte[] rawIp = context.Memory.ReadBytes(context.Request.SendBuff[0].Position, context.Request.SendBuff[0].Size); @@ -313,14 +311,14 @@ namespace Ryujinx.HLE.HOS.Services.Sfdnsres context.ResponseData.Write((int)errno); context.ResponseData.Write(serializedSize); - return 0; + return ResultCode.Success; } [Command(4)] // GetHostStringError(u32) -> buffer - public long GetHostStringError(ServiceCtx context) + public ResultCode GetHostStringError(ServiceCtx context) { - long resultCode = MakeError(ErrorModule.Os, 1023); + ResultCode resultCode = ResultCode.NotAllocated; NetDbError errorCode = (NetDbError)context.RequestData.ReadInt32(); string errorString = GetHostStringErrorFromErrorCode(errorCode); @@ -335,11 +333,11 @@ namespace Ryujinx.HLE.HOS.Services.Sfdnsres [Command(5)] // GetGaiStringError(u32) -> buffer - public long GetGaiStringError(ServiceCtx context) + public ResultCode GetGaiStringError(ServiceCtx context) { - long resultCode = MakeError(ErrorModule.Os, 1023); - GaiError errorCode = (GaiError)context.RequestData.ReadInt32(); - string errorString = GetGaiStringErrorFromErrorCode(errorCode); + ResultCode resultCode = ResultCode.NotAllocated; + GaiError errorCode = (GaiError)context.RequestData.ReadInt32(); + string errorString = GetGaiStringErrorFromErrorCode(errorCode); if (errorString.Length + 1 <= context.Request.ReceiveBuff[0].Size) { @@ -352,7 +350,7 @@ namespace Ryujinx.HLE.HOS.Services.Sfdnsres [Command(8)] // RequestCancelHandle(u64, pid) -> u32 - public long RequestCancelHandle(ServiceCtx context) + public ResultCode RequestCancelHandle(ServiceCtx context) { ulong unknown0 = context.RequestData.ReadUInt64(); @@ -360,30 +358,30 @@ namespace Ryujinx.HLE.HOS.Services.Sfdnsres Logger.PrintStub(LogClass.ServiceSfdnsres, new { unknown0 }); - return 0; + return ResultCode.Success; } [Command(9)] // CancelSocketCall(u32, u64, pid) - public long CancelSocketCall(ServiceCtx context) + public ResultCode CancelSocketCall(ServiceCtx context) { uint unknown0 = context.RequestData.ReadUInt32(); ulong unknown1 = context.RequestData.ReadUInt64(); Logger.PrintStub(LogClass.ServiceSfdnsres, new { unknown0, unknown1 }); - return 0; + return ResultCode.Success; } [Command(11)] // ClearDnsAddresses(u32) - public long ClearDnsAddresses(ServiceCtx context) + public ResultCode ClearDnsAddresses(ServiceCtx context) { uint unknown0 = context.RequestData.ReadUInt32(); Logger.PrintStub(LogClass.ServiceSfdnsres, new { unknown0 }); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Sfdnsres/NetDBError.cs b/Ryujinx.HLE/HOS/Services/Sfdnsres/NetDBError.cs index dad02cf2..95ef7419 100644 --- a/Ryujinx.HLE/HOS/Services/Sfdnsres/NetDBError.cs +++ b/Ryujinx.HLE/HOS/Services/Sfdnsres/NetDBError.cs @@ -10,4 +10,4 @@ NoData, NoAddress = NoData } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs b/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs index 92923850..bcab5b17 100644 --- a/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs @@ -41,27 +41,27 @@ namespace Ryujinx.HLE.HOS.Services.Sm [Command(0)] // Initialize(pid, u64 reserved) - public long Initialize(ServiceCtx context) + public ResultCode Initialize(ServiceCtx context) { _isInitialized = true; - return 0; + return ResultCode.Success; } [Command(1)] // GetService(ServiceName name) -> handle - public long GetService(ServiceCtx context) + public ResultCode GetService(ServiceCtx context) { if (!_isInitialized) { - return ErrorCode.MakeError(ErrorModule.Sm, SmErr.NotInitialized); + return ResultCode.NotInitialized; } string name = ReadName(context); if (name == string.Empty) { - return ErrorCode.MakeError(ErrorModule.Sm, SmErr.InvalidName); + return ResultCode.InvalidName; } KSession session = new KSession(context.Device.System); @@ -106,16 +106,16 @@ namespace Ryujinx.HLE.HOS.Services.Sm context.Response.HandleDesc = IpcHandleDesc.MakeMove(handle); - return 0; + return ResultCode.Success; } [Command(2)] // RegisterService(ServiceName name, u8, u32 maxHandles) -> handle - public long RegisterService(ServiceCtx context) + public ResultCode RegisterService(ServiceCtx context) { if (!_isInitialized) { - return ErrorCode.MakeError(ErrorModule.Sm, SmErr.NotInitialized); + return ResultCode.NotInitialized; } long namePosition = context.RequestData.BaseStream.Position; @@ -130,7 +130,7 @@ namespace Ryujinx.HLE.HOS.Services.Sm if (name == string.Empty) { - return ErrorCode.MakeError(ErrorModule.Sm, SmErr.InvalidName); + return ResultCode.InvalidName; } Logger.PrintInfo(LogClass.ServiceSm, $"Register \"{name}\"."); @@ -139,7 +139,7 @@ namespace Ryujinx.HLE.HOS.Services.Sm if (!_registeredServices.TryAdd(name, port)) { - return ErrorCode.MakeError(ErrorModule.Sm, SmErr.AlreadyRegistered); + return ResultCode.AlreadyRegistered; } if (context.Process.HandleTable.GenerateHandle(port.ServerPort, out int handle) != KernelResult.Success) @@ -149,16 +149,16 @@ namespace Ryujinx.HLE.HOS.Services.Sm context.Response.HandleDesc = IpcHandleDesc.MakeMove(handle); - return 0; + return ResultCode.Success; } [Command(3)] // UnregisterService(ServiceName name) - public long UnregisterService(ServiceCtx context) + public ResultCode UnregisterService(ServiceCtx context) { if (!_isInitialized) { - return ErrorCode.MakeError(ErrorModule.Sm, SmErr.NotInitialized); + return ResultCode.NotInitialized; } long namePosition = context.RequestData.BaseStream.Position; @@ -173,15 +173,15 @@ namespace Ryujinx.HLE.HOS.Services.Sm if (name == string.Empty) { - return ErrorCode.MakeError(ErrorModule.Sm, SmErr.InvalidName); + return ResultCode.InvalidName; } if (!_registeredServices.TryRemove(name, out _)) { - return ErrorCode.MakeError(ErrorModule.Sm, SmErr.NotRegistered); + return ResultCode.NotRegistered; } - return 0; + return ResultCode.Success; } private static string ReadName(ServiceCtx context) diff --git a/Ryujinx.HLE/HOS/Services/Sm/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Sm/ResultCode.cs new file mode 100644 index 00000000..f72bf010 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Sm/ResultCode.cs @@ -0,0 +1,15 @@ +namespace Ryujinx.HLE.HOS.Services.Sm +{ + enum ResultCode + { + ModuleId = 21, + ErrorCodeShift = 9, + + Success = 0, + + NotInitialized = (2 << ErrorCodeShift) | ModuleId, + AlreadyRegistered = (4 << ErrorCodeShift) | ModuleId, + InvalidName = (6 << ErrorCodeShift) | ModuleId, + NotRegistered = (7 << ErrorCodeShift) | ModuleId + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Sm/SmErr.cs b/Ryujinx.HLE/HOS/Services/Sm/SmErr.cs deleted file mode 100644 index 7dd3a205..00000000 --- a/Ryujinx.HLE/HOS/Services/Sm/SmErr.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Ryujinx.HLE.HOS.Services.Sm -{ - static class SmErr - { - public const int NotInitialized = 2; - public const int AlreadyRegistered = 4; - public const int InvalidName = 6; - public const int NotRegistered = 7; - } -} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Spl/IRandomInterface.cs b/Ryujinx.HLE/HOS/Services/Spl/IRandomInterface.cs index 46c9fad1..75c308af 100644 --- a/Ryujinx.HLE/HOS/Services/Spl/IRandomInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Spl/IRandomInterface.cs @@ -15,7 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.Spl [Command(0)] // GetRandomBytes() -> buffer - public long GetRandomBytes(ServiceCtx context) + public ResultCode GetRandomBytes(ServiceCtx context) { byte[] randomBytes = new byte[context.Request.ReceiveBuff[0].Size]; @@ -23,7 +23,7 @@ namespace Ryujinx.HLE.HOS.Services.Spl context.Memory.WriteBytes(context.Request.ReceiveBuff[0].Position, randomBytes); - return 0; + return ResultCode.Success; } public void Dispose() diff --git a/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs b/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs index 3064a9b1..43e4bc7f 100644 --- a/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs +++ b/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs @@ -9,7 +9,7 @@ namespace Ryujinx.HLE.HOS.Services.Ssl [Command(0)] // CreateContext(nn::ssl::sf::SslVersion, u64, pid) -> object - public long CreateContext(ServiceCtx context) + public ResultCode CreateContext(ServiceCtx context) { int sslVersion = context.RequestData.ReadInt32(); long unknown = context.RequestData.ReadInt64(); @@ -18,18 +18,18 @@ namespace Ryujinx.HLE.HOS.Services.Ssl MakeObject(context, new ISslContext()); - return 0; + return ResultCode.Success; } [Command(5)] // SetInterfaceVersion(u32) - public long SetInterfaceVersion(ServiceCtx context) + public ResultCode SetInterfaceVersion(ServiceCtx context) { int version = context.RequestData.ReadInt32(); Logger.PrintStub(LogClass.ServiceSsl, new { version }); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Time/IStaticService.cs b/Ryujinx.HLE/HOS/Services/Time/IStaticService.cs index f45b6c25..420e6912 100644 --- a/Ryujinx.HLE/HOS/Services/Time/IStaticService.cs +++ b/Ryujinx.HLE/HOS/Services/Time/IStaticService.cs @@ -17,52 +17,52 @@ namespace Ryujinx.HLE.HOS.Services.Time [Command(0)] // GetStandardUserSystemClock() -> object - public long GetStandardUserSystemClock(ServiceCtx context) + public ResultCode GetStandardUserSystemClock(ServiceCtx context) { MakeObject(context, new ISystemClock(SystemClockType.User)); - return 0; + return ResultCode.Success; } [Command(1)] // GetStandardNetworkSystemClock() -> object - public long GetStandardNetworkSystemClock(ServiceCtx context) + public ResultCode GetStandardNetworkSystemClock(ServiceCtx context) { MakeObject(context, new ISystemClock(SystemClockType.Network)); - return 0; + return ResultCode.Success; } [Command(2)] // GetStandardSteadyClock() -> object - public long GetStandardSteadyClock(ServiceCtx context) + public ResultCode GetStandardSteadyClock(ServiceCtx context) { MakeObject(context, new ISteadyClock()); - return 0; + return ResultCode.Success; } [Command(3)] // GetTimeZoneService() -> object - public long GetTimeZoneService(ServiceCtx context) + public ResultCode GetTimeZoneService(ServiceCtx context) { MakeObject(context, new ITimeZoneService()); - return 0; + return ResultCode.Success; } [Command(4)] // GetStandardLocalSystemClock() -> object - public long GetStandardLocalSystemClock(ServiceCtx context) + public ResultCode GetStandardLocalSystemClock(ServiceCtx context) { MakeObject(context, new ISystemClock(SystemClockType.Local)); - return 0; + return ResultCode.Success; } [Command(20)] // 6.0.0+ // GetSharedMemoryNativeHandle() -> handle - public long GetSharedMemoryNativeHandle(ServiceCtx context) + public ResultCode GetSharedMemoryNativeHandle(ServiceCtx context) { if (_timeSharedMemoryNativeHandle == 0) { @@ -74,20 +74,19 @@ namespace Ryujinx.HLE.HOS.Services.Time context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_timeSharedMemoryNativeHandle); - return 0; + return ResultCode.Success; } [Command(300)] // 4.0.0+ // CalculateMonotonicSystemClockBaseTimePoint(nn::time::SystemClockContext) -> u64 - public long CalculateMonotonicSystemClockBaseTimePoint(ServiceCtx context) + public ResultCode CalculateMonotonicSystemClockBaseTimePoint(ServiceCtx context) { long timeOffset = (long)(DateTime.UtcNow - StartupDate).TotalSeconds; long systemClockContextEpoch = context.RequestData.ReadInt64(); context.ResponseData.Write(timeOffset + systemClockContextEpoch); - return 0; + return ResultCode.Success; } - } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Time/ISteadyClock.cs b/Ryujinx.HLE/HOS/Services/Time/ISteadyClock.cs index 4964e616..ccf19d7d 100644 --- a/Ryujinx.HLE/HOS/Services/Time/ISteadyClock.cs +++ b/Ryujinx.HLE/HOS/Services/Time/ISteadyClock.cs @@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Time [Command(0)] // GetCurrentTimePoint() -> nn::time::SteadyClockTimePoint - public long GetCurrentTimePoint(ServiceCtx context) + public ResultCode GetCurrentTimePoint(ServiceCtx context) { context.ResponseData.Write((long)(System.Diagnostics.Process.GetCurrentProcess().StartTime - DateTime.Now).TotalSeconds); @@ -22,25 +22,25 @@ namespace Ryujinx.HLE.HOS.Services.Time context.ResponseData.Write((byte)0); } - return 0; + return ResultCode.Success; } [Command(1)] // GetTestOffset() -> nn::TimeSpanType - public long GetTestOffset(ServiceCtx context) + public ResultCode GetTestOffset(ServiceCtx context) { context.ResponseData.Write(_testOffset); - return 0; + return ResultCode.Success; } [Command(2)] // SetTestOffset(nn::TimeSpanType) - public long SetTestOffset(ServiceCtx context) + public ResultCode SetTestOffset(ServiceCtx context) { _testOffset = context.RequestData.ReadUInt64(); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Time/ISystemClock.cs b/Ryujinx.HLE/HOS/Services/Time/ISystemClock.cs index a9e5fc75..0ed34d17 100644 --- a/Ryujinx.HLE/HOS/Services/Time/ISystemClock.cs +++ b/Ryujinx.HLE/HOS/Services/Time/ISystemClock.cs @@ -30,7 +30,7 @@ namespace Ryujinx.HLE.HOS.Services.Time [Command(0)] // GetCurrentTime() -> nn::time::PosixTime - public long GetCurrentTime(ServiceCtx context) + public ResultCode GetCurrentTime(ServiceCtx context) { DateTime currentTime = DateTime.Now; @@ -42,12 +42,12 @@ namespace Ryujinx.HLE.HOS.Services.Time context.ResponseData.Write((long)((currentTime - Epoch).TotalSeconds) + _timeOffset); - return 0; + return ResultCode.Success; } [Command(1)] // SetCurrentTime(nn::time::PosixTime) - public long SetCurrentTime(ServiceCtx context) + public ResultCode SetCurrentTime(ServiceCtx context) { DateTime currentTime = DateTime.Now; @@ -59,12 +59,12 @@ namespace Ryujinx.HLE.HOS.Services.Time _timeOffset = (context.RequestData.ReadInt64() - (long)(currentTime - Epoch).TotalSeconds); - return 0; + return ResultCode.Success; } [Command(2)] // GetSystemClockContext() -> nn::time::SystemClockContext - public long GetSystemClockContext(ServiceCtx context) + public ResultCode GetSystemClockContext(ServiceCtx context) { context.ResponseData.Write((long)(_systemClockContextEpoch - Epoch).TotalSeconds); @@ -77,12 +77,12 @@ namespace Ryujinx.HLE.HOS.Services.Time context.ResponseData.Write(_systemClockContextEnding[i]); } - return 0; + return ResultCode.Success; } [Command(3)] // SetSystemClockContext(nn::time::SystemClockContext) - public long SetSystemClockContext(ServiceCtx context) + public ResultCode SetSystemClockContext(ServiceCtx context) { long newSystemClockEpoch = context.RequestData.ReadInt64(); long newSystemClockTimePoint = context.RequestData.ReadInt64(); @@ -91,7 +91,7 @@ namespace Ryujinx.HLE.HOS.Services.Time _systemClockTimePoint = newSystemClockTimePoint; _systemClockContextEnding = context.RequestData.ReadBytes(0x10); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Time/ITimeZoneService.cs b/Ryujinx.HLE/HOS/Services/Time/ITimeZoneService.cs index 56651716..74182428 100644 --- a/Ryujinx.HLE/HOS/Services/Time/ITimeZoneService.cs +++ b/Ryujinx.HLE/HOS/Services/Time/ITimeZoneService.cs @@ -5,8 +5,6 @@ using Ryujinx.HLE.HOS.Services.Time.TimeZone; using System; using System.Text; -using static Ryujinx.HLE.HOS.ErrorCode; - namespace Ryujinx.HLE.HOS.Services.Time { class ITimeZoneService : IpcService @@ -15,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Time [Command(0)] // GetDeviceLocationName() -> nn::time::LocationName - public long GetDeviceLocationName(ServiceCtx context) + public ResultCode GetDeviceLocationName(ServiceCtx context) { char[] tzName = TimeZoneManager.Instance.GetDeviceLocationName().ToCharArray(); @@ -23,7 +21,7 @@ namespace Ryujinx.HLE.HOS.Services.Time if (padding < 0) { - return MakeError(ErrorModule.Time, TimeError.LocationNameTooLong); + return ResultCode.LocationNameTooLong; } context.ResponseData.Write(tzName); @@ -33,12 +31,12 @@ namespace Ryujinx.HLE.HOS.Services.Time context.ResponseData.Write((byte)0); } - return 0; + return ResultCode.Success; } [Command(1)] // SetDeviceLocationName(nn::time::LocationName) - public long SetDeviceLocationName(ServiceCtx context) + public ResultCode SetDeviceLocationName(ServiceCtx context) { string locationName = Encoding.ASCII.GetString(context.RequestData.ReadBytes(0x24)).TrimEnd('\0'); @@ -47,23 +45,23 @@ namespace Ryujinx.HLE.HOS.Services.Time [Command(2)] // GetTotalLocationNameCount() -> u32 - public long GetTotalLocationNameCount(ServiceCtx context) + public ResultCode GetTotalLocationNameCount(ServiceCtx context) { context.ResponseData.Write(TimeZoneManager.Instance.GetTotalLocationNameCount()); - return 0; + return ResultCode.Success; } [Command(3)] // LoadLocationNameList(u32 index) -> (u32 outCount, buffer) - public long LoadLocationNameList(ServiceCtx context) + public ResultCode LoadLocationNameList(ServiceCtx context) { // TODO: fix logic to use index uint index = context.RequestData.ReadUInt32(); long bufferPosition = context.Request.ReceiveBuff[0].Position; long bufferSize = context.Request.ReceiveBuff[0].Size; - uint errorCode = TimeZoneManager.Instance.LoadLocationNameList(index, out string[] locationNameArray, (uint)bufferSize / 0x24); + ResultCode errorCode = TimeZoneManager.Instance.LoadLocationNameList(index, out string[] locationNameArray, (uint)bufferSize / 0x24); if (errorCode == 0) { @@ -75,7 +73,7 @@ namespace Ryujinx.HLE.HOS.Services.Time if (padding < 0) { - return MakeError(ErrorModule.Time, TimeError.LocationNameTooLong); + return ResultCode.LocationNameTooLong; } context.Memory.WriteBytes(bufferPosition + offset, Encoding.ASCII.GetBytes(locationName)); @@ -92,7 +90,7 @@ namespace Ryujinx.HLE.HOS.Services.Time [Command(4)] // LoadTimeZoneRule(nn::time::LocationName locationName) -> buffer - public long LoadTimeZoneRule(ServiceCtx context) + public ResultCode LoadTimeZoneRule(ServiceCtx context) { long bufferPosition = context.Request.ReceiveBuff[0].Position; long bufferSize = context.Request.ReceiveBuff[0].Size; @@ -108,7 +106,7 @@ namespace Ryujinx.HLE.HOS.Services.Time string locationName = Encoding.ASCII.GetString(context.RequestData.ReadBytes(0x24)).TrimEnd('\0'); - long resultCode = TimeZoneManager.Instance.LoadTimeZoneRules(out TimeZoneRule rules, locationName); + ResultCode resultCode = TimeZoneManager.Instance.LoadTimeZoneRules(out TimeZoneRule rules, locationName); // Write TimeZoneRule if success if (resultCode == 0) @@ -121,7 +119,7 @@ namespace Ryujinx.HLE.HOS.Services.Time [Command(100)] // ToCalendarTime(nn::time::PosixTime time, buffer rules) -> (nn::time::CalendarTime, nn::time::sf::CalendarAdditionalInfo) - public long ToCalendarTime(ServiceCtx context) + public ResultCode ToCalendarTime(ServiceCtx context) { long posixTime = context.RequestData.ReadInt64(); long bufferPosition = context.Request.SendBuff[0].Position; @@ -137,7 +135,7 @@ namespace Ryujinx.HLE.HOS.Services.Time TimeZoneRule rules = MemoryHelper.Read(context.Memory, bufferPosition); - long resultCode = TimeZoneManager.ToCalendarTime(rules, posixTime, out CalendarInfo calendar); + ResultCode resultCode = TimeZoneManager.ToCalendarTime(rules, posixTime, out CalendarInfo calendar); if (resultCode == 0) { @@ -149,11 +147,11 @@ namespace Ryujinx.HLE.HOS.Services.Time [Command(101)] // ToCalendarTimeWithMyRule(nn::time::PosixTime) -> (nn::time::CalendarTime, nn::time::sf::CalendarAdditionalInfo) - public long ToCalendarTimeWithMyRule(ServiceCtx context) + public ResultCode ToCalendarTimeWithMyRule(ServiceCtx context) { long posixTime = context.RequestData.ReadInt64(); - long resultCode = TimeZoneManager.Instance.ToCalendarTimeWithMyRules(posixTime, out CalendarInfo calendar); + ResultCode resultCode = TimeZoneManager.Instance.ToCalendarTimeWithMyRules(posixTime, out CalendarInfo calendar); if (resultCode == 0) { @@ -165,7 +163,7 @@ namespace Ryujinx.HLE.HOS.Services.Time [Command(201)] // ToPosixTime(nn::time::CalendarTime calendarTime, buffer rules) -> (u32 outCount, buffer) - public long ToPosixTime(ServiceCtx context) + public ResultCode ToPosixTime(ServiceCtx context) { long inBufferPosition = context.Request.SendBuff[0].Position; long inBufferSize = context.Request.SendBuff[0].Size; @@ -182,7 +180,7 @@ namespace Ryujinx.HLE.HOS.Services.Time TimeZoneRule rules = MemoryHelper.Read(context.Memory, inBufferPosition); - long resultCode = TimeZoneManager.ToPosixTime(rules, calendarTime, out long posixTime); + ResultCode resultCode = TimeZoneManager.ToPosixTime(rules, calendarTime, out long posixTime); if (resultCode == 0) { @@ -198,11 +196,11 @@ namespace Ryujinx.HLE.HOS.Services.Time [Command(202)] // ToPosixTimeWithMyRule(nn::time::CalendarTime calendarTime) -> (u32 outCount, buffer) - public long ToPosixTimeWithMyRule(ServiceCtx context) + public ResultCode ToPosixTimeWithMyRule(ServiceCtx context) { CalendarTime calendarTime = context.RequestData.ReadStruct(); - long resultCode = TimeZoneManager.Instance.ToPosixTimeWithMyRules(calendarTime, out long posixTime); + ResultCode resultCode = TimeZoneManager.Instance.ToPosixTimeWithMyRules(calendarTime, out long posixTime); if (resultCode == 0) { diff --git a/Ryujinx.HLE/HOS/Services/Time/ITimeZoneServiceTypes.cs b/Ryujinx.HLE/HOS/Services/Time/ITimeZoneServiceTypes.cs index e50bd5d6..9a83b82b 100644 --- a/Ryujinx.HLE/HOS/Services/Time/ITimeZoneServiceTypes.cs +++ b/Ryujinx.HLE/HOS/Services/Time/ITimeZoneServiceTypes.cs @@ -125,4 +125,4 @@ namespace Ryujinx.HLE.HOS.Services.Time public CalendarTime Time; public CalendarAdditionalInfo AdditionalInfo; } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Time/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Time/ResultCode.cs new file mode 100644 index 00000000..5868a458 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Time/ResultCode.cs @@ -0,0 +1,17 @@ +namespace Ryujinx.HLE.HOS.Services.Time +{ + public enum ResultCode + { + ModuleId = 116, + ErrorCodeShift = 9, + + Success = 0, + + TimeNotFound = (200 << ErrorCodeShift) | ModuleId, + Overflow = (201 << ErrorCodeShift) | ModuleId, + LocationNameTooLong = (801 << ErrorCodeShift) | ModuleId, + OutOfRange = (902 << ErrorCodeShift) | ModuleId, + TimeZoneConversionFailed = (903 << ErrorCodeShift) | ModuleId, + TimeZoneNotFound = (989 << ErrorCodeShift) | ModuleId + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Time/TimeError.cs b/Ryujinx.HLE/HOS/Services/Time/TimeError.cs deleted file mode 100644 index 20b2375c..00000000 --- a/Ryujinx.HLE/HOS/Services/Time/TimeError.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Ryujinx.HLE.HOS.Services.Time -{ - static class TimeError - { - public const int TimeNotFound = 200; - public const int Overflow = 201; - public const int LocationNameTooLong = 801; - public const int OutOfRange = 902; - public const int TimeZoneConversionFailed = 903; - public const int TimeZoneNotFound = 989; - } -} diff --git a/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs b/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs index 8039dc89..4898b2b9 100644 --- a/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs +++ b/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs @@ -1237,7 +1237,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone } } - private static int CreateCalendarTime(long time, int gmtOffset, out CalendarTimeInternal calendarTime, out CalendarAdditionalInfo calendarAdditionalInfo) + private static ResultCode CreateCalendarTime(long time, int gmtOffset, out CalendarTimeInternal calendarTime, out CalendarAdditionalInfo calendarAdditionalInfo) { long year = EpochYear; long timeDays = time / SecondsPerDay; @@ -1263,7 +1263,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone if (IncrementOverflow64(ref newYear, delta)) { - return TimeError.OutOfRange; + return ResultCode.OutOfRange; } long leapDays = GetLeapDays(newYear - 1) - GetLeapDays(year - 1); @@ -1290,7 +1290,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone { if (IncrementOverflow64(ref year, -1)) { - return TimeError.OutOfRange; + return ResultCode.OutOfRange; } dayOfYear += YearLengths[IsLeap((int)year)]; @@ -1302,7 +1302,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone if (IncrementOverflow64(ref year, 1)) { - return TimeError.OutOfRange; + return ResultCode.OutOfRange; } } @@ -1340,7 +1340,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone return 0; } - private static int ToCalendarTimeInternal(TimeZoneRule rules, long time, out CalendarTimeInternal calendarTime, out CalendarAdditionalInfo calendarAdditionalInfo) + private static ResultCode ToCalendarTimeInternal(TimeZoneRule rules, long time, out CalendarTimeInternal calendarTime, out CalendarAdditionalInfo calendarAdditionalInfo) { calendarTime = new CalendarTimeInternal(); calendarAdditionalInfo = new CalendarAdditionalInfo() @@ -1348,7 +1348,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone TimezoneName = new char[8] }; - int result; + ResultCode result; if ((rules.GoAhead && time < rules.Ats[0]) || (rules.GoBack && time > rules.Ats[rules.TimeCount - 1])) { @@ -1382,7 +1382,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone if (newTime < rules.Ats[0] && newTime > rules.Ats[rules.TimeCount - 1]) { - return TimeError.TimeNotFound; + return ResultCode.TimeNotFound; } result = ToCalendarTimeInternal(rules, newTime, out calendarTime, out calendarAdditionalInfo); @@ -1400,7 +1400,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone calendarTime.Year += years; } - return 0; + return ResultCode.Success; } int ttiIndex; @@ -1453,7 +1453,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone return result; } - private static int ToPosixTimeInternal(TimeZoneRule rules, CalendarTimeInternal calendarTime, out long posixTime) + private static ResultCode ToPosixTimeInternal(TimeZoneRule rules, CalendarTimeInternal calendarTime, out long posixTime) { posixTime = 0; @@ -1462,7 +1462,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone if (NormalizeOverflow32(ref hour, ref minute, MinutesPerHour)) { - return TimeError.Overflow; + return ResultCode.Overflow; } calendarTime.Minute = (sbyte)minute; @@ -1470,7 +1470,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone int day = calendarTime.Day; if (NormalizeOverflow32(ref day, ref hour, HoursPerDays)) { - return TimeError.Overflow; + return ResultCode.Overflow; } calendarTime.Day = (sbyte)day; @@ -1481,21 +1481,21 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone if (NormalizeOverflow64(ref year, ref month, MonthsPerYear)) { - return TimeError.Overflow; + return ResultCode.Overflow; } calendarTime.Month = (sbyte)month; if (IncrementOverflow64(ref year, YearBase)) { - return TimeError.Overflow; + return ResultCode.Overflow; } while (day <= 0) { if (IncrementOverflow64(ref year, -1)) { - return TimeError.Overflow; + return ResultCode.Overflow; } long li = year; @@ -1521,7 +1521,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone if (IncrementOverflow64(ref year, 1)) { - return TimeError.Overflow; + return ResultCode.Overflow; } } @@ -1542,7 +1542,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone calendarTime.Month = 0; if (IncrementOverflow64(ref year, 1)) { - return TimeError.Overflow; + return ResultCode.Overflow; } } } @@ -1551,7 +1551,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone if (IncrementOverflow64(ref year, -YearBase)) { - return TimeError.Overflow; + return ResultCode.Overflow; } calendarTime.Year = year; @@ -1567,7 +1567,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone int second = calendarTime.Second; if (IncrementOverflow32(ref second, 1 - SecondsPerMinute)) { - return TimeError.Overflow; + return ResultCode.Overflow; } savedSeconds = second; @@ -1597,7 +1597,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone int direction; - int result = ToCalendarTimeInternal(rules, pivot, out CalendarTimeInternal candidateCalendarTime, out _); + ResultCode result = ToCalendarTimeInternal(rules, pivot, out CalendarTimeInternal candidateCalendarTime, out _); if (result != 0) { if (pivot > 0) @@ -1620,7 +1620,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone if ((timeResult < pivot) != (savedSeconds < 0)) { - return TimeError.Overflow; + return ResultCode.Overflow; } posixTime = timeResult; @@ -1632,7 +1632,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone { if (pivot == long.MaxValue) { - return TimeError.TimeNotFound; + return ResultCode.TimeNotFound; } pivot += 1; @@ -1642,7 +1642,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone { if (pivot == long.MinValue) { - return TimeError.TimeNotFound; + return ResultCode.TimeNotFound; } pivot -= 1; @@ -1651,7 +1651,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone if (low > high) { - return TimeError.TimeNotFound; + return ResultCode.TimeNotFound; } if (direction > 0) @@ -1665,12 +1665,12 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone } } - return 0; + return ResultCode.Success; } - internal static int ToCalendarTime(TimeZoneRule rules, long time, out CalendarInfo calendar) + internal static ResultCode ToCalendarTime(TimeZoneRule rules, long time, out CalendarInfo calendar) { - int result = ToCalendarTimeInternal(rules, time, out CalendarTimeInternal calendarTime, out CalendarAdditionalInfo calendarAdditionalInfo); + ResultCode result = ToCalendarTimeInternal(rules, time, out CalendarTimeInternal calendarTime, out CalendarAdditionalInfo calendarAdditionalInfo); calendar = new CalendarInfo() { @@ -1689,7 +1689,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone return result; } - internal static int ToPosixTime(TimeZoneRule rules, CalendarTime calendarTime, out long posixTime) + internal static ResultCode ToPosixTime(TimeZoneRule rules, CalendarTime calendarTime, out long posixTime) { CalendarTimeInternal calendarTimeInternal = new CalendarTimeInternal() { @@ -1704,4 +1704,4 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone return ToPosixTimeInternal(rules, calendarTimeInternal, out posixTime); } } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneManager.cs b/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneManager.cs index b3dc4c34..cf27639b 100644 --- a/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneManager.cs +++ b/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneManager.cs @@ -10,7 +10,6 @@ using TimeZoneConverter.Posix; using TimeZoneConverter; using static Ryujinx.HLE.HOS.Services.Time.TimeZoneRule; -using static Ryujinx.HLE.HOS.ErrorCode; namespace Ryujinx.HLE.HOS.Services.Time.TimeZone { @@ -138,9 +137,9 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone return _deviceLocationName; } - public uint SetDeviceLocationName(string locationName) + public ResultCode SetDeviceLocationName(string locationName) { - uint resultCode = LoadTimeZoneRules(out TimeZoneRule rules, locationName); + ResultCode resultCode = LoadTimeZoneRules(out TimeZoneRule rules, locationName); if (resultCode == 0) { @@ -151,7 +150,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone return resultCode; } - public uint LoadLocationNameList(uint index, out string[] outLocationNameArray, uint maxLength) + public ResultCode LoadLocationNameList(uint index, out string[] outLocationNameArray, uint maxLength) { List locationNameList = new List(); @@ -169,7 +168,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone { outLocationNameArray = new string[0]; - return MakeError(ErrorModule.Time, TimeError.LocationNameTooLong); + return ResultCode.LocationNameTooLong; } locationNameList.Add(locationName); @@ -177,7 +176,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone outLocationNameArray = locationNameList.ToArray(); - return 0; + return ResultCode.Success; } public uint GetTotalLocationNameCount() @@ -195,7 +194,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone return !string.IsNullOrEmpty(GetTimeZoneBinaryTitleContentPath()); } - internal uint LoadTimeZoneRules(out TimeZoneRule outRules, string locationName) + internal ResultCode LoadTimeZoneRules(out TimeZoneRule outRules, string locationName) { outRules = new TimeZoneRule { @@ -207,7 +206,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone if (!IsLocationNameValid(locationName)) { - return MakeError(ErrorModule.Time, TimeError.TimeZoneNotFound); + return ResultCode.TimeZoneNotFound; } if (!HasTimeZoneBinaryTitle()) @@ -222,7 +221,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone if (!TimeZone.ParsePosixName(posixRule, out outRules)) { - return MakeError(ErrorModule.Time, TimeError.TimeZoneConversionFailed); + return ResultCode.TimeZoneConversionFailed; } return 0; @@ -231,7 +230,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone { Logger.PrintWarning(LogClass.ServiceTime, $"Timezone not found for string: {locationName})"); - return MakeError(ErrorModule.Time, TimeError.TimeZoneNotFound); + return ResultCode.TimeZoneNotFound; } } else @@ -244,7 +243,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone if (!TimeZone.LoadTimeZoneRules(out outRules, tzIfStream)) { - return MakeError(ErrorModule.Time, TimeError.TimeZoneConversionFailed); + return ResultCode.TimeZoneConversionFailed; } } @@ -252,38 +251,38 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone } } - internal uint ToCalendarTimeWithMyRules(long time, out CalendarInfo calendar) + internal ResultCode ToCalendarTimeWithMyRules(long time, out CalendarInfo calendar) { return ToCalendarTime(_myRules, time, out calendar); } - internal static uint ToCalendarTime(TimeZoneRule rules, long time, out CalendarInfo calendar) + internal static ResultCode ToCalendarTime(TimeZoneRule rules, long time, out CalendarInfo calendar) { - int error = TimeZone.ToCalendarTime(rules, time, out calendar); + ResultCode error = TimeZone.ToCalendarTime(rules, time, out calendar); - if (error != 0) + if (error != ResultCode.Success) { - return MakeError(ErrorModule.Time, error); + return error; } - return 0; + return ResultCode.Success; } - internal uint ToPosixTimeWithMyRules(CalendarTime calendarTime, out long posixTime) + internal ResultCode ToPosixTimeWithMyRules(CalendarTime calendarTime, out long posixTime) { return ToPosixTime(_myRules, calendarTime, out posixTime); } - internal static uint ToPosixTime(TimeZoneRule rules, CalendarTime calendarTime, out long posixTime) + internal static ResultCode ToPosixTime(TimeZoneRule rules, CalendarTime calendarTime, out long posixTime) { - int error = TimeZone.ToPosixTime(rules, calendarTime, out posixTime); + ResultCode error = TimeZone.ToPosixTime(rules, calendarTime, out posixTime); - if (error != 0) + if (error != ResultCode.Success) { - return MakeError(ErrorModule.Time, error); + return error; } - return 0; + return ResultCode.Success; } } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Vi/ColorFormat.cs b/Ryujinx.HLE/HOS/Services/Vi/ColorFormat.cs index 70938585..2522dffc 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/ColorFormat.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/ColorFormat.cs @@ -363,4 +363,4 @@ namespace Ryujinx.HLE.HOS.Services.Android X6Bayer10GBRG = ColorSpace.BayerGBRG | ColorSwizzle.Y000 | ColorComponent.Y6X10 | ColorDataType.Integer, XYZ = ColorSpace.XYZ | ColorSwizzle.XYZ1 | ColorComponent.X20Y20Z20 | ColorDataType.Float, } -} +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs b/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs index 948309fe..2f1e68e8 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs @@ -5,7 +5,6 @@ using System; using System.IO; using System.Text; -using static Ryujinx.HLE.HOS.ErrorCode; using static Ryujinx.HLE.HOS.Services.Android.Parcel; namespace Ryujinx.HLE.HOS.Services.Vi @@ -21,47 +20,47 @@ namespace Ryujinx.HLE.HOS.Services.Vi [Command(100)] // GetRelayService() -> object - public long GetRelayService(ServiceCtx context) + public ResultCode GetRelayService(ServiceCtx context) { MakeObject(context, new IHOSBinderDriver( context.Device.System, context.Device.Gpu.Renderer)); - return 0; + return ResultCode.Success; } [Command(101)] // GetSystemDisplayService() -> object - public long GetSystemDisplayService(ServiceCtx context) + public ResultCode GetSystemDisplayService(ServiceCtx context) { MakeObject(context, new ISystemDisplayService(this)); - return 0; + return ResultCode.Success; } [Command(102)] // GetManagerDisplayService() -> object - public long GetManagerDisplayService(ServiceCtx context) + public ResultCode GetManagerDisplayService(ServiceCtx context) { MakeObject(context, new IManagerDisplayService(this)); - return 0; + return ResultCode.Success; } [Command(103)] // 2.0.0+ // GetIndirectDisplayTransactionService() -> object - public long GetIndirectDisplayTransactionService(ServiceCtx context) + public ResultCode GetIndirectDisplayTransactionService(ServiceCtx context) { MakeObject(context, new IHOSBinderDriver( context.Device.System, context.Device.Gpu.Renderer)); - return 0; + return ResultCode.Success; } [Command(1000)] // ListDisplays() -> (u64, buffer) - public long ListDisplays(ServiceCtx context) + public ResultCode ListDisplays(ServiceCtx context) { long recBuffPtr = context.Request.ReceiveBuff[0].Position; @@ -76,12 +75,12 @@ namespace Ryujinx.HLE.HOS.Services.Vi context.ResponseData.Write(1L); - return 0; + return ResultCode.Success; } [Command(1010)] // OpenDisplay(nn::vi::DisplayName) -> u64 - public long OpenDisplay(ServiceCtx context) + public ResultCode OpenDisplay(ServiceCtx context) { string name = GetDisplayName(context); @@ -89,35 +88,35 @@ namespace Ryujinx.HLE.HOS.Services.Vi context.ResponseData.Write(displayId); - return 0; + return ResultCode.Success; } [Command(1020)] // CloseDisplay(u64) - public long CloseDisplay(ServiceCtx context) + public ResultCode CloseDisplay(ServiceCtx context) { int displayId = context.RequestData.ReadInt32(); _displays.Delete(displayId); - return 0; + return ResultCode.Success; } [Command(1102)] // GetDisplayResolution(u64) -> (u64, u64) - public long GetDisplayResolution(ServiceCtx context) + public ResultCode GetDisplayResolution(ServiceCtx context) { long displayId = context.RequestData.ReadInt32(); context.ResponseData.Write(1280); context.ResponseData.Write(720); - return 0; + return ResultCode.Success; } [Command(2020)] // OpenLayer(nn::vi::DisplayName, u64, nn::applet::AppletResourceUserId, pid) -> (u64, buffer) - public long OpenLayer(ServiceCtx context) + public ResultCode OpenLayer(ServiceCtx context) { long layerId = context.RequestData.ReadInt64(); long userId = context.RequestData.ReadInt64(); @@ -130,21 +129,21 @@ namespace Ryujinx.HLE.HOS.Services.Vi context.ResponseData.Write((long)parcel.Length); - return 0; + return ResultCode.Success; } [Command(2021)] // CloseLayer(u64) - public long CloseLayer(ServiceCtx context) + public ResultCode CloseLayer(ServiceCtx context) { long layerId = context.RequestData.ReadInt64(); - return 0; + return ResultCode.Success; } [Command(2030)] // CreateStrayLayer(u32, u64) -> (u64, u64, buffer) - public long CreateStrayLayer(ServiceCtx context) + public ResultCode CreateStrayLayer(ServiceCtx context) { long layerFlags = context.RequestData.ReadInt64(); long displayId = context.RequestData.ReadInt64(); @@ -160,29 +159,29 @@ namespace Ryujinx.HLE.HOS.Services.Vi context.ResponseData.Write(0L); context.ResponseData.Write((long)parcel.Length); - return 0; + return ResultCode.Success; } [Command(2031)] // DestroyStrayLayer(u64) - public long DestroyStrayLayer(ServiceCtx context) + public ResultCode DestroyStrayLayer(ServiceCtx context) { - return 0; + return ResultCode.Success; } [Command(2101)] // SetLayerScalingMode(u32, u64) - public long SetLayerScalingMode(ServiceCtx context) + public ResultCode SetLayerScalingMode(ServiceCtx context) { int scalingMode = context.RequestData.ReadInt32(); long unknown = context.RequestData.ReadInt64(); - return 0; + return ResultCode.Success; } [Command(2102)] // 5.0.0+ // ConvertScalingMode(unknown) -> unknown - public long ConvertScalingMode(ServiceCtx context) + public ResultCode ConvertScalingMode(ServiceCtx context) { SrcScalingMode scalingMode = (SrcScalingMode)context.RequestData.ReadInt32(); @@ -191,19 +190,19 @@ namespace Ryujinx.HLE.HOS.Services.Vi if (!convertedScalingMode.HasValue) { // Scaling mode out of the range of valid values. - return MakeError(ErrorModule.Vi, 1); + return ResultCode.InvalidArguments; } if (scalingMode != SrcScalingMode.ScaleToWindow && scalingMode != SrcScalingMode.PreserveAspectRatio) { // Invalid scaling mode specified. - return MakeError(ErrorModule.Vi, 6); + return ResultCode.InvalidScalingMode; } context.ResponseData.Write((ulong)convertedScalingMode); - return 0; + return ResultCode.Success; } private DstScalingMode? ConvertScalingMode(SrcScalingMode source) @@ -222,7 +221,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi [Command(5202)] // GetDisplayVsyncEvent(u64) -> handle - public long GetDisplayVSyncEvent(ServiceCtx context) + public ResultCode GetDisplayVSyncEvent(ServiceCtx context) { string name = GetDisplayName(context); @@ -233,7 +232,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); - return 0; + return ResultCode.Success; } private byte[] MakeIGraphicsBufferProducer(long basePtr) diff --git a/Ryujinx.HLE/HOS/Services/Vi/IApplicationRootService.cs b/Ryujinx.HLE/HOS/Services/Vi/IApplicationRootService.cs index a614d877..e0f71d0f 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/IApplicationRootService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/IApplicationRootService.cs @@ -7,13 +7,13 @@ namespace Ryujinx.HLE.HOS.Services.Vi [Command(0)] // GetDisplayService(u32) -> object - public long GetDisplayService(ServiceCtx context) + public ResultCode GetDisplayService(ServiceCtx context) { int serviceType = context.RequestData.ReadInt32(); MakeObject(context, new IApplicationDisplayService()); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Vi/IHOSBinderDriver.cs b/Ryujinx.HLE/HOS/Services/Vi/IHOSBinderDriver.cs index 5583326f..4da0e2ff 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/IHOSBinderDriver.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/IHOSBinderDriver.cs @@ -24,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi [Command(0)] // TransactParcel(s32, u32, u32, buffer) -> buffer - public long TransactParcel(ServiceCtx context) + public ResultCode TransactParcel(ServiceCtx context) { int id = context.RequestData.ReadInt32(); int code = context.RequestData.ReadInt32(); @@ -36,23 +36,23 @@ namespace Ryujinx.HLE.HOS.Services.Vi data = Parcel.GetParcelData(data); - return _flinger.ProcessParcelRequest(context, data, code); + return (ResultCode)_flinger.ProcessParcelRequest(context, data, code); } [Command(1)] // AdjustRefcount(s32, s32, s32) - public long AdjustRefcount(ServiceCtx context) + public ResultCode AdjustRefcount(ServiceCtx context) { int id = context.RequestData.ReadInt32(); int addVal = context.RequestData.ReadInt32(); int type = context.RequestData.ReadInt32(); - return 0; + return ResultCode.Success; } [Command(2)] // GetNativeHandle(s32, s32) -> handle - public long GetNativeHandle(ServiceCtx context) + public ResultCode GetNativeHandle(ServiceCtx context) { int id = context.RequestData.ReadInt32(); uint unk = context.RequestData.ReadUInt32(); @@ -64,12 +64,12 @@ namespace Ryujinx.HLE.HOS.Services.Vi context.Response.HandleDesc = IpcHandleDesc.MakeMove(handle); - return 0; + return ResultCode.Success; } [Command(3)] // 3.0.0+ // TransactParcelAuto(s32, u32, u32, buffer) -> buffer - public long TransactParcelAuto(ServiceCtx context) + public ResultCode TransactParcelAuto(ServiceCtx context) { int id = context.RequestData.ReadInt32(); int code = context.RequestData.ReadInt32(); @@ -80,7 +80,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi data = Parcel.GetParcelData(data); - return _flinger.ProcessParcelRequest(context, data, code); + return (ResultCode)_flinger.ProcessParcelRequest(context, data, code); } public void Dispose() diff --git a/Ryujinx.HLE/HOS/Services/Vi/IManagerDisplayService.cs b/Ryujinx.HLE/HOS/Services/Vi/IManagerDisplayService.cs index ac6d49bd..3a64be15 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/IManagerDisplayService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/IManagerDisplayService.cs @@ -13,27 +13,27 @@ namespace Ryujinx.HLE.HOS.Services.Vi [Command(2010)] // CreateManagedLayer(u32, u64, nn::applet::AppletResourceUserId) -> u64 - public static long CreateManagedLayer(ServiceCtx context) + public ResultCode CreateManagedLayer(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceVi); context.ResponseData.Write(0L); //LayerId - return 0; + return ResultCode.Success; } [Command(2011)] // DestroyManagedLayer(u64) - public long DestroyManagedLayer(ServiceCtx context) + public ResultCode DestroyManagedLayer(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceVi); - return 0; + return ResultCode.Success; } [Command(2012)] // 7.0.0+ // CreateStrayLayer(u32, u64) -> (u64, u64, buffer) - public static long CreateStrayLayer(ServiceCtx context) + public ResultCode CreateStrayLayer(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceVi); @@ -42,20 +42,20 @@ namespace Ryujinx.HLE.HOS.Services.Vi [Command(6000)] // AddToLayerStack(u32, u64) - public static long AddToLayerStack(ServiceCtx context) + public ResultCode AddToLayerStack(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceVi); - return 0; + return ResultCode.Success; } [Command(6002)] // SetLayerVisibility(b8, u64) - public static long SetLayerVisibility(ServiceCtx context) + public ResultCode SetLayerVisibility(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceVi); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Vi/IManagerRootService.cs b/Ryujinx.HLE/HOS/Services/Vi/IManagerRootService.cs index 991f01c3..feaf4612 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/IManagerRootService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/IManagerRootService.cs @@ -7,13 +7,13 @@ namespace Ryujinx.HLE.HOS.Services.Vi [Command(2)] // GetDisplayService(u32) -> object - public long GetDisplayService(ServiceCtx context) + public ResultCode GetDisplayService(ServiceCtx context) { int serviceType = context.RequestData.ReadInt32(); MakeObject(context, new IApplicationDisplayService()); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Vi/ISystemDisplayService.cs b/Ryujinx.HLE/HOS/Services/Vi/ISystemDisplayService.cs index 28702d6f..dc0430f6 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/ISystemDisplayService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/ISystemDisplayService.cs @@ -13,25 +13,25 @@ namespace Ryujinx.HLE.HOS.Services.Vi [Command(2205)] // SetLayerZ(u64, u64) - public static long SetLayerZ(ServiceCtx context) + public ResultCode SetLayerZ(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceVi); - return 0; + return ResultCode.Success; } [Command(2207)] // SetLayerVisibility(b8, u64) - public static long SetLayerVisibility(ServiceCtx context) + public ResultCode SetLayerVisibility(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceVi); - return 0; + return ResultCode.Success; } [Command(2312)] // 1.0.0-6.2.0 // CreateStrayLayer(u32, u64) -> (u64, u64, buffer) - public static long CreateStrayLayer(ServiceCtx context) + public ResultCode CreateStrayLayer(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceVi); @@ -40,7 +40,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi [Command(3200)] // GetDisplayMode(u64) -> nn::vi::DisplayModeInfo - public static long GetDisplayMode(ServiceCtx context) + public ResultCode GetDisplayMode(ServiceCtx context) { // TODO: De-hardcode resolution. context.ResponseData.Write(1280); @@ -48,7 +48,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi context.ResponseData.Write(60.0f); context.ResponseData.Write(0); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Vi/ISystemRootService.cs b/Ryujinx.HLE/HOS/Services/Vi/ISystemRootService.cs index 9d7ae3fd..09d604c1 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/ISystemRootService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/ISystemRootService.cs @@ -7,13 +7,13 @@ namespace Ryujinx.HLE.HOS.Services.Vi [Command(1)] // GetDisplayService(u32) -> object - public long GetDisplayService(ServiceCtx context) + public ResultCode GetDisplayService(ServiceCtx context) { int serviceType = context.RequestData.ReadInt32(); MakeObject(context, new IApplicationDisplayService()); - return 0; + return ResultCode.Success; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs b/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs index d6b5fbdb..5db028cc 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs @@ -17,7 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Android { class NvFlinger : IDisposable { - private delegate long ServiceProcessParcel(ServiceCtx context, BinaryReader parcelReader); + private delegate ResultCode ServiceProcessParcel(ServiceCtx context, BinaryReader parcelReader); private Dictionary<(string, int), ServiceProcessParcel> _commands; @@ -152,7 +152,7 @@ namespace Ryujinx.HLE.HOS.Services.Android _waitBufferFree = new AutoResetEvent(false); } - public long ProcessParcelRequest(ServiceCtx context, byte[] parcelData, int code) + public ResultCode ProcessParcelRequest(ServiceCtx context, byte[] parcelData, int code) { using (MemoryStream ms = new MemoryStream(parcelData)) { @@ -186,7 +186,7 @@ namespace Ryujinx.HLE.HOS.Services.Android } } - private long GbpRequestBuffer(ServiceCtx context, BinaryReader parcelReader) + private ResultCode GbpRequestBuffer(ServiceCtx context, BinaryReader parcelReader) { int slot = parcelReader.ReadInt32(); @@ -210,7 +210,7 @@ namespace Ryujinx.HLE.HOS.Services.Android } } - private long GbpDequeueBuffer(ServiceCtx context, BinaryReader parcelReader) + private ResultCode GbpDequeueBuffer(ServiceCtx context, BinaryReader parcelReader) { // TODO: Errors. int format = parcelReader.ReadInt32(); @@ -224,7 +224,7 @@ namespace Ryujinx.HLE.HOS.Services.Android return MakeReplyParcel(context, slot, 1, 0x24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); } - private long GbpQueueBuffer(ServiceCtx context, BinaryReader parcelReader) + private ResultCode GbpQueueBuffer(ServiceCtx context, BinaryReader parcelReader) { context.Device.Statistics.RecordGameFrameTime(); @@ -252,12 +252,12 @@ namespace Ryujinx.HLE.HOS.Services.Android return MakeReplyParcel(context, 1280, 720, 0, 0, 0); } - private long GbpDetachBuffer(ServiceCtx context, BinaryReader parcelReader) + private ResultCode GbpDetachBuffer(ServiceCtx context, BinaryReader parcelReader) { return MakeReplyParcel(context, 0); } - private long GbpCancelBuffer(ServiceCtx context, BinaryReader parcelReader) + private ResultCode GbpCancelBuffer(ServiceCtx context, BinaryReader parcelReader) { // TODO: Errors. int slot = parcelReader.ReadInt32(); @@ -271,22 +271,22 @@ namespace Ryujinx.HLE.HOS.Services.Android return MakeReplyParcel(context, 0); } - private long GbpQuery(ServiceCtx context, BinaryReader parcelReader) + private ResultCode GbpQuery(ServiceCtx context, BinaryReader parcelReader) { return MakeReplyParcel(context, 0, 0); } - private long GbpConnect(ServiceCtx context, BinaryReader parcelReader) + private ResultCode GbpConnect(ServiceCtx context, BinaryReader parcelReader) { return MakeReplyParcel(context, 1280, 720, 0, 0, 0); } - private long GbpDisconnect(ServiceCtx context, BinaryReader parcelReader) + private ResultCode GbpDisconnect(ServiceCtx context, BinaryReader parcelReader) { return MakeReplyParcel(context, 0); } - private long GbpPreallocBuffer(ServiceCtx context, BinaryReader parcelReader) + private ResultCode GbpPreallocBuffer(ServiceCtx context, BinaryReader parcelReader) { int slot = parcelReader.ReadInt32(); @@ -325,7 +325,7 @@ namespace Ryujinx.HLE.HOS.Services.Android } } - private long MakeReplyParcel(ServiceCtx context, params int[] ints) + private ResultCode MakeReplyParcel(ServiceCtx context, params int[] ints) { using (MemoryStream ms = new MemoryStream()) { @@ -340,7 +340,7 @@ namespace Ryujinx.HLE.HOS.Services.Android } } - private long MakeReplyParcel(ServiceCtx context, byte[] data) + private ResultCode MakeReplyParcel(ServiceCtx context, byte[] data) { (long replyPos, long replySize) = context.Request.GetBufferType0x22(); @@ -348,7 +348,7 @@ namespace Ryujinx.HLE.HOS.Services.Android context.Memory.WriteBytes(replyPos, reply); - return 0; + return ResultCode.Success; } private GalImageFormat ConvertColorFormat(ColorFormat colorFormat) diff --git a/Ryujinx.HLE/HOS/Services/Vi/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Vi/ResultCode.cs new file mode 100644 index 00000000..35ee6ae2 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Vi/ResultCode.cs @@ -0,0 +1,13 @@ +namespace Ryujinx.HLE.HOS.Services.Vi +{ + enum ResultCode + { + ModuleId = 114, + ErrorCodeShift = 9, + + Success = 0, + + InvalidArguments = (1 << ErrorCodeShift) | ModuleId, + InvalidScalingMode = (6 << ErrorCodeShift) | ModuleId + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Vi/ScalingMode.cs b/Ryujinx.HLE/HOS/Services/Vi/ScalingMode.cs index 7b555b59..3adf1d33 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/ScalingMode.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/ScalingMode.cs @@ -17,4 +17,4 @@ None = 3, PreserveAspectRatio = 4 } -} +} \ No newline at end of file