misc: chore: Remove redundant code

This commit is contained in:
KeatonTheBot 2025-03-11 01:40:13 -05:00
parent 340ec79e9f
commit 05a88ccc94
109 changed files with 271 additions and 412 deletions

View file

@ -146,9 +146,9 @@ namespace ARMeilleure.CodeGen.RegisterAllocators
}
}
private Queue<Operation> _fillQueue = null;
private Queue<Operation> _spillQueue = null;
private ParallelCopy _parallelCopy = null;
private Queue<Operation> _fillQueue;
private Queue<Operation> _spillQueue;
private ParallelCopy _parallelCopy;
public bool HasCopy { get; private set; }

View file

@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace ARMeilleure.Instructions
{

View file

@ -1,7 +1,7 @@
namespace ARMeilleure
{
using Arm64HardwareCapabilities = ARMeilleure.CodeGen.Arm64.HardwareCapabilities;
using X86HardwareCapabilities = ARMeilleure.CodeGen.X86.HardwareCapabilities;
using Arm64HardwareCapabilities = CodeGen.Arm64.HardwareCapabilities;
using X86HardwareCapabilities = CodeGen.X86.HardwareCapabilities;
public static class Optimizations
{

View file

@ -24,7 +24,7 @@ namespace ARMeilleure.State
public long Tpidr2El0;
}
private static NativeCtxStorage _dummyStorage = new();
private static NativeCtxStorage _dummyStorage;
private readonly IJitMemoryBlock _block;

View file

@ -54,7 +54,7 @@ namespace ARMeilleure.Translation
public bool HasPtc { get; }
public Aarch32Mode Mode { get; }
private int _ifThenBlockStateIndex = 0;
private int _ifThenBlockStateIndex;
private Condition[] _ifThenBlockState = [];
public bool IsInIfThenBlock => _ifThenBlockStateIndex < _ifThenBlockState.Length;
public Condition CurrentIfThenBlockCond => _ifThenBlockState[_ifThenBlockStateIndex];

View file

@ -18,7 +18,7 @@ namespace ARMeilleure.Translation.Cache
UnwindInfo = unwindInfo;
}
public int CompareTo([AllowNull] CacheEntry other)
public int CompareTo(CacheEntry other)
{
return Offset.CompareTo(other.Offset);
}

View file

@ -17,7 +17,7 @@ namespace ARMeilleure.Translation.Cache
Size = size;
}
public int CompareTo([AllowNull] MemoryBlock other)
public int CompareTo(MemoryBlock other)
{
return Offset.CompareTo(other.Offset);
}

View file

@ -32,7 +32,7 @@ namespace ARMeilleure.Translation.Cache
private static bool _initialized;
private static readonly List<ReservedRegion> _jitRegions = [];
private static int _activeRegionIndex = 0;
private static int _activeRegionIndex;
[SupportedOSPlatform("windows")]
[LibraryImport("kernel32.dll", SetLastError = true)]

View file

