Replacing Abstract Types with Concrete Types

This commit is contained in:
Marco Carvalho 2024-04-07 15:58:41 -03:00
parent 7969fb6bba
commit 231fb01dc1
41 changed files with 103 additions and 90 deletions

View file

@ -5,6 +5,7 @@ using Ryujinx.Common.Memory;
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.IO;
namespace ARMeilleure.CodeGen.Arm64
{
@ -14,7 +15,7 @@ namespace ARMeilleure.CodeGen.Arm64
private const int CbnzInstLength = 4;
private const int LdrLitInstLength = 4;
private readonly Stream _stream;
private readonly RecyclableMemoryStream _stream;
public int StreamOffset => (int)_stream.Length;

View file

@ -266,7 +266,7 @@ namespace ARMeilleure.Instructions
}
}
private static Exception InvalidOpCodeType(OpCode opCode)
private static InvalidOperationException InvalidOpCodeType(OpCode opCode)
{
return new InvalidOperationException($"Invalid OpCode type \"{opCode?.GetType().Name ?? "null"}\".");
}

View file

@ -717,7 +717,7 @@ namespace ARMeilleure.Instructions
};
}
private static Exception InvalidOpCodeType(OpCode opCode)
private static InvalidOperationException InvalidOpCodeType(OpCode opCode)
{
return new InvalidOperationException($"Invalid OpCode type \"{opCode?.GetType().Name ?? "null"}\".");
}

View file

@ -14,6 +14,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
using System.Timers;
using Microsoft.IO;
using static ARMeilleure.Translation.PTC.PtcFormatter;
using Timer = System.Timers.Timer;
@ -189,7 +190,7 @@ namespace ARMeilleure.Translation.PTC
return false;
}
using MemoryStream stream = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream stream = MemoryStreamManager.Shared.GetStream();
Debug.Assert(stream.Seek(0L, SeekOrigin.Begin) == 0L && stream.Length == 0L);
try

View file

@ -5,7 +5,7 @@ namespace Ryujinx.Common.Logging.Targets
{
public class ConsoleLogTarget : ILogTarget
{
private readonly ILogFormatter _formatter;
private readonly DefaultLogFormatter _formatter;
private readonly string _name;

View file

@ -8,7 +8,7 @@ namespace Ryujinx.Common.Logging.Targets
public class FileLogTarget : ILogTarget
{
private readonly StreamWriter _logWriter;
private readonly ILogFormatter _formatter;
private readonly DefaultLogFormatter _formatter;
private readonly string _name;
string ILogTarget.Name { get => _name; }

View file

@ -12,8 +12,8 @@ namespace Ryujinx.Common.SystemInterop
public partial class StdErrAdapter : IDisposable
{
private bool _disposable;
private Stream _pipeReader;
private Stream _pipeWriter;
private FileStream _pipeReader;
private FileStream _pipeWriter;
private CancellationTokenSource _cancellationTokenSource;
private Task _worker;
@ -46,7 +46,7 @@ namespace Ryujinx.Common.SystemInterop
[SupportedOSPlatform("macos")]
private async Task EventWorkerAsync(CancellationToken cancellationToken)
{
using TextReader reader = new StreamReader(_pipeReader, leaveOpen: true);
using StreamReader reader = new(_pipeReader, leaveOpen: true);
string line;
while (cancellationToken.IsCancellationRequested == false && (line = await reader.ReadLineAsync(cancellationToken)) != null)
{
@ -92,7 +92,7 @@ namespace Ryujinx.Common.SystemInterop
[SupportedOSPlatform("linux")]
[SupportedOSPlatform("macos")]
private static Stream CreateFileDescriptorStream(int fd)
private static FileStream CreateFileDescriptorStream(int fd)
{
return new FileStream(
new SafeFileHandle(fd, ownsHandle: true),

View file

@ -3,6 +3,7 @@ using Ryujinx.Common.Memory;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.IO;
namespace Ryujinx.Common.Utilities
{
@ -58,7 +59,7 @@ namespace Ryujinx.Common.Utilities
public static async Task<byte[]> StreamToBytesAsync(Stream input, CancellationToken cancellationToken = default)
{
using MemoryStream stream = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream stream = MemoryStreamManager.Shared.GetStream();
await input.CopyToAsync(stream, cancellationToken);

View file

@ -74,7 +74,7 @@ namespace Ryujinx.Cpu.LightningJit
}
}
private static IStackWalker CreateStackWalker()
private static StackWalker CreateStackWalker()
{
if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
{

View file

@ -379,8 +379,8 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
/// <param name="hash">Code and constant buffer data hash</param>
/// <returns>Entry index</returns>
private int WriteNewEntry(
Stream tocFileStream,
Stream dataFileStream,
FileStream tocFileStream,
FileStream dataFileStream,
ref TocHeader header,
ReadOnlySpan<byte> data,
ReadOnlySpan<byte> cb1Data,

View file

@ -737,7 +737,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
/// <param name="magic">Magic value to be written</param>
/// <param name="codegenVersion">Shader codegen version, only valid for the host file</param>
/// <param name="timestamp">File creation timestamp</param>
private static void CreateToc(Stream tocFileStream, ref TocHeader header, uint magic, uint codegenVersion, ulong timestamp)
private static void CreateToc(FileStream tocFileStream, ref TocHeader header, uint magic, uint codegenVersion, ulong timestamp)
{
BinarySerializer writer = new(tocFileStream);

View file

@ -5,6 +5,7 @@ using Ryujinx.Graphics.Shader;
using Ryujinx.Graphics.Shader.Translation;
using System.Collections.Generic;
using System.IO;
using Microsoft.IO;
namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
{
@ -12,7 +13,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
{
public static byte[] Pack(ShaderSource[] sources)
{
using MemoryStream output = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream output = MemoryStreamManager.Shared.GetStream();
output.Write(sources.Length);

View file

@ -18,7 +18,7 @@ namespace Ryujinx.Graphics.OpenGL
private bool _updateSize;
private int _copyFramebufferHandle;
private IPostProcessingEffect _antiAliasing;
private IScalingFilter _scalingFilter;
private FsrScalingFilter _scalingFilter;
private bool _isLinear;
private AntiAliasing _currentAntiAliasing;
private bool _updateEffect;

View file

@ -46,7 +46,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
}
private static readonly IReadOnlyDictionary<int, AttributeEntry> _attributes;
private static readonly Dictionary<int, AttributeEntry> _attributes;
private static readonly IReadOnlyDictionary<int, AttributeEntry> _attributesPerPatch;
static AttributeMap()
@ -55,7 +55,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
_attributesPerPatch = CreatePerPatchMap();
}
private static IReadOnlyDictionary<int, AttributeEntry> CreateMap()
private static Dictionary<int, AttributeEntry> CreateMap()
{
var map = new Dictionary<int, AttributeEntry>();
@ -82,7 +82,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
return map;
}
private static IReadOnlyDictionary<int, AttributeEntry> CreatePerPatchMap()
private static Dictionary<int, AttributeEntry> CreatePerPatchMap()
{
var map = new Dictionary<int, AttributeEntry>();

View file

@ -32,29 +32,29 @@ namespace Ryujinx.Graphics.Vulkan
private readonly PipelineHelperShader _pipeline;
private readonly ISampler _samplerLinear;
private readonly ISampler _samplerNearest;
private readonly IProgram _programColorBlit;
private readonly IProgram _programColorBlitMs;
private readonly IProgram _programColorBlitClearAlpha;
private readonly IProgram _programColorClearF;
private readonly IProgram _programColorClearSI;
private readonly IProgram _programColorClearUI;
private readonly IProgram _programDepthStencilClear;
private readonly IProgram _programStrideChange;
private readonly ShaderCollection _programColorBlit;
private readonly ShaderCollection _programColorBlitMs;
private readonly ShaderCollection _programColorBlitClearAlpha;
private readonly ShaderCollection _programColorClearF;
private readonly ShaderCollection _programColorClearSI;
private readonly ShaderCollection _programColorClearUI;
private readonly ShaderCollection _programDepthStencilClear;
private readonly ShaderCollection _programStrideChange;
private readonly IProgram _programConvertD32S8ToD24S8;
private readonly IProgram _programConvertIndexBuffer;
private readonly IProgram _programConvertIndirectData;
private readonly IProgram _programColorCopyShortening;
private readonly IProgram _programColorCopyToNonMs;
private readonly IProgram _programColorCopyWidening;
private readonly IProgram _programColorDrawToMs;
private readonly IProgram _programDepthBlit;
private readonly IProgram _programDepthBlitMs;
private readonly IProgram _programDepthDrawToMs;
private readonly IProgram _programDepthDrawToNonMs;
private readonly IProgram _programStencilBlit;
private readonly IProgram _programStencilBlitMs;
private readonly IProgram _programStencilDrawToMs;
private readonly IProgram _programStencilDrawToNonMs;
private readonly ShaderCollection _programConvertIndexBuffer;
private readonly ShaderCollection _programConvertIndirectData;
private readonly ShaderCollection _programColorCopyShortening;
private readonly ShaderCollection _programColorCopyToNonMs;
private readonly ShaderCollection _programColorCopyWidening;
private readonly ShaderCollection _programColorDrawToMs;
private readonly ShaderCollection _programDepthBlit;
private readonly ShaderCollection _programDepthBlitMs;
private readonly ShaderCollection _programDepthDrawToMs;
private readonly ShaderCollection _programDepthDrawToNonMs;
private readonly ShaderCollection _programStencilBlit;
private readonly ShaderCollection _programStencilBlitMs;
private readonly ShaderCollection _programStencilDrawToMs;
private readonly ShaderCollection _programStencilDrawToNonMs;
public HelperShader(VulkanRenderer gd, Device device)
{

View file

@ -35,7 +35,7 @@ namespace Ryujinx.Graphics.Vulkan
private AntiAliasing _currentAntiAliasing;
private bool _updateEffect;
private IPostProcessingEffect _effect;
private IScalingFilter _scalingFilter;
private FsrScalingFilter _scalingFilter;
private bool _isLinear;
private float _scalingFilterLevel;
private bool _updateScalingFilter;

View file

@ -345,7 +345,7 @@ namespace Ryujinx.Modules
using HttpResponseMessage response = client.GetAsync(downloadUrl, HttpCompletionOption.ResponseHeadersRead).Result;
using Stream remoteFileStream = response.Content.ReadAsStreamAsync().Result;
using Stream updateFileStream = File.Open(updateFile, FileMode.Create);
using FileStream updateFileStream = File.Open(updateFile, FileMode.Create);
long totalBytes = response.Content.Headers.ContentLength.Value;
long byteWritten = 0;

View file

@ -18,6 +18,7 @@ using System.Buffers.Binary;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Microsoft.IO;
using Image = SixLabors.ImageSharp.Image;
namespace Ryujinx.UI.Windows
@ -139,7 +140,7 @@ namespace Ryujinx.UI.Windows
romfs.OpenFile(ref file.Ref, ("/" + item.FullPath).ToU8Span(), OpenMode.Read).ThrowIfFailure();
using MemoryStream stream = MemoryStreamManager.Shared.GetStream();
using MemoryStream streamPng = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream streamPng = MemoryStreamManager.Shared.GetStream();
file.Get.AsStream().CopyTo(stream);
stream.Position = 0;
@ -168,7 +169,7 @@ namespace Ryujinx.UI.Windows
private byte[] ProcessImage(byte[] data)
{
using MemoryStream streamJpg = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream streamJpg = MemoryStreamManager.Shared.GetStream();
Image avatarImage = Image.Load(data, new PngDecoder());
@ -222,7 +223,7 @@ namespace Ryujinx.UI.Windows
Close();
}
private static byte[] DecompressYaz0(Stream stream)
private static byte[] DecompressYaz0(MemoryStream stream)
{
using BinaryReader reader = new(stream);

View file

@ -112,7 +112,7 @@ namespace Ryujinx.UI.Windows
#pragma warning restore CS0649, IDE0044
private readonly MainWindow _mainWindow;
private readonly IGamepadDriver _gtk3KeyboardDriver;
private readonly GTK3KeyboardDriver _gtk3KeyboardDriver;
private IGamepad _selectedGamepad;
private bool _mousePressed;
private bool _middleMousePressed;

View file

@ -12,6 +12,7 @@ using System.IO;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.IO;
using Image = SixLabors.ImageSharp.Image;
namespace Ryujinx.UI.Windows
@ -181,7 +182,7 @@ namespace Ryujinx.UI.Windows
image.Mutate(x => x.Resize(256, 256));
using MemoryStream streamJpg = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream streamJpg = MemoryStreamManager.Shared.GetStream();
image.SaveAsJpeg(streamJpg);

View file

@ -571,7 +571,7 @@ namespace Ryujinx.HLE.FileSystem
return file.Release();
}
private static Stream GetZipStream(ZipArchiveEntry entry)
private static MemoryStream GetZipStream(ZipArchiveEntry entry)
{
MemoryStream dest = MemoryStreamManager.Shared.GetStream();

View file

@ -5,6 +5,7 @@ using Ryujinx.HLE.HOS.Services.Am.AppletAE;
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.IO;
namespace Ryujinx.HLE.HOS.Applets.Browser
{
@ -70,7 +71,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);
@ -78,7 +79,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

@ -7,6 +7,7 @@ using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Microsoft.IO;
using static Ryujinx.HLE.HOS.Services.Hid.HidServer.HidUtils;
namespace Ryujinx.HLE.HOS.Applets
@ -124,7 +125,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>())));
@ -134,7 +135,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

@ -3,6 +3,7 @@ using Ryujinx.HLE.HOS.Services.Account.Acc;
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
using System;
using System.IO;
using Microsoft.IO;
namespace Ryujinx.HLE.HOS.Applets
{
@ -46,7 +47,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

@ -542,7 +542,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,6 +1,7 @@
using Ryujinx.Common.Memory;
using Ryujinx.HLE.HOS.Services.Account.Acc;
using System.IO;
using Microsoft.IO;
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.Storage
{
@ -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

@ -14,6 +14,7 @@ using System;
using System.Buffers.Binary;
using System.Collections.Generic;
using System.IO;
using Microsoft.IO;
namespace Ryujinx.HLE.HOS.Services.Sdb.Pl
{
@ -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

@ -14,6 +14,7 @@ using System.Buffers.Binary;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using Microsoft.IO;
namespace Ryujinx.HLE.HOS.Services
{
@ -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)
ManagedSocket newBsdSocket = new(netDomain, (SocketType)type, protocol)
{
Blocking = !creationFlags.HasFlag(BsdSocketCreationFlags.NonBlocking),
};

View file

@ -400,7 +400,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));

View file

@ -5,7 +5,7 @@ namespace Ryujinx.Horizon.Common
static class ResultNames
{
// Reference: https://github.com/Thealexbarney/LibHac/blob/master/build/CodeGen/results.csv
private static readonly IReadOnlyDictionary<int, string> _names = new Dictionary<int, string>()
private static readonly Dictionary<int, string> _names = new Dictionary<int, string>()
{
{ 0x0, "Success" },
{ 0xE01, "OutOfSessions" },

View file

@ -14,6 +14,7 @@ using System.Net;
using System.Net.Sockets;
using System.Numerics;
using System.Threading.Tasks;
using Microsoft.IO;
namespace Ryujinx.Input.Motion.CemuHook
{
@ -380,7 +381,7 @@ namespace Ryujinx.Input.Motion.CemuHook
Header header = GenerateHeader(clientId);
using MemoryStream stream = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream stream = MemoryStreamManager.Shared.GetStream();
using BinaryWriter writer = new(stream);
writer.WriteStruct(header);
@ -419,7 +420,7 @@ namespace Ryujinx.Input.Motion.CemuHook
Header header = GenerateHeader(clientId);
using MemoryStream stream = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream stream = MemoryStreamManager.Shared.GetStream();
using BinaryWriter writer = new(stream);
writer.WriteStruct(header);

View file

@ -463,7 +463,7 @@ namespace Ryujinx.Modules
using HttpResponseMessage response = client.GetAsync(downloadUrl, HttpCompletionOption.ResponseHeadersRead).Result;
using Stream remoteFileStream = response.Content.ReadAsStreamAsync().Result;
using Stream updateFileStream = File.Open(updateFile, FileMode.Create);
using FileStream updateFileStream = File.Open(updateFile, FileMode.Create);
long totalBytes = response.Content.Headers.ContentLength.Value;
long byteWritten = 0;

View file

@ -406,7 +406,7 @@ namespace Ryujinx.Ava.UI.Helpers
return dialogWindow.ShowDialog(_contentDialogOverlayWindow ?? mainWindow);
}
private static Window GetMainWindow()
private static MainWindow GetMainWindow()
{
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime al)
{

View file

@ -116,7 +116,7 @@ namespace Ryujinx.Ava.UI.Renderer
}
[SupportedOSPlatform("linux")]
private IPlatformHandle CreateLinux(IPlatformHandle control)
private PlatformHandle CreateLinux(IPlatformHandle control)
{
if (ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.Vulkan)
{
@ -135,7 +135,7 @@ namespace Ryujinx.Ava.UI.Renderer
}
[SupportedOSPlatform("windows")]
IPlatformHandle CreateWin32(IPlatformHandle control)
PlatformHandle CreateWin32(IPlatformHandle control)
{
_className = "NativeWindow-" + Guid.NewGuid();
@ -172,7 +172,7 @@ namespace Ryujinx.Ava.UI.Renderer
}
[SupportedOSPlatform("macos")]
IPlatformHandle CreateMacOS()
PlatformHandle CreateMacOS()
{
// Create a new CAMetalLayer.
ObjectiveC.Object layerObject = new("CAMetalLayer");

View file

@ -143,7 +143,7 @@ namespace Ryujinx.Ava.UI.ViewModels
}
}
private static byte[] DecompressYaz0(Stream stream)
private static byte[] DecompressYaz0(MemoryStream stream)
{
using BinaryReader reader = new(stream);

View file

@ -100,7 +100,7 @@ namespace Ryujinx.Ava.UI.ViewModels
return false;
}
private IComparer<SaveModel> GetComparer()
private SortExpressionComparer<SaveModel> GetComparer()
{
return SortIndex switch
{

View file

@ -15,7 +15,7 @@ namespace Ryujinx.Ava.UI.Views.Settings
public partial class SettingsHotkeysView : UserControl
{
private ButtonKeyAssigner _currentAssigner;
private readonly IGamepadDriver _avaloniaKeyboardDriver;
private readonly AvaloniaKeyboardDriver _avaloniaKeyboardDriver;
public SettingsHotkeysView()
{