Skip to content

Commit

Permalink
Do not initialize unnecessarily
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-carvalho committed Dec 22, 2024
1 parent decd37c commit bfa2135
Show file tree
Hide file tree
Showing 72 changed files with 153 additions and 153 deletions.
6 changes: 3 additions & 3 deletions src/ARMeilleure/CodeGen/Arm64/HardwareCapabilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ public enum LinuxFeatureFlagsHwCap2 : ulong
Sve2p1 = 1UL << 36,
}

public static LinuxFeatureFlagsHwCap LinuxFeatureInfoHwCap { get; } = 0;
public static LinuxFeatureFlagsHwCap2 LinuxFeatureInfoHwCap2 { get; } = 0;
public static LinuxFeatureFlagsHwCap LinuxFeatureInfoHwCap { get; }
public static LinuxFeatureFlagsHwCap2 LinuxFeatureInfoHwCap2 { get; }

#endregion

Expand Down Expand Up @@ -167,7 +167,7 @@ public enum MacOsFeatureFlags
Sha256 = 1 << 8,
}

public static MacOsFeatureFlags MacOsFeatureInfo { get; } = 0;
public static MacOsFeatureFlags MacOsFeatureInfo { get; }

#endregion

Expand Down
6 changes: 3 additions & 3 deletions src/ARMeilleure/CodeGen/RegisterAllocators/CopyResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ private static void EmitXorSwap(List<Operation> sequence, Operand x, Operand y)
}
}

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; }

Expand Down
6 changes: 3 additions & 3 deletions src/ARMeilleure/CodeGen/X86/HardwareCapabilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ public enum Xcr0FlagsEax

public static FeatureFlags1Edx FeatureInfo1Edx { get; }
public static FeatureFlags1Ecx FeatureInfo1Ecx { get; }
public static FeatureFlags7Ebx FeatureInfo7Ebx { get; } = 0;
public static FeatureFlags7Ecx FeatureInfo7Ecx { get; } = 0;
public static Xcr0FlagsEax Xcr0InfoEax { get; } = 0;
public static FeatureFlags7Ebx FeatureInfo7Ebx { get; }
public static FeatureFlags7Ecx FeatureInfo7Ecx { get; }
public static Xcr0FlagsEax Xcr0InfoEax { get; }

public static bool SupportsSse => FeatureInfo1Edx.HasFlag(FeatureFlags1Edx.Sse);
public static bool SupportsSse2 => FeatureInfo1Edx.HasFlag(FeatureFlags1Edx.Sse2);
Expand Down
2 changes: 1 addition & 1 deletion src/ARMeilleure/Decoders/OpCode32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public OpCode32(InstDescriptor inst, ulong address, int opCode) : base(inst, add
Cond = (Condition)((uint)opCode >> 28);
}

public bool IsThumb { get; protected init; } = false;
public bool IsThumb { get; protected init; }

