mirror of
https://github.com/Ryubing/Ryujinx.git
synced 2025-11-26 16:52:22 -05:00
[Ryujinx.HLE] Address dotnet-format issues (#5380)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0052 warnings * Address or silence dotnet format IDE1006 warnings * Address dotnet format CA1816 warnings * Address or silence dotnet format CA2208 warnings * Address or silence dotnet format CA1806 and a few CA1854 warnings * Address dotnet format CA2211 warnings * Address dotnet format CA1822 warnings * Address or silence dotnet format CA1069 warnings * Make dotnet format succeed in style mode * Address or silence dotnet format CA2211 warnings * Address review comments * Address dotnet format CA2208 warnings properly * Make ProcessResult readonly * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Add previously silenced warnings back I have no clue how these disappeared * Revert formatting changes for while and for-loops * Format if-blocks correctly * Run dotnet format style after rebase * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Run dotnet format analyzers after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Fix a few disabled warnings * Fix naming rule violation, Convert shader properties to auto-property and convert values to const * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Run dotnet format after rebase * Use using declaration instead of block syntax * Address IDE0251 warnings * Address a few disabled IDE0060 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Fix naming rule violations * Fix typo * Add trailing commas, use targeted new and use array initializer * Fix build issues * Fix remaining build issues * Remove SuppressMessage for CA1069 where possible * Address dotnet format issues * Address formatting issues Co-authored-by: Ac_K <acoustik666@gmail.com> * Add GetHashCode implementation for RenderingSurfaceInfo * Explicitly silence CA1822 for every affected method in Syscall * Address formatting issues in Demangler.cs * Address review feedback Co-authored-by: Ac_K <acoustik666@gmail.com> * Revert marking service methods as static * Next dotnet format pass * Address review feedback --------- Co-authored-by: Ac_K <acoustik666@gmail.com>
This commit is contained in:
@@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
{
|
||||
public class AccountManager
|
||||
{
|
||||
public static readonly UserId DefaultUserId = new UserId("00000000000000010000000000000000");
|
||||
public static readonly UserId DefaultUserId = new("00000000000000010000000000000000");
|
||||
|
||||
private readonly AccountSaveDataManager _accountSaveDataManager;
|
||||
|
||||
@@ -51,7 +51,9 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
{
|
||||
commandLineUserProfileOverride = _profiles.Values.FirstOrDefault(x => x.Name == initialProfileName)?.UserId ?? default;
|
||||
if (commandLineUserProfileOverride.IsNull)
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.Application, $"The command line specified profile named '{initialProfileName}' was not found");
|
||||
}
|
||||
}
|
||||
OpenUser(commandLineUserProfileOverride.IsNull ? _accountSaveDataManager.LastOpened : commandLineUserProfileOverride);
|
||||
}
|
||||
@@ -64,7 +66,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
userId = new UserId(Guid.NewGuid().ToString().Replace("-", ""));
|
||||
}
|
||||
|
||||
UserProfile profile = new UserProfile(userId, name, image);
|
||||
UserProfile profile = new(userId, name, image);
|
||||
|
||||
_profiles.AddOrUpdate(userId.ToString(), profile, (key, old) => profile);
|
||||
|
||||
@@ -238,4 +240,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
return _profiles.First().Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
{
|
||||
private readonly string _profilesJsonPath = Path.Join(AppDataManager.BaseDirPath, "system", "Profiles.json");
|
||||
|
||||
private static readonly ProfilesJsonSerializerContext SerializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
private static readonly ProfilesJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
|
||||
public UserId LastOpened { get; set; }
|
||||
|
||||
@@ -23,22 +23,22 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
|
||||
if (File.Exists(_profilesJsonPath))
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
ProfilesJson profilesJson = JsonHelper.DeserializeFromFile(_profilesJsonPath, SerializerContext.ProfilesJson);
|
||||
ProfilesJson profilesJson = JsonHelper.DeserializeFromFile(_profilesJsonPath, _serializerContext.ProfilesJson);
|
||||
|
||||
foreach (var profile in profilesJson.Profiles)
|
||||
{
|
||||
UserProfile addedProfile = new UserProfile(new UserId(profile.UserId), profile.Name, profile.Image, profile.LastModifiedTimestamp);
|
||||
UserProfile addedProfile = new(new UserId(profile.UserId), profile.Name, profile.Image, profile.LastModifiedTimestamp);
|
||||
|
||||
profiles.AddOrUpdate(profile.UserId, addedProfile, (key, old) => addedProfile);
|
||||
}
|
||||
|
||||
LastOpened = new UserId(profilesJson.LastOpened);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error?.Print(LogClass.Application, $"Failed to parse {_profilesJsonPath}: {e.Message} Loading default profile!");
|
||||
Logger.Error?.Print(LogClass.Application, $"Failed to parse {_profilesJsonPath}: {ex.Message} Loading default profile!");
|
||||
|
||||
LastOpened = AccountManager.DefaultUserId;
|
||||
}
|
||||
@@ -51,26 +51,26 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
|
||||
public void Save(ConcurrentDictionary<string, UserProfile> profiles)
|
||||
{
|
||||
ProfilesJson profilesJson = new ProfilesJson()
|
||||
ProfilesJson profilesJson = new()
|
||||
{
|
||||
Profiles = new List<UserProfileJson>(),
|
||||
LastOpened = LastOpened.ToString()
|
||||
Profiles = new List<UserProfileJson>(),
|
||||
LastOpened = LastOpened.ToString(),
|
||||
};
|
||||
|
||||
foreach (var profile in profiles)
|
||||
{
|
||||
profilesJson.Profiles.Add(new UserProfileJson()
|
||||
{
|
||||
UserId = profile.Value.UserId.ToString(),
|
||||
Name = profile.Value.Name,
|
||||
AccountState = profile.Value.AccountState,
|
||||
OnlinePlayState = profile.Value.OnlinePlayState,
|
||||
UserId = profile.Value.UserId.ToString(),
|
||||
Name = profile.Value.Name,
|
||||
AccountState = profile.Value.AccountState,
|
||||
OnlinePlayState = profile.Value.OnlinePlayState,
|
||||
LastModifiedTimestamp = profile.Value.LastModifiedTimestamp,
|
||||
Image = profile.Value.Image,
|
||||
Image = profile.Value.Image,
|
||||
});
|
||||
}
|
||||
|
||||
JsonHelper.SerializeToFile(_profilesJsonPath, profilesJson, SerializerContext.ProfilesJson);
|
||||
JsonHelper.SerializeToFile(_profilesJsonPath, profilesJson, _serializerContext.ProfilesJson);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
{
|
||||
class IManagerForApplication : IpcService
|
||||
{
|
||||
private ManagerServer _managerServer;
|
||||
private readonly ManagerServer _managerServer;
|
||||
|
||||
public IManagerForApplication(UserId userId)
|
||||
{
|
||||
@@ -72,4 +72,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
return resultCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
{
|
||||
class IManagerForSystemService : IpcService
|
||||
{
|
||||
private ManagerServer _managerServer;
|
||||
private readonly ManagerServer _managerServer;
|
||||
|
||||
public IManagerForSystemService(UserId userId)
|
||||
{
|
||||
@@ -44,4 +44,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
return _managerServer.LoadIdTokenCache(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
{
|
||||
class IProfile : IpcService
|
||||
{
|
||||
private ProfileServer _profileServer;
|
||||
private readonly ProfileServer _profileServer;
|
||||
|
||||
public IProfile(UserProfile profile)
|
||||
{
|
||||
@@ -37,4 +37,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
return _profileServer.LoadImage(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
{
|
||||
class IProfileEditor : IpcService
|
||||
{
|
||||
private ProfileServer _profileServer;
|
||||
private readonly ProfileServer _profileServer;
|
||||
|
||||
public IProfileEditor(UserProfile profile)
|
||||
{
|
||||
@@ -51,4 +51,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
return _profileServer.StoreWithImage(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
// TODO: Determine where and how NetworkServiceAccountId is set.
|
||||
private const long NetworkServiceAccountId = 0xcafe;
|
||||
|
||||
private UserId _userId;
|
||||
#pragma warning disable IDE0052 // Remove unread private member
|
||||
private readonly UserId _userId;
|
||||
#pragma warning restore IDE0052
|
||||
|
||||
public ManagerServer(UserId userId)
|
||||
{
|
||||
@@ -29,15 +31,15 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
|
||||
RSAParameters parameters = provider.ExportParameters(true);
|
||||
|
||||
RsaSecurityKey secKey = new RsaSecurityKey(parameters);
|
||||
RsaSecurityKey secKey = new(parameters);
|
||||
|
||||
SigningCredentials credentials = new SigningCredentials(secKey, "RS256");
|
||||
SigningCredentials credentials = new(secKey, "RS256");
|
||||
|
||||
credentials.Key.KeyId = parameters.ToString();
|
||||
|
||||
var header = new JwtHeader(credentials)
|
||||
{
|
||||
{ "jku", "https://e0d67c509fb203858ebcb2fe3f88c2aa.baas.nintendo.com/1.0.0/certificates" }
|
||||
{ "jku", "https://e0d67c509fb203858ebcb2fe3f88c2aa.baas.nintendo.com/1.0.0/certificates" },
|
||||
};
|
||||
|
||||
byte[] rawUserId = new byte[0x10];
|
||||
@@ -60,10 +62,10 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
{ "typ", "id_token" },
|
||||
{ "iat", DateTimeOffset.UtcNow.ToUnixTimeSeconds() },
|
||||
{ "jti", Guid.NewGuid().ToString() },
|
||||
{ "exp", (DateTimeOffset.UtcNow + TimeSpan.FromHours(3)).ToUnixTimeSeconds() }
|
||||
{ "exp", (DateTimeOffset.UtcNow + TimeSpan.FromHours(3)).ToUnixTimeSeconds() },
|
||||
};
|
||||
|
||||
JwtSecurityToken securityToken = new JwtSecurityToken(header, payload);
|
||||
JwtSecurityToken securityToken = new(header, payload);
|
||||
|
||||
return new JwtSecurityTokenHandler().WriteToken(securityToken);
|
||||
}
|
||||
@@ -94,8 +96,8 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
|
||||
public ResultCode EnsureIdTokenCacheAsync(ServiceCtx context, out IAsyncContext asyncContext)
|
||||
{
|
||||
KEvent asyncEvent = new KEvent(context.Device.System.KernelContext);
|
||||
AsyncExecution asyncExecution = new AsyncExecution(asyncEvent);
|
||||
KEvent asyncEvent = new(context.Device.System.KernelContext);
|
||||
AsyncExecution asyncExecution = new(asyncEvent);
|
||||
|
||||
asyncExecution.Initialize(1000, EnsureIdTokenCacheAsyncImpl);
|
||||
|
||||
@@ -123,7 +125,9 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
public ResultCode LoadIdTokenCache(ServiceCtx context)
|
||||
{
|
||||
ulong bufferPosition = context.Request.ReceiveBuff[0].Position;
|
||||
ulong bufferSize = context.Request.ReceiveBuff[0].Size;
|
||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
||||
ulong bufferSize = context.Request.ReceiveBuff[0].Size;
|
||||
#pragma warning restore IDE0059
|
||||
|
||||
// NOTE: This opens the file at "su/cache/USERID_IN_UUID_STRING.dat" (where USERID_IN_UUID_STRING is formatted as "%08x-%04x-%04x-%02x%02x-%08x%04x")
|
||||
// in the "account:/" savedata and writes some data in the buffer.
|
||||
@@ -169,8 +173,8 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
|
||||
public ResultCode LoadNetworkServiceLicenseKindAsync(ServiceCtx context, out IAsyncNetworkServiceLicenseKindContext asyncContext)
|
||||
{
|
||||
KEvent asyncEvent = new KEvent(context.Device.System.KernelContext);
|
||||
AsyncExecution asyncExecution = new AsyncExecution(asyncEvent);
|
||||
KEvent asyncEvent = new(context.Device.System.KernelContext);
|
||||
AsyncExecution asyncExecution = new(asyncEvent);
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceAcc);
|
||||
|
||||
@@ -184,4 +188,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
return ResultCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
{
|
||||
class ProfileServer
|
||||
{
|
||||
private UserProfile _profile;
|
||||
private readonly UserProfile _profile;
|
||||
|
||||
public ProfileServer(UserProfile profile)
|
||||
{
|
||||
@@ -23,8 +23,8 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
MemoryHelper.FillWithZeros(context.Memory, bufferPosition, 0x80);
|
||||
|
||||
// TODO: Determine the struct.
|
||||
context.Memory.Write(bufferPosition, 0); // Unknown
|
||||
context.Memory.Write(bufferPosition + 4, 1); // Icon ID. 0 = Mii, the rest are character icon IDs.
|
||||
context.Memory.Write(bufferPosition, 0); // Unknown
|
||||
context.Memory.Write(bufferPosition + 4, 1); // Icon ID. 0 = Mii, the rest are character icon IDs.
|
||||
context.Memory.Write(bufferPosition + 8, (byte)1); // Profile icon background color ID
|
||||
// 0x07 bytes - Unknown
|
||||
// 0x10 bytes - Some ID related to the Mii? All zeros when a character icon is used.
|
||||
@@ -58,7 +58,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
public ResultCode LoadImage(ServiceCtx context)
|
||||
{
|
||||
ulong bufferPosition = context.Request.ReceiveBuff[0].Position;
|
||||
ulong bufferLen = context.Request.ReceiveBuff[0].Size;
|
||||
ulong bufferLen = context.Request.ReceiveBuff[0].Size;
|
||||
|
||||
if ((ulong)_profile.Image.Length > bufferLen)
|
||||
{
|
||||
@@ -75,7 +75,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
public ResultCode Store(ServiceCtx context)
|
||||
{
|
||||
ulong userDataPosition = context.Request.PtrBuff[0].Position;
|
||||
ulong userDataSize = context.Request.PtrBuff[0].Size;
|
||||
ulong userDataSize = context.Request.PtrBuff[0].Size;
|
||||
|
||||
byte[] userData = new byte[userDataSize];
|
||||
|
||||
@@ -91,14 +91,14 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
public ResultCode StoreWithImage(ServiceCtx context)
|
||||
{
|
||||
ulong userDataPosition = context.Request.PtrBuff[0].Position;
|
||||
ulong userDataSize = context.Request.PtrBuff[0].Size;
|
||||
ulong userDataSize = context.Request.PtrBuff[0].Size;
|
||||
|
||||
byte[] userData = new byte[userDataSize];
|
||||
|
||||
context.Memory.Read(userDataPosition, userData);
|
||||
|
||||
ulong profileImagePosition = context.Request.SendBuff[0].Position;
|
||||
ulong profileImageSize = context.Request.SendBuff[0].Size;
|
||||
ulong profileImageSize = context.Request.SendBuff[0].Size;
|
||||
|
||||
byte[] profileImageData = new byte[profileImageSize];
|
||||
|
||||
@@ -111,4 +111,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
return ResultCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
}
|
||||
|
||||
ulong outputPosition = context.Request.RecvListBuff[0].Position;
|
||||
ulong outputSize = context.Request.RecvListBuff[0].Size;
|
||||
ulong outputSize = context.Request.RecvListBuff[0].Size;
|
||||
|
||||
MemoryHelper.FillWithZeros(context.Memory, outputPosition, (int)outputSize);
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
break;
|
||||
}
|
||||
|
||||
context.Memory.Write(outputPosition + offset, userProfile.UserId.High);
|
||||
context.Memory.Write(outputPosition + offset, userProfile.UserId.High);
|
||||
context.Memory.Write(outputPosition + offset + 8, userProfile.UserId.Low);
|
||||
|
||||
offset += 0x10;
|
||||
@@ -148,7 +148,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
|
||||
public ResultCode CheckNetworkServiceAvailabilityAsync(ServiceCtx context, out IAsyncContext asyncContext)
|
||||
{
|
||||
KEvent asyncEvent = new(context.Device.System.KernelContext);
|
||||
KEvent asyncEvent = new(context.Device.System.KernelContext);
|
||||
AsyncExecution asyncExecution = new(asyncEvent);
|
||||
|
||||
asyncExecution.Initialize(1000, CheckNetworkServiceAvailabilityAsyncImpl);
|
||||
@@ -183,7 +183,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
}
|
||||
|
||||
ulong inputPosition = context.Request.SendBuff[0].Position;
|
||||
ulong inputSize = context.Request.SendBuff[0].Size;
|
||||
ulong inputSize = context.Request.SendBuff[0].Size;
|
||||
|
||||
if (inputSize != 0x24000)
|
||||
{
|
||||
@@ -251,4 +251,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
return ResultCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||
using System;
|
||||
using System.Threading;
|
||||
@@ -9,18 +9,18 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AsyncContext
|
||||
class AsyncExecution
|
||||
{
|
||||
private readonly CancellationTokenSource _tokenSource;
|
||||
private readonly CancellationToken _token;
|
||||
private readonly CancellationToken _token;
|
||||
|
||||
public KEvent SystemEvent { get; }
|
||||
public bool IsInitialized { get; private set; }
|
||||
public bool IsRunning { get; private set; }
|
||||
public KEvent SystemEvent { get; }
|
||||
public bool IsInitialized { get; private set; }
|
||||
public bool IsRunning { get; private set; }
|
||||
|
||||
public AsyncExecution(KEvent asyncEvent)
|
||||
{
|
||||
SystemEvent = asyncEvent;
|
||||
|
||||
_tokenSource = new CancellationTokenSource();
|
||||
_token = _tokenSource.Token;
|
||||
_token = _tokenSource.Token;
|
||||
}
|
||||
|
||||
public void Initialize(int timeout, Func<CancellationToken, Task> taskAsync)
|
||||
@@ -53,4 +53,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AsyncContext
|
||||
_tokenSource.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
[Service("acc:su", AccountServiceFlag.Administrator)] // Max Sessions: 8
|
||||
class IAccountServiceForAdministrator : IpcService
|
||||
{
|
||||
private ApplicationServiceServer _applicationServiceServer;
|
||||
private readonly ApplicationServiceServer _applicationServiceServer;
|
||||
|
||||
public IAccountServiceForAdministrator(ServiceCtx context, AccountServiceFlag serviceFlag)
|
||||
{
|
||||
@@ -126,4 +126,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
return ResultCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
[Service("acc:u0", AccountServiceFlag.Application)] // Max Sessions: 4
|
||||
class IAccountServiceForApplication : IpcService
|
||||
{
|
||||
private ApplicationServiceServer _applicationServiceServer;
|
||||
private readonly ApplicationServiceServer _applicationServiceServer;
|
||||
|
||||
public IAccountServiceForApplication(ServiceCtx context, AccountServiceFlag serviceFlag)
|
||||
{
|
||||
@@ -197,4 +197,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
return ResultCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
[Service("acc:u1", AccountServiceFlag.SystemService)] // Max Sessions: 16
|
||||
class IAccountServiceForSystemService : IpcService
|
||||
{
|
||||
private ApplicationServiceServer _applicationServiceServer;
|
||||
private readonly ApplicationServiceServer _applicationServiceServer;
|
||||
|
||||
public IAccountServiceForSystemService(ServiceCtx context, AccountServiceFlag serviceFlag)
|
||||
{
|
||||
@@ -104,4 +104,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
return _applicationServiceServer.ListQualifiedUsers(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Ryujinx.HLE.HOS.Ipc;
|
||||
using Ryujinx.HLE.HOS.Ipc;
|
||||
using Ryujinx.HLE.HOS.Services.Account.Acc.AsyncContext;
|
||||
using Ryujinx.Horizon.Common;
|
||||
using System;
|
||||
@@ -18,12 +18,12 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
// GetSystemEvent() -> handle<copy>
|
||||
public ResultCode GetSystemEvent(ServiceCtx context)
|
||||
{
|
||||
if (context.Process.HandleTable.GenerateHandle(AsyncExecution.SystemEvent.ReadableEvent, out int _systemEventHandle) != Result.Success)
|
||||
if (context.Process.HandleTable.GenerateHandle(AsyncExecution.SystemEvent.ReadableEvent, out int systemEventHandle) != Result.Success)
|
||||
{
|
||||
throw new InvalidOperationException("Out of handles!");
|
||||
}
|
||||
|
||||
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_systemEventHandle);
|
||||
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(systemEventHandle);
|
||||
|
||||
return ResultCode.Success;
|
||||
}
|
||||
@@ -76,4 +76,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
return ResultCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
{
|
||||
class IAsyncNetworkServiceLicenseKindContext : IAsyncContext
|
||||
{
|
||||
private NetworkServiceLicenseKind? _serviceLicenseKind;
|
||||
private readonly NetworkServiceLicenseKind? _serviceLicenseKind;
|
||||
|
||||
public IAsyncNetworkServiceLicenseKindContext(AsyncExecution asyncExecution, NetworkServiceLicenseKind? serviceLicenseKind) : base(asyncExecution)
|
||||
{
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
{
|
||||
public IBaasAccessTokenAccessor(ServiceCtx context) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
internal partial class ProfilesJsonSerializerContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
{
|
||||
enum AccountServiceFlag
|
||||
{
|
||||
Administrator = 100,
|
||||
SystemService = 101,
|
||||
Application = 102,
|
||||
BaasAccessTokenAccessor = 200
|
||||
Administrator = 100,
|
||||
SystemService = 101,
|
||||
Application = 102,
|
||||
BaasAccessTokenAccessor = 200,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
public enum AccountState
|
||||
{
|
||||
Closed,
|
||||
Open
|
||||
Open,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
enum NetworkServiceLicenseKind : uint
|
||||
{
|
||||
NoSubscription,
|
||||
Subscribed
|
||||
Subscribed,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.Types
|
||||
public List<UserProfileJson> Profiles { get; set; }
|
||||
public string LastOpened { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,18 +15,18 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
|
||||
public bool IsNull => (Low | High) == 0;
|
||||
|
||||
public static UserId Null => new UserId(0, 0);
|
||||
public static UserId Null => new(0, 0);
|
||||
|
||||
public UserId(long low, long high)
|
||||
{
|
||||
Low = low;
|
||||
Low = low;
|
||||
High = high;
|
||||
}
|
||||
|
||||
public UserId(byte[] bytes)
|
||||
{
|
||||
High = BitConverter.ToInt64(bytes, 0);
|
||||
Low = BitConverter.ToInt64(bytes, 8);
|
||||
Low = BitConverter.ToInt64(bytes, 8);
|
||||
}
|
||||
|
||||
public UserId(string hex)
|
||||
@@ -36,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
throw new ArgumentException("Invalid Hex value!", nameof(hex));
|
||||
}
|
||||
|
||||
Low = long.Parse(hex.AsSpan(16), NumberStyles.HexNumber);
|
||||
Low = long.Parse(hex.AsSpan(16), NumberStyles.HexNumber);
|
||||
High = long.Parse(hex.AsSpan(0, 16), NumberStyles.HexNumber);
|
||||
}
|
||||
|
||||
@@ -61,4 +61,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
return new UInt128((ulong)High, (ulong)Low);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
}
|
||||
}
|
||||
|
||||
public AccountState _onlinePlayState;
|
||||
private AccountState _onlinePlayState;
|
||||
|
||||
public AccountState OnlinePlayState
|
||||
{
|
||||
@@ -63,10 +63,10 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
public UserProfile(UserId userId, string name, byte[] image, long lastModifiedTimestamp = 0)
|
||||
{
|
||||
UserId = userId;
|
||||
Name = name;
|
||||
Image = image;
|
||||
Name = name;
|
||||
Image = image;
|
||||
|
||||
AccountState = AccountState.Closed;
|
||||
AccountState = AccountState.Closed;
|
||||
OnlinePlayState = AccountState.Closed;
|
||||
|
||||
if (lastModifiedTimestamp != 0)
|
||||
@@ -84,4 +84,4 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||
LastModifiedTimestamp = (long)(DateTime.Now - DateTime.UnixEpoch).TotalSeconds;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,4 @@
|
||||
public long LastModifiedTimestamp { get; set; }
|
||||
public byte[] Image { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
{
|
||||
public IService(ServiceCtx context) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,23 +2,23 @@ namespace Ryujinx.HLE.HOS.Services.Account
|
||||
{
|
||||
enum ResultCode
|
||||
{
|
||||
ModuleId = 124,
|
||||
ModuleId = 124,
|
||||
ErrorCodeShift = 9,
|
||||
|
||||
Success = 0,
|
||||
|
||||
NullArgument = (20 << ErrorCodeShift) | ModuleId,
|
||||
InvalidArgument = (22 << ErrorCodeShift) | ModuleId,
|
||||
NullInputBuffer = (30 << ErrorCodeShift) | ModuleId,
|
||||
InvalidBufferSize = (31 << ErrorCodeShift) | ModuleId,
|
||||
InvalidBuffer = (32 << ErrorCodeShift) | ModuleId,
|
||||
AsyncExecutionNotInitialized = (40 << ErrorCodeShift) | ModuleId,
|
||||
Unknown41 = (41 << ErrorCodeShift) | ModuleId,
|
||||
InternetRequestDenied = (59 << ErrorCodeShift) | ModuleId,
|
||||
UserNotFound = (100 << ErrorCodeShift) | ModuleId,
|
||||
NullObject = (302 << ErrorCodeShift) | ModuleId,
|
||||
Unknown341 = (341 << ErrorCodeShift) | ModuleId,
|
||||
NullArgument = (20 << ErrorCodeShift) | ModuleId,
|
||||
InvalidArgument = (22 << ErrorCodeShift) | ModuleId,
|
||||
NullInputBuffer = (30 << ErrorCodeShift) | ModuleId,
|
||||
InvalidBufferSize = (31 << ErrorCodeShift) | ModuleId,
|
||||
InvalidBuffer = (32 << ErrorCodeShift) | ModuleId,
|
||||
AsyncExecutionNotInitialized = (40 << ErrorCodeShift) | ModuleId,
|
||||
Unknown41 = (41 << ErrorCodeShift) | ModuleId,
|
||||
InternetRequestDenied = (59 << ErrorCodeShift) | ModuleId,
|
||||
UserNotFound = (100 << ErrorCodeShift) | ModuleId,
|
||||
NullObject = (302 << ErrorCodeShift) | ModuleId,
|
||||
Unknown341 = (341 << ErrorCodeShift) | ModuleId,
|
||||
MissingNetworkServiceLicenseKind = (400 << ErrorCodeShift) | ModuleId,
|
||||
InvalidIdTokenCacheBufferSize = (451 << ErrorCodeShift) | ModuleId
|
||||
InvalidIdTokenCacheBufferSize = (451 << ErrorCodeShift) | ModuleId,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user