remove zero userid check

This commit is contained in:
emmaus 2018-09-27 10:14:46 +00:00
parent 263bb21dbb
commit 1746983adc
5 changed files with 8 additions and 18 deletions

View file

@ -39,7 +39,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc
{
UserId Uuid = new UserId(
Context.RequestData.ReadInt64(),
Context.RequestData.ReadInt64(), false);
Context.RequestData.ReadInt64());
Context.ResponseData.Write(Context.Device.System.State.TryGetUser(Uuid, out _) ? 1 : 0);
@ -94,7 +94,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc
{
UserId Uuid = new UserId(
Context.RequestData.ReadInt64(),
Context.RequestData.ReadInt64(), false);
Context.RequestData.ReadInt64());
if (!Context.Device.System.State.TryGetUser(Uuid, out UserProfile Profile))
{

View file

@ -63,7 +63,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
{
UserId Uuid = new UserId(
Context.RequestData.ReadInt64(),
Context.RequestData.ReadInt64(), false);
Context.RequestData.ReadInt64());
if (Context.Device.System.State.TryGetUser(Uuid, out UserProfile Profile))
{
@ -81,7 +81,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
{
UserId Uuid = new UserId(
Context.RequestData.ReadInt64(),
Context.RequestData.ReadInt64(), false);
Context.RequestData.ReadInt64());
long Unknown0 = Context.RequestData.ReadInt64();

View file

@ -80,7 +80,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
UserId UserId = new UserId(
Context.RequestData.ReadInt64(),
Context.RequestData.ReadInt64(), false);
Context.RequestData.ReadInt64());
long SaveId = Context.RequestData.ReadInt64();

View file

@ -57,7 +57,7 @@ namespace Ryujinx.HLE.HOS.SystemState
Profiles = new ConcurrentDictionary<string, UserProfile>();
UserId DefaultUuid = new UserId("00000000000000000000000000000001", true);
UserId DefaultUuid = new UserId("00000000000000000000000000000001");
AddUser(DefaultUuid, "Player");

View file

@ -11,13 +11,8 @@ namespace Ryujinx.HLE.HOS.SystemState
public byte[] Bytes { get; private set; }
public UserId(long Low, long High, bool Verify)
public UserId(long Low, long High)
{
if ((Low | High) == 0 && Verify)
{
throw new ArgumentException("Zero is not a valid user id!");
}
byte[] Bytes = new byte[16];
int Index = Bytes.Length;
@ -43,18 +38,13 @@ namespace Ryujinx.HLE.HOS.SystemState
this.Bytes = Bytes;
}
public UserId(string UserIdHex, bool Verify)
public UserId(string UserIdHex)
{
if (UserIdHex == null || UserIdHex.Length != 32 || !UserIdHex.All("0123456789abcdefABCDEF".Contains))
{
throw new ArgumentException("Invalid user id!", nameof(UserIdHex));
}
if (UserIdHex == "00000000000000000000000000000000" && Verify)
{
throw new ArgumentException("Zero is not a valid user id!", nameof(UserIdHex));
}
this.UserIdHex = UserIdHex.ToUpper();
Bytes = StringUtils.HexToBytes(UserIdHex);