Migrate to .NET 9 #198

Merged
marco-carvalho merged 13 commits from net90 into master 2024-12-20 00:52:25 +00:00
19 changed files with 34 additions and 33 deletions
Showing only changes of commit 938886824e - Show all commits

View File

@ -19,7 +19,7 @@ namespace Ryujinx.Audio.Input
/// <summary> /// <summary>
/// Lock used for session allocation. /// Lock used for session allocation.
/// </summary> /// </summary>
private readonly object _sessionLock = new(); private readonly Lock _sessionLock = new();
/// <summary> /// <summary>
/// The session ids allocation table. /// The session ids allocation table.

View File

@ -19,7 +19,7 @@ namespace Ryujinx.Audio.Output
/// <summary> /// <summary>
/// Lock used for session allocation. /// Lock used for session allocation.
/// </summary> /// </summary>
private readonly object _sessionLock = new(); private readonly Lock _sessionLock = new();
/// <summary> /// <summary>
/// The session ids allocation table. /// The session ids allocation table.

View File

@ -19,12 +19,12 @@ namespace Ryujinx.Audio.Renderer.Server
/// <summary> /// <summary>
/// Lock used for session allocation. /// Lock used for session allocation.
/// </summary> /// </summary>
private readonly object _sessionLock = new(); private readonly Lock _sessionLock = new();
/// <summary> /// <summary>
/// Lock used to control the <see cref="AudioProcessor"/> running state. /// Lock used to control the <see cref="AudioProcessor"/> running state.
/// </summary> /// </summary>
private readonly object _audioProcessorLock = new(); private readonly Lock _audioProcessorLock = new();
/// <summary> /// <summary>
/// The session ids allocation table. /// The session ids allocation table.

View File

@ -58,7 +58,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
public uint ProgramCount { get; set; } = 0; public uint ProgramCount { get; set; } = 0;
private Action _interruptAction; private Action _interruptAction;
private readonly object _interruptLock = new(); private readonly Lock _interruptLock = new();
public event EventHandler<ScreenCaptureImageInfo> ScreenCaptured; public event EventHandler<ScreenCaptureImageInfo> ScreenCaptured;

View File

@ -6,6 +6,7 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading;
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
{ {
@ -21,7 +22,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
const string CancelText = "Cancel"; const string CancelText = "Cancel";
const string ControllerToggleText = "Toggle input"; const string ControllerToggleText = "Toggle input";
private readonly object _bufferLock = new(); private readonly Lock _bufferLock = new();
private RenderingSurfaceInfo _surfaceInfo = null; private RenderingSurfaceInfo _surfaceInfo = null;
private SKImageInfo _imageInfo; private SKImageInfo _imageInfo;

View File

@ -40,8 +40,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
public ProcessState State { get; private set; } public ProcessState State { get; private set; }
private readonly object _processLock = new(); private readonly Lock _processLock = new();
private readonly object _threadingLock = new(); private readonly Lock _threadingLock = new();
public KAddressArbiter AddressArbiter { get; private set; } public KAddressArbiter AddressArbiter { get; private set; }

View File

@ -112,7 +112,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
public bool WaitingInArbitration { get; set; } public bool WaitingInArbitration { get; set; }
private readonly object _activityOperationLock = new(); private readonly Lock _activityOperationLock = new();
public KThread(KernelContext context) : base(context) public KThread(KernelContext context) : base(context)
{ {

View File

@ -4,6 +4,7 @@ using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy.Types; using Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy.Types;
using Ryujinx.Horizon.Common; using Ryujinx.Horizon.Common;
using System; using System;
using System.Threading;
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
{ {
@ -17,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
private KEvent _accumulatedSuspendedTickChangedEvent; private KEvent _accumulatedSuspendedTickChangedEvent;
private int _accumulatedSuspendedTickChangedEventHandle; private int _accumulatedSuspendedTickChangedEventHandle;
private readonly object _fatalSectionLock = new(); private readonly Lock _fatalSectionLock = new();
private int _fatalSectionCount; 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. // 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.

View File

@ -18,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm.Proxy
private byte[] _buffer; private byte[] _buffer;
private int _bufferEnd; private int _bufferEnd;
private readonly object _scanLock = new(); private readonly Lock _scanLock = new();
private Dictionary<ulong, NetworkInfo> _scanResultsLast = new(); private Dictionary<ulong, NetworkInfo> _scanResultsLast = new();
private Dictionary<ulong, NetworkInfo> _scanResults = new(); private Dictionary<ulong, NetworkInfo> _scanResults = new();

View File

@ -17,7 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl
private readonly Switch _device; private readonly Switch _device;
private readonly object _syncpointAllocatorLock = new(); private readonly Lock _syncpointAllocatorLock = new();
public NvHostSyncpt(Switch device) public NvHostSyncpt(Switch device)
{ {

View File

@ -1,4 +1,5 @@
using Ryujinx.Common; using Ryujinx.Common;
using System.Threading;
using System.Timers; using System.Timers;
namespace Ryujinx.HLE namespace Ryujinx.HLE
@ -20,12 +21,12 @@ namespace Ryujinx.HLE
private readonly long[] _framesRendered; private readonly long[] _framesRendered;
private readonly double[] _percentTime; private readonly double[] _percentTime;
private readonly object[] _frameLock; private readonly Lock[] _frameLock = new[] { new Lock() };
private readonly object[] _percentLock; private readonly Lock[] _percentLock = new[] { new Lock() };
private readonly double _ticksToSeconds; private readonly double _ticksToSeconds;
private readonly Timer _resetTimer; private readonly System.Timers.Timer _resetTimer;
public PerformanceStatistics() public PerformanceStatistics()
{ {
@ -41,10 +42,7 @@ namespace Ryujinx.HLE
_framesRendered = new long[1]; _framesRendered = new long[1];
_percentTime = new double[1]; _percentTime = new double[1];
_frameLock = new[] { new object() }; _resetTimer = new(750);
_percentLock = new[] { new object() };
_resetTimer = new Timer(750);
_resetTimer.Elapsed += ResetTimerElapsed; _resetTimer.Elapsed += ResetTimerElapsed;
_resetTimer.AutoReset = true; _resetTimer.AutoReset = true;

View File

@ -1,6 +1,7 @@
using Ryujinx.Horizon.Common; using Ryujinx.Horizon.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading;
namespace Ryujinx.Horizon.Sdk.Sf.Cmif namespace Ryujinx.Horizon.Sdk.Sf.Cmif
{ {
@ -209,14 +210,13 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif
} }
private readonly EntryManager _entryManager; private readonly EntryManager _entryManager;
private readonly object _entryOwnerLock; private readonly Lock _entryOwnerLock = new();
private readonly HashSet<Domain> _domains; private readonly HashSet<Domain> _domains;
private readonly int _maxDomains; private readonly int _maxDomains;
public ServerDomainManager(int entryCount, int maxDomains) public ServerDomainManager(int entryCount, int maxDomains)
{ {
_entryManager = new EntryManager(entryCount); _entryManager = new EntryManager(entryCount);
_entryOwnerLock = new object();
_domains = new HashSet<Domain>(); _domains = new HashSet<Domain>();
_maxDomains = maxDomains; _maxDomains = maxDomains;
} }

View File

@ -4,6 +4,7 @@ using Ryujinx.Horizon.Sdk.Sm;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Numerics; using System.Numerics;
using System.Threading;
namespace Ryujinx.Horizon.Sdk.Sf.Hipc namespace Ryujinx.Horizon.Sdk.Sf.Hipc
{ {
@ -17,7 +18,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
private readonly ulong _pointerBuffersBaseAddress; private readonly ulong _pointerBuffersBaseAddress;
private readonly ulong _savedMessagesBaseAddress; private readonly ulong _savedMessagesBaseAddress;
private readonly object _resourceLock; private readonly Lock _resourceLock = new();
private readonly ulong[] _sessionAllocationBitmap; private readonly ulong[] _sessionAllocationBitmap;
private readonly HashSet<ServerSession> _sessions; private readonly HashSet<ServerSession> _sessions;
private readonly HashSet<Server> _servers; private readonly HashSet<Server> _servers;
@ -42,7 +43,6 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
} }
} }
_resourceLock = new object();
_sessionAllocationBitmap = new ulong[(maxSessions + 63) / 64]; _sessionAllocationBitmap = new ulong[(maxSessions + 63) / 64];
_sessions = new HashSet<ServerSession>(); _sessions = new HashSet<ServerSession>();
_servers = new HashSet<Server>(); _servers = new HashSet<Server>();

View File

@ -4,6 +4,7 @@ using Ryujinx.Horizon.Sdk.Sf.Cmif;
using Ryujinx.Horizon.Sdk.Sm; using Ryujinx.Horizon.Sdk.Sm;
using System; using System;
using System.Linq; using System.Linq;
using System.Threading;
namespace Ryujinx.Horizon.Sdk.Sf.Hipc namespace Ryujinx.Horizon.Sdk.Sf.Hipc
{ {
@ -16,8 +17,8 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
private readonly MultiWait _multiWait; private readonly MultiWait _multiWait;
private readonly MultiWait _waitList; private readonly MultiWait _waitList;
private readonly object _multiWaitSelectionLock; private readonly Lock _multiWaitSelectionLock = new();
private readonly object _waitListLock; private readonly Lock _waitListLock = new();
private readonly Event _requestStopEvent; private readonly Event _requestStopEvent;
private readonly Event _notifyEvent; private readonly Event _notifyEvent;
@ -39,9 +40,6 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
_multiWait = new MultiWait(); _multiWait = new MultiWait();
_waitList = new MultiWait(); _waitList = new MultiWait();
_multiWaitSelectionLock = new object();
_waitListLock = new object();
_requestStopEvent = new Event(EventClearMode.ManualClear); _requestStopEvent = new Event(EventClearMode.ManualClear);
_notifyEvent = new Event(EventClearMode.ManualClear); _notifyEvent = new Event(EventClearMode.ManualClear);

View File

@ -4,6 +4,7 @@ using Ryujinx.Common.Logging;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Numerics; using System.Numerics;
using System.Threading;
using static SDL2.SDL; using static SDL2.SDL;
namespace Ryujinx.Input.SDL2 namespace Ryujinx.Input.SDL2
@ -58,7 +59,7 @@ namespace Ryujinx.Input.SDL2
SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_INVALID, SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_INVALID,
}; };
private readonly object _userMappingLock = new(); private readonly Lock _userMappingLock = new();
private readonly List<ButtonMappingEntry> _buttonsUserMapping; private readonly List<ButtonMappingEntry> _buttonsUserMapping;

View File

@ -4,6 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Numerics; using System.Numerics;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Threading;
using static SDL2.SDL; using static SDL2.SDL;
using ConfigKey = Ryujinx.Common.Configuration.Hid.Key; using ConfigKey = Ryujinx.Common.Configuration.Hid.Key;
@ -17,7 +18,7 @@ namespace Ryujinx.Input.SDL2
public bool IsValid => To is not GamepadButtonInputId.Unbound && From is not Key.Unbound; public bool IsValid => To is not GamepadButtonInputId.Unbound && From is not Key.Unbound;
} }
private readonly object _userMappingLock = new(); private readonly Lock _userMappingLock = new();
#pragma warning disable IDE0052 // Remove unread private member #pragma warning disable IDE0052 // Remove unread private member
private readonly SDL2KeyboardDriver _driver; private readonly SDL2KeyboardDriver _driver;

View File

@ -14,7 +14,7 @@ namespace Ryujinx.Memory
private readonly PageInitDelegate _pageInit; private readonly PageInitDelegate _pageInit;
private readonly object _lock = new object(); private readonly Lock _lock = new();
private readonly ulong _pageSize; private readonly ulong _pageSize;
private readonly MemoryBlock _reservedBlock; private readonly MemoryBlock _reservedBlock;
private readonly List<MemoryBlock> _mappedBlocks; private readonly List<MemoryBlock> _mappedBlocks;

View File

@ -51,7 +51,7 @@ namespace Ryujinx.Memory.Tracking
private event Action OnDirty; private event Action OnDirty;
private readonly object _preActionLock = new(); private readonly Lock _preActionLock = new();
private RegionSignal _preAction; // Action to perform before a read or write. This will block the memory access. private RegionSignal _preAction; // Action to perform before a read or write. This will block the memory access.
private PreciseRegionSignal _preciseAction; // Action to perform on a precise read or write. private PreciseRegionSignal _preciseAction; // Action to perform on a precise read or write.
private readonly List<VirtualRegion> _regions; private readonly List<VirtualRegion> _regions;

View File

@ -4,6 +4,7 @@ using Ryujinx.Input;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Numerics; using System.Numerics;
using System.Threading;
using ConfigKey = Ryujinx.Common.Configuration.Hid.Key; using ConfigKey = Ryujinx.Common.Configuration.Hid.Key;
using Key = Ryujinx.Input.Key; using Key = Ryujinx.Input.Key;
@ -15,7 +16,7 @@ namespace Ryujinx.Ava.Input
private readonly AvaloniaKeyboardDriver _driver; private readonly AvaloniaKeyboardDriver _driver;
private StandardKeyboardInputConfig _configuration; private StandardKeyboardInputConfig _configuration;
private readonly object _userMappingLock = new(); private readonly Lock _userMappingLock = new();
public string Id { get; } public string Id { get; }
public string Name { get; } public string Name { get; }