diff options
| author | TSR Berry <20988865+TSRBerry@users.noreply.github.com> | 2023-04-08 01:22:00 +0200 |
|---|---|---|
| committer | Mary <thog@protonmail.com> | 2023-04-27 23:51:14 +0200 |
| commit | cee712105850ac3385cd0091a923438167433f9f (patch) | |
| tree | 4a5274b21d8b7f938c0d0ce18736d3f2993b11b1 /Ryujinx.HLE/HOS/Applets/Browser | |
| parent | cd124bda587ef09668a971fa1cac1c3f0cfc9f21 (diff) | |
Move solution and projects to src
Diffstat (limited to 'Ryujinx.HLE/HOS/Applets/Browser')
| -rw-r--r-- | Ryujinx.HLE/HOS/Applets/Browser/BootDisplayKind.cs | 11 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Applets/Browser/BrowserApplet.cs | 104 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Applets/Browser/BrowserArgument.cs | 133 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Applets/Browser/BrowserOutput.cs | 47 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Applets/Browser/BrowserOutputType.cs | 14 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Applets/Browser/DocumentKind.cs | 9 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Applets/Browser/LeftStickMode.cs | 8 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Applets/Browser/ShimKind.cs | 13 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Applets/Browser/WebArgHeader.cs | 9 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Applets/Browser/WebArgTLV.cs | 9 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Applets/Browser/WebArgTLVType.cs | 62 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Applets/Browser/WebCommonReturnValue.cs | 12 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Applets/Browser/WebExitReason.cs | 11 |
13 files changed, 0 insertions, 442 deletions
diff --git a/Ryujinx.HLE/HOS/Applets/Browser/BootDisplayKind.cs b/Ryujinx.HLE/HOS/Applets/Browser/BootDisplayKind.cs deleted file mode 100644 index fe6e6040..00000000 --- a/Ryujinx.HLE/HOS/Applets/Browser/BootDisplayKind.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Ryujinx.HLE.HOS.Applets.Browser -{ - enum BootDisplayKind - { - White, - Offline, - Black, - Share, - Lobby - } -} diff --git a/Ryujinx.HLE/HOS/Applets/Browser/BrowserApplet.cs b/Ryujinx.HLE/HOS/Applets/Browser/BrowserApplet.cs deleted file mode 100644 index 952afcd5..00000000 --- a/Ryujinx.HLE/HOS/Applets/Browser/BrowserApplet.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Ryujinx.Common; -using Ryujinx.Common.Logging; -using Ryujinx.Common.Memory; -using Ryujinx.HLE.HOS.Services.Am.AppletAE; -using System; -using System.Collections.Generic; -using System.IO; - -namespace Ryujinx.HLE.HOS.Applets.Browser -{ - internal class BrowserApplet : IApplet - { - public event EventHandler AppletStateChanged; - - private AppletSession _normalSession; - private AppletSession _interactiveSession; - - private CommonArguments _commonArguments; - private List<BrowserArgument> _arguments; - private ShimKind _shimKind; - - public BrowserApplet(Horizon system) {} - - public ResultCode GetResult() - { - return ResultCode.Success; - } - - public ResultCode Start(AppletSession normalSession, AppletSession interactiveSession) - { - _normalSession = normalSession; - _interactiveSession = interactiveSession; - - _commonArguments = IApplet.ReadStruct<CommonArguments>(_normalSession.Pop()); - - Logger.Stub?.PrintStub(LogClass.ServiceAm, $"WebApplet version: 0x{_commonArguments.AppletVersion:x8}"); - - ReadOnlySpan<byte> webArguments = _normalSession.Pop(); - - (_shimKind, _arguments) = BrowserArgument.ParseArguments(webArguments); - - Logger.Stub?.PrintStub(LogClass.ServiceAm, $"Web Arguments: {_arguments.Count}"); - - foreach (BrowserArgument argument in _arguments) - { - Logger.Stub?.PrintStub(LogClass.ServiceAm, $"{argument.Type}: {argument.GetValue()}"); - } - - if ((_commonArguments.AppletVersion >= 0x80000 && _shimKind == ShimKind.Web) || (_commonArguments.AppletVersion >= 0x30000 && _shimKind == ShimKind.Share)) - { - List<BrowserOutput> result = new List<BrowserOutput>(); - - result.Add(new BrowserOutput(BrowserOutputType.ExitReason, (uint)WebExitReason.ExitButton)); - - _normalSession.Push(BuildResponseNew(result)); - } - else - { - WebCommonReturnValue result = new WebCommonReturnValue() - { - ExitReason = WebExitReason.ExitButton, - }; - - _normalSession.Push(BuildResponseOld(result)); - } - - AppletStateChanged?.Invoke(this, null); - - return ResultCode.Success; - } - - private byte[] BuildResponseOld(WebCommonReturnValue result) - { - using (MemoryStream stream = MemoryStreamManager.Shared.GetStream()) - using (BinaryWriter writer = new BinaryWriter(stream)) - { - writer.WriteStruct(result); - - return stream.ToArray(); - } - } - private byte[] BuildResponseNew(List<BrowserOutput> outputArguments) - { - using (MemoryStream stream = MemoryStreamManager.Shared.GetStream()) - using (BinaryWriter writer = new BinaryWriter(stream)) - { - writer.WriteStruct(new WebArgHeader - { - Count = (ushort)outputArguments.Count, - ShimKind = _shimKind - }); - - foreach (BrowserOutput output in outputArguments) - { - output.Write(writer); - } - - writer.Write(new byte[0x2000 - writer.BaseStream.Position]); - - return stream.ToArray(); - } - } - } -} diff --git a/Ryujinx.HLE/HOS/Applets/Browser/BrowserArgument.cs b/Ryujinx.HLE/HOS/Applets/Browser/BrowserArgument.cs deleted file mode 100644 index 17fd4089..00000000 --- a/Ryujinx.HLE/HOS/Applets/Browser/BrowserArgument.cs +++ /dev/null @@ -1,133 +0,0 @@ -using Ryujinx.HLE.HOS.Services.Account.Acc; -using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; -using System.Text; - -namespace Ryujinx.HLE.HOS.Applets.Browser -{ - class BrowserArgument - { - public WebArgTLVType Type { get; } - public byte[] Value { get; } - - public BrowserArgument(WebArgTLVType type, byte[] value) - { - Type = type; - Value = value; - } - - private static readonly Dictionary<WebArgTLVType, Type> _typeRegistry = new Dictionary<WebArgTLVType, Type> - { - { WebArgTLVType.InitialURL, typeof(string) }, - { WebArgTLVType.CallbackUrl, typeof(string) }, - { WebArgTLVType.CallbackableUrl, typeof(string) }, - { WebArgTLVType.ApplicationId, typeof(ulong) }, - { WebArgTLVType.DocumentPath, typeof(string) }, - { WebArgTLVType.DocumentKind, typeof(DocumentKind) }, - { WebArgTLVType.SystemDataId, typeof(ulong) }, - { WebArgTLVType.Whitelist, typeof(string) }, - { WebArgTLVType.NewsFlag, typeof(bool) }, - { WebArgTLVType.UserID, typeof(UserId) }, - { WebArgTLVType.ScreenShotEnabled, typeof(bool) }, - { WebArgTLVType.EcClientCertEnabled, typeof(bool) }, - { WebArgTLVType.UnknownFlag0x14, typeof(bool) }, - { WebArgTLVType.UnknownFlag0x15, typeof(bool) }, - { WebArgTLVType.PlayReportEnabled, typeof(bool) }, - { WebArgTLVType.BootDisplayKind, typeof(BootDisplayKind) }, - { WebArgTLVType.FooterEnabled, typeof(bool) }, - { WebArgTLVType.PointerEnabled, typeof(bool) }, - { WebArgTLVType.LeftStickMode, typeof(LeftStickMode) }, - { WebArgTLVType.KeyRepeatFrame1, typeof(int) }, - { WebArgTLVType.KeyRepeatFrame2, typeof(int) }, - { WebArgTLVType.BootAsMediaPlayerInverted, typeof(bool) }, - { WebArgTLVType.DisplayUrlKind, typeof(bool) }, - { WebArgTLVType.BootAsMediaPlayer, typeof(bool) }, - { WebArgTLVType.ShopJumpEnabled, typeof(bool) }, - { WebArgTLVType.MediaAutoPlayEnabled, typeof(bool) }, - { WebArgTLVType.LobbyParameter, typeof(string) }, - { WebArgTLVType.JsExtensionEnabled, typeof(bool) }, - { WebArgTLVType.AdditionalCommentText, typeof(string) }, - { WebArgTLVType.TouchEnabledOnContents, typeof(bool) }, - { WebArgTLVType.UserAgentAdditionalString, typeof(string) }, - { WebArgTLVType.MediaPlayerAutoCloseEnabled, typeof(bool) }, - { WebArgTLVType.PageCacheEnabled, typeof(bool) }, - { WebArgTLVType.WebAudioEnabled, typeof(bool) }, - { WebArgTLVType.PageFadeEnabled, typeof(bool) }, - { WebArgTLVType.BootLoadingIconEnabled, typeof(bool) }, - { WebArgTLVType.PageScrollIndicatorEnabled, typeof(bool) }, - { WebArgTLVType.MediaPlayerSpeedControlEnabled, typeof(bool) }, - { WebArgTLVType.OverrideWebAudioVolume, typeof(float) }, - { WebArgTLVType.OverrideMediaAudioVolume, typeof(float) }, - { WebArgTLVType.MediaPlayerUiEnabled, typeof(bool) }, - }; - - public static (ShimKind, List<BrowserArgument>) ParseArguments(ReadOnlySpan<byte> data) - { - List<BrowserArgument> browserArguments = new List<BrowserArgument>(); - - WebArgHeader header = IApplet.ReadStruct<WebArgHeader>(data.Slice(0, 8)); - - ReadOnlySpan<byte> rawTLVs = data.Slice(8); - - for (int i = 0; i < header.Count; i++) - { - WebArgTLV tlv = IApplet.ReadStruct<WebArgTLV>(rawTLVs); - ReadOnlySpan<byte> tlvData = rawTLVs.Slice(Unsafe.SizeOf<WebArgTLV>(), tlv.Size); - - browserArguments.Add(new BrowserArgument((WebArgTLVType)tlv.Type, tlvData.ToArray())); - - rawTLVs = rawTLVs.Slice(Unsafe.SizeOf<WebArgTLV>() + tlv.Size); - } - - return (header.ShimKind, browserArguments); - } - - public object GetValue() - { - if (_typeRegistry.TryGetValue(Type, out Type valueType)) - { - if (valueType == typeof(string)) - { - return Encoding.UTF8.GetString(Value); - } - else if (valueType == typeof(bool)) - { - return Value[0] == 1; - } - else if (valueType == typeof(uint)) - { - return BitConverter.ToUInt32(Value); - } - else if (valueType == typeof(int)) - { - return BitConverter.ToInt32(Value); - } - else if (valueType == typeof(ulong)) - { - return BitConverter.ToUInt64(Value); - } - else if (valueType == typeof(long)) - { - return BitConverter.ToInt64(Value); - } - else if (valueType == typeof(float)) - { - return BitConverter.ToSingle(Value); - } - else if (valueType == typeof(UserId)) - { - return new UserId(Value); - } - else if (valueType.IsEnum) - { - return Enum.ToObject(valueType, BitConverter.ToInt32(Value)); - } - - return $"{valueType.Name} parsing not implemented"; - } - - return $"Unknown value format (raw length: {Value.Length})"; - } - } -} diff --git a/Ryujinx.HLE/HOS/Applets/Browser/BrowserOutput.cs b/Ryujinx.HLE/HOS/Applets/Browser/BrowserOutput.cs deleted file mode 100644 index 0b368262..00000000 --- a/Ryujinx.HLE/HOS/Applets/Browser/BrowserOutput.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Ryujinx.Common; -using System; -using System.IO; - -namespace Ryujinx.HLE.HOS.Applets.Browser -{ - class BrowserOutput - { - public BrowserOutputType Type { get; } - public byte[] Value { get; } - - public BrowserOutput(BrowserOutputType type, byte[] value) - { - Type = type; - Value = value; - } - - public BrowserOutput(BrowserOutputType type, uint value) - { - Type = type; - Value = BitConverter.GetBytes(value); - } - - public BrowserOutput(BrowserOutputType type, ulong value) - { - Type = type; - Value = BitConverter.GetBytes(value); - } - - public BrowserOutput(BrowserOutputType type, bool value) - { - Type = type; - Value = BitConverter.GetBytes(value); - } - - public void Write(BinaryWriter writer) - { - writer.WriteStruct(new WebArgTLV - { - Type = (ushort)Type, - Size = (ushort)Value.Length - }); - - writer.Write(Value); - } - } -} diff --git a/Ryujinx.HLE/HOS/Applets/Browser/BrowserOutputType.cs b/Ryujinx.HLE/HOS/Applets/Browser/BrowserOutputType.cs deleted file mode 100644 index 209ae8ae..00000000 --- a/Ryujinx.HLE/HOS/Applets/Browser/BrowserOutputType.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Ryujinx.HLE.HOS.Applets.Browser -{ - enum BrowserOutputType : ushort - { - ExitReason = 0x1, - LastUrl = 0x2, - LastUrlSize = 0x3, - SharePostResult = 0x4, - PostServiceName = 0x5, - PostServiceNameSize = 0x6, - PostId = 0x7, - MediaPlayerAutoClosedByCompletion = 0x8 - } -} diff --git a/Ryujinx.HLE/HOS/Applets/Browser/DocumentKind.cs b/Ryujinx.HLE/HOS/Applets/Browser/DocumentKind.cs deleted file mode 100644 index 385bcdd0..00000000 --- a/Ryujinx.HLE/HOS/Applets/Browser/DocumentKind.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Ryujinx.HLE.HOS.Applets.Browser -{ - enum DocumentKind - { - OfflineHtmlPage = 1, - ApplicationLegalInformation, - SystemDataPage - } -} diff --git a/Ryujinx.HLE/HOS/Applets/Browser/LeftStickMode.cs b/Ryujinx.HLE/HOS/Applets/Browser/LeftStickMode.cs deleted file mode 100644 index 917549d2..00000000 --- a/Ryujinx.HLE/HOS/Applets/Browser/LeftStickMode.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Ryujinx.HLE.HOS.Applets.Browser -{ - enum LeftStickMode - { - Pointer = 0, - Cursor - } -} diff --git a/Ryujinx.HLE/HOS/Applets/Browser/ShimKind.cs b/Ryujinx.HLE/HOS/Applets/Browser/ShimKind.cs deleted file mode 100644 index ca2ef32f..00000000 --- a/Ryujinx.HLE/HOS/Applets/Browser/ShimKind.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Ryujinx.HLE.HOS.Applets.Browser -{ - public enum ShimKind : uint - { - Shop = 1, - Login, - Offline, - Share, - Web, - Wifi, - Lobby - } -} diff --git a/Ryujinx.HLE/HOS/Applets/Browser/WebArgHeader.cs b/Ryujinx.HLE/HOS/Applets/Browser/WebArgHeader.cs deleted file mode 100644 index c5e19f6c..00000000 --- a/Ryujinx.HLE/HOS/Applets/Browser/WebArgHeader.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Ryujinx.HLE.HOS.Applets.Browser -{ - public struct WebArgHeader - { - public ushort Count; - public ushort Padding; - public ShimKind ShimKind; - } -} diff --git a/Ryujinx.HLE/HOS/Applets/Browser/WebArgTLV.cs b/Ryujinx.HLE/HOS/Applets/Browser/WebArgTLV.cs deleted file mode 100644 index f6c1e5ae..00000000 --- a/Ryujinx.HLE/HOS/Applets/Browser/WebArgTLV.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Ryujinx.HLE.HOS.Applets.Browser -{ - public struct WebArgTLV - { - public ushort Type; - public ushort Size; - public uint Padding; - } -} diff --git a/Ryujinx.HLE/HOS/Applets/Browser/WebArgTLVType.cs b/Ryujinx.HLE/HOS/Applets/Browser/WebArgTLVType.cs deleted file mode 100644 index bd303207..00000000 --- a/Ryujinx.HLE/HOS/Applets/Browser/WebArgTLVType.cs +++ /dev/null @@ -1,62 +0,0 @@ -namespace Ryujinx.HLE.HOS.Applets.Browser -{ - enum WebArgTLVType : ushort - { - InitialURL = 0x1, - CallbackUrl = 0x3, - CallbackableUrl = 0x4, - ApplicationId = 0x5, - DocumentPath = 0x6, - DocumentKind = 0x7, - SystemDataId = 0x8, - ShareStartPage = 0x9, - Whitelist = 0xA, - NewsFlag = 0xB, - UserID = 0xE, - AlbumEntry0 = 0xF, - ScreenShotEnabled = 0x10, - EcClientCertEnabled = 0x11, - PlayReportEnabled = 0x13, - UnknownFlag0x14 = 0x14, - UnknownFlag0x15 = 0x15, - BootDisplayKind = 0x17, - BackgroundKind = 0x18, - FooterEnabled = 0x19, - PointerEnabled = 0x1A, - LeftStickMode = 0x1B, - KeyRepeatFrame1 = 0x1C, - KeyRepeatFrame2 = 0x1D, - BootAsMediaPlayerInverted = 0x1E, - DisplayUrlKind = 0x1F, - BootAsMediaPlayer = 0x21, - ShopJumpEnabled = 0x22, - MediaAutoPlayEnabled = 0x23, - LobbyParameter = 0x24, - ApplicationAlbumEntry = 0x26, - JsExtensionEnabled = 0x27, - AdditionalCommentText = 0x28, - TouchEnabledOnContents = 0x29, - UserAgentAdditionalString = 0x2A, - AdditionalMediaData0 = 0x2B, - MediaPlayerAutoCloseEnabled = 0x2C, - PageCacheEnabled = 0x2D, - WebAudioEnabled = 0x2E, - FooterFixedKind = 0x32, - PageFadeEnabled = 0x33, - MediaCreatorApplicationRatingAge = 0x34, - BootLoadingIconEnabled = 0x35, - PageScrollIndicatorEnabled = 0x36, - MediaPlayerSpeedControlEnabled = 0x37, - AlbumEntry1 = 0x38, - AlbumEntry2 = 0x39, - AlbumEntry3 = 0x3A, - AdditionalMediaData1 = 0x3B, - AdditionalMediaData2 = 0x3C, - AdditionalMediaData3 = 0x3D, - BootFooterButton = 0x3E, - OverrideWebAudioVolume = 0x3F, - OverrideMediaAudioVolume = 0x40, - BootMode = 0x41, - MediaPlayerUiEnabled = 0x43 - } -} diff --git a/Ryujinx.HLE/HOS/Applets/Browser/WebCommonReturnValue.cs b/Ryujinx.HLE/HOS/Applets/Browser/WebCommonReturnValue.cs deleted file mode 100644 index 9f7eae70..00000000 --- a/Ryujinx.HLE/HOS/Applets/Browser/WebCommonReturnValue.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Ryujinx.Common.Memory; - -namespace Ryujinx.HLE.HOS.Applets.Browser -{ - public struct WebCommonReturnValue - { - public WebExitReason ExitReason; - public uint Padding; - public ByteArray4096 LastUrl; - public ulong LastUrlSize; - } -} diff --git a/Ryujinx.HLE/HOS/Applets/Browser/WebExitReason.cs b/Ryujinx.HLE/HOS/Applets/Browser/WebExitReason.cs deleted file mode 100644 index 4e44d34a..00000000 --- a/Ryujinx.HLE/HOS/Applets/Browser/WebExitReason.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Ryujinx.HLE.HOS.Applets.Browser -{ - public enum WebExitReason : uint - { - ExitButton, - BackButton, - Requested, - LastUrl, - ErrorDialog = 7 - } -} |