@ -79,7 +79,7 @@ namespace ARMeilleure.Translation.Cache
_unwindInfo = (UnwindInfo*)(workBufferPtr + _sizeOfRuntimeFunction);
_getRuntimeFunctionCallback = new GetRuntimeFunctionCallback(FunctionTableHandler);
_getRuntimeFunctionCallback = FunctionTableHandler;
result = RtlInstallFunctionTableCallback(
codeCachePtr | 3,
@ -102,10 +102,7 @@ namespace ARMeilleure.Translation.Cache
bool result;
unsafe
{
result = RtlDeleteFunctionTable(codeCachePtr | 3);
}
result = RtlDeleteFunctionTable(codeCachePtr | 3);
if (!result)
{

View file

@ -63,7 +63,7 @@ namespace ARMeilleure.Translation
private static readonly SortedList<string, DelegateInfo> _delegates;
unsafe static Delegates()
static Delegates()
{
_delegates = new SortedList<string, DelegateInfo>();

View file

@ -14,8 +14,8 @@ namespace ARMeilleure.Translation
private const bool Black = true;
private const bool Red = false;
private IntervalTreeNode<TK, TV> _root = null;
private int _count = 0;
private IntervalTreeNode<TK, TV> _root;
private int _count;
public int Count => _count;
@ -709,9 +709,9 @@ namespace ARMeilleure.Translation
class IntervalTreeNode<TK, TV>
{
public bool Color = true;
public IntervalTreeNode<TK, TV> Left = null;
public IntervalTreeNode<TK, TV> Right = null;
public IntervalTreeNode<TK, TV> Parent = null;
public IntervalTreeNode<TK, TV> Left;
public IntervalTreeNode<TK, TV> Right;
public IntervalTreeNode<TK, TV> Parent;
/// <summary>
/// The start of the range.

View file

@ -8,7 +8,7 @@ namespace Ryujinx.Audio.Backends.SoundIo.Native
public class SoundIoOutStreamContext : IDisposable
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private unsafe delegate void WriteCallbackDelegate(IntPtr ctx, int frameCountMin, int frameCountMax);
private delegate void WriteCallbackDelegate(IntPtr ctx, int frameCountMin, int frameCountMax);
private IntPtr _context;
private IntPtr _nameStored;

View file

@ -127,24 +127,21 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
{
get
{
unsafe
if (Unsafe.IsNullRef(ref _v2))
{
if (Unsafe.IsNullRef(ref _v2))
if (Unsafe.IsNullRef(ref _v1))
{
if (Unsafe.IsNullRef(ref _v1))
{
return new SplitterDestination();
}
else
{
return new SplitterDestination(ref _v1.Next);
}
return new SplitterDestination();
}
else
{
return new SplitterDestination(ref _v2.Next);
return new SplitterDestination(ref _v1.Next);
}
}
else
{
return new SplitterDestination(ref _v2.Next);
}
}
}

View file

@ -100,7 +100,7 @@ namespace Ryujinx.Common.Memory
return obj is ArrayPtr<T> other && Equals(other);
}
public readonly bool Equals([AllowNull] ArrayPtr<T> other)
public readonly bool Equals(ArrayPtr<T> other)
{
return _ptr == other._ptr && Length == other.Length;
}

View file

@ -45,7 +45,7 @@ namespace Ryujinx.Common.Memory
return obj is Ptr<T> other && Equals(other);
}
public readonly bool Equals([AllowNull] Ptr<T> other)
public readonly bool Equals(Ptr<T> other)
{
return _ptr == other._ptr;
}

View file

@ -90,8 +90,8 @@ namespace Ryujinx.Common.Utilities
private BinaryReader _binaryReader;
private long _offsetB, _dataSizeB, _cartSizeB, _fileSizeB;
private bool _fileOK = true;
private bool _freeSpaceChecked = false;
private bool _freeSpaceValid = false;
private bool _freeSpaceChecked;
private bool _freeSpaceValid;
public enum OperationOutcome
{
@ -191,7 +191,7 @@ namespace Ryujinx.Common.Utilities
if (timedSw.Elapsed.TotalSeconds > 0)
{
Log?.Write(LogType.Info, $"Checked at {readSizeB / (double)XCIFileTrimmer.BytesInAMegabyte / timedSw.Elapsed.TotalSeconds:N} Mb/sec");
Log?.Write(LogType.Info, $"Checked at {readSizeB / (double)BytesInAMegabyte / timedSw.Elapsed.TotalSeconds:N} Mb/sec");
}
if (freeSpaceValid)
@ -219,7 +219,7 @@ namespace Ryujinx.Common.Utilities
private bool CheckPadding(long readSizeB, CancellationToken? cancelToken = null)
{
long maxReads = readSizeB / XCIFileTrimmer.BufferSize;
long maxReads = readSizeB / BufferSize;
long read = 0;
var buffer = new byte[BufferSize];
@ -230,12 +230,12 @@ namespace Ryujinx.Common.Utilities
return false;
}
int bytes = _fileStream.Read(buffer, 0, XCIFileTrimmer.BufferSize);
int bytes = _fileStream.Read(buffer, 0, BufferSize);
if (bytes == 0)
break;
Log?.Progress(read, maxReads, "Verifying file can be trimmed", false);
if (buffer.Take(bytes).AsParallel().Any(b => b != XCIFileTrimmer.PaddingByte))
if (buffer.Take(bytes).AsParallel().Any(b => b != PaddingByte))
{
Log?.Write(LogType.Warn, "Free space is NOT valid");
return false;
@ -380,7 +380,7 @@ namespace Ryujinx.Common.Utilities
if (timedSw.Elapsed.TotalSeconds > 0)
{
Log?.Write(LogType.Info, $"Wrote at {bytesToWriteB / (double)XCIFileTrimmer.BytesInAMegabyte / timedSw.Elapsed.TotalSeconds:N} Mb/sec");
Log?.Write(LogType.Info, $"Wrote at {bytesToWriteB / (double)BytesInAMegabyte / timedSw.Elapsed.TotalSeconds:N} Mb/sec");
}
if (cancelToken.HasValue && cancelToken.Value.IsCancellationRequested)
@ -408,13 +408,13 @@ namespace Ryujinx.Common.Utilities
private void WritePadding(FileStream outfileStream, long bytesToWriteB, CancellationToken? cancelToken = null)
{
long bytesLeftToWriteB = bytesToWriteB;
long writes = bytesLeftToWriteB / XCIFileTrimmer.BufferSize;
long writes = bytesLeftToWriteB / BufferSize;
int write = 0;
try
{
var buffer = new byte[BufferSize];
Array.Fill<byte>(buffer, XCIFileTrimmer.PaddingByte);
Array.Fill<byte>(buffer, PaddingByte);
while (bytesLeftToWriteB > 0)
{
@ -423,7 +423,7 @@ namespace Ryujinx.Common.Utilities
return;
}
long bytesToWrite = Math.Min(XCIFileTrimmer.BufferSize, bytesLeftToWriteB);
long bytesToWrite = Math.Min(BufferSize, bytesLeftToWriteB);
#if !XCI_TRIMMER_READ_ONLY_MODE
outfileStream.Write(buffer, 0, (int)bytesToWrite);
@ -504,12 +504,12 @@ namespace Ryujinx.Common.Utilities
}
// Setup offset
_offsetB = (long)(assumeKeyArea ? XCIFileTrimmer.CartKeyAreaSize : 0);
_offsetB = (long)(assumeKeyArea ? CartKeyAreaSize : 0);
// Check header
Pos = _offsetB + XCIFileTrimmer.HeaderFilePos;
Pos = _offsetB + HeaderFilePos;
string head = System.Text.Encoding.ASCII.GetString(_binaryReader.ReadBytes(4));
if (head != XCIFileTrimmer.HeaderMagicValue)
if (head != HeaderMagicValue)
{
if (!assumeKeyArea)
{
@ -524,17 +524,17 @@ namespace Ryujinx.Common.Utilities
}
// Read Cart Size
Pos = _offsetB + XCIFileTrimmer.CartSizeFilePos;
Pos = _offsetB + CartSizeFilePos;
byte cartSizeId = _binaryReader.ReadByte();
if (!_cartSizesGB.TryGetValue(cartSizeId, out long cartSizeNGB))
{
Log?.Write(LogType.Error, $"The source file doesn't look like an XCI file as the Cartridge Size is incorrect (0x{cartSizeId:X2})");
return false;
}
_cartSizeB = cartSizeNGB * XCIFileTrimmer.CartSizeMBinFormattedGB * XCIFileTrimmer.BytesInAMegabyte;
_cartSizeB = cartSizeNGB * CartSizeMBinFormattedGB * BytesInAMegabyte;
// Read data size
Pos = _offsetB + XCIFileTrimmer.DataSizeFilePos;
Pos = _offsetB + DataSizeFilePos;
long records = (long)BitConverter.ToUInt32(_binaryReader.ReadBytes(4), 0);
_dataSizeB = RecordsToByte(records);

View file

@ -4,7 +4,8 @@ using System.Runtime.Versioning;
namespace Ryujinx.Cpu.AppleHv
{
[SupportedOSPlatform("macos")]
class HvMemoryBlockAllocator : PrivateMemoryAllocatorImpl<HvMemoryBlockAllocator.Block>
class HvMemoryBlockAllocator(HvIpaAllocator ipaAllocator, ulong blockAlignment)
: PrivateMemoryAllocatorImpl<HvMemoryBlockAllocator.Block>(blockAlignment, MemoryAllocationFlags.None)
{
public class Block : PrivateMemoryAllocator.Block
{
@ -36,13 +37,6 @@ namespace Ryujinx.Cpu.AppleHv
}
}
private readonly HvIpaAllocator _ipaAllocator;
public HvMemoryBlockAllocator(HvIpaAllocator ipaAllocator, ulong blockAlignment) : base(blockAlignment, MemoryAllocationFlags.None)
{
_ipaAllocator = ipaAllocator;
}
public HvMemoryBlockAllocation Allocate(ulong size, ulong alignment)
{
var allocation = Allocate(size, alignment, CreateBlock);
@ -52,7 +46,7 @@ namespace Ryujinx.Cpu.AppleHv
private Block CreateBlock(MemoryBlock memory, ulong size)
{
return new Block(_ipaAllocator, memory, size);
return new Block(ipaAllocator, memory, size);
}
}
}

View file

@ -5,7 +5,6 @@ using Ryujinx.Memory.Tracking;
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;

View file

@ -8,7 +8,7 @@ namespace Ryujinx.Cpu.AppleHv
{
private const ulong InterruptIntervalNs = 16 * 1000000; // 16 ms
private static ulong _interruptTimeDeltaTicks = 0;
private static ulong _interruptTimeDeltaTicks;
public readonly ulong Handle;
public readonly HvVcpuExit* ExitInfo;

View file

@ -5,7 +5,6 @@ using Ryujinx.Memory.Tracking;
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;

View file

@ -8,7 +8,6 @@ using Ryujinx.Memory.Tracking;
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
namespace Ryujinx.Cpu.Jit

View file

@ -14,7 +14,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
Size = size;
}
public int CompareTo([AllowNull] CacheEntry other)
public int CompareTo(CacheEntry other)
{
return Offset.CompareTo(other.Offset);
}

View file

@ -18,7 +18,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
Size = size;
}
public int CompareTo([AllowNull] MemoryBlock other)
public int CompareTo(MemoryBlock other)
{
return Offset.CompareTo(other.Offset);
}

View file

@ -28,7 +28,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
private static readonly Lock _lock = new();
private static bool _initialized;
private static readonly List<ReservedRegion> _jitRegions = [];
private static int _activeRegionIndex = 0;
private static int _activeRegionIndex;
[SupportedOSPlatform("windows")]
[LibraryImport("kernel32.dll", SetLastError = true)]
@ -75,12 +75,9 @@ namespace Ryujinx.Cpu.LightningJit.Cache
if (OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
{
unsafe
fixed (byte* codePtr = code)
{
fixed (byte* codePtr = code)
{
JitSupportDarwin.Copy(funcPtr, (IntPtr)codePtr, (ulong)code.Length);
}
JitSupportDarwin.Copy(funcPtr, (IntPtr)codePtr, (ulong)code.Length);
}
}
else

View file

@ -20,7 +20,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
Size = size;
}
public int CompareTo([AllowNull] Range other)
public int CompareTo(Range other)
{
return Offset.CompareTo(other.Offset);
}

View file

@ -21,7 +21,7 @@ namespace Ryujinx.Cpu.LightningJit.State
public int Running;
}
private static NativeCtxStorage _dummyStorage = new();
private static NativeCtxStorage _dummyStorage;
private readonly IJitMemoryBlock _block;
@ -79,22 +79,22 @@ namespace Ryujinx.Cpu.LightningJit.State
GetStorage().V[index * 2 + 1] = value.Extract<ulong>(1);
}
public unsafe uint GetPstate()
public uint GetPstate()
{
return GetStorage().Flags;
}
public unsafe void SetPstate(uint value)
public void SetPstate(uint value)
{
GetStorage().Flags = value;
}
public unsafe uint GetFPState(uint mask = uint.MaxValue)
public uint GetFPState(uint mask = uint.MaxValue)
{
return GetStorage().FpFlags & mask;
}
public unsafe void SetFPState(uint value, uint mask = uint.MaxValue)
public void SetFPState(uint value, uint mask = uint.MaxValue)
{
GetStorage().FpFlags = (value & mask) | (GetStorage().FpFlags & ~mask);
}

View file

@ -13,7 +13,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
/// </summary>
class BufferMap
{
private ulong _bufferHandle = 0;
private ulong _bufferHandle;
private readonly Dictionary<BufferHandle, BufferHandle> _bufferMap = new();
private readonly HashSet<BufferHandle> _inFlight = [];

View file

@ -55,7 +55,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
private int _refProducerPtr;
private int _refConsumerPtr;
public uint ProgramCount { get; set; } = 0;
public uint ProgramCount { get; set; }
private Action _interruptAction;
private readonly Lock _interruptLock = new();

View file

@ -506,7 +506,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
maxDrawCount,
stride,
indexCount,
Threed.IndirectDrawType.DrawIndexedIndirectCount);
IndirectDrawType.DrawIndexedIndirectCount);
}
/// <summary>

View file

@ -1,6 +1,5 @@
using Ryujinx.Common;
using Ryujinx.Graphics.GAL;
using System;
using System.Collections.Generic;
namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender

View file

@ -15,10 +15,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
// State associated with direct uniform buffer updates.
// This state is used to attempt to batch together consecutive updates.
private ulong _ubBeginCpuAddress = 0;
private ulong _ubFollowUpAddress = 0;
private ulong _ubByteCount = 0;
private int _ubIndex = 0;
private ulong _ubBeginCpuAddress;
private ulong _ubFollowUpAddress;
private ulong _ubByteCount;
private int _ubIndex;
private readonly int[] _ubData = new int[UniformDataCacheSize];
/// <summary>

View file

@ -4,7 +4,6 @@ using Ryujinx.Graphics.Gpu.Memory;
using Ryujinx.Graphics.Shader;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
namespace Ryujinx.Graphics.Gpu.Image

View file

@ -60,13 +60,13 @@ namespace Ryujinx.Graphics.Gpu.Memory
/// <remarks>
/// This is null until at least one modification occurs.
/// </remarks>
private BufferModifiedRangeList _modifiedRanges = null;
private BufferModifiedRangeList _modifiedRanges;
/// <summary>
/// A structure that is used to flush buffer data back to a host mapped buffer for cached readback.
/// Only used if the buffer data is explicitly owned by device local memory.
/// </summary>
private BufferPreFlush _preFlush = null;
private BufferPreFlush _preFlush;
/// <summary>
/// Usage tracking state that determines what type of backing the buffer should use.
@ -171,9 +171,9 @@ namespace Ryujinx.Graphics.Gpu.Memory
_memoryTracking.RegisterPreciseAction(PreciseAction);
}
_externalFlushDelegate = new RegionSignal(ExternalFlush);
_loadDelegate = new Action<ulong, ulong>(LoadRegion);
_modifiedDelegate = new Action<ulong, ulong>(RegionModified);
_externalFlushDelegate = ExternalFlush;
_loadDelegate = LoadRegion;
_modifiedDelegate = RegionModified;
_virtualDependenciesLock = new ReaderWriterLockSlim();
}

