Save Common implementation (#434)
* save common implementation * remove zero userid check * Renamed UserId to UInt128 * fix index in hex conversion
This commit is contained in:
parent
5b8ccb717f
commit
caa181edf2
9 changed files with 97 additions and 108 deletions
|
@ -1,3 +1,4 @@
|
|||
using Ryujinx.HLE.Utilities;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
|
@ -57,9 +58,10 @@ namespace Ryujinx.HLE.HOS.SystemState
|
|||
|
||||
Profiles = new ConcurrentDictionary<string, UserProfile>();
|
||||
|
||||
UserId DefaultUuid = new UserId("00000000000000000000000000000001");
|
||||
UInt128 DefaultUuid = new UInt128("00000000000000000000000000000001");
|
||||
|
||||
AddUser(DefaultUuid, "Player");
|
||||
|
||||
OpenUser(DefaultUuid);
|
||||
}
|
||||
|
||||
|
@ -85,24 +87,24 @@ namespace Ryujinx.HLE.HOS.SystemState
|
|||
ActiveAudioOutput = AudioOutputs[2];
|
||||
}
|
||||
|
||||
public void AddUser(UserId Uuid, string Name)
|
||||
public void AddUser(UInt128 Uuid, string Name)
|
||||
{
|
||||
UserProfile Profile = new UserProfile(Uuid, Name);
|
||||
|
||||
Profiles.AddOrUpdate(Uuid.UserIdHex, Profile, (Key, Old) => Profile);
|
||||
Profiles.AddOrUpdate(Uuid.ToString(), Profile, (Key, Old) => Profile);
|
||||
}
|
||||
|
||||
public void OpenUser(UserId Uuid)
|
||||
public void OpenUser(UInt128 Uuid)
|
||||
{
|
||||
if (Profiles.TryGetValue(Uuid.UserIdHex, out UserProfile Profile))
|
||||
if (Profiles.TryGetValue(Uuid.ToString(), out UserProfile Profile))
|
||||
{
|
||||
(LastOpenUser = Profile).AccountState = OpenCloseState.Open;
|
||||
}
|
||||
}
|
||||
|
||||
public void CloseUser(UserId Uuid)
|
||||
public void CloseUser(UInt128 Uuid)
|
||||
{
|
||||
if (Profiles.TryGetValue(Uuid.UserIdHex, out UserProfile Profile))
|
||||
if (Profiles.TryGetValue(Uuid.ToString(), out UserProfile Profile))
|
||||
{
|
||||
Profile.AccountState = OpenCloseState.Closed;
|
||||
}
|
||||
|
@ -113,9 +115,9 @@ namespace Ryujinx.HLE.HOS.SystemState
|
|||
return Profiles.Count;
|
||||
}
|
||||
|
||||
internal bool TryGetUser(UserId Uuid, out UserProfile Profile)
|
||||
internal bool TryGetUser(UInt128 Uuid, out UserProfile Profile)
|
||||
{
|
||||
return Profiles.TryGetValue(Uuid.UserIdHex, out Profile);
|
||||
return Profiles.TryGetValue(Uuid.ToString(), out Profile);
|
||||
}
|
||||
|
||||
internal IEnumerable<UserProfile> GetAllUsers()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue