aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremmauss <emmausssss@gmail.com>2018-09-02 01:04:20 +0300
committergdkchan <gab.dark.100@gmail.com>2018-09-01 19:04:20 -0300
commit675f3f6f816d4f315c2f319d6b323834dc252590 (patch)
treef769609601b88bc8645eded130a4ec9698f920e4
parentb549daed034225a0b305dc40497d73983cc3827e (diff)
Implement loading of profile image (#391)
* implement loading of profile image * rename icon to profilepicture * rename icon file
-rw-r--r--Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs (renamed from Ryujinx.HLE/HOS/Services/Acc/IAccountServiceForApplication.cs)4
-rw-r--r--Ryujinx.HLE/HOS/Services/Acc/IProfile.cs36
-rw-r--r--Ryujinx.HLE/HOS/Services/ServiceFactory.cs5
-rw-r--r--Ryujinx.HLE/Ryujinx.HLE.csproj8
-rw-r--r--Ryujinx.HLE/RyujinxProfileImage.jpgbin0 -> 5394 bytes
5 files changed, 48 insertions, 5 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Acc/IAccountServiceForApplication.cs b/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs
index 36dfd9ef..8fd7bfea 100644
--- a/Ryujinx.HLE/HOS/Services/Acc/IAccountServiceForApplication.cs
+++ b/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs
@@ -7,13 +7,13 @@ using static Ryujinx.HLE.HOS.ErrorCode;
namespace Ryujinx.HLE.HOS.Services.Acc
{
- class IAccountServiceForApplication : IpcService
+ class IAccountService : IpcService
{
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
- public IAccountServiceForApplication()
+ public IAccountService()
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
diff --git a/Ryujinx.HLE/HOS/Services/Acc/IProfile.cs b/Ryujinx.HLE/HOS/Services/Acc/IProfile.cs
index 960cc49c..316f16d0 100644
--- a/Ryujinx.HLE/HOS/Services/Acc/IProfile.cs
+++ b/Ryujinx.HLE/HOS/Services/Acc/IProfile.cs
@@ -3,7 +3,10 @@ using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.Utilities;
+using System;
using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
using System.Text;
namespace Ryujinx.HLE.HOS.Services.Acc
@@ -16,15 +19,21 @@ namespace Ryujinx.HLE.HOS.Services.Acc
private UserProfile Profile;
+ private Stream ProfilePictureStream;
+
public IProfile(UserProfile Profile)
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
- { 0, Get },
- { 1, GetBase }
+ { 0, Get },
+ { 1, GetBase },
+ { 10, GetImageSize },
+ { 11, LoadImage },
};
this.Profile = Profile;
+
+ ProfilePictureStream = Assembly.GetCallingAssembly().GetManifestResourceStream("Ryujinx.HLE.RyujinxProfileImage.jpg");
}
public long Get(ServiceCtx Context)
@@ -54,5 +63,28 @@ namespace Ryujinx.HLE.HOS.Services.Acc
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;
+ }
}
} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/ServiceFactory.cs b/Ryujinx.HLE/HOS/Services/ServiceFactory.cs
index babceb7d..5e65d1d1 100644
--- a/Ryujinx.HLE/HOS/Services/ServiceFactory.cs
+++ b/Ryujinx.HLE/HOS/Services/ServiceFactory.cs
@@ -31,7 +31,10 @@ namespace Ryujinx.HLE.HOS.Services
switch (Name)
{
case "acc:u0":
- return new IAccountServiceForApplication();
+ return new IAccountService();
+
+ case "acc:u1":
+ return new IAccountService();
case "aoc:u":
return new IAddOnContentManager();
diff --git a/Ryujinx.HLE/Ryujinx.HLE.csproj b/Ryujinx.HLE/Ryujinx.HLE.csproj
index f7fb84a5..fa4c254e 100644
--- a/Ryujinx.HLE/Ryujinx.HLE.csproj
+++ b/Ryujinx.HLE/Ryujinx.HLE.csproj
@@ -14,6 +14,14 @@
</PropertyGroup>
<ItemGroup>
+ <None Remove="RyujinxProfileImage.jpg" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <EmbeddedResource Include="RyujinxProfileImage.jpg" />
+ </ItemGroup>
+
+ <ItemGroup>
<ProjectReference Include="..\ChocolArm64\ChocolArm64.csproj" />
<ProjectReference Include="..\Ryujinx.Audio\Ryujinx.Audio.csproj" />
<ProjectReference Include="..\Ryujinx.Graphics\Ryujinx.Graphics.csproj" />
diff --git a/Ryujinx.HLE/RyujinxProfileImage.jpg b/Ryujinx.HLE/RyujinxProfileImage.jpg
new file mode 100644
index 00000000..fe9ec2a9
--- /dev/null
+++ b/Ryujinx.HLE/RyujinxProfileImage.jpg
Binary files differ