From 675f3f6f816d4f315c2f319d6b323834dc252590 Mon Sep 17 00:00:00 2001 From: emmauss Date: Sun, 2 Sep 2018 01:04:20 +0300 Subject: [PATCH] Implement loading of profile image (#391) * implement loading of profile image * rename icon to profilepicture * rename icon file --- ...ceForApplication.cs => IAccountService.cs} | 4 +- Ryujinx.HLE/HOS/Services/Acc/IProfile.cs | 36 +++++++++++++++++- Ryujinx.HLE/HOS/Services/ServiceFactory.cs | 5 ++- Ryujinx.HLE/Ryujinx.HLE.csproj | 8 ++++ Ryujinx.HLE/RyujinxProfileImage.jpg | Bin 0 -> 5394 bytes 5 files changed, 48 insertions(+), 5 deletions(-) rename Ryujinx.HLE/HOS/Services/Acc/{IAccountServiceForApplication.cs => IAccountService.cs} (97%) create mode 100644 Ryujinx.HLE/RyujinxProfileImage.jpg diff --git a/Ryujinx.HLE/HOS/Services/Acc/IAccountServiceForApplication.cs b/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs similarity index 97% rename from Ryujinx.HLE/HOS/Services/Acc/IAccountServiceForApplication.cs rename to 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 m_Commands; public override IReadOnlyDictionary Commands => m_Commands; - public IAccountServiceForApplication() + public IAccountService() { m_Commands = new Dictionary() { 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() { - { 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 @@ -13,6 +13,14 @@ true + + + + + + + + diff --git a/Ryujinx.HLE/RyujinxProfileImage.jpg b/Ryujinx.HLE/RyujinxProfileImage.jpg new file mode 100644 index 0000000000000000000000000000000000000000..fe9ec2a9590d2d53ef1dcffc8078f5bd04e7b00f GIT binary patch literal 5394 zcmcIn2{=@3-#^yL5~&$NHI<4?rLq?$3CR;Fj3q`q%2L)WW1CdMWXWEV2~CnMWlJ&0 zRudXa)@bZ&_RKKmyhlB%?|t9zdwSpN`tF(kea|)L+~@rF-|q(7!Oy^kQ(8J&02><{ zUzFh0LxHvhvcwsQ^b^N^i{CvE8eCq`^ZdflMB*4eFL3o4E zCO86t;1?9xEDYbg5srYbK7@?}+QZ4k!^On|U(dH5{vQvp91vQ^2CxAfY&!vVAvO*n zHn0jn0stEqr0uH0e+@QvNJnniIv!p==!Sv~06QB82RkRns@Blm{?K)RQ;2Khjzj9) zn+z_%cDlk32S%l=lQ^DNfjCQ@-X&}8cAbY;SY)%P*zP@&QhTN41j){$nPq=$8F*WTG>2dm# zjHl0E&LeCj!s%%|G?nT@W|-c%m6DtIJh z&rTz(-Kf06yX0uQXI4%7X4&rouU`daFI%@jy0(CM` zN3cFZxPWxZ<8eka=5l{kpWWw?cV#3wrxSqVV{vlIEg3Wh?+)RCH0-aIR~) z_s#kE7kzvWtj}7!tL}g;WR)d=%skc_(s42P1_dLCO`q<; zipd2O$WQ4y?*;)*mi3H8$R$Dz-qs-D%P7;*4Fm!iL2v`CU4RtaKoeLMM5~`F2;9jh ze!-wD^xyO{_;grM-|!>itM_e2|vU38v={=PW;?GuE?1* zdDKywRD8EvZ#Fs0-2gKcYyVU(?etY0WO?z#A9;66itjlqD=xl*lrm4+vG!yO%$w$L zGyO$WTuw|madtCuI4@U10R&vKM;f2excrt^RkB@GiP-h;)PbS;1jW=MpUCHXj_;vT z4rMjcO*er+<0J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