0
0
Fork 0
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2024-10-19 19:21:41 +00:00
ryujinx-fork/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserProfile.cs
Thog ea14a95524
Fix inconsistencies with UserId (#906)
* Fix inconsistencies with UserId

The account user id isn't an UUID. This PR adds a new UserId type with
the correct value ordering to avoid mismatch with LibHac's Uid. This also fix
an hardcoded value of the UserId.

As the userid has been invalid for quite some time (and to avoid forcing
users to their recreate saves), the userid has been changed to "00000000000000010000000000000000".

Also implement a stub for IApplicationFunctions::GetSaveDataSize. (see
the sources for the reason)

Fix #626

* Address jd's & Ac_k's comments
2020-02-02 14:24:17 +11:00

37 lines
No EOL
963 B
C#

using Ryujinx.HLE.Utilities;
using System;
namespace Ryujinx.HLE.HOS.Services.Account.Acc
{
class UserProfile
{
private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public UserId UserId { get; private set; }
public string Name { get; private set; }
public long LastModifiedTimestamp { get; private set; }
public AccountState AccountState { get; set; }
public AccountState OnlinePlayState { get; set; }
public UserProfile(UserId userId, string name)
{
UserId = userId;
Name = name;
LastModifiedTimestamp = 0;
AccountState = AccountState.Closed;
OnlinePlayState = AccountState.Closed;
UpdateTimestamp();
}
private void UpdateTimestamp()
{
LastModifiedTimestamp = (long)(DateTime.Now - Epoch).TotalSeconds;
}
}
}