mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-23 13:07:10 +02:00
Migrate to .NET 9 (#198)
This commit is contained in:
parent
8db5a7e98b
commit
ff6628149d
136 changed files with 278 additions and 270 deletions
|
@ -22,6 +22,7 @@ using System.IO.Compression;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using Path = System.IO.Path;
|
||||
|
||||
namespace Ryujinx.HLE.FileSystem
|
||||
|
@ -55,7 +56,7 @@ namespace Ryujinx.HLE.FileSystem
|
|||
|
||||
private readonly VirtualFileSystem _virtualFileSystem;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
public ContentManager(VirtualFileSystem virtualFileSystem)
|
||||
{
|
||||
|
@ -396,7 +397,7 @@ namespace Ryujinx.HLE.FileSystem
|
|||
if (locationList != null)
|
||||
{
|
||||
LocationEntry entry =
|
||||
locationList.ToList().Find(x => x.TitleId == titleId && x.ContentType == contentType);
|
||||
locationList.ToList().FirstOrDefault(x => x.TitleId == titleId && x.ContentType == contentType);
|
||||
|
||||
if (entry.ContentPath != null)
|
||||
{
|
||||
|
@ -424,7 +425,7 @@ namespace Ryujinx.HLE.FileSystem
|
|||
{
|
||||
LinkedList<LocationEntry> locationList = _locationEntries[storageId];
|
||||
|
||||
return locationList.ToList().Find(x => x.TitleId == titleId && x.ContentType == contentType);
|
||||
return locationList.ToList().FirstOrDefault(x => x.TitleId == titleId && x.ContentType == contentType);
|
||||
}
|
||||
|
||||
public void InstallFirmware(string firmwareSource)
|
||||
|
@ -719,7 +720,7 @@ namespace Ryujinx.HLE.FileSystem
|
|||
|
||||
if (updateNcas.TryGetValue(SystemUpdateTitleId, out var ncaEntry))
|
||||
{
|
||||
string metaPath = ncaEntry.Find(x => x.type == NcaContentType.Meta).path;
|
||||
string metaPath = ncaEntry.FirstOrDefault(x => x.type == NcaContentType.Meta).path;
|
||||
|
||||
CnmtContentMetaEntry[] metaEntries = null;
|
||||
|
||||
|
@ -755,7 +756,7 @@ namespace Ryujinx.HLE.FileSystem
|
|||
|
||||
if (updateNcas.TryGetValue(SystemVersionTitleId, out var updateNcasItem))
|
||||
{
|
||||
string versionEntry = updateNcasItem.Find(x => x.type != NcaContentType.Meta).path;
|
||||
string versionEntry = updateNcasItem.FirstOrDefault(x => x.type != NcaContentType.Meta).path;
|
||||
|
||||
using Stream ncaStream = GetZipStream(archive.GetEntry(versionEntry));
|
||||
Nca nca = new(_virtualFileSystem.KeySet, ncaStream.AsStorage());
|
||||
|
@ -774,9 +775,9 @@ namespace Ryujinx.HLE.FileSystem
|
|||
{
|
||||
if (updateNcas.TryGetValue(metaEntry.TitleId, out ncaEntry))
|
||||
{
|
||||
metaPath = ncaEntry.Find(x => x.type == NcaContentType.Meta).path;
|
||||
metaPath = ncaEntry.FirstOrDefault(x => x.type == NcaContentType.Meta).path;
|
||||
|
||||
string contentPath = ncaEntry.Find(x => x.type != NcaContentType.Meta).path;
|
||||
string contentPath = ncaEntry.FirstOrDefault(x => x.type != NcaContentType.Meta).path;
|
||||
|
||||
// Nintendo in 9.0.0, removed PPC and only kept the meta nca of it.
|
||||
// This is a perfect valid case, so we should just ignore the missing content nca and continue.
|
||||
|
@ -915,8 +916,8 @@ namespace Ryujinx.HLE.FileSystem
|
|||
{
|
||||
if (updateNcas.TryGetValue(metaEntry.TitleId, out var ncaEntry))
|
||||
{
|
||||
string metaNcaPath = ncaEntry.Find(x => x.type == NcaContentType.Meta).path;
|
||||
string contentPath = ncaEntry.Find(x => x.type != NcaContentType.Meta).path;
|
||||
string metaNcaPath = ncaEntry.FirstOrDefault(x => x.type == NcaContentType.Meta).path;
|
||||
string contentPath = ncaEntry.FirstOrDefault(x => x.type != NcaContentType.Meta).path;
|
||||
|
||||
// Nintendo in 9.0.0, removed PPC and only kept the meta nca of it.
|
||||
// This is a perfect valid case, so we should just ignore the missing content nca and continue.
|
||||
|
@ -1076,7 +1077,7 @@ namespace Ryujinx.HLE.FileSystem
|
|||
{
|
||||
if (File.Exists(Path.Combine(pathToCheck, file)))
|
||||
{
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace Ryujinx.HLE.FileSystem
|
|||
continue;
|
||||
}
|
||||
|
||||
string ncaId = BitConverter.ToString(entry.NcaId).Replace("-", null).ToLower();
|
||||
string ncaId = Convert.ToHexStringLower(entry.NcaId).Replace("-", null);
|
||||
Nca nca = _pfs.GetNca(keySet, $"/{ncaId}.nca");
|
||||
|
||||
if (nca.GetProgramIndex() == programIndex)
|
||||
|
|
|
@ -14,6 +14,7 @@ using System.IO;
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Applets
|
||||
{
|
||||
|
@ -62,7 +63,7 @@ namespace Ryujinx.HLE.HOS.Applets
|
|||
private bool _canAcceptController = false;
|
||||
private KeyboardInputMode _inputMode = KeyboardInputMode.ControllerAndKeyboard;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
public event EventHandler AppletStateChanged;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Diagnostics;
|
|||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
||||
{
|
||||
|
@ -21,7 +22,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
|||
const string CancelText = "Cancel";
|
||||
const string ControllerToggleText = "Toggle input";
|
||||
|
||||
private readonly object _bufferLock = new();
|
||||
private readonly Lock _bufferLock = new();
|
||||
|
||||
private RenderingSurfaceInfo _surfaceInfo = null;
|
||||
private SKImageInfo _imageInfo;
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
|||
|
||||
private TRef<bool> _cancelled = null;
|
||||
private Thread _thread = null;
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
public bool IsRunning
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@ using Ryujinx.Common;
|
|||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||
using Ryujinx.Horizon.Common;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Kernel.Common
|
||||
{
|
||||
|
@ -14,7 +15,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
|
|||
private readonly long[] _current2;
|
||||
private readonly long[] _peak;
|
||||
|
||||
private readonly object _lock;
|
||||
private readonly object _lock = new();
|
||||
|
||||
private readonly LinkedList<KThread> _waitingThreads;
|
||||
|
||||
|
@ -27,8 +28,6 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
|
|||
_current2 = new long[(int)LimitableResource.Count];
|
||||
_peak = new long[(int)LimitableResource.Count];
|
||||
|
||||
_lock = new object();
|
||||
|
||||
_waitingThreads = new LinkedList<KThread>();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ using Ryujinx.HLE.HOS.Kernel.Process;
|
|||
using Ryujinx.Horizon.Common;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Kernel.Memory
|
||||
{
|
||||
|
@ -11,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
|||
{
|
||||
public KProcess Owner { get; private set; }
|
||||
private readonly KPageList _pageList;
|
||||
private readonly object _lock;
|
||||
private readonly Lock _lock = new();
|
||||
private ulong _address;
|
||||
private bool _isOwnerMapped;
|
||||
private bool _isMapped;
|
||||
|
@ -19,7 +20,6 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
|||
public KCodeMemory(KernelContext context) : base(context)
|
||||
{
|
||||
_pageList = new KPageList();
|
||||
_lock = new object();
|
||||
}
|
||||
|
||||
public Result Initialize(ulong address, ulong size)
|
||||
|
|
|
@ -40,8 +40,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
|
||||
public ProcessState State { get; private set; }
|
||||
|
||||
private readonly object _processLock = new();
|
||||
private readonly object _threadingLock = new();
|
||||
private readonly Lock _processLock = new();
|
||||
private readonly Lock _threadingLock = new();
|
||||
|
||||
public KAddressArbiter AddressArbiter { get; private set; }
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
|
||||
WakeThreads(_condVarThreads, count, TryAcquireMutex, x => x.CondVarAddress == address);
|
||||
|
||||
if (!_condVarThreads.Exists(x => x.CondVarAddress == address))
|
||||
if (!_condVarThreads.Any(x => x.CondVarAddress == address))
|
||||
{
|
||||
KernelTransfer.KernelToUser(address, 0);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
class KCriticalSection
|
||||
{
|
||||
private readonly KernelContext _context;
|
||||
private readonly object _lock;
|
||||
private readonly object _lock = new();
|
||||
private int _recursionCount;
|
||||
|
||||
public object Lock => _lock;
|
||||
|
@ -13,7 +13,6 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
public KCriticalSection(KernelContext context)
|
||||
{
|
||||
_context = context;
|
||||
_lock = new object();
|
||||
}
|
||||
|
||||
public void Enter()
|
||||
|
|
|
@ -112,7 +112,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
|
||||
public bool WaitingInArbitration { get; set; }
|
||||
|
||||
private readonly object _activityOperationLock = new();
|
||||
private readonly Lock _activityOperationLock = new();
|
||||
|
||||
public KThread(KernelContext context) : base(context)
|
||||
{
|
||||
|
|
|
@ -168,7 +168,7 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
if (StrEquals(RomfsDir, modDir.Name))
|
||||
{
|
||||
var modData = modMetadata.Mods.Find(x => modDir.FullName.Contains(x.Path));
|
||||
var modData = modMetadata.Mods.FirstOrDefault(x => modDir.FullName.Contains(x.Path));
|
||||
var enabled = modData?.Enabled ?? true;
|
||||
|
||||
mods.RomfsDirs.Add(mod = new Mod<DirectoryInfo>(dir.Name, modDir, enabled));
|
||||
|
@ -176,7 +176,7 @@ namespace Ryujinx.HLE.HOS
|
|||
}
|
||||
else if (StrEquals(ExefsDir, modDir.Name))
|
||||
{
|
||||
var modData = modMetadata.Mods.Find(x => modDir.FullName.Contains(x.Path));
|
||||
var modData = modMetadata.Mods.FirstOrDefault(x => modDir.FullName.Contains(x.Path));
|
||||
var enabled = modData?.Enabled ?? true;
|
||||
|
||||
mods.ExefsDirs.Add(mod = new Mod<DirectoryInfo>(dir.Name, modDir, enabled));
|
||||
|
@ -275,7 +275,7 @@ namespace Ryujinx.HLE.HOS
|
|||
var fsFile = new FileInfo(Path.Combine(applicationDir.FullName, RomfsContainer));
|
||||
if (fsFile.Exists)
|
||||
{
|
||||
var modData = modMetadata.Mods.Find(x => fsFile.FullName.Contains(x.Path));
|
||||
var modData = modMetadata.Mods.FirstOrDefault(x => fsFile.FullName.Contains(x.Path));
|
||||
var enabled = modData == null || modData.Enabled;
|
||||
|
||||
mods.RomfsContainers.Add(new Mod<FileInfo>($"<{applicationDir.Name} RomFs>", fsFile, enabled));
|
||||
|
@ -284,7 +284,7 @@ namespace Ryujinx.HLE.HOS
|
|||
fsFile = new FileInfo(Path.Combine(applicationDir.FullName, ExefsContainer));
|
||||
if (fsFile.Exists)
|
||||
{
|
||||
var modData = modMetadata.Mods.Find(x => fsFile.FullName.Contains(x.Path));
|
||||
var modData = modMetadata.Mods.FirstOrDefault(x => fsFile.FullName.Contains(x.Path));
|
||||
var enabled = modData == null || modData.Enabled;
|
||||
|
||||
mods.ExefsContainers.Add(new Mod<FileInfo>($"<{applicationDir.Name} ExeFs>", fsFile, enabled));
|
||||
|
@ -403,7 +403,7 @@ namespace Ryujinx.HLE.HOS
|
|||
}
|
||||
|
||||
// Assumes searchDirPaths don't overlap
|
||||
private static void CollectMods(Dictionary<ulong, ModCache> modCaches, PatchCache patches, params string[] searchDirPaths)
|
||||
private static void CollectMods(Dictionary<ulong, ModCache> modCaches, PatchCache patches, params ReadOnlySpan<string> searchDirPaths)
|
||||
{
|
||||
static bool IsPatchesDir(string name) => StrEquals(AmsNsoPatchDir, name) ||
|
||||
StrEquals(AmsNroPatchDir, name) ||
|
||||
|
@ -453,7 +453,7 @@ namespace Ryujinx.HLE.HOS
|
|||
patches.Initialized = true;
|
||||
}
|
||||
|
||||
public void CollectMods(IEnumerable<ulong> applications, params string[] searchDirPaths)
|
||||
public void CollectMods(IEnumerable<ulong> applications, params ReadOnlySpan<string> searchDirPaths)
|
||||
{
|
||||
Clear();
|
||||
|
||||
|
@ -680,7 +680,7 @@ namespace Ryujinx.HLE.HOS
|
|||
ApplyProgramPatches(nroPatches, 0, nro);
|
||||
}
|
||||
|
||||
internal bool ApplyNsoPatches(ulong applicationId, params IExecutable[] programs)
|
||||
internal bool ApplyNsoPatches(ulong applicationId, params ReadOnlySpan<IExecutable> programs)
|
||||
{
|
||||
IEnumerable<Mod<DirectoryInfo>> nsoMods = _patches.NsoPatches;
|
||||
|
||||
|
@ -744,7 +744,7 @@ namespace Ryujinx.HLE.HOS
|
|||
}
|
||||
}
|
||||
|
||||
private static bool ApplyProgramPatches(IEnumerable<Mod<DirectoryInfo>> mods, int protectedOffset, params IExecutable[] programs)
|
||||
private static bool ApplyProgramPatches(IEnumerable<Mod<DirectoryInfo>> mods, int protectedOffset, params ReadOnlySpan<IExecutable> programs)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
|
@ -755,12 +755,18 @@ namespace Ryujinx.HLE.HOS
|
|||
patches[i] = new MemPatch();
|
||||
}
|
||||
|
||||
var buildIds = programs.Select(p => p switch
|
||||
var buildIds = new List<string>(programs.Length);
|
||||
|
||||
foreach (IExecutable p in programs)
|
||||
{
|
||||
NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()).TrimEnd('0'),
|
||||
NroExecutable nro => Convert.ToHexString(nro.Header.BuildId).TrimEnd('0'),
|
||||
_ => string.Empty,
|
||||
}).ToList();
|
||||
var buildId = p switch
|
||||
{
|
||||
NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()).TrimEnd('0'),
|
||||
NroExecutable nro => Convert.ToHexString(nro.Header.BuildId).TrimEnd('0'),
|
||||
_ => string.Empty,
|
||||
};
|
||||
buildIds.Add(buildId);
|
||||
}
|
||||
|
||||
int GetIndex(string buildId) => buildIds.FindIndex(id => id == buildId); // O(n) but list is small
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ using Ryujinx.HLE.HOS.Kernel.Threading;
|
|||
using Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy.Types;
|
||||
using Ryujinx.Horizon.Common;
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
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 int _accumulatedSuspendedTickChangedEventHandle;
|
||||
|
||||
private readonly object _fatalSectionLock = new();
|
||||
private readonly Lock _fatalSectionLock = new();
|
||||
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.
|
||||
|
|
|
@ -123,7 +123,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|||
return true;
|
||||
}
|
||||
|
||||
public void Configure(params ControllerConfig[] configs)
|
||||
public void Configure(params ReadOnlySpan<ControllerConfig> configs)
|
||||
{
|
||||
_configuredTypes = new ControllerType[MaxControllers];
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|||
{
|
||||
public TouchDevice(Switch device, bool active) : base(device, active) { }
|
||||
|
||||
public void Update(params TouchPoint[] points)
|
||||
public void Update(params ReadOnlySpan<TouchPoint> points)
|
||||
{
|
||||
ref RingLifo<TouchScreenState> lifo = ref _device.Hid.SharedMemory.TouchScreen;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Ldn.Types
|
||||
{
|
||||
|
@ -12,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.Types
|
|||
|
||||
static class NodeLatestUpdateHelper
|
||||
{
|
||||
private static readonly object _lock = new();
|
||||
private static readonly Lock _lock = new();
|
||||
|
||||
public static void CalculateLatestUpdate(this Array8<NodeLatestUpdate> array, Array8<NodeInfo> beforeNodes, Array8<NodeInfo> afterNodes)
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
|
|||
private ILdnTcpSocket _tcp;
|
||||
private LdnProxyUdpServer _udp, _udp2;
|
||||
private readonly List<LdnProxyTcpSession> _stations = new();
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
private readonly AutoResetEvent _apConnected = new(false);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm.Proxy
|
|||
private byte[] _buffer;
|
||||
private int _bufferEnd;
|
||||
|
||||
private readonly object _scanLock = new();
|
||||
private readonly Lock _scanLock = new();
|
||||
|
||||
private Dictionary<ulong, NetworkInfo> _scanResultsLast = new();
|
||||
private Dictionary<ulong, NetworkInfo> _scanResults = new();
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
|
|||
private readonly Action _timeoutCallback;
|
||||
private CancellationTokenSource _cancel;
|
||||
|
||||
private readonly object _lock = new object();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
public NetworkTimeout(int idleTimeout, Action timeoutCallback)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
|
||||
{
|
||||
|
@ -8,7 +9,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
|
|||
|
||||
private readonly List<ushort> _ephemeralPorts = new List<ushort>();
|
||||
|
||||
private readonly object _lock = new object();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
public ushort Get()
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@ using Ryujinx.HLE.HOS.Services.Nfc.Nfp.NfpManager;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
|
||||
{
|
||||
|
@ -104,7 +105,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
|
|||
{
|
||||
VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId);
|
||||
|
||||
if (virtualAmiiboFile.ApplicationAreas.Exists(item => item.ApplicationAreaId == applicationAreaId))
|
||||
if (virtualAmiiboFile.ApplicationAreas.Any(item => item.ApplicationAreaId == applicationAreaId))
|
||||
{
|
||||
_openedApplicationAreaId = applicationAreaId;
|
||||
|
||||
|
@ -133,7 +134,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
|
|||
{
|
||||
VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId);
|
||||
|
||||
if (virtualAmiiboFile.ApplicationAreas.Exists(item => item.ApplicationAreaId == applicationAreaId))
|
||||
if (virtualAmiiboFile.ApplicationAreas.Any(item => item.ApplicationAreaId == applicationAreaId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -153,7 +154,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
|
|||
{
|
||||
VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId);
|
||||
|
||||
if (virtualAmiiboFile.ApplicationAreas.Exists(item => item.ApplicationAreaId == _openedApplicationAreaId))
|
||||
if (virtualAmiiboFile.ApplicationAreas.Any(item => item.ApplicationAreaId == _openedApplicationAreaId))
|
||||
{
|
||||
for (int i = 0; i < virtualAmiiboFile.ApplicationAreas.Count; i++)
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl
|
|||
private NvFence _previousFailingFence;
|
||||
private uint _failingCount;
|
||||
|
||||
public readonly object Lock = new();
|
||||
public readonly Lock Lock = new();
|
||||
|
||||
/// <summary>
|
||||
/// Max failing count until waiting on CPU.
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl
|
|||
|
||||
private readonly Switch _device;
|
||||
|
||||
private readonly object _syncpointAllocatorLock = new();
|
||||
private readonly Lock _syncpointAllocatorLock = new();
|
||||
|
||||
public NvHostSyncpt(Switch device)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ using System;
|
|||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||
{
|
||||
|
@ -10,7 +11,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
|||
{
|
||||
private static readonly ConcurrentDictionary<ulong, BsdContext> _registry = new();
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
private readonly List<IFileDescriptor> _fds;
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Ssl
|
||||
{
|
||||
|
@ -43,7 +44,7 @@ namespace Ryujinx.HLE.HOS.Services.Ssl
|
|||
private bool _initialized;
|
||||
private Dictionary<CaCertificateId, CertStoreEntry> _certificates;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
private struct CertStoreFileHeader
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using Ryujinx.HLE.HOS.Services.SurfaceFlinger.Types;
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
||||
{
|
||||
|
@ -23,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
|||
|
||||
protected BufferQueueConsumer Consumer;
|
||||
|
||||
protected readonly object Lock = new();
|
||||
protected readonly Lock Lock = new();
|
||||
|
||||
private readonly IConsumerListener _listener;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ using Ryujinx.Common.Logging;
|
|||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
||||
{
|
||||
|
@ -11,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
|||
|
||||
private static int _lastBinderId = 0;
|
||||
|
||||
private static readonly object _lock = new();
|
||||
private static readonly Lock _lock = new();
|
||||
|
||||
public static int RegisterBinderObject(IBinder binder)
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
|||
private int _swapInterval;
|
||||
private int _swapIntervalDelay;
|
||||
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
public long RenderLayerId { get; private set; }
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ using Ryujinx.Common.Memory;
|
|||
using Ryujinx.HLE.HOS.Services.Time.Clock;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||
{
|
||||
|
@ -13,7 +14,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
|||
private UInt128 _timeZoneRuleVersion;
|
||||
private uint _totalLocationNameCount;
|
||||
private SteadyClockTimePoint _timeZoneUpdateTimePoint;
|
||||
private readonly object _lock = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
public TimeZoneManager()
|
||||
{
|
||||
|
|
|
@ -231,7 +231,7 @@ namespace Ryujinx.HLE.Loaders.Processes
|
|||
ulong programId,
|
||||
byte programIndex,
|
||||
byte[] arguments = null,
|
||||
params IExecutable[] executables)
|
||||
params ReadOnlySpan<IExecutable> executables)
|
||||
{
|
||||
context.Device.System.ServiceTable.WaitServicesReady();
|
||||
|
||||
|
@ -251,12 +251,17 @@ namespace Ryujinx.HLE.Loaders.Processes
|
|||
ulong codeStart = ((meta.Flags & 1) != 0 ? 0x8000000UL : 0x200000UL) + CodeStartOffset;
|
||||
uint codeSize = 0;
|
||||
|
||||
var buildIds = executables.Select(e => (e switch
|
||||
var buildIds = new string[executables.Length];
|
||||
|
||||
for (int i = 0; i < executables.Length; i++)
|
||||
{
|
||||
NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()),
|
||||
NroExecutable nro => Convert.ToHexString(nro.Header.BuildId),
|
||||
_ => string.Empty
|
||||
}).ToUpper());
|
||||
buildIds[i] = (executables[i] switch
|
||||
{
|
||||
NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()),
|
||||
NroExecutable nro => Convert.ToHexString(nro.Header.BuildId),
|
||||
_ => string.Empty
|
||||
}).ToUpper();
|
||||
}
|
||||
|
||||
ulong[] nsoBase = new ulong[executables.Length];
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Ryujinx.Common;
|
||||
using System.Threading;
|
||||
using System.Timers;
|
||||
|
||||
namespace Ryujinx.HLE
|
||||
|
@ -20,12 +21,12 @@ namespace Ryujinx.HLE
|
|||
private readonly long[] _framesRendered;
|
||||
private readonly double[] _percentTime;
|
||||
|
||||
private readonly object[] _frameLock;
|
||||
private readonly object[] _percentLock;
|
||||
private readonly Lock[] _frameLock = [new()];
|
||||
private readonly Lock[] _percentLock = [new()];
|
||||
|
||||
private readonly double _ticksToSeconds;
|
||||
|
||||
private readonly Timer _resetTimer;
|
||||
private readonly System.Timers.Timer _resetTimer;
|
||||
|
||||
public PerformanceStatistics()
|
||||
{
|
||||
|
@ -41,10 +42,7 @@ namespace Ryujinx.HLE
|
|||
_framesRendered = new long[1];
|
||||
_percentTime = new double[1];
|
||||
|
||||
_frameLock = new[] { new object() };
|
||||
_percentLock = new[] { new object() };
|
||||
|
||||
_resetTimer = new Timer(750);
|
||||
_resetTimer = new(750);
|
||||
|
||||
_resetTimer.Elapsed += ResetTimerElapsed;
|
||||
_resetTimer.AutoReset = true;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
|
||||
</PropertyGroup>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue