0
0
Fork 0
mirror of https://github.com/GreemDev/Ryujinx.git synced 2024-12-23 11:35:47 +00:00

Implement loading of profile image (#391)

* implement loading of profile image

* rename icon to profilepicture

* rename icon file
This commit is contained in:
emmauss 2018-09-02 01:04:20 +03:00 committed by gdkchan
parent b549daed03
commit 675f3f6f81
5 changed files with 48 additions and 5 deletions

View file

@ -7,13 +7,13 @@ using static Ryujinx.HLE.HOS.ErrorCode;
namespace Ryujinx.HLE.HOS.Services.Acc namespace Ryujinx.HLE.HOS.Services.Acc
{ {
class IAccountServiceForApplication : IpcService class IAccountService : IpcService
{ {
private Dictionary<int, ServiceProcessRequest> m_Commands; private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public IAccountServiceForApplication() public IAccountService()
{ {
m_Commands = new Dictionary<int, ServiceProcessRequest>() m_Commands = new Dictionary<int, ServiceProcessRequest>()
{ {

View file

@ -3,7 +3,10 @@ using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.SystemState; using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.HLE.Logging; using Ryujinx.HLE.Logging;
using Ryujinx.HLE.Utilities; using Ryujinx.HLE.Utilities;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text; using System.Text;
namespace Ryujinx.HLE.HOS.Services.Acc namespace Ryujinx.HLE.HOS.Services.Acc
@ -16,15 +19,21 @@ namespace Ryujinx.HLE.HOS.Services.Acc
private UserProfile Profile; private UserProfile Profile;
private Stream ProfilePictureStream;
public IProfile(UserProfile Profile) public IProfile(UserProfile Profile)
{ {
m_Commands = new Dictionary<int, ServiceProcessRequest>() m_Commands = new Dictionary<int, ServiceProcessRequest>()
{ {
{ 0, Get }, { 0, Get },
{ 1, GetBase } { 1, GetBase },
{ 10, GetImageSize },
{ 11, LoadImage },
}; };
this.Profile = Profile; this.Profile = Profile;
ProfilePictureStream = Assembly.GetCallingAssembly().GetManifestResourceStream("Ryujinx.HLE.RyujinxProfileImage.jpg");
} }
public long Get(ServiceCtx Context) public long Get(ServiceCtx Context)
@ -54,5 +63,28 @@ namespace Ryujinx.HLE.HOS.Services.Acc
return 0; return 0;
} }
private long 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.WriteBytes(BufferPosition, ProfilePictureData);
Context.ResponseData.Write(ProfilePictureStream.Length);
return 0;
}
private long GetImageSize(ServiceCtx Context)
{
Context.ResponseData.Write(ProfilePictureStream.Length);
return 0;
}
} }
} }

View file

@ -31,7 +31,10 @@ namespace Ryujinx.HLE.HOS.Services
switch (Name) switch (Name)
{ {
case "acc:u0": case "acc:u0":
return new IAccountServiceForApplication(); return new IAccountService();
case "acc:u1":
return new IAccountService();
case "aoc:u": case "aoc:u":
return new IAddOnContentManager(); return new IAddOnContentManager();

View file

@ -13,6 +13,14 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Remove="RyujinxProfileImage.jpg" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="RyujinxProfileImage.jpg" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\ChocolArm64\ChocolArm64.csproj" /> <ProjectReference Include="..\ChocolArm64\ChocolArm64.csproj" />
<ProjectReference Include="..\Ryujinx.Audio\Ryujinx.Audio.csproj" /> <ProjectReference Include="..\Ryujinx.Audio\Ryujinx.Audio.csproj" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB