account: Adds AccountManager (#2184)
* account: Adds Account Manager In a way to have Custom User Profiles merged in master faster, this PR adds a `AccountManager` class (based on `AccountUtils` class) and the following changes have been made: - Adds a "default profile values" which were the old hardcoded ones. - The image profile is moved to the Account service folder. - The hardcoded UserId for the savedata is now using the `AccountManager` last opened one. - The DeviceId in Mii service is changed to the right value (checked by REd sys:set call). * Fix csproj * Addresses gdkchan's comments * Fix UserProfile fields * Fix mii GetDeviceId() * Update Ryujinx.HLE.csproj
This commit is contained in:
parent
001005b3d5
commit
7344dee475
19 changed files with 89 additions and 81 deletions
|
@ -1,8 +1,6 @@
|
|||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Cpu;
|
||||
using Ryujinx.HLE.Utilities;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
||||
|
@ -10,12 +8,10 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
|||
class ProfileServer
|
||||
{
|
||||
private UserProfile _profile;
|
||||
private Stream _profilePictureStream;
|
||||
|
||||
public ProfileServer(UserProfile profile)
|
||||
{
|
||||
_profile = profile;
|
||||
_profilePictureStream = Assembly.GetCallingAssembly().GetManifestResourceStream("Ryujinx.HLE.RyujinxProfileImage.jpg");
|
||||
_profile = profile;
|
||||
}
|
||||
|
||||
public ResultCode Get(ServiceCtx context)
|
||||
|
@ -54,7 +50,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
|||
|
||||
public ResultCode GetImageSize(ServiceCtx context)
|
||||
{
|
||||
context.ResponseData.Write(_profilePictureStream.Length);
|
||||
context.ResponseData.Write(_profile.Image.Length);
|
||||
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
@ -64,13 +60,14 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
|||
long bufferPosition = context.Request.ReceiveBuff[0].Position;
|
||||
long bufferLen = context.Request.ReceiveBuff[0].Size;
|
||||
|
||||
byte[] profilePictureData = new byte[bufferLen];
|
||||
if (_profile.Image.Length > bufferLen)
|
||||
{
|
||||
return ResultCode.InvalidBufferSize;
|
||||
}
|
||||
|
||||
_profilePictureStream.Read(profilePictureData, 0, profilePictureData.Length);
|
||||
context.Memory.Write((ulong)bufferPosition, _profile.Image);
|
||||
|
||||
context.Memory.Write((ulong)bufferPosition, profilePictureData);
|
||||
|
||||
context.ResponseData.Write(_profilePictureStream.Length);
|
||||
context.ResponseData.Write(_profile.Image.Length);
|
||||
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
@ -100,16 +97,16 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
|
|||
|
||||
context.Memory.Read((ulong)userDataPosition, userData);
|
||||
|
||||
long profilePicturePosition = context.Request.SendBuff[0].Position;
|
||||
long profilePictureSize = context.Request.SendBuff[0].Size;
|
||||
long profileImagePosition = context.Request.SendBuff[0].Position;
|
||||
long profileImageSize = context.Request.SendBuff[0].Size;
|
||||
|
||||
byte[] profilePictureData = new byte[profilePictureSize];
|
||||
byte[] profileImageData = new byte[profileImageSize];
|
||||
|
||||
context.Memory.Read((ulong)profilePicturePosition, profilePictureData);
|
||||
context.Memory.Read((ulong)profileImagePosition, profileImageData);
|
||||
|
||||
// TODO: Read the nn::account::profile::ProfileBase and store everything in the savedata.
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceAcc, new { userDataSize, profilePictureSize });
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceAcc, new { userDataSize, profileImageSize });
|
||||
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue