This commit is contained in:
Marco Carvalho
2025-01-13 09:09:20 +11:00
committed by GitHub
45 changed files with 150 additions and 171 deletions

View File

@@ -1,3 +1,4 @@
using Microsoft.IO;
using Ryujinx.Common;
using Ryujinx.Common.Logging;
using Ryujinx.Common.Memory;
@@ -63,7 +64,7 @@ namespace Ryujinx.HLE.HOS.Applets.Browser
private static byte[] BuildResponseOld(WebCommonReturnValue result)
{
using MemoryStream stream = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream stream = MemoryStreamManager.Shared.GetStream();
using BinaryWriter writer = new(stream);
writer.WriteStruct(result);
@@ -71,7 +72,7 @@ namespace Ryujinx.HLE.HOS.Applets.Browser
}
private byte[] BuildResponseNew(List<BrowserOutput> outputArguments)
{
using MemoryStream stream = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream stream = MemoryStreamManager.Shared.GetStream();
using BinaryWriter writer = new(stream);
writer.WriteStruct(new WebArgHeader
{

View File

@@ -1,3 +1,4 @@
using Microsoft.IO;
using Ryujinx.Common.Logging;
using Ryujinx.Common.Memory;
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
@@ -119,7 +120,7 @@ namespace Ryujinx.HLE.HOS.Applets
private static byte[] BuildResponse(ControllerSupportResultInfo result)
{
using MemoryStream stream = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream stream = MemoryStreamManager.Shared.GetStream();
using BinaryWriter writer = new(stream);
writer.Write(MemoryMarshal.AsBytes(MemoryMarshal.CreateReadOnlySpan(ref result, Unsafe.SizeOf<ControllerSupportResultInfo>())));
@@ -129,7 +130,7 @@ namespace Ryujinx.HLE.HOS.Applets
private static byte[] BuildResponse()
{
using MemoryStream stream = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream stream = MemoryStreamManager.Shared.GetStream();
using BinaryWriter writer = new(stream);
writer.Write((ulong)ResultCode.Success);

View File

@@ -1,3 +1,4 @@
using Microsoft.IO;
using Ryujinx.Common.Logging;
using Ryujinx.Common.Memory;
using Ryujinx.HLE.HOS.Applets;
@@ -11,14 +12,14 @@ namespace Ryujinx.HLE.HOS.Applets.Dummy
{
private readonly Horizon _system;
private AppletSession _normalSession;
public event EventHandler AppletStateChanged;
public DummyApplet(Horizon system)
{
_system = system;
}
public ResultCode Start(AppletSession normalSession, AppletSession interactiveSession)
{
_normalSession = normalSession;
@@ -27,10 +28,10 @@ namespace Ryujinx.HLE.HOS.Applets.Dummy
_system.ReturnFocus();
return ResultCode.Success;
}
private static byte[] BuildResponse()
{
using MemoryStream stream = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream stream = MemoryStreamManager.Shared.GetStream();
using BinaryWriter writer = new(stream);
writer.Write((ulong)ResultCode.Success);
return stream.ToArray();

View File

@@ -1,3 +1,4 @@
using Microsoft.IO;
using Ryujinx.Common.Memory;
using Ryujinx.HLE.HOS.Services.Account.Acc;
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
@@ -41,7 +42,7 @@ namespace Ryujinx.HLE.HOS.Applets
{
UserProfile currentUser = _system.AccountManager.LastOpenedUser;
using MemoryStream stream = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream stream = MemoryStreamManager.Shared.GetStream();
using BinaryWriter writer = new(stream);
writer.Write((ulong)PlayerSelectResult.Success);

View File

@@ -252,7 +252,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
// <exception-spec> ::= Do # non-throwing exception-specification (e.g., noexcept, throw())
// ::= DO <expression> E # computed (instantiation-dependent) noexcept
// ::= Dw <type>+ E # dynamic exception specification with instantiation-dependent types
private BaseNode ParseFunctionType()
private FunctionType ParseFunctionType()
{
Cv cvQualifiers = ParseCvQualifiers();
@@ -347,7 +347,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
// <array-type> ::= A <positive dimension number> _ <element type>
// ::= A [<dimension expression>] _ <element type>
private BaseNode ParseArrayType()
private ArrayType ParseArrayType()
{
if (!ConsumeIf("A"))
{
@@ -945,7 +945,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
}
// <source-name> ::= <positive length number> <identifier>
private BaseNode ParseSourceName()
private NameType ParseSourceName()
{
int length = ParsePositiveNumber();
if (Count() < length || length <= 0)
@@ -1320,7 +1320,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
// ::= D0 # deleting destructor
// ::= D1 # complete object destructor
// ::= D2 # base object destructor
private BaseNode ParseCtorDtorName(NameParserContext context, BaseNode prev)
private CtorDtorNameType ParseCtorDtorName(NameParserContext context, BaseNode prev)
{
if (prev.Type == NodeType.SpecialSubstitution && prev is SpecialSubstitution substitution)
{
@@ -1377,7 +1377,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
// ::= fp <top-level CV-qualifiers> <parameter-2 non-negative number> _ # L == 0, second and later parameters
// ::= fL <L-1 non-negative number> p <top-level CV-qualifiers> _ # L > 0, first parameter
// ::= fL <L-1 non-negative number> p <top-level CV-qualifiers> <parameter-2 non-negative number> _ # L > 0, second and later parameters
private BaseNode ParseFunctionParameter()
private FunctionParameter ParseFunctionParameter()
{
if (ConsumeIf("fp"))
{
@@ -1422,7 +1422,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
// ::= fR <binary-operator-name> <expression> <expression>
// ::= fl <binary-operator-name> <expression>
// ::= fr <binary-operator-name> <expression>
private BaseNode ParseFoldExpression()
private FoldExpression ParseFoldExpression()
{
if (!ConsumeIf("f"))
{
@@ -1571,7 +1571,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
// ::= cv <type> <expression> # type (expression), conversion with one argument
// ::= cv <type> _ <expression>* E # type (expr-list), conversion with other than one argument
private BaseNode ParseConversionExpression()
private ConversionExpression ParseConversionExpression()
{
if (!ConsumeIf("cv"))
{
@@ -1616,7 +1616,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
return new ConversionExpression(type, new NodeArray(expressions));
}
private BaseNode ParseBinaryExpression(string name)
private BinaryExpression ParseBinaryExpression(string name)
{
BaseNode leftPart = ParseExpression();
if (leftPart == null)
@@ -1633,7 +1633,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
return new BinaryExpression(leftPart, name, rightPart);
}
private BaseNode ParsePrefixExpression(string name)
private PrefixExpression ParsePrefixExpression(string name)
{
BaseNode expression = ParseExpression();
if (expression == null)
@@ -1720,7 +1720,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
// ::= [gs] na <expression>* _ <type> <initializer> # new[] (expr-list) type (init)
//
// <initializer> ::= pi <expression>* E # parenthesized initialization
private BaseNode ParseNewExpression()
private NewExpression ParseNewExpression()
{
bool isGlobal = ConsumeIf("gs");
bool isArray = Peek(1) == 'a';
@@ -2404,7 +2404,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
return null;
}
private BaseNode ParseIntegerLiteral(string literalName)
private IntegerLiteral ParseIntegerLiteral(string literalName)
{
string number = ParseNumber(true);
if (number == null || number.Length == 0 || !ConsumeIf("E"))
@@ -2521,7 +2521,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
// <decltype> ::= Dt <expression> E # decltype of an id-expression or class member access (C++0x)
// ::= DT <expression> E # decltype of an expression (C++0x)
private BaseNode ParseDecltype()
private EnclosedExpression ParseDecltype()
{
if (!ConsumeIf("D") || (!ConsumeIf("t") && !ConsumeIf("T")))
{
@@ -2588,7 +2588,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
}
// <template-args> ::= I <template-arg>+ E
private BaseNode ParseTemplateArguments(bool hasContext = false)
private TemplateArguments ParseTemplateArguments(bool hasContext = false)
{
if (!ConsumeIf("I"))
{
@@ -2740,7 +2740,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
// <destructor-name> ::= <unresolved-type> # e.g., ~T or ~decltype(f())
// ::= <simple-id> # e.g., ~A<2*N>
private BaseNode ParseDestructorName()
private DtorName ParseDestructorName()
{
BaseNode node;
if (char.IsDigit(Peek()))
@@ -3134,7 +3134,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
// <local-name> ::= Z <function encoding> E <entity name> [<discriminator>]
// ::= Z <function encoding> E s [<discriminator>]
// ::= Z <function encoding> Ed [ <parameter number> ] _ <entity name>
private BaseNode ParseLocalName(NameParserContext context)
private LocalName ParseLocalName(NameParserContext context)
{
if (!ConsumeIf("Z"))
{

View File

@@ -534,7 +534,7 @@ namespace Ryujinx.HLE.HOS
return newStorage;
}
private static void AddFiles(IFileSystem fs, string modName, string rootPath, ISet<string> fileSet, RomFsBuilder builder)
private static void AddFiles(IFileSystem fs, string modName, string rootPath, HashSet<string> fileSet, RomFsBuilder builder)
{
foreach (var entry in fs.EnumerateEntries()
.AsParallel()

View File

@@ -1,3 +1,4 @@
using Microsoft.IO;
using Ryujinx.Common.Memory;
using Ryujinx.HLE.HOS.Services.Account.Acc;
using System.IO;
@@ -11,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.Storage
public static byte[] MakeLaunchParams(UserProfile userProfile)
{
// Size needs to be at least 0x88 bytes otherwise application errors.
using MemoryStream ms = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream ms = MemoryStreamManager.Shared.GetStream();
BinaryWriter writer = new(ms);
ms.SetLength(0x88);

View File

@@ -313,7 +313,7 @@ namespace Ryujinx.HLE.HOS.Services.Ro
return ResultCode.Success;
}
private Result SetNroMemoryPermissions(KProcess process, IExecutable relocatableObject, ulong baseAddress)
private Result SetNroMemoryPermissions(KProcess process, NroExecutable relocatableObject, ulong baseAddress)
{
ulong textStart = baseAddress + relocatableObject.TextOffset;
ulong roStart = baseAddress + relocatableObject.RoOffset;

View File

@@ -5,6 +5,7 @@ using LibHac.FsSystem;
using LibHac.Ncm;
using LibHac.Tools.FsSystem;
using LibHac.Tools.FsSystem.NcaUtils;
using Microsoft.IO;
using Ryujinx.Common.Memory;
using Ryujinx.HLE.Exceptions;
using Ryujinx.HLE.FileSystem;
@@ -161,7 +162,7 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pl
static uint KXor(uint data) => data ^ FontKey;
using BinaryReader reader = new(bfttfStream);
using MemoryStream ttfStream = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream ttfStream = MemoryStreamManager.Shared.GetStream();
using BinaryWriter output = new(ttfStream);
if (KXor(reader.ReadUInt32()) != BFTTFMagic)

View File

@@ -1,3 +1,4 @@
using Microsoft.IO;
using Ryujinx.Common;
using Ryujinx.Common.Logging;
using Ryujinx.Common.Memory;
@@ -46,10 +47,10 @@ namespace Ryujinx.HLE.HOS.Services
private readonly Dictionary<int, IpcService> _sessions = new();
private readonly Dictionary<int, Func<IpcService>> _ports = new();
private readonly MemoryStream _requestDataStream;
private readonly RecyclableMemoryStream _requestDataStream;
private readonly BinaryReader _requestDataReader;
private readonly MemoryStream _responseDataStream;
private readonly RecyclableMemoryStream _responseDataStream;
private readonly BinaryWriter _responseDataWriter;
private int _isDisposed = 0;

View File

@@ -95,7 +95,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
}
}
ISocket newBsdSocket = new ManagedSocket(netDomain, (SocketType)type, protocol, context.Device.Configuration.MultiplayerLanInterfaceId)
ManagedSocket newBsdSocket = new ManagedSocket(netDomain, (SocketType)type, protocol, context.Device.Configuration.MultiplayerLanInterfaceId)
{
Blocking = !creationFlags.HasFlag(BsdSocketCreationFlags.NonBlocking),
};

View File

@@ -415,7 +415,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
return true;
}
private static IList<ArraySegment<byte>> ConvertMessagesToBuffer(BsdMMsgHdr message)
private static ArraySegment<byte>[] ConvertMessagesToBuffer(BsdMMsgHdr message)
{
int segmentCount = 0;
int index = 0;

View File

@@ -21,7 +21,7 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService
private SessionCacheMode _sessionCacheMode;
private string _hostName;
private ISslConnectionBase _connection;
private SslManagedSocketConnection _connection;
private BsdContext _bsdContext;
private readonly ulong _processId;

View File

@@ -54,7 +54,7 @@ namespace Ryujinx.HLE.HOS.Tamper
return null;
}
private ITamperProgram CompileImpl(string name, IEnumerable<string> rawInstructions)
private AtmosphereProgram CompileImpl(string name, IEnumerable<string> rawInstructions)
{
CompilationContext context = new(_exeAddress, _heapAddress, _aliasAddress, _aslrAddress, _process);
context.BlockStack.Push(new OperationBlock(null));