public uint GetPc()
{
Expand Down
2 changes: 1 addition & 1 deletion src/ARMeilleure/Optimizations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace ARMeilleure
public static class Optimizations
{
// low-core count PPTC
public static bool LowPower { get; set; } = false;
public static bool LowPower { get; set; }

public static bool FastFP { get; set; } = true;

Expand Down
2 changes: 1 addition & 1 deletion src/ARMeilleure/State/NativeContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private unsafe struct NativeCtxStorage
public long Tpidr2El0;
}

private static NativeCtxStorage _dummyStorage = new();
private static NativeCtxStorage _dummyStorage;

private readonly IJitMemoryBlock _block;

Expand Down
2 changes: 1 addition & 1 deletion src/ARMeilleure/Translation/ArmEmitterContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public Block CurrBlock
public bool HasPtc { get; }
public Aarch32Mode Mode { get; }

private int _ifThenBlockStateIndex = 0;
private int _ifThenBlockStateIndex;
private Condition[] _ifThenBlockState = Array.Empty<Condition>();
public bool IsInIfThenBlock => _ifThenBlockStateIndex < _ifThenBlockState.Length;
public Condition CurrentIfThenBlockCond => _ifThenBlockState[_ifThenBlockStateIndex];
Expand Down
10 changes: 5 additions & 5 deletions src/ARMeilleure/Translation/IntervalTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public class IntervalTree<TK, TV> where TK : IComparable<TK>

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;

Expand Down Expand Up @@ -709,9 +709,9 @@ public void Clear()
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.
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Common/PreciseSleep/WindowsSleepEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ internal class WindowsSleepEvent : IPreciseSleepEvent
/// <summary>
/// Set to true to disable timepoint realignment.
/// </summary>
public bool Precise { get; set; } = false;
public bool Precise { get; set; }

public long AdjustTimePoint(long timePoint, long timeoutNs)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Ryujinx.Common/Utilities/XCIFileTrimmer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public static bool CanUntrim(string filename, ILog log = null)
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
{
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Cpu/AppleHv/HvVcpu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ unsafe class HvVcpu
{
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;
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Cpu/LightningJit/State/NativeContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private unsafe struct NativeCtxStorage
public int Running;
}

private static NativeCtxStorage _dummyStorage = new();
private static NativeCtxStorage _dummyStorage;

private readonly IJitMemoryBlock _block;

Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Graphics.GAL/Multithreading/BufferMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class ThreadedRenderer : IRenderer
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ class ConstantBufferUpdater

// 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>
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Graphics.Gpu/Engine/Threed/DrawState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class DrawState
/// <summary>
/// Index buffer data streamer for inline index buffer updates, such as those used in legacy OpenGL.
/// </summary>
public IbStreamer IbStreamer = new();
public IbStreamer IbStreamer;

/// <summary>
/// If the vertex shader is emulated on compute, this should be set to the compute program, otherwise it should be null.
Expand Down
4 changes: 2 additions & 2 deletions src/Ryujinx.Graphics.Gpu/GraphicsConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ public static class GraphicsConfig
/// <summary>
/// Enables or disables recompression of compressed textures that are not natively supported by the host.
/// </summary>
public static bool EnableTextureRecompression = false;
public static bool EnableTextureRecompression;

/// <summary>
/// Enables or disables color space passthrough, if available.
/// </summary>
public static bool EnableColorSpacePassthrough = false;
public static bool EnableColorSpacePassthrough;
}
#pragma warning restore CA2211
}
4 changes: 2 additions & 2 deletions src/Ryujinx.Graphics.Gpu/Memory/Buffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ class Buffer : IRange, ISyncActionHandler, IDisposable
/// <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.
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Graphics.Gpu/Memory/MultiRangeBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public PhysicalDependency(Buffer physicalBuffer, ulong physicalOffset, ulong vir
}

private List<PhysicalDependency> _dependencies;
private BufferModifiedRangeList _modifiedRanges = null;
private BufferModifiedRangeList _modifiedRanges;

/// <summary>
/// Creates a new instance of the buffer.
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Graphics.OpenGL/OpenGLRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public sealed class OpenGLRenderer : IRenderer

private readonly Sync _sync;

public uint ProgramCount { get; set; } = 0;
public uint ProgramCount { get; set; }

public event EventHandler<ScreenCaptureImageInfo> ScreenCaptured;

Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Graphics.OpenGL/Queries/CounterQueueEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CounterQueueEvent : ICounterEvent
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();
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Graphics.OpenGL/Sync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ private class SyncHandle
public nint Handle;
}

private ulong _firstHandle = 0;
private ulong _firstHandle;
private static ClientWaitSyncFlags SyncFlags => HwCapabilities.RequiresSyncFlush ? ClientWaitSyncFlags.None : ClientWaitSyncFlags.SyncFlushCommandsBit;

private readonly List<SyncHandle> _handles = new();
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public sealed class VulkanRenderer : IRenderer

private bool _initialized;

public uint ProgramCount { get; set; } = 0;
public uint ProgramCount { get; set; }

internal FormatCapabilities FormatCapabilities { get; private set; }
internal HardwareCapabilities Capabilities;
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class VirtualFileSystem : IDisposable

private readonly ConcurrentDictionary<ulong, Stream> _romFsByPid;

private static bool _isInitialized = false;
private static bool _isInitialized;

public static VirtualFileSystem CreateInstance()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ internal class SoftwareKeyboardApplet : IApplet
private SoftwareKeyboardState _foregroundState = SoftwareKeyboardState.Uninitialized;
private volatile InlineKeyboardState _backgroundState = InlineKeyboardState.Uninitialized;

private bool _isBackground = false;
private bool _isBackground;

private AppletSession _normalSession;
private AppletSession _interactiveSession;
Expand All @@ -53,14 +53,14 @@ internal class SoftwareKeyboardApplet : IApplet
private byte[] _transferMemory;

