mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-11-24 11:05:12 +00:00
f77694e4f7
* Implement a new physical memory manager and replace DeviceMemory * Proper generic constraints * Fix debug build * Add memory tests * New CPU memory manager and general code cleanup * Remove host memory management from CPU project, use Ryujinx.Memory instead * Fix tests * Document exceptions on MemoryBlock * Fix leak on unix memory allocation * Proper disposal of some objects on tests * Fix JitCache not being set as initialized * GetRef without checks for 8-bits and 16-bits CAS * Add MemoryBlock destructor * Throw in separate method to improve codegen * Address PR feedback * QueryModified improvements * Fix memory write tracking not marking all pages as modified in some cases * Simplify MarkRegionAsModified * Remove XML doc for ghost param * Add back optimization to avoid useless buffer updates * Add Ryujinx.Cpu project, move MemoryManager there and remove MemoryBlockWrapper * Some nits * Do not perform address translation when size is 0 * Address PR feedback and format NativeInterface class * Remove ghost parameter description * Update Ryujinx.Cpu to .NET Core 3.1 * Address PR feedback * Fix build * Return a well defined value for GetPhysicalAddress with invalid VA, and do not return unmapped ranges as modified * Typo
80 lines
No EOL
2.5 KiB
C#
80 lines
No EOL
2.5 KiB
C#
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
|
|
{
|
|
class IProfile : IpcService
|
|
{
|
|
private UserProfile _profile;
|
|
private Stream _profilePictureStream;
|
|
|
|
public IProfile(UserProfile profile)
|
|
{
|
|
_profile = profile;
|
|
_profilePictureStream = Assembly.GetCallingAssembly().GetManifestResourceStream("Ryujinx.HLE.RyujinxProfileImage.jpg");
|
|
}
|
|
|
|
[Command(0)]
|
|
// Get() -> (nn::account::profile::ProfileBase, buffer<nn::account::profile::UserData, 0x1a>)
|
|
public ResultCode Get(ServiceCtx context)
|
|
{
|
|
Logger.PrintStub(LogClass.ServiceAcc);
|
|
|
|
long position = context.Request.ReceiveBuff[0].Position;
|
|
|
|
MemoryHelper.FillWithZeros(context.Memory, position, 0x80);
|
|
|
|
context.Memory.Write((ulong)position, 0);
|
|
context.Memory.Write((ulong)position + 4, 1);
|
|
context.Memory.Write((ulong)position + 8, 1L);
|
|
|
|
return GetBase(context);
|
|
}
|
|
|
|
[Command(1)]
|
|
// GetBase() -> nn::account::profile::ProfileBase
|
|
public ResultCode GetBase(ServiceCtx context)
|
|
{
|
|
_profile.UserId.Write(context.ResponseData);
|
|
|
|
context.ResponseData.Write(_profile.LastModifiedTimestamp);
|
|
|
|
byte[] username = StringUtils.GetFixedLengthBytes(_profile.Name, 0x20, Encoding.UTF8);
|
|
|
|
context.ResponseData.Write(username);
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[Command(10)]
|
|
// GetImageSize() -> u32
|
|
public ResultCode GetImageSize(ServiceCtx context)
|
|
{
|
|
context.ResponseData.Write(_profilePictureStream.Length);
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[Command(11)]
|
|
// LoadImage() -> (u32, buffer<bytes, 6>)
|
|
public ResultCode LoadImage(ServiceCtx context)
|
|
{
|
|
long bufferPosition = context.Request.ReceiveBuff[0].Position;
|
|
long bufferLen = context.Request.ReceiveBuff[0].Size;
|
|
|
|
byte[] profilePictureData = new byte[bufferLen];
|
|
|
|
_profilePictureStream.Read(profilePictureData, 0, profilePictureData.Length);
|
|
|
|
context.Memory.Write((ulong)bufferPosition, profilePictureData);
|
|
|
|
context.ResponseData.Write(_profilePictureStream.Length);
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
}
|
|
} |