View file

@ -69,7 +69,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
}
private List<PhysicalDependency> _dependencies;
private BufferModifiedRangeList _modifiedRanges = null;
private BufferModifiedRangeList _modifiedRanges;
/// <summary>
/// Creates a new instance of the buffer.

View file

@ -2,7 +2,6 @@ using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.Gpu.Engine;
using Ryujinx.Graphics.Gpu.Image;
using Ryujinx.Graphics.Shader;
using System;
using System.Linq;
namespace Ryujinx.Graphics.Gpu.Shader

View file

@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg
{
unsafe class FFmpegContext : IDisposable
{
private unsafe delegate int AVCodec_decode(AVCodecContext* avctx, void* outdata, int* got_frame_ptr, AVPacket* avpkt);
private delegate int AVCodec_decode(AVCodecContext* avctx, void* outdata, int* got_frame_ptr, AVPacket* avpkt);
private readonly AVCodec_decode _decodeFrame;
private static readonly FFmpegApi.av_log_set_callback_callback _logFunc;

View file

@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native
public IntPtr SampleFmts;
// Deprecated
public unsafe ulong* ChannelLayouts;
public unsafe IntPtr PrivClass;
public IntPtr PrivClass;
public IntPtr Profiles;
public unsafe byte* WrapperName;
public IntPtr ChLayouts;

View file

@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native
public IntPtr SampleFmts;
// Deprecated
public unsafe ulong* ChannelLayouts;
public unsafe IntPtr PrivClass;
public IntPtr PrivClass;
public IntPtr Profiles;
public unsafe byte* WrapperName;
#pragma warning restore CS0649

View file

@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native
struct AVCodecContext
{
#pragma warning disable CS0649 // Field is never assigned to
public unsafe IntPtr AvClass;
public IntPtr AvClass;
public int LogLevelOffset;
public int CodecType;
public unsafe AVCodec* Codec;

View file

@ -281,7 +281,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
Array8<uint> frameSizes = new();
int frameCount = 0;
res = Types.Decoder.ParseSuperframeIndex(data, (ulong)data.Length, ref frameSizes, out frameCount);
res = Decoder.ParseSuperframeIndex(data, (ulong)data.Length, ref frameSizes, out frameCount);
if (res != CodecErr.Ok)
{
return res;
@ -322,7 +322,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
// Account for suboptimal termination by the encoder.
while (dataStart.Length != 0)
{
byte marker = Types.Decoder.ReadMarker(dataStart);
byte marker = Decoder.ReadMarker(dataStart);
if (marker != 0)
{
break;

View file

@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Nvdec
{
private static readonly Decoder _decoder = new();
public unsafe static void Decode(ResourceManager rm, ref NvdecRegisters state)
public static void Decode(ResourceManager rm, ref NvdecRegisters state)
{
PictureInfo pictureInfo = rm.MemoryManager.DeviceRead<PictureInfo>(state.SetDrvPicSetupOffset);
EntropyProbs entropy = rm.MemoryManager.DeviceRead<EntropyProbs>(state.Vp9SetProbTabBufOffset);

View file

@ -5,7 +5,7 @@ using System.Threading;
namespace Ryujinx.Graphics.OpenGL
{
unsafe class BackgroundContextWorker : IDisposable
class BackgroundContextWorker : IDisposable
{
[ThreadStatic]
public static bool InBackground;

View file

@ -6,7 +6,7 @@ using System;
namespace Ryujinx.Graphics.OpenGL.Effects.Smaa
{
internal partial class SmaaPostProcessingEffect : IPostProcessingEffect
internal class SmaaPostProcessingEffect : IPostProcessingEffect
{
public const int AreaWidth = 160;
public const int AreaHeight = 560;
@ -75,7 +75,7 @@ namespace Ryujinx.Graphics.OpenGL.Effects.Smaa
}
}
private unsafe void RecreateShaders(int width, int height)
private void RecreateShaders(int width, int height)
{
string baseShader = EmbeddedResources.ReadAllText("Ryujinx.Graphics.OpenGL/Effects/Shaders/smaa.hlsl");
var pixelSizeDefine = $"#define SMAA_RT_METRICS float4(1.0 / {width}.0, 1.0 / {height}.0, {width}, {height}) \n";

View file

@ -29,7 +29,7 @@ namespace Ryujinx.Graphics.OpenGL
private readonly Sync _sync;
public uint ProgramCount { get; set; } = 0;
public uint ProgramCount { get; set; }
public event EventHandler<ScreenCaptureImageInfo> ScreenCaptured;

View file

@ -21,7 +21,7 @@ namespace Ryujinx.Graphics.OpenGL.Queries
private readonly CounterQueue _queue;
private readonly BufferedQuery _counter;
private bool _hostAccessReserved = false;
private bool _hostAccessReserved;
private int _refCount = 1; // Starts with a reference from the counter queue.
private readonly Lock _lock = new();

View file

@ -14,7 +14,7 @@ namespace Ryujinx.Graphics.OpenGL
public IntPtr Handle;
}
private ulong _firstHandle = 0;
private ulong _firstHandle;
private static ClientWaitSyncFlags SyncFlags => HwCapabilities.RequiresSyncFlush ? ClientWaitSyncFlags.None : ClientWaitSyncFlags.SyncFlushCommandsBit;
private readonly List<SyncHandle> _handles = [];

View file

@ -10,7 +10,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
{
using IrOperandType = IntermediateRepresentation.OperandType;
partial class CodeGenContext : Module
class CodeGenContext : Module
{
private const uint SpirvVersionMajor = 1;
private const uint SpirvVersionMinor = 3;

View file

@ -4,17 +4,10 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
{
class StructuredProgramInfo
{
public List<StructuredFunction> Functions { get; }
public List<StructuredFunction> Functions { get; } = [];
public HashSet<IoDefinition> IoDefinitions { get; }
public HashSet<IoDefinition> IoDefinitions { get; } = [];
public HelperFunctionsMask HelperFunctionsMask { get; set; }
public StructuredProgramInfo()
{
Functions = [];
IoDefinitions = [];
}
}
}

View file

@ -4,31 +4,22 @@ using System.Numerics;
namespace Ryujinx.Graphics.Shader.Translation
{
class AttributeUsage
class AttributeUsage(IGpuAccessor gpuAccessor)
{
public bool NextUsesFixedFuncAttributes { get; private set; }
public int UsedInputAttributes { get; private set; }
public int UsedOutputAttributes { get; private set; }
public HashSet<int> UsedInputAttributesPerPatch { get; }
public HashSet<int> UsedOutputAttributesPerPatch { get; }
public HashSet<int> UsedInputAttributesPerPatch { get; } = [];
public HashSet<int> UsedOutputAttributesPerPatch { get; } = [];
public HashSet<int> NextUsedInputAttributesPerPatch { get; private set; }
public int PassthroughAttributes { get; private set; }
private int _nextUsedInputAttributes;
private int _thisUsedInputAttributes;
private Dictionary<int, int> _perPatchAttributeLocations;
private readonly IGpuAccessor _gpuAccessor;
public UInt128 NextInputAttributesComponents { get; private set; }
public UInt128 ThisInputAttributesComponents { get; private set; }
public AttributeUsage(IGpuAccessor gpuAccessor)
{
_gpuAccessor = gpuAccessor;
UsedInputAttributesPerPatch = [];
UsedOutputAttributesPerPatch = [];
}
public void SetInputUserAttribute(int index, int component)
{
int mask = 1 << index;
@ -74,7 +65,7 @@ namespace Ryujinx.Graphics.Shader.Translation
int location = BitOperations.TrailingZeroCount(freeMask);
if (location == 32)
{
_gpuAccessor.Log($"No enough free locations for patch input/output 0x{attr:X}.");
gpuAccessor.Log($"No enough free locations for patch input/output 0x{attr:X}.");
break;
}

View file

@ -61,18 +61,12 @@ namespace Ryujinx.Graphics.Shader.Translation
private readonly TransformFeedbackOutput[] _transformFeedbackOutputs;
readonly struct TransformFeedbackVariable : IEquatable<TransformFeedbackVariable>
readonly struct TransformFeedbackVariable(IoVariable ioVariable, int location = 0, int component = 0)
: IEquatable<TransformFeedbackVariable>
{
public IoVariable IoVariable { get; }
public int Location { get; }
public int Component { get; }
public TransformFeedbackVariable(IoVariable ioVariable, int location = 0, int component = 0)
{
IoVariable = ioVariable;
Location = location;
Component = component;
}
public IoVariable IoVariable { get; } = ioVariable;
public int Location { get; } = location;
public int Component { get; } = component;
public override bool Equals(object other)
{

View file

@ -67,7 +67,7 @@ namespace Ryujinx.Graphics.Vulkan
return (access, stages);
}
private readonly record struct StageFlags : IEquatable<StageFlags>
private readonly record struct StageFlags
{
public readonly PipelineStageFlags Source;
public readonly PipelineStageFlags Dest;
@ -122,7 +122,7 @@ namespace Ryujinx.Graphics.Vulkan
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void FlushMemoryBarrier(ShaderCollection program, bool inRenderPass)
public void FlushMemoryBarrier(ShaderCollection program, bool inRenderPass)
{
if (_queuedIncoherentBarrier > IncoherentBarrierType.None)
{
@ -182,7 +182,7 @@ namespace Ryujinx.Graphics.Vulkan
}
}
public unsafe void Flush(CommandBufferScoped cbs, bool inRenderPass, RenderPassHolder rpHolder, Action endRenderPass)
public void Flush(CommandBufferScoped cbs, bool inRenderPass, RenderPassHolder rpHolder, Action endRenderPass)
{
Flush(cbs, null, inRenderPass, rpHolder, endRenderPass);
}

View file

@ -640,7 +640,7 @@ namespace Ryujinx.Graphics.Vulkan
}
}
public unsafe void SetDataUnchecked<T>(int offset, ReadOnlySpan<T> data) where T : unmanaged
public void SetDataUnchecked<T>(int offset, ReadOnlySpan<T> data) where T : unmanaged
{
SetDataUnchecked(offset, MemoryMarshal.AsBytes(data));
}

View file

@ -44,7 +44,7 @@ namespace Ryujinx.Graphics.Vulkan
}
}
public unsafe DescriptorSetCollection AllocateDescriptorSets(ReadOnlySpan<DescriptorSetLayout> layouts, int consumedDescriptors)
public DescriptorSetCollection AllocateDescriptorSets(ReadOnlySpan<DescriptorSetLayout> layouts, int consumedDescriptors)
{
TryAllocateDescriptorSets(layouts, consumedDescriptors, isTry: false, out var dsc);
return dsc;

View file

@ -9,48 +9,48 @@ namespace Ryujinx.Graphics.Vulkan
{
class FormatCapabilities
{
private static readonly GAL.Format[] _scaledFormats =
private static readonly Format[] _scaledFormats =
[
GAL.Format.R8Uscaled,
GAL.Format.R8Sscaled,
GAL.Format.R16Uscaled,
GAL.Format.R16Sscaled,
GAL.Format.R8G8Uscaled,
GAL.Format.R8G8Sscaled,
GAL.Format.R16G16Uscaled,
GAL.Format.R16G16Sscaled,
GAL.Format.R8G8B8Uscaled,
GAL.Format.R8G8B8Sscaled,
GAL.Format.R16G16B16Uscaled,
GAL.Format.R16G16B16Sscaled,
GAL.Format.R8G8B8A8Uscaled,
GAL.Format.R8G8B8A8Sscaled,
GAL.Format.R16G16B16A16Uscaled,
GAL.Format.R16G16B16A16Sscaled,
GAL.Format.R10G10B10A2Uscaled,
GAL.Format.R10G10B10A2Sscaled
Format.R8Uscaled,
Format.R8Sscaled,
Format.R16Uscaled,
Format.R16Sscaled,
Format.R8G8Uscaled,
Format.R8G8Sscaled,
Format.R16G16Uscaled,
Format.R16G16Sscaled,
Format.R8G8B8Uscaled,
Format.R8G8B8Sscaled,
Format.R16G16B16Uscaled,
Format.R16G16B16Sscaled,
Format.R8G8B8A8Uscaled,
Format.R8G8B8A8Sscaled,
Format.R16G16B16A16Uscaled,
Format.R16G16B16A16Sscaled,
Format.R10G10B10A2Uscaled,
Format.R10G10B10A2Sscaled
];
private static readonly GAL.Format[] _intFormats =
private static readonly Format[] _intFormats =
[
GAL.Format.R8Uint,
GAL.Format.R8Sint,
GAL.Format.R16Uint,
GAL.Format.R16Sint,
GAL.Format.R8G8Uint,
GAL.Format.R8G8Sint,
GAL.Format.R16G16Uint,
GAL.Format.R16G16Sint,
GAL.Format.R8G8B8Uint,
GAL.Format.R8G8B8Sint,
GAL.Format.R16G16B16Uint,
GAL.Format.R16G16B16Sint,
GAL.Format.R8G8B8A8Uint,
GAL.Format.R8G8B8A8Sint,
GAL.Format.R16G16B16A16Uint,
GAL.Format.R16G16B16A16Sint,
GAL.Format.R10G10B10A2Uint,
GAL.Format.R10G10B10A2Sint
Format.R8Uint,
Format.R8Sint,
Format.R16Uint,
Format.R16Sint,
Format.R8G8Uint,
Format.R8G8Sint,
Format.R16G16Uint,
Format.R16G16Sint,
Format.R8G8B8Uint,
Format.R8G8B8Sint,
Format.R16G16B16Uint,
Format.R16G16B16Sint,
Format.R8G8B8A8Uint,
Format.R8G8B8A8Sint,
Format.R16G16B16A16Uint,
Format.R16G16B16A16Sint,
Format.R10G10B10A2Uint,
Format.R10G10B10A2Sint
];
private readonly FormatFeatureFlags[] _bufferTable;

View file

@ -131,7 +131,7 @@ namespace Ryujinx.Graphics.Vulkan
TriFanToTrisPattern = new IndexBufferPattern(Gd, 3, 3, 2, [int.MinValue, -1, 0], 1, true);
}
public unsafe void Barrier()
public void Barrier()
{
Gd.Barriers.QueueMemoryBarrier();
}
@ -255,7 +255,7 @@ namespace Ryujinx.Graphics.Vulkan
Gd.Api.CmdClearAttachments(CommandBuffer, 1, &attachment, 1, &clearRect);
}
public unsafe void CommandBufferBarrier()
public void CommandBufferBarrier()
{
Gd.Barriers.QueueCommandBufferBarrier();
}
@ -1348,7 +1348,7 @@ namespace Ryujinx.Graphics.Vulkan
_descriptorSetUpdater.ForceImageDirty();
}
public unsafe void TextureBarrier()
public void TextureBarrier()
{
Gd.Barriers.QueueTextureBarrier();
}
@ -1446,7 +1446,7 @@ namespace Ryujinx.Graphics.Vulkan
_newState.SamplesCount = FramebufferParams.AttachmentSamples.Length != 0 ? FramebufferParams.AttachmentSamples[0] : 1;
}
protected unsafe void CreateRenderPass()
protected void CreateRenderPass()
{
var hasFramebuffer = FramebufferParams != null;

View file

@ -205,7 +205,7 @@ namespace Ryujinx.Graphics.Vulkan
/// <param name="size">The minimum size the reserved data requires</param>
/// <param name="alignment">The required alignment for the buffer offset</param>
/// <returns>The reserved range of the staging buffer</returns>
public unsafe StagingBufferReserved? TryReserveData(CommandBufferScoped cbs, int size, int alignment)
public StagingBufferReserved? TryReserveData(CommandBufferScoped cbs, int size, int alignment)
{
if (size > BufferSize)
{
@ -235,7 +235,7 @@ namespace Ryujinx.Graphics.Vulkan
/// <param name="cbs">Command buffer to reserve the data on</param>
/// <param name="size">The minimum size the reserved data requires</param>
/// <returns>The reserved range of the staging buffer</returns>
public unsafe StagingBufferReserved? TryReserveData(CommandBufferScoped cbs, int size)
public StagingBufferReserved? TryReserveData(CommandBufferScoped cbs, int size)
{
return TryReserveData(cbs, size, _resourceAlignment);
}

View file

@ -6,7 +6,7 @@ using System.Linq;
namespace Ryujinx.Graphics.Vulkan
{
class SyncManager
class SyncManager(VulkanRenderer gd, Device device)
{
private class SyncHandle
{
@ -23,19 +23,10 @@ namespace Ryujinx.Graphics.Vulkan
private ulong _firstHandle;
private readonly VulkanRenderer _gd;
private readonly Device _device;
private readonly List<SyncHandle> _handles;
private readonly List<SyncHandle> _handles = [];
private ulong _flushId;
private long _waitTicks;
public SyncManager(VulkanRenderer gd, Device device)
{
_gd = gd;
_device = device;
_handles = [];
}
public void RegisterFlush()
{
_flushId++;
@ -45,17 +36,17 @@ namespace Ryujinx.Graphics.Vulkan
{
ulong flushId = _flushId;
MultiFenceHolder waitable = new();
if (strict || _gd.InterruptAction == null)
if (strict || gd.InterruptAction == null)
{
_gd.FlushAllCommands();
_gd.CommandBufferPool.AddWaitable(waitable);
gd.FlushAllCommands();
gd.CommandBufferPool.AddWaitable(waitable);
}
else
{
// Don't flush commands, instead wait for the current command buffer to finish.
// If this sync is waited on before the command buffer is submitted, interrupt the gpu thread and flush it manually.
_gd.CommandBufferPool.AddInUseWaitable(waitable);
gd.CommandBufferPool.AddInUseWaitable(waitable);
}
SyncHandle handle = new()
@ -88,7 +79,7 @@ namespace Ryujinx.Graphics.Vulkan
if (handle.ID > lastHandle)
{
bool signaled = handle.Signalled || handle.Waitable.WaitForFences(_gd.Api, _device, 0);
bool signaled = handle.Signalled || handle.Waitable.WaitForFences(gd.Api, device, 0);
if (signaled)
{
lastHandle = handle.ID;
@ -134,11 +125,11 @@ namespace Ryujinx.Graphics.Vulkan
if (result.NeedsFlush(_flushId))
{
_gd.InterruptAction(() =>
gd.InterruptAction(() =>
{
if (result.NeedsFlush(_flushId))
{
_gd.FlushAllCommands();
gd.FlushAllCommands();
}
});
}
@ -150,7 +141,7 @@ namespace Ryujinx.Graphics.Vulkan
return;
}
bool signaled = result.Signalled || result.Waitable.WaitForFences(_gd.Api, _device, 1000000000);
bool signaled = result.Signalled || result.Waitable.WaitForFences(gd.Api, device, 1000000000);
if (!signaled)
{
@ -182,7 +173,7 @@ namespace Ryujinx.Graphics.Vulkan
break;
}
bool signaled = first.Waitable.WaitForFences(_gd.Api, _device, 0);
bool signaled = first.Waitable.WaitForFences(gd.Api, device, 0);
if (signaled)
{
// Delete the sync object.

View file

@ -28,7 +28,7 @@ namespace Ryujinx.Graphics.Vulkan
private bool _initialized;
public uint ProgramCount { get; set; } = 0;
public uint ProgramCount { get; set; }
internal FormatCapabilities FormatCapabilities { get; private set; }
internal HardwareCapabilities Capabilities;

View file

@ -42,7 +42,7 @@ namespace Ryujinx.Graphics.Vulkan
private ScalingFilter _currentScalingFilter;
private bool _colorSpacePassthroughEnabled;
public unsafe Window(VulkanRenderer gd, SurfaceKHR surface, PhysicalDevice physicalDevice, Device device)
public Window(VulkanRenderer gd, SurfaceKHR surface, PhysicalDevice physicalDevice, Device device)
{
_gd = gd;
_physicalDevice = physicalDevice;

View file

@ -698,8 +698,6 @@ namespace Ryujinx.HLE.FileSystem
{
throw new InvalidFirmwarePackageException("Update not found in xci file.");
}
default:
break;
}
SystemVersion VerifyAndGetVersionDirectory(string firmwareDirectory)

View file

@ -38,7 +38,7 @@ namespace Ryujinx.HLE.FileSystem
private readonly ConcurrentDictionary<ulong, Stream> _romFsByPid;
private static bool _isInitialized = false;
private static bool _isInitialized;
public static VirtualFileSystem CreateInstance()
{

View file

@ -128,13 +128,13 @@ namespace Ryujinx.HLE.HOS.Applets.Cabinet
#region Structs
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public unsafe struct TagInfo
public struct TagInfo
{
public fixed byte Data[0x58];
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public unsafe struct StartParamForAmiiboSettings
public struct StartParamForAmiiboSettings
{
public byte ZeroValue; // Left at zero by sdknso
public byte Type;
@ -151,7 +151,7 @@ namespace Ryujinx.HLE.HOS.Applets.Cabinet
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public unsafe struct ReturnValueForAmiiboSettings
public struct ReturnValueForAmiiboSettings
{
public byte AmiiboSettingsReturnFlag;
private byte Padding1;

View file

@ -34,7 +34,7 @@ namespace Ryujinx.HLE.HOS.Applets
private SoftwareKeyboardState _foregroundState = SoftwareKeyboardState.Uninitialized;
private volatile InlineKeyboardState _backgroundState = InlineKeyboardState.Uninitialized;
private bool _isBackground = false;
private bool _isBackground;
private AppletSession _normalSession;
private AppletSession _interactiveSession;
@ -53,14 +53,14 @@ namespace Ryujinx.HLE.HOS.Applets
private byte[] _transferMemory;
private string _textValue = "";
private int _cursorBegin = 0;
private int _cursorBegin;
private Encoding _encoding = Encoding.Unicode;
private KeyboardResult _lastResult = KeyboardResult.NotSet;
private IDynamicTextInputHandler _dynamicTextInputHandler = null;
private SoftwareKeyboardRenderer _keyboardRenderer = null;
private NpadReader _npads = null;
private bool _canAcceptController = false;
private IDynamicTextInputHandler _dynamicTextInputHandler;
private SoftwareKeyboardRenderer _keyboardRenderer;
private NpadReader _npads;
private bool _canAcceptController;
private KeyboardInputMode _inputMode = KeyboardInputMode.ControllerAndKeyboard;
private readonly Lock _lock = new();

View file

@ -23,15 +23,15 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
private readonly Lock _bufferLock = new();
private RenderingSurfaceInfo _surfaceInfo = null;
private RenderingSurfaceInfo _surfaceInfo;
private SKImageInfo _imageInfo;
private SKSurface _surface = null;
private byte[] _bufferData = null;
private SKSurface _surface;
private byte[] _bufferData;
private readonly SKBitmap _ryujinxLogo = null;
private readonly SKBitmap _padAcceptIcon = null;
private readonly SKBitmap _padCancelIcon = null;
private readonly SKBitmap _keyModeIcon = null;
private readonly SKBitmap _ryujinxLogo;
private readonly SKBitmap _padAcceptIcon;
private readonly SKBitmap _padCancelIcon;
private readonly SKBitmap _keyModeIcon;
private readonly float _textBoxOutlineWidth;
private readonly float _padPressedPenWidth;

View file

@ -25,8 +25,8 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
}
}
private TRef<bool> _cancelled = null;
private Thread _thread = null;
private TRef<bool> _cancelled;
private Thread _thread;
private readonly Lock _lock = new();
public bool IsRunning

View file

@ -3,7 +3,7 @@ using Ryujinx.HLE.HOS.Kernel.Threading;
namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
{
partial class SyscallHandler
class SyscallHandler
{
private readonly KernelContext _context;

View file

@ -6,7 +6,7 @@ using System.Threading;
namespace Ryujinx.HLE.HOS.Kernel.Threading
{
partial class KScheduler : IDisposable
class KScheduler : IDisposable
{
public const int PrioritiesCount = 64;
public static int CpuCoresCount;

View file

@ -4,7 +4,6 @@ using Ryujinx.Common.Utilities;
using Ryujinx.HLE.HOS.Services.Account.Acc.Types;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
namespace Ryujinx.HLE.HOS.Services.Account.Acc

View file

@ -26,21 +26,21 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// TODO: Determine where those fields are used.
#pragma warning disable IDE0052 // Remove unread private member
private bool _screenShotPermission = false;
private bool _operationModeChangedNotification = false;
private bool _performanceModeChangedNotification = false;
private bool _restartMessageEnabled = false;
private bool _outOfFocusSuspendingEnabled = false;
private bool _handlesRequestToDisplay = false;
private bool _screenShotPermission;
private bool _operationModeChangedNotification;
private bool _performanceModeChangedNotification;
private bool _restartMessageEnabled;
private bool _outOfFocusSuspendingEnabled;
private bool _handlesRequestToDisplay;
#pragma warning restore IDE0052
private bool _autoSleepDisabled = false;
private bool _autoSleepDisabled;
#pragma warning disable IDE0052 // Remove unread private member
private bool _albumImageTakenNotificationEnabled = false;
private bool _recordVolumeMuted = false;
private bool _albumImageTakenNotificationEnabled;
private bool _recordVolumeMuted;
private uint _screenShotImageOrientation = 0;
private uint _screenShotImageOrientation;
#pragma warning restore IDE0052
private uint _idleTimeDetectionExtension = 0;
private uint _idleTimeDetectionExtension;
public ISelfController(ServiceCtx context, ulong pid)
{

View file

@ -11,7 +11,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
[Service("irs")]
class IIrSensorServer : IpcService
{
private int _irsensorSharedMemoryHandle = 0;
private int _irsensorSharedMemoryHandle;
public IIrSensorServer(ServiceCtx context) { }

View file

@ -10,8 +10,8 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.Lp2p
{
private readonly KEvent _stateChangeEvent;
private readonly KEvent _jointEvent;
private int _stateChangeEventHandle = 0;
private int _jointEventHandle = 0;
private int _stateChangeEventHandle;
private int _jointEventHandle;
public ISfServiceMonitor(ServiceCtx context)
{

View file

@ -22,7 +22,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
{
public bool NeedsRealId => true;
private static InitializeMessage InitializeMemory = new InitializeMessage();
private static InitializeMessage InitializeMemory;
private const int InactiveTimeout = 6000;
private const int FailureTimeout = 4000;

View file

@ -16,7 +16,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
private readonly int _headerSize = Marshal.SizeOf<LdnHeader>();
private readonly byte[] _buffer = new byte[MaxPacketSize];
private int _bufferEnd = 0;
private int _bufferEnd;
// Client Packets.
public event Action<LdnHeader, InitializeMessage> Initialize;
@ -312,9 +312,6 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
break;
}
default:
break;
}
}

View file

@ -12,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.Mii
class MiiDatabaseManager
{
private readonly bool _isTestModeEnabled = false;
private uint _mountCounter = 0;
private uint _mountCounter;
private const ulong DatabaseTestSaveDataId = 0x8000000000000031;
private const ulong DatabaseSaveDataId = 0x8000000000000030;

View file

@ -7,7 +7,6 @@ using Ryujinx.HLE.HOS.Services.Mii.Types;
using Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption;
using Ryujinx.HLE.HOS.Services.Nfc.Nfp.NfpManager;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

View file

@ -13,9 +13,9 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
{
private readonly GeneralServiceDetail _generalServiceDetail;
private IPInterfaceProperties _targetPropertiesCache = null;
private UnicastIPAddressInformation _targetAddressInfoCache = null;
private string _cacheChosenInterface = null;
private IPInterfaceProperties _targetPropertiesCache;
private UnicastIPAddressInformation _targetAddressInfoCache;
private string _cacheChosenInterface;
public IGeneralService()
{

View file

@ -52,7 +52,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv
private IVirtualMemoryManager _clientMemory;
private ulong _owner;
private bool _transferMemInitialized = false;
private bool _transferMemInitialized;
// TODO: This should call set:sys::GetDebugModeFlag
private readonly bool _debugModeEnabled = false;

View file

@ -17,9 +17,9 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory
// TODO: Find where they are set.
private readonly bool _restrictionEnabled = false;
private readonly bool _featuresRestriction = false;
private bool _freeCommunicationEnabled = false;
private bool _freeCommunicationEnabled;
private readonly bool _stereoVisionRestrictionConfigurable = true;
private bool _stereoVisionRestriction = false;
private bool _stereoVisionRestriction;
#pragma warning restore IDE0052, CS0414
public IParentalControlService(ServiceCtx context, ulong pid, bool withInitialize, int permissionFlag)

View file

@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.Pcv.Clkrst
[Service("clkrst:i")] // 8.0.0+
class IClkrstManager : IpcService
{
private int _moduleStateTableEventHandle = 0;
private int _moduleStateTableEventHandle;
public IClkrstManager(ServiceCtx context) { }

View file

@ -40,7 +40,7 @@ namespace Ryujinx.HLE.HOS.Services
private KProcess _selfProcess;
private KThread _selfThread;
private KEvent _wakeEvent;
private int _wakeHandle = 0;
private int _wakeHandle;
private readonly ReaderWriterLockSlim _handleLock = new();
private readonly Dictionary<int, IpcService> _sessions = new();
@ -52,7 +52,7 @@ namespace Ryujinx.HLE.HOS.Services
private readonly MemoryStream _responseDataStream;
private readonly BinaryWriter _responseDataWriter;
private int _isDisposed = 0;
private int _isDisposed;
public ManualResetEvent InitDone { get; }
public string Name { get; }

View file

@ -14,7 +14,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{
[Service("bsd:s", true)]
[Service("bsd:u", false)]
class IClient : IpcService
class IClient(ServiceCtx context, bool isPrivileged) : IpcService(context.Device.System.BsdServer)
{
private static readonly List<IPollManager> _pollManagers =
[
@ -23,12 +23,6 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
];
private BsdContext _context;
private readonly bool _isPrivileged;
public IClient(ServiceCtx context, bool isPrivileged) : base(context.Device.System.BsdServer)
{
_isPrivileged = isPrivileged;
}
private ResultCode WriteBsdResult(ServiceCtx context, int result, LinuxError errorCode = LinuxError.SUCCESS)
{
@ -79,7 +73,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{
return WriteBsdResult(context, -1, LinuxError.EPROTONOSUPPORT);
}
else if ((type == BsdSocketType.Seqpacket || type == BsdSocketType.Raw) && !_isPrivileged)
else if ((type == BsdSocketType.Seqpacket || type == BsdSocketType.Raw) && !isPrivileged)
{
if (domain != BsdAddressFamily.InterNetwork || type != BsdSocketType.Raw || protocol != ProtocolType.Icmp)
{
@ -1040,7 +1034,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
LinuxError errno = LinuxError.ENOENT;
int newSockFd = -1;
if (_isPrivileged)
if (isPrivileged)
{
errno = LinuxError.SUCCESS;

View file

@ -1,6 +1,5 @@
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy;
using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types;
using System;
using System.Collections.Generic;
using System.Linq;

View file

@ -18,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd
private readonly FqdnResolver _fqdnResolver;
#pragma warning restore IDE0052
private readonly bool _isInitialized = false;
private readonly bool _isInitialized;
public IManager(ServiceCtx context)
{

View file

@ -44,8 +44,6 @@ namespace Ryujinx.HLE.HOS.Services.Spl
configValue = (ulong)HardwareState.Development;
result = SmcResult.Success;
break;
default:
break;
}
}

View file

@ -792,8 +792,6 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
freeSlot = slot;
}
break;
default:
break;
}
}

View file

@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
{
private static readonly Dictionary<int, IBinder> _registeredBinderObjects = new();
private static int _lastBinderId = 0;
private static int _lastBinderId;
private static readonly Lock _lock = new();

View file

@ -21,7 +21,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
private readonly TimeManager _timeManager;
private readonly TimePermissions _permissions;
private int _timeSharedMemoryNativeHandle = 0;
private int _timeSharedMemoryNativeHandle;
public IStaticServiceForPsc(ServiceCtx context, TimePermissions permissions) : this(TimeManager.Instance, permissions) { }

View file

@ -5,7 +5,7 @@ namespace Ryujinx.HLE.HOS.Tamper
{
class Register : IOperand
{
private ulong _register = 0;
private ulong _register;
private readonly string _alias;
public Register(string alias)

View file

@ -11,7 +11,7 @@ namespace Ryujinx.HLE.HOS.Tamper
public ProcessState State => _process.State;
public bool TamperedCodeMemory { get; set; } = false;
public bool TamperedCodeMemory { get; set; }
public TamperedKProcess(KProcess process)
{

View file

@ -16,9 +16,9 @@ namespace Ryujinx.HLE.HOS
// cheat and the re-execution of the first one.
private const int TamperMachineSleepMs = 1000 / 12;
private Thread _tamperThread = null;
private Thread _tamperThread;
private readonly ConcurrentQueue<ITamperProgram> _programs = new();
private long _pressedKeys = 0;
private long _pressedKeys;
private readonly Dictionary<string, ITamperProgram> _programDictionary = new();
private void Activate()

View file

@ -2,7 +2,6 @@ using Ryujinx.Common;
using Ryujinx.Horizon.Common;
using Ryujinx.Horizon.Sdk.Sf;
using Ryujinx.Horizon.Sdk.Sf.Hipc;
using System;
namespace Ryujinx.Horizon.Sdk.Codec.Detail
{

View file

@ -9,20 +9,11 @@ namespace Ryujinx.Horizon.Sdk.Ngc.Detail
private const int CompressedEntriesPerBlock = 64;
private const int BitsPerWord = Set.BitsPerWord;
private readonly struct BitfieldRange
private readonly struct BitfieldRange(uint range, int baseValue)
{
private readonly uint _range;
private readonly int _baseValue;
public int BitfieldIndex => (int)(_range & 0x7ffffff);
public int BitfieldLength => (int)(_range >> 27) + 1;
public int BaseValue => _baseValue;
public BitfieldRange(uint range, int baseValue)
{
_range = range;
_baseValue = baseValue;
}
public int BitfieldIndex => (int)(range & 0x7ffffff);
public int BitfieldLength => (int)(range >> 27) + 1;
public int BaseValue => baseValue;
}
private uint[] _bitfieldRanges;

View file

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Threading;
namespace Ryujinx.Horizon.Sdk.OsTypes

View file

@ -1,7 +1,6 @@
using Ryujinx.Memory.Range;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
namespace Ryujinx.Memory

View file

@ -19,7 +19,7 @@ namespace Ryujinx.Memory
_length = length;
}
public unsafe T* Pointer => _pointer;
public T* Pointer => _pointer;
public int Length => _length;

View file

@ -60,8 +60,8 @@ namespace Ryujinx.Memory.Tracking
private readonly MemoryTracking _tracking;
private bool _disposed;
private int _checkCount = 0;
private int _volatileCount = 0;
private int _checkCount;
private int _volatileCount;
private bool _volatile;
internal MemoryPermission RequiredPermission

View file

@ -1,5 +1,4 @@
using NUnit.Framework;
using System;
namespace Ryujinx.Tests.Cpu
{

View file

@ -795,10 +795,10 @@ namespace Ryujinx.UI.App.Common
{
ldnWebHost = DefaultLanPlayWebHost;
}
IEnumerable<LdnGameData> ldnGameDataArray = Array.Empty<LdnGameData>();
using HttpClient httpClient = new HttpClient();
string ldnGameDataArrayString = await httpClient.GetStringAsync($"https://{ldnWebHost}/api/public_games");
ldnGameDataArray = JsonHelper.Deserialize(ldnGameDataArrayString, _ldnDataSerializerContext.IEnumerableLdnGameData);
IEnumerable<LdnGameData> ldnGameDataArray = JsonHelper.Deserialize(ldnGameDataArrayString, _ldnDataSerializerContext.IEnumerableLdnGameData);
var evt = new LdnGameDataReceivedEventArgs
{
LdnData = ldnGameDataArray

View file

@ -12,7 +12,7 @@ namespace Ryujinx.UI.App.Common
public TimeSpan TimePlayed { get; set; } = TimeSpan.Zero;
[JsonPropertyName("last_played_utc")]
public DateTime? LastPlayed { get; set; } = null;
public DateTime? LastPlayed { get; set; }
[JsonPropertyName("time_played")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]

View file

@ -13,7 +13,6 @@ using Ryujinx.UI.Common.Helper;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text.Json.Nodes;
namespace Ryujinx.UI.Common.Configuration
{
@ -26,44 +25,23 @@ namespace Ryujinx.UI.Common.Configuration
{
public class Columns
{
public ReactiveObject<bool> FavColumn { get; private set; }
public ReactiveObject<bool> IconColumn { get; private set; }
public ReactiveObject<bool> AppColumn { get; private set; }
public ReactiveObject<bool> DevColumn { get; private set; }
public ReactiveObject<bool> VersionColumn { get; private set; }
public ReactiveObject<bool> LdnInfoColumn { get; private set; }
public ReactiveObject<bool> TimePlayedColumn { get; private set; }
public ReactiveObject<bool> LastPlayedColumn { get; private set; }
public ReactiveObject<bool> FileExtColumn { get; private set; }
public ReactiveObject<bool> FileSizeColumn { get; private set; }
public ReactiveObject<bool> PathColumn { get; private set; }
public Columns()
{
FavColumn = new ReactiveObject<bool>();
IconColumn = new ReactiveObject<bool>();
AppColumn = new ReactiveObject<bool>();
DevColumn = new ReactiveObject<bool>();
VersionColumn = new ReactiveObject<bool>();
LdnInfoColumn = new ReactiveObject<bool>();
TimePlayedColumn = new ReactiveObject<bool>();
LastPlayedColumn = new ReactiveObject<bool>();
FileExtColumn = new ReactiveObject<bool>();
FileSizeColumn = new ReactiveObject<bool>();
PathColumn = new ReactiveObject<bool>();
}
public ReactiveObject<bool> FavColumn { get; private set; } = new();
public ReactiveObject<bool> IconColumn { get; private set; } = new();
public ReactiveObject<bool> AppColumn { get; private set; } = new();
public ReactiveObject<bool> DevColumn { get; private set; } = new();
public ReactiveObject<bool> VersionColumn { get; private set; } = new();
public ReactiveObject<bool> LdnInfoColumn { get; private set; } = new();
public ReactiveObject<bool> TimePlayedColumn { get; private set; } = new();
public ReactiveObject<bool> LastPlayedColumn { get; private set; } = new();
public ReactiveObject<bool> FileExtColumn { get; private set; } = new();
public ReactiveObject<bool> FileSizeColumn { get; private set; } = new();
public ReactiveObject<bool> PathColumn { get; private set; } = new();
}
public class ColumnSortSettings
{
public ReactiveObject<int> SortColumnId { get; private set; }
public ReactiveObject<bool> SortAscending { get; private set; }
public ColumnSortSettings()
{
SortColumnId = new ReactiveObject<int>();
SortAscending = new ReactiveObject<bool>();
}
public ReactiveObject<int> SortColumnId { get; private set; } = new();
public ReactiveObject<bool> SortAscending { get; private set; } = new();
}
/// <summary>
@ -71,22 +49,12 @@ namespace Ryujinx.UI.Common.Configuration
/// </summary>
public class ShownFileTypeSettings
{
public ReactiveObject<bool> NSP { get; private set; }
public ReactiveObject<bool> PFS0 { get; private set; }
public ReactiveObject<bool> XCI { get; private set; }
public ReactiveObject<bool> NCA { get; private set; }
public ReactiveObject<bool> NRO { get; private set; }
public ReactiveObject<bool> NSO { get; private set; }
public ShownFileTypeSettings()
{
NSP = new ReactiveObject<bool>();
PFS0 = new ReactiveObject<bool>();
XCI = new ReactiveObject<bool>();
NCA = new ReactiveObject<bool>();
NRO = new ReactiveObject<bool>();
NSO = new ReactiveObject<bool>();
}
public ReactiveObject<bool> NSP { get; private set; } = new();
public ReactiveObject<bool> PFS0 { get; private set; } = new();
public ReactiveObject<bool> XCI { get; private set; } = new();
public ReactiveObject<bool> NCA { get; private set; } = new();
public ReactiveObject<bool> NRO { get; private set; } = new();
public ReactiveObject<bool> NSO { get; private set; } = new();
}
// <summary>
@ -94,20 +62,11 @@ namespace Ryujinx.UI.Common.Configuration
///<summary>
public class WindowStartupSettings
{
public ReactiveObject<int> WindowSizeWidth { get; private set; }
public ReactiveObject<int> WindowSizeHeight { get; private set; }
public ReactiveObject<int> WindowPositionX { get; private set; }
public ReactiveObject<int> WindowPositionY { get; private set; }
public ReactiveObject<bool> WindowMaximized { get; private set; }
public WindowStartupSettings()
{
WindowSizeWidth = new ReactiveObject<int>();
WindowSizeHeight = new ReactiveObject<int>();
WindowPositionX = new ReactiveObject<int>();
WindowPositionY = new ReactiveObject<int>();
WindowMaximized = new ReactiveObject<bool>();
}
public ReactiveObject<int> WindowSizeWidth { get; private set; } = new();
public ReactiveObject<int> WindowSizeHeight { get; private set; } = new();
public ReactiveObject<int> WindowPositionX { get; private set; } = new();
public ReactiveObject<int> WindowPositionY { get; private set; } = new();
public ReactiveObject<bool> WindowMaximized { get; private set; } = new();
}
/// <summary>
@ -421,32 +380,24 @@ namespace Ryujinx.UI.Common.Configuration
/// <summary>
/// Enable or disable keyboard support (Independent from controllers binding)
/// </summary>
public ReactiveObject<bool> EnableKeyboard { get; private set; }
public ReactiveObject<bool> EnableKeyboard { get; private set; } = new();
/// <summary>
/// Enable or disable mouse support (Independent from controllers binding)
/// </summary>
public ReactiveObject<bool> EnableMouse { get; private set; }
public ReactiveObject<bool> EnableMouse { get; private set; } = new();
/// <summary>
/// Hotkey Keyboard Bindings
/// </summary>
public ReactiveObject<KeyboardHotkeys> Hotkeys { get; private set; }
public ReactiveObject<KeyboardHotkeys> Hotkeys { get; private set; } = new();
/// <summary>
/// Input device configuration.
/// NOTE: This ReactiveObject won't issue an event when the List has elements added or removed.
/// TODO: Implement a ReactiveList class.
/// </summary>
public ReactiveObject<List<InputConfig>> InputConfig { get; private set; }
public HidSection()
{
EnableKeyboard = new ReactiveObject<bool>();
EnableMouse = new ReactiveObject<bool>();
Hotkeys = new ReactiveObject<KeyboardHotkeys>();
InputConfig = new ReactiveObject<List<InputConfig>>();
}
public ReactiveObject<List<InputConfig>> InputConfig { get; private set; } = new();
}
/// <summary>

Some files were not shown because too many files have changed in this diff Show more