private string _textValue = string.Empty;
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ internal class SoftwareKeyboardRendererBase

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
internal class SoftwareKeyboardUIState
{
public string InputText = string.Empty;
public int CursorBegin = 0;
public int CursorEnd = 0;
public bool AcceptPressed = false;
public bool CancelPressed = false;
public bool OverwriteMode = false;
public int CursorBegin;
public int CursorEnd;
public bool AcceptPressed;
public bool CancelPressed;
public bool OverwriteMode;
public bool TypingEnabled = true;
public bool ControllerEnabled = true;
public int TextBoxBlinkCounter = 0;
public int TextBoxBlinkCounter;

public RenderingSurfaceInfo SurfaceInfo = null;
public RenderingSurfaceInfo SurfaceInfo;
}
}
4 changes: 2 additions & 2 deletions src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/TimedAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public SleepSubstepData(int sleepMilliseconds)
}
}

private TRef<bool> _cancelled = null;
private Thread _thread = null;
private TRef<bool> _cancelled;
private Thread _thread;
private readonly Lock _lock = new();

public bool IsRunning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@ class ISelfController : IpcService
private int _fatalSectionCount;

// TODO: Set this when the game goes in suspension (go back to home menu ect), we currently don't support that so we can keep it set to 0.
private readonly ulong _accumulatedSuspendedTickValue = 0;
private readonly ulong _accumulatedSuspendedTickValue;

Check warning on line 25 in src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs

View workflow job for this annotation

GitHub Actions / pr_build / linux-arm64 (Release)

Field 'ISelfController._accumulatedSuspendedTickValue' is never assigned to, and will always have its default value 0

Check warning on line 25 in src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs

View workflow job for this annotation

GitHub Actions / pr_build / linux-arm64 (Debug)

Field 'ISelfController._accumulatedSuspendedTickValue' is never assigned to, and will always have its default value 0

Check warning on line 25 in src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs

View workflow job for this annotation

GitHub Actions / pr_build / linux-x64 (Release)

Field 'ISelfController._accumulatedSuspendedTickValue' is never assigned to, and will always have its default value 0

Check warning on line 25 in src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs

View workflow job for this annotation

GitHub Actions / pr_build / linux-x64 (Debug)

Field 'ISelfController._accumulatedSuspendedTickValue' is never assigned to, and will always have its default value 0

Check warning on line 25 in src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs

View workflow job for this annotation

GitHub Actions / pr_build / osx-x64 (Debug)

Field 'ISelfController._accumulatedSuspendedTickValue' is never assigned to, and will always have its default value 0

Check warning on line 25 in src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs

View workflow job for this annotation

GitHub Actions / pr_build / macOS Universal (Release)

Field 'ISelfController._accumulatedSuspendedTickValue' is never assigned to, and will always have its default value 0

Check warning on line 25 in src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs

View workflow job for this annotation

GitHub Actions / pr_build / macOS Universal (Release)

Field 'ISelfController._accumulatedSuspendedTickValue' is never assigned to, and will always have its default value 0

Check warning on line 25 in src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs

View workflow job for this annotation

GitHub Actions / pr_build / macOS Universal (Release)

Field 'ISelfController._accumulatedSuspendedTickValue' is never assigned to, and will always have its default value 0

Check warning on line 25 in src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs

View workflow job for this annotation

GitHub Actions / pr_build / osx-x64 (Release)

Field 'ISelfController._accumulatedSuspendedTickValue' is never assigned to, and will always have its default value 0

Check warning on line 25 in src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs

View workflow job for this annotation

GitHub Actions / pr_build / macOS Universal (Debug)

Field 'ISelfController._accumulatedSuspendedTickValue' is never assigned to, and will always have its default value 0

Check warning on line 25 in src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs

View workflow job for this annotation

GitHub Actions / pr_build / macOS Universal (Debug)

Field 'ISelfController._accumulatedSuspendedTickValue' is never assigned to, and will always have its default value 0

Check warning on line 25 in src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs

View workflow job for this annotation

GitHub Actions / pr_build / macOS Universal (Debug)

Field 'ISelfController._accumulatedSuspendedTickValue' is never assigned to, and will always have its default value 0

Check warning on line 25 in src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs

View workflow job for this annotation

GitHub Actions / pr_build / macOS Universal (Debug)

Field 'ISelfController._accumulatedSuspendedTickValue' is never assigned to, and will always have its default value 0

// 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)
{
Expand Down
Loading

0 comments on commit bfa2135

Please sign in to comment.