diff options
| author | Ac_K <Acoustik666@gmail.com> | 2019-07-12 03:13:43 +0200 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2019-07-11 22:13:43 -0300 |
| commit | 560ccbeb2d55a4426ad2827bf7534d4a695431c2 (patch) | |
| tree | 7e224acbd6c023ea56ff80c6207aa0966aa06ee5 /Ryujinx.HLE/HOS/Services/Acc | |
| parent | f723f6f39aaf7b1cebc0224a055058d62e3b689c (diff) | |
Refactoring commands handling (#728)
* Refactoring commands handling
- Use Reflection to handle commands ID.
- Add all symbols (from SwIPC so not all time accurate).
- Re-sort some services commands methods.
- Some cleanup.
- Keep some empty constructor for consistency.
* Fix order in IProfile
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Acc')
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs | 49 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Acc/IManagerForApplication.cs | 17 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Acc/IProfile.cs | 42 |
3 files changed, 35 insertions, 73 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs b/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs index 84b0e030..7176240a 100644 --- a/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs +++ b/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs @@ -1,6 +1,5 @@ using Ryujinx.Common.Logging; using Ryujinx.HLE.FileSystem; -using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.HOS.Services.Arp; using Ryujinx.HLE.HOS.SystemState; using Ryujinx.HLE.Utilities; @@ -19,40 +18,9 @@ namespace Ryujinx.HLE.HOS.Services.Acc private ApplicationLaunchProperty _applicationLaunchProperty; - private Dictionary<int, ServiceProcessRequest> _commands; - - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; - - public IAccountService(ServiceCtx context) - { - _commands = new Dictionary<int, ServiceProcessRequest> - { - { 0, GetUserCount }, - { 1, GetUserExistence }, - { 2, ListAllUsers }, - { 3, ListOpenUsers }, - { 4, GetLastOpenedUser }, - { 5, GetProfile }, - //{ 6, GetProfileDigest }, // 3.0.0+ - { 50, IsUserRegistrationRequestPermitted }, - { 51, TrySelectUserWithoutInteraction }, - //{ 60, ListOpenContextStoredUsers }, // 5.0.0-5.1.0 - //{ 99, DebugActivateOpenContextRetention }, // 6.0.0+ - { 100, InitializeApplicationInfo }, - { 101, GetBaasAccountManagerForApplication }, - //{ 102, AuthenticateApplicationAsync }, - //{ 103, CheckNetworkServiceAvailabilityAsync }, // 4.0.0+ - { 110, StoreSaveDataThumbnail }, - { 111, ClearSaveDataThumbnail }, - //{ 120, CreateGuestLoginRequest }, - //{ 130, LoadOpenContext }, // 6.0.0+ - //{ 131, ListOpenContextStoredUsers }, // 6.0.0+ - { 140, InitializeApplicationInfo }, // 6.0.0+ - //{ 141, ListQualifiedUsers }, // 6.0.0+ - { 150, IsUserAccountSwitchLocked }, // 6.0.0+ - }; - } + public IAccountService(ServiceCtx context) { } + [Command(0)] // GetUserCount() -> i32 public long GetUserCount(ServiceCtx context) { @@ -61,6 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + [Command(1)] // GetUserExistence(nn::account::Uid) -> bool public long GetUserExistence(ServiceCtx context) { @@ -76,12 +45,14 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + [Command(2)] // ListAllUsers() -> array<nn::account::Uid, 0xa> public long ListAllUsers(ServiceCtx context) { return WriteUserList(context, context.Device.System.State.Account.GetAllUsers()); } + [Command(3)] // ListOpenUsers() -> array<nn::account::Uid, 0xa> public long ListOpenUsers(ServiceCtx context) { @@ -116,6 +87,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + [Command(4)] // GetLastOpenedUser() -> nn::account::Uid public long GetLastOpenedUser(ServiceCtx context) { @@ -124,6 +96,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + [Command(5)] // GetProfile(nn::account::Uid) -> object<nn::account::profile::IProfile> public long GetProfile(ServiceCtx context) { @@ -144,6 +117,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + [Command(50)] // IsUserRegistrationRequestPermitted(u64, pid) -> bool public long IsUserRegistrationRequestPermitted(ServiceCtx context) { @@ -153,6 +127,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + [Command(51)] // TrySelectUserWithoutInteraction(bool) -> nn::account::Uid public long TrySelectUserWithoutInteraction(ServiceCtx context) { @@ -180,6 +155,8 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + [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) @@ -225,6 +202,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + [Command(101)] // GetBaasAccountManagerForApplication(nn::account::Uid) -> object<nn::account::baas::IManagerForApplication> public long GetBaasAccountManagerForApplication(ServiceCtx context) { @@ -248,6 +226,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + [Command(110)] // StoreSaveDataThumbnail(nn::account::Uid, buffer<bytes, 5>) public long StoreSaveDataThumbnail(ServiceCtx context) { @@ -285,6 +264,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + [Command(111)] // ClearSaveDataThumbnail(nn::account::Uid) public long ClearSaveDataThumbnail(ServiceCtx context) { @@ -307,6 +287,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + [Command(150)] // 6.0.0+ // IsUserAccountSwitchLocked() -> bool public long IsUserAccountSwitchLocked(ServiceCtx context) { diff --git a/Ryujinx.HLE/HOS/Services/Acc/IManagerForApplication.cs b/Ryujinx.HLE/HOS/Services/Acc/IManagerForApplication.cs index 1ac18c5e..d4e753f4 100644 --- a/Ryujinx.HLE/HOS/Services/Acc/IManagerForApplication.cs +++ b/Ryujinx.HLE/HOS/Services/Acc/IManagerForApplication.cs @@ -1,33 +1,21 @@ using Ryujinx.Common.Logging; -using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.HOS.Services.Arp; using Ryujinx.HLE.Utilities; -using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Acc { class IManagerForApplication : IpcService { - private UInt128 _userId; - + private UInt128 _userId; private ApplicationLaunchProperty _applicationLaunchProperty; - private Dictionary<int, ServiceProcessRequest> _commands; - - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; - public IManagerForApplication(UInt128 userId, ApplicationLaunchProperty applicationLaunchProperty) { - _commands = new Dictionary<int, ServiceProcessRequest> - { - { 0, CheckAvailability }, - { 1, GetAccountId } - }; - _userId = userId; _applicationLaunchProperty = applicationLaunchProperty; } + [Command(0)] // CheckAvailability() public long CheckAvailability(ServiceCtx context) { @@ -36,6 +24,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + [Command(1)] // GetAccountId() -> nn::account::NetworkServiceAccountId public long GetAccountId(ServiceCtx context) { diff --git a/Ryujinx.HLE/HOS/Services/Acc/IProfile.cs b/Ryujinx.HLE/HOS/Services/Acc/IProfile.cs index 966fda24..6a346068 100644 --- a/Ryujinx.HLE/HOS/Services/Acc/IProfile.cs +++ b/Ryujinx.HLE/HOS/Services/Acc/IProfile.cs @@ -1,9 +1,7 @@ using ChocolArm64.Memory; using Ryujinx.Common.Logging; -using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.HOS.SystemState; using Ryujinx.HLE.Utilities; -using System.Collections.Generic; using System.IO; using System.Reflection; using System.Text; @@ -12,29 +10,17 @@ namespace Ryujinx.HLE.HOS.Services.Acc { class IProfile : IpcService { - private Dictionary<int, ServiceProcessRequest> _commands; - - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands; - private UserProfile _profile; - - private Stream _profilePictureStream; + private Stream _profilePictureStream; public IProfile(UserProfile profile) { - _commands = new Dictionary<int, ServiceProcessRequest> - { - { 0, Get }, - { 1, GetBase }, - { 10, GetImageSize }, - { 11, LoadImage } - }; - - _profile = profile; - + _profile = profile; _profilePictureStream = Assembly.GetCallingAssembly().GetManifestResourceStream("Ryujinx.HLE.RyujinxProfileImage.jpg"); } + [Command(0)] + // Get() -> (nn::account::profile::ProfileBase, buffer<nn::account::profile::UserData, 0x1a>) public long Get(ServiceCtx context) { Logger.PrintStub(LogClass.ServiceAcc); @@ -50,6 +36,8 @@ namespace Ryujinx.HLE.HOS.Services.Acc return GetBase(context); } + [Command(1)] + // GetBase() -> nn::account::profile::ProfileBase public long GetBase(ServiceCtx context) { _profile.UserId.Write(context.ResponseData); @@ -63,6 +51,17 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + [Command(10)] + // GetImageSize() -> u32 + private long GetImageSize(ServiceCtx context) + { + context.ResponseData.Write(_profilePictureStream.Length); + + return 0; + } + + [Command(11)] + // LoadImage() -> (u32, buffer<bytes, 6>) private long LoadImage(ServiceCtx context) { long bufferPosition = context.Request.ReceiveBuff[0].Position; @@ -78,12 +77,5 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } - - private long GetImageSize(ServiceCtx context) - { - context.ResponseData.Write(_profilePictureStream.Length); - - return 0; - } } }
\ No newline at end of file |
