misc: chore: Use collection expressions in HLE project

This commit is contained in:
Evan Husted 2025-01-26 15:43:02 -06:00
parent 3c2f283ec7
commit 70b767ef60
72 changed files with 312 additions and 299 deletions

View File

@ -1072,7 +1072,7 @@ namespace Ryujinx.HLE.FileSystem
public bool AreKeysAlredyPresent(string pathToCheck)
{
string[] fileNames = { "prod.keys", "title.keys", "console.keys", "dev.keys" };
string[] fileNames = ["prod.keys", "title.keys", "console.keys", "dev.keys"];
foreach (string file in fileNames)
{
if (File.Exists(Path.Combine(pathToCheck, file)))

View File

@ -439,7 +439,7 @@ namespace Ryujinx.HLE.FileSystem
U8Span mountName = "system".ToU8Span();
DirectoryHandle handle = default;
List<ulong> localList = new();
List<ulong> localList = [];
try
{

View File

@ -39,10 +39,10 @@ namespace Ryujinx.HLE.HOS.Applets.Browser
if ((_commonArguments.AppletVersion >= 0x80000 && _shimKind == ShimKind.Web) || (_commonArguments.AppletVersion >= 0x30000 && _shimKind == ShimKind.Share))
{
List<BrowserOutput> result = new()
{
new BrowserOutput(BrowserOutputType.ExitReason, (uint)WebExitReason.ExitButton),
};
List<BrowserOutput> result =
[
new BrowserOutput(BrowserOutputType.ExitReason, (uint)WebExitReason.ExitButton)
];
_normalSession.Push(BuildResponseNew(result));
}

View File

@ -64,7 +64,7 @@ namespace Ryujinx.HLE.HOS.Applets.Browser
public static (ShimKind, List<BrowserArgument>) ParseArguments(ReadOnlySpan<byte> data)
{
List<BrowserArgument> browserArguments = new();
List<BrowserArgument> browserArguments = [];
WebArgHeader header = IApplet.ReadStruct<WebArgHeader>(data[..8]);

View File

@ -184,7 +184,7 @@ namespace Ryujinx.HLE.HOS.Applets.Error
string messageText = Encoding.ASCII.GetString(messageTextBuffer.TakeWhile(b => !b.Equals(0)).ToArray());
string detailsText = Encoding.ASCII.GetString(detailsTextBuffer.TakeWhile(b => !b.Equals(0)).ToArray());
List<string> buttons = new();
List<string> buttons = [];
// TODO: Handle the LanguageCode to return the translated "OK" and "Details".

View File

@ -122,13 +122,14 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
{
// Try a list of fonts in case any of them is not available in the system.
string[] availableFonts = {
string[] availableFonts =
[
uiThemeFontFamily,
"Liberation Sans",
"FreeSans",
"DejaVu Sans",
"Lucida Grande",
};
"Lucida Grande"
];
foreach (string fontFamily in availableFonts)
{

View File

@ -9,10 +9,10 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
class Demangler
{
private const string Base36 = "0123456789abcdefghijklmnopqrstuvwxyz";
private readonly List<BaseNode> _substitutionList = new();
private List<BaseNode> _templateParamList = new();
private readonly List<BaseNode> _substitutionList = [];
private List<BaseNode> _templateParamList = [];
private readonly List<ForwardTemplateReference> _forwardTemplateReferenceList = new();
private readonly List<ForwardTemplateReference> _forwardTemplateReferenceList = [];
public string Mangled { get; private set; }
@ -274,7 +274,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
}
else if (ConsumeIf("Dw"))
{
List<BaseNode> types = new();
List<BaseNode> types = [];
while (!ConsumeIf("E"))
{
@ -308,7 +308,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
}
Reference referenceQualifier = Reference.None;
List<BaseNode> paramsList = new();
List<BaseNode> paramsList = [];
while (true)
{
@ -1588,7 +1588,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
return null;
}
List<BaseNode> expressions = new();
List<BaseNode> expressions = [];
if (ConsumeIf("_"))
{
while (!ConsumeIf("E"))
@ -1730,8 +1730,8 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
return null;
}
List<BaseNode> expressions = new();
List<BaseNode> initializers = new();
List<BaseNode> expressions = [];
List<BaseNode> initializers = [];
while (!ConsumeIf("_"))
{
@ -1899,7 +1899,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
return null;
}
List<BaseNode> names = new();
List<BaseNode> names = [];
while (!ConsumeIf("E"))
{
expression = ParseExpression();
@ -2048,7 +2048,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
case 'l':
_position += 2;
List<BaseNode> bracedExpressions = new();
List<BaseNode> bracedExpressions = [];
while (!ConsumeIf("E"))
{
expression = ParseBracedExpression();
@ -2327,7 +2327,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
return null;
case 'P':
_position += 2;
List<BaseNode> arguments = new();
List<BaseNode> arguments = [];
while (!ConsumeIf("E"))
{
BaseNode argument = ParseTemplateArgument();
@ -2368,7 +2368,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
return null;
}
List<BaseNode> bracedExpressions = new();
List<BaseNode> bracedExpressions = [];
while (!ConsumeIf("E"))
{
expression = ParseBracedExpression();
@ -2600,7 +2600,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
_templateParamList.Clear();
}
List<BaseNode> args = new();
List<BaseNode> args = [];
while (!ConsumeIf("E"))
{
if (hasContext)
@ -2659,7 +2659,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
// J <template-arg>* E
case 'J':
_position++;
List<BaseNode> templateArguments = new();
List<BaseNode> templateArguments = [];
while (!ConsumeIf("E"))
{
BaseNode templateArgument = ParseTemplateArgument();
@ -3298,7 +3298,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
return new EncodedFunction(name, null, context.Cv, context.Ref, null, returnType);
}
List<BaseNode> paramsList = new();
List<BaseNode> paramsList = [];
// backup because that can be destroyed by parseType
CvType cv = context.Cv;

View File

@ -130,7 +130,7 @@ namespace Ryujinx.HLE.HOS
PerformanceState = new PerformanceState();
NfpDevices = new List<NfpDevice>();
NfpDevices = [];
// Note: This is not really correct, but with HLE of services, the only memory
// region used that is used is Application, so we can use the other ones for anything.
@ -283,14 +283,15 @@ namespace Ryujinx.HLE.HOS
ProcessCreationInfo creationInfo = new("Service", 1, 0, 0x8000000, 1, Flags, 0, 0);
uint[] defaultCapabilities = {
uint[] defaultCapabilities =
[
(((uint)KScheduler.CpuCoresCount - 1) << 24) + (((uint)KScheduler.CpuCoresCount - 1) << 16) + 0x63F7u,
0x1FFFFFCF,
0x207FFFEF,
0x47E0060F,
0x0048BFFF,
0x01007FFF,
};
0x01007FFF
];
// TODO:
// - Pass enough information (capabilities, process creation info, etc) on ServiceEntry for proper initialization.
@ -341,7 +342,7 @@ namespace Ryujinx.HLE.HOS
{
if (VirtualAmiibo.ApplicationBytes.Length > 0)
{
VirtualAmiibo.ApplicationBytes = Array.Empty<byte>();
VirtualAmiibo.ApplicationBytes = [];
VirtualAmiibo.InputBin = string.Empty;
}
if (NfpDevices[nfpDeviceId].State == NfpDeviceState.SearchingForTag)
@ -356,7 +357,7 @@ namespace Ryujinx.HLE.HOS
VirtualAmiibo.InputBin = path;
if (VirtualAmiibo.ApplicationBytes.Length > 0)
{
VirtualAmiibo.ApplicationBytes = Array.Empty<byte>();
VirtualAmiibo.ApplicationBytes = [];
}
byte[] encryptedData = File.ReadAllBytes(path);
VirtualAmiiboFile newFile = AmiiboBinReader.ReadBinFile(encryptedData);

View File

@ -24,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Ipc
PId = HasPId ? reader.ReadUInt64() : 0;
int toCopySize = (word >> 1) & 0xf;
int[] toCopy = toCopySize == 0 ? Array.Empty<int>() : new int[toCopySize];
int[] toCopy = toCopySize == 0 ? [] : new int[toCopySize];
for (int index = 0; index < toCopy.Length; index++)
{
@ -34,7 +34,7 @@ namespace Ryujinx.HLE.HOS.Ipc
ToCopy = toCopy;
int toMoveSize = (word >> 5) & 0xf;
int[] toMove = toMoveSize == 0 ? Array.Empty<int>() : new int[toMoveSize];
int[] toMove = toMoveSize == 0 ? [] : new int[toMoveSize];
for (int index = 0; index < toMove.Length; index++)
{
@ -59,12 +59,12 @@ namespace Ryujinx.HLE.HOS.Ipc
public static IpcHandleDesc MakeCopy(params int[] handles)
{
return new IpcHandleDesc(handles, Array.Empty<int>());
return new IpcHandleDesc(handles, []);
}
public static IpcHandleDesc MakeMove(params int[] handles)
{
return new IpcHandleDesc(Array.Empty<int>(), handles);
return new IpcHandleDesc([], handles);
}
public RecyclableMemoryStream GetStream()

View File

@ -26,13 +26,13 @@ namespace Ryujinx.HLE.HOS.Ipc
public IpcMessage()
{
PtrBuff = new List<IpcPtrBuffDesc>(0);
SendBuff = new List<IpcBuffDesc>(0);
ReceiveBuff = new List<IpcBuffDesc>(0);
ExchangeBuff = new List<IpcBuffDesc>(0);
RecvListBuff = new List<IpcRecvListBuffDesc>(0);
PtrBuff = [];
SendBuff = [];
ReceiveBuff = [];
ExchangeBuff = [];
RecvListBuff = [];
ObjectIds = new List<int>(0);
ObjectIds = [];
}
public IpcMessage(ReadOnlySpan<byte> data, long cmdPtr)
@ -122,7 +122,7 @@ namespace Ryujinx.HLE.HOS.Ipc
RecvListBuff.Add(new IpcRecvListBuffDesc(reader.ReadUInt64()));
}
ObjectIds = new List<int>(0);
ObjectIds = [];
}
public RecyclableMemoryStream GetStream(long cmdPtr, ulong recvListAddr)

View File

@ -29,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
_current2 = new long[(int)LimitableResource.Count];
_peak = new long[(int)LimitableResource.Count];
_waitingThreads = new LinkedList<KThread>();
_waitingThreads = [];
}
public bool Reserve(LimitableResource resource, ulong amount)

View File

@ -9,7 +9,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
public KSynchronizationObject(KernelContext context) : base(context)
{
WaitingThreads = new LinkedList<KThread>();
WaitingThreads = [];
}
public LinkedListNode<KThread> AddWaitingThread(KThread thread)

View File

@ -34,7 +34,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
public KTimeManager(KernelContext context)
{
_context = context;
_waitingObjects = new List<WaitingObject>();
_waitingObjects = [];
_keepRunning = true;
Thread work = new(WaitAndCheckScheduledObjects)

View File

@ -72,13 +72,13 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
servicePool = new MemoryRegion(DramMemoryMap.SlabHeapEnd, servicePoolSize);
return new[]
{
return
[
GetMemoryRegion(applicationPool),
GetMemoryRegion(appletPool),
GetMemoryRegion(servicePool),
GetMemoryRegion(nvServicesPool),
};
GetMemoryRegion(nvServicesPool)
];
}
private static KMemoryRegionManager GetMemoryRegion(MemoryRegion region)

View File

@ -16,8 +16,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
{
_parent = parent;
_incomingConnections = new LinkedList<KServerSession>();
_lightIncomingConnections = new LinkedList<KLightServerSession>();
_incomingConnections = [];
_lightIncomingConnections = [];
}
public void EnqueueIncomingSession(KServerSession session)

View File

@ -10,12 +10,13 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
{
class KServerSession : KSynchronizationObject
{
private static readonly MemoryState[] _ipcMemoryStates = {
private static readonly MemoryState[] _ipcMemoryStates =
[
MemoryState.IpcBuffer3,
MemoryState.IpcBuffer0,
MemoryState.IpcBuffer1,
(MemoryState)0xfffce5d4, //This is invalid, shouldn't be accessed.
};
(MemoryState)0xfffce5d4 //This is invalid, shouldn't be accessed.
];
private readonly struct Message
{
@ -176,7 +177,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
{
_parent = parent;
_requests = new LinkedList<KSessionRequest>();
_requests = [];
}
public Result EnqueueRequest(KSessionRequest request)

View File

@ -84,7 +84,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
}
}
private static readonly int[] _memoryBlockPageShifts = { 12, 16, 21, 22, 25, 29, 30 };
private static readonly int[] _memoryBlockPageShifts = [12, 16, 21, 22, 25, 29, 30];
#pragma warning disable IDE0052 // Remove unread private member
private readonly ulong _heapAddress;

View File

@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
public KPageList()
{
Nodes = new LinkedList<KPageNode>();
Nodes = [];
}
public Result AddRange(ulong address, ulong pagesCount)

View File

@ -13,14 +13,15 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
{
abstract class KPageTableBase
{
private static readonly int[] _mappingUnitSizes = {
private static readonly int[] _mappingUnitSizes =
[
0x1000,
0x10000,
0x200000,
0x400000,
0x2000000,
0x40000000,
};
0x40000000
];
private const ulong RegionAlignment = 0x200000;

View File

@ -8,7 +8,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
public KSlabHeap(ulong pa, ulong itemSize, ulong size)
{
_items = new LinkedList<ulong>();
_items = [];
int itemsCount = (int)(size / itemSize);

View File

@ -41,7 +41,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
{
_owner = owner;
_images = new List<Image>();
_images = [];
}
public string GetGuestStackTrace(KThread thread)
@ -414,7 +414,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
ulong strTblAddr = textOffset + strTab;
ulong symTblAddr = textOffset + symTab;
List<ElfSymbol> symbols = new();
List<ElfSymbol> symbols = [];
while (symTblAddr < strTblAddr)
{

View File

@ -107,7 +107,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
// TODO: Remove once we no longer need to initialize it externally.
HandleTable = new KHandleTable();
_threads = new LinkedList<KThread>();
_threads = [];
Debugger = new HleProcessDebugger(this);
}

View File

@ -21,8 +21,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
{
_context = context;
_condVarThreads = new List<KThread>();
_arbiterThreads = new List<KThread>();
_condVarThreads = [];
_arbiterThreads = [];
}
public Result ArbitrateLock(int ownerHandle, ulong mutexAddress, int requesterHandle)

View File

@ -23,8 +23,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
for (int core = 0; core < KScheduler.CpuCoresCount; core++)
{
_suggestedThreadsPerPrioPerCore[prio][core] = new LinkedList<KThread>();
_scheduledThreadsPerPrioPerCore[prio][core] = new LinkedList<KThread>();
_suggestedThreadsPerPrioPerCore[prio][core] = [];
_scheduledThreadsPerPrioPerCore[prio][core] = [];
}
}

View File

@ -121,8 +121,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
SiblingsPerCore = new LinkedListNode<KThread>[KScheduler.CpuCoresCount];
_mutexWaiters = new LinkedList<KThread>();
_pinnedWaiters = new LinkedList<KThread>();
_mutexWaiters = [];
_pinnedWaiters = [];
}
public Result Initialize(

View File

@ -100,20 +100,20 @@ namespace Ryujinx.HLE.HOS
AccessControlBits.Bits.MoveCacheStorage;
// Sdb has save data access control info so we can't store just its access control bits
private static ReadOnlySpan<byte> SdbFacData => new byte[]
{
private static ReadOnlySpan<byte> SdbFacData =>
[
0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x03, 0x03, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x09, 0x10, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
};
0x00, 0x00, 0x00, 0x01
];
private static ReadOnlySpan<byte> SdbFacDescriptor => new byte[]
{
private static ReadOnlySpan<byte> SdbFacDescriptor =>
[
0x01, 0x00, 0x02, 0x00, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x09, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
};
0x01, 0x09, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
];
}
}

View File

@ -87,11 +87,11 @@ namespace Ryujinx.HLE.HOS
public ModCache()
{
RomfsContainers = new List<Mod<FileInfo>>();
ExefsContainers = new List<Mod<FileInfo>>();
RomfsDirs = new List<Mod<DirectoryInfo>>();
ExefsDirs = new List<Mod<DirectoryInfo>>();
Cheats = new List<Cheat>();
RomfsContainers = [];
ExefsContainers = [];
RomfsDirs = [];
ExefsDirs = [];
Cheats = [];
}
}
@ -106,9 +106,9 @@ namespace Ryujinx.HLE.HOS
public PatchCache()
{
NsoPatches = new List<Mod<DirectoryInfo>>();
NroPatches = new List<Mod<DirectoryInfo>>();
KipPatches = new List<Mod<DirectoryInfo>>();
NsoPatches = [];
NroPatches = [];
KipPatches = [];
Initialized = false;
}
@ -357,7 +357,7 @@ namespace Ryujinx.HLE.HOS
private static IEnumerable<Cheat> GetCheatsInFile(FileInfo cheatFile)
{
string cheatName = DefaultCheatName;
List<string> instructions = new();
List<string> instructions = [];
using StreamReader cheatData = cheatFile.OpenText();
while (cheatData.ReadLine() is { } line)
@ -384,7 +384,7 @@ namespace Ryujinx.HLE.HOS
// Start a new cheat section.
cheatName = line[1..^1];
instructions = new List<string>();
instructions = [];
}
else if (line.Length > 0)
{
@ -470,7 +470,7 @@ namespace Ryujinx.HLE.HOS
return baseStorage;
}
HashSet<string> fileSet = new();
HashSet<string> fileSet = [];
RomFsBuilder builder = new();
int count = 0;

View File

@ -33,7 +33,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
_horizonClient = horizonClient;
_profiles = new ConcurrentDictionary<string, UserProfile>();
_storedOpenedUsers = Array.Empty<UserProfile>();
_storedOpenedUsers = [];
_accountSaveDataManager = new AccountSaveDataManager(_profiles);

View File

@ -65,7 +65,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
{
ProfilesJson profilesJson = new()
{
Profiles = new List<UserProfileJson>(),
Profiles = [],
LastOpened = LastOpened.ToString(),
};

View File

@ -872,8 +872,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
// Initialize entries to avoid issues with some games.
List<GamepadInput> emptyGamepadInputs = new();
List<SixAxisInput> emptySixAxisInputs = new();
List<GamepadInput> emptyGamepadInputs = [];
List<SixAxisInput> emptySixAxisInputs = [];
for (int player = 0; player < NpadDevices.MaxControllers; player++)
{

View File

@ -123,7 +123,7 @@ namespace Ryujinx.HLE.HOS.Services
{
Logger.Trace?.Print(LogClass.KernelIpc, $"{service.GetType().Name}: {processRequest.Name}");
result = (ResultCode)processRequest.Invoke(service, new object[] { context });
result = (ResultCode)processRequest.Invoke(service, [context]);
}
else
{
@ -176,7 +176,7 @@ namespace Ryujinx.HLE.HOS.Services
{
Logger.Debug?.Print(LogClass.KernelIpc, $"{GetType().Name}: {processRequest.Name}");
result = (ResultCode)processRequest.Invoke(this, new object[] { context });
result = (ResultCode)processRequest.Invoke(this, [context]);
}
else
{

View File

@ -84,7 +84,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator
NetworkConfig = networkConfig,
};
bool success = _parent.NetworkClient.CreateNetwork(request, _advertiseData ?? Array.Empty<byte>());
bool success = _parent.NetworkClient.CreateNetwork(request, _advertiseData ?? []);
return success ? ResultCode.Success : ResultCode.InvalidState;
}

View File

@ -163,7 +163,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator
}
else
{
return Array.Empty<NodeLatestUpdate>();
return [];
}
}

View File

@ -56,7 +56,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator
public NetworkInfo[] Scan(ushort channel, ScanFilter scanFilter)
{
Logger.Warning?.PrintMsg(LogClass.ServiceLdn, "Attempted to scan for networks, but Multiplayer is disabled!");
return Array.Empty<NetworkInfo>();
return [];
}
public void SetAdvertiseData(byte[] data) { }

View File

@ -28,7 +28,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
private readonly Ssid _fakeSsid;
private ILdnTcpSocket _tcp;
private LdnProxyUdpServer _udp, _udp2;
private readonly List<LdnProxyTcpSession> _stations = new();
private readonly List<LdnProxyTcpSession> _stations = [];
private readonly Lock _lock = new();
private readonly AutoResetEvent _apConnected = new(false);
@ -340,10 +340,10 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
if (_protocol.SendBroadcast(_udp, LanPacketType.Scan, DefaultPort) < 0)
{
return Array.Empty<NetworkInfo>();
return [];
}
List<NetworkInfo> outNetworkInfo = new();
List<NetworkInfo> outNetworkInfo = [];
foreach (KeyValuePair<ulong, NetworkInfo> item in _udp.GetScanResults())
{

View File

@ -162,7 +162,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
public int SendBroadcast(ILdnSocket s, LanPacketType type, int port)
{
return SendPacket(s, type, Array.Empty<byte>(), new IPEndPoint(_discovery.LocalBroadcastAddr, port));
return SendPacket(s, type, [], new IPEndPoint(_discovery.LocalBroadcastAddr, port));
}
public int SendPacket(ILdnSocket s, LanPacketType type, byte[] data, EndPoint endPoint = null)
@ -231,7 +231,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
private int Compress(byte[] input, out byte[] output)
{
List<byte> outputList = new();
List<byte> outputList = [];
int i = 0;
int maxCount = 0xFF;
@ -275,7 +275,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
private int Decompress(byte[] input, out byte[] output)
{
List<byte> outputList = new();
List<byte> outputList = [];
int i = 0;
while (i < input.Length && outputList.Count < BufferSize)

View File

@ -40,7 +40,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
private readonly RyuLdnProtocol _protocol;
private readonly NetworkTimeout _timeout;
private readonly List<NetworkInfo> _availableGames = new();
private readonly List<NetworkInfo> _availableGames = [];
private DisconnectReason _disconnectReason;
private P2pProxyServer _hostedProxy;
@ -109,7 +109,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
ConnectAsync();
int index = WaitHandle.WaitAny(new WaitHandle[] { _connected, _error }, FailureTimeout);
int index = WaitHandle.WaitAny([_connected, _error], FailureTimeout);
if (IsConnected)
{
@ -326,7 +326,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
SendAsync(_protocol.Encode(PacketId.Reject, new RejectRequest(disconnectReason, nodeId)));
int index = WaitHandle.WaitAny(new WaitHandle[] { _reject, _error }, InactiveTimeout);
int index = WaitHandle.WaitAny([_reject, _error], InactiveTimeout);
if (index == 0)
{
@ -566,13 +566,13 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
SendAsync(_protocol.Encode(PacketId.Scan, scanFilter));
index = WaitHandle.WaitAny(new WaitHandle[] { _scan, _error }, ScanTimeout);
index = WaitHandle.WaitAny([_scan, _error], ScanTimeout);
}
if (index != 0)
{
// An error occurred or timeout. Write 0 games.
return Array.Empty<NetworkInfo>();
return [];
}
return _availableGames.ToArray();

View File

@ -7,7 +7,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
{
private const ushort EphemeralBase = 49152;
private readonly List<ushort> _ephemeralPorts = new();
private readonly List<ushort> _ephemeralPorts = [];
private readonly Lock _lock = new();

View File

@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
public EndPoint LocalEndpoint { get; }
public IPAddress LocalAddress { get; }
private readonly List<LdnProxySocket> _sockets = new();
private readonly List<LdnProxySocket> _sockets = [];
private readonly Dictionary<ProtocolType, EphemeralPortPool> _ephemeralPorts = new();
private readonly IProxyClient _parent;

View File

@ -18,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
private readonly LdnProxy _proxy;
private bool _isListening;
private readonly List<LdnProxySocket> _listenSockets = new();
private readonly List<LdnProxySocket> _listenSockets = [];
private readonly Queue<ProxyConnectRequest> _connectRequests = new();

View File

@ -41,9 +41,9 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
private NatDevice _natDevice;
private Mapping _portMapping;
private readonly List<P2pProxySession> _players = new();
private readonly List<P2pProxySession> _players = [];
private readonly List<ExternalProxyToken> _waitingTokens = new();
private readonly List<ExternalProxyToken> _waitingTokens = [];
private readonly AutoResetEvent _tokenEvent = new(false);
private uint _broadcastAddress;

View File

@ -40,11 +40,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii
}
#pragma warning disable IDE0055 // Disable formatting
public static ReadOnlySpan<byte> Ver3FacelineColorTable => new byte[] { 0, 1, 2, 3, 4, 5 };
public static ReadOnlySpan<byte> Ver3HairColorTable => new byte[] { 8, 1, 2, 3, 4, 5, 6, 7 };
public static ReadOnlySpan<byte> Ver3EyeColorTable => new byte[] { 8, 9, 10, 11, 12, 13 };
public static ReadOnlySpan<byte> Ver3MouthColorTable => new byte[] { 19, 20, 21, 22, 23 };
public static ReadOnlySpan<byte> Ver3GlassColorTable => new byte[] { 8, 14, 15, 16, 17, 18, 0 };
public static ReadOnlySpan<byte> Ver3FacelineColorTable => [0, 1, 2, 3, 4, 5];
public static ReadOnlySpan<byte> Ver3HairColorTable => [8, 1, 2, 3, 4, 5, 6, 7];
public static ReadOnlySpan<byte> Ver3EyeColorTable => [8, 9, 10, 11, 12, 13];
public static ReadOnlySpan<byte> Ver3MouthColorTable => [19, 20, 21, 22, 23];
public static ReadOnlySpan<byte> Ver3GlassColorTable => [8, 14, 15, 16, 17, 18, 0];
#pragma warning restore IDE0055
}
}

View File

@ -830,8 +830,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
}
#region "Element Info Array"
private readonly ReadOnlySpan<byte> ElementInfoArray => new byte[]
{
private readonly ReadOnlySpan<byte> ElementInfoArray =>
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x83, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -905,8 +905,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x1b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
};
0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
];
#endregion
}
}

View File

@ -73,7 +73,7 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
// The first 2 Mii in the default table are used as base for Male/Female in editor but not exposed via IPC.
public static int TableLength => _fromIndex.Length;
private static readonly int[] _fromIndex = { 2, 3, 4, 5, 6, 7 };
private static readonly int[] _fromIndex = [2, 3, 4, 5, 6, 7];
public static DefaultMii GetDefaultMii(uint index)
{
@ -81,8 +81,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
}
#region "Raw Table Array"
private static ReadOnlySpan<byte> TableRawArray => new byte[]
{
private static ReadOnlySpan<byte> TableRawArray =>
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x21, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
@ -190,8 +190,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x6f, 0x00,
0x20, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
0x20, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
#endregion
}
}

View File

@ -6,17 +6,19 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
{
static class RandomMiiConstants
{
public static readonly int[] EyeRotateTable = {
public static readonly int[] EyeRotateTable =
[
0x03, 0x04, 0x04, 0x04, 0x03, 0x04, 0x04, 0x04, 0x03, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x04,
0x04, 0x04, 0x03, 0x03, 0x04, 0x03, 0x04, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x03, 0x04, 0x04,
0x04, 0x03, 0x03, 0x03, 0x04, 0x04, 0x03, 0x03, 0x03, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x03, 0x04, 0x04, 0x03, 0x04, 0x04,
};
0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x03, 0x04, 0x04, 0x03, 0x04, 0x04
];
public static readonly int[] EyebrowRotateTable = {
public static readonly int[] EyebrowRotateTable =
[
0x06, 0x06, 0x05, 0x07, 0x06, 0x07, 0x06, 0x07, 0x04, 0x07, 0x06, 0x08, 0x05, 0x05, 0x06, 0x06,
0x07, 0x07, 0x06, 0x06, 0x05, 0x06, 0x07, 0x05,
};
0x07, 0x07, 0x06, 0x06, 0x05, 0x06, 0x07, 0x05
];
[Flags]
public enum BeardAndMustacheFlag
@ -89,8 +91,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
#region "Random Mii Data Arrays"
private static ReadOnlySpan<byte> RandomMiiFacelineRawArray => new byte[]
{
private static ReadOnlySpan<byte> RandomMiiFacelineRawArray =>
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
@ -320,11 +322,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
private static ReadOnlySpan<byte> RandomMiiFacelineColorRawArray => new byte[]
{
private static ReadOnlySpan<byte> RandomMiiFacelineColorRawArray =>
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
@ -399,11 +401,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
private static ReadOnlySpan<byte> RandomMiiFacelineWrinkleRawArray => new byte[]
{
private static ReadOnlySpan<byte> RandomMiiFacelineWrinkleRawArray =>
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -633,11 +635,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
private static ReadOnlySpan<byte> RandomMiiFacelineMakeRawArray => new byte[]
{
private static ReadOnlySpan<byte> RandomMiiFacelineMakeRawArray =>
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -867,11 +869,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
private static ReadOnlySpan<byte> RandomMiiHairTypeRawArray => new byte[]
{
private static ReadOnlySpan<byte> RandomMiiHairTypeRawArray =>
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00,
0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00,
@ -1101,11 +1103,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
private static ReadOnlySpan<byte> RandomMiiHairColorRawArray => new byte[]
{
private static ReadOnlySpan<byte> RandomMiiHairColorRawArray =>
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -1218,11 +1220,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
private static ReadOnlySpan<byte> RandomMiiEyeTypeRawArray => new byte[]
{
private static ReadOnlySpan<byte> RandomMiiEyeTypeRawArray =>
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
@ -1452,11 +1454,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
0x2e, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
private static ReadOnlySpan<byte> RandomMiiEyeColorRawArray => new byte[]
{
private static ReadOnlySpan<byte> RandomMiiEyeColorRawArray =>
[
0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
@ -1493,11 +1495,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
private static ReadOnlySpan<byte> RandomMiiEyebrowTypeRawArray => new byte[]
{
private static ReadOnlySpan<byte> RandomMiiEyebrowTypeRawArray =>
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
@ -1727,11 +1729,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
private static ReadOnlySpan<byte> RandomMiiNoseTypeRawArray => new byte[]
{
private static ReadOnlySpan<byte> RandomMiiNoseTypeRawArray =>
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
@ -1961,11 +1963,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
private static ReadOnlySpan<byte> RandomMiiMouthTypeRawArray => new byte[]
{
private static ReadOnlySpan<byte> RandomMiiMouthTypeRawArray =>
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
@ -2195,11 +2197,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
private static ReadOnlySpan<byte> RandomMiiGlassTypeRawArray => new byte[]
{
private static ReadOnlySpan<byte> RandomMiiGlassTypeRawArray =>
[
0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00,
0x60, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -2236,8 +2238,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
#endregion
}
}

View File

@ -16,7 +16,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
static class VirtualAmiibo
{
public static uint OpenedApplicationAreaId;
public static byte[] ApplicationBytes = Array.Empty<byte>();
public static byte[] ApplicationBytes = [];
public static string InputBin = string.Empty;
public static string NickName = string.Empty;
private static readonly AmiiboJsonSerializerContext _serializerContext = AmiiboJsonSerializerContext.Default;
@ -137,7 +137,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
if (ApplicationBytes.Length > 0)
{
byte[] bytes = ApplicationBytes;
ApplicationBytes = Array.Empty<byte>();
ApplicationBytes = [];
return bytes;
}
VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId);
@ -150,7 +150,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
}
}
return Array.Empty<byte>();
return [];
}
public static bool CreateApplicationArea(string amiiboId, uint applicationAreaId, byte[] applicationAreaData)
@ -219,12 +219,12 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
virtualAmiiboFile = new VirtualAmiiboFile()
{
FileVersion = 0,
TagUuid = Array.Empty<byte>(),
TagUuid = [],
AmiiboId = amiiboId,
FirstWriteDate = DateTime.Now,
LastWriteDate = DateTime.Now,
WriteCounter = 0,
ApplicationAreas = new List<VirtualAmiiboApplicationArea>(),
ApplicationAreas = [],
};
SaveAmiiboFile(virtualAmiiboFile);

View File

@ -5,7 +5,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.GeneralService
{
static class GeneralServiceManager
{
private static readonly List<GeneralServiceDetail> _generalServices = new();
private static readonly List<GeneralServiceDetail> _generalServices = [];
public static int Count
{

View File

@ -15,7 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
private ulong _addOnContentBaseId;
private readonly List<ulong> _mountedAocTitleIds = new();
private readonly List<ulong> _mountedAocTitleIds = [];
public IAddOnContentManager(ServiceCtx context)
{

View File

@ -25,11 +25,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv
[Service("nvdrv:t")]
class INvDrvServices : IpcService
{
private static readonly List<string> _deviceFileDebugRegistry = new()
{
private static readonly List<string> _deviceFileDebugRegistry =
[
"/dev/nvhost-dbg-gpu",
"/dev/nvhost-prof-gpu",
};
"/dev/nvhost-prof-gpu"
];
private static readonly Dictionary<string, Type> _deviceFileRegistry = new()
{
@ -73,9 +73,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv
if (_deviceFileRegistry.TryGetValue(path, out Type deviceFileClass))
{
ConstructorInfo constructor = deviceFileClass.GetConstructor(new[] { typeof(ServiceCtx), typeof(IVirtualMemoryManager), typeof(ulong) });
ConstructorInfo constructor = deviceFileClass.GetConstructor([typeof(ServiceCtx), typeof(IVirtualMemoryManager), typeof(ulong)
]);
NvDeviceFile deviceFile = (NvDeviceFile)constructor.Invoke(new object[] { context, _clientMemory, _owner });
NvDeviceFile deviceFile = (NvDeviceFile)constructor.Invoke([context, _clientMemory, _owner]);
deviceFile.Path = path;

View File

@ -15,7 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu
private const uint SmallPageSize = 0x1000;
private const uint BigPageSize = 0x10000;
private static readonly uint[] _pageSizes = { SmallPageSize, BigPageSize };
private static readonly uint[] _pageSizes = [SmallPageSize, BigPageSize];
private const ulong SmallRegionLimit = 0x400000000UL; // 16 GiB
private const ulong DefaultUserSize = 1UL << 37;
@ -32,10 +32,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu
}
}
private static readonly VmRegion[] _vmRegions = {
private static readonly VmRegion[] _vmRegions =
[
new((ulong)BigPageSize << 16, SmallRegionLimit),
new(SmallRegionLimit, DefaultUserSize),
};
new(SmallRegionLimit, DefaultUserSize)
];
private readonly AddressSpaceContext _asContext;
private readonly NvMemoryAllocator _memoryAllocator;

View File

@ -23,7 +23,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv
private readonly TreeDictionary<ulong, ulong> _tree = new();
private readonly Dictionary<ulong, LinkedListNode<ulong>> _dictionary = new();
private readonly LinkedList<ulong> _list = new();
private readonly LinkedList<ulong> _list = [];
public NvMemoryAllocator()
{

View File

@ -12,15 +12,16 @@ namespace Ryujinx.HLE.HOS.Services.Pcv.Clkrst.ClkrstManager
#pragma warning restore IDE0052
private uint _clockRate;
private readonly DeviceCode[] _allowedDeviceCodeTable = {
private readonly DeviceCode[] _allowedDeviceCodeTable =
[
DeviceCode.Cpu, DeviceCode.Gpu, DeviceCode.Disp1, DeviceCode.Disp2,
DeviceCode.Tsec, DeviceCode.Mselect, DeviceCode.Sor1, DeviceCode.Host1x,
DeviceCode.Vic, DeviceCode.Nvenc, DeviceCode.Nvjpg, DeviceCode.Nvdec,
DeviceCode.Ape, DeviceCode.AudioDsp, DeviceCode.Emc, DeviceCode.Dsi,
DeviceCode.SysBus, DeviceCode.XusbSs, DeviceCode.XusbHost, DeviceCode.XusbDevice,
DeviceCode.Gpuaux, DeviceCode.Pcie, DeviceCode.Apbdma, DeviceCode.Sdmmc1,
DeviceCode.Sdmmc2, DeviceCode.Sdmmc4,
};
DeviceCode.Sdmmc2, DeviceCode.Sdmmc4
];
public IClkrstSession(DeviceCode deviceCode, uint unknown)
{

View File

@ -64,7 +64,7 @@ namespace Ryujinx.HLE.HOS.Services.Ro
return ResultCode.InvalidSize;
}
List<byte[]> hashes = new();
List<byte[]> hashes = [];
for (int i = 0; i < header.HashesCount; i++)
{

View File

@ -33,7 +33,7 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pdm.QueryService
PlayLogQueryCapability queryCapability = (PlayLogQueryCapability)context.Device.Processes.ActiveApplication.ApplicationControlProperties.PlayLogQueryCapability;
List<ulong> titleIds = new();
List<ulong> titleIds = [];
for (ulong i = 0; i < inputSize / sizeof(ulong); i++)
{

View File

@ -3,7 +3,7 @@ namespace Ryujinx.HLE.HOS.Services.Settings
static class KeyCodeMaps
{
public static byte[] Default =
{
[
0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -345,11 +345,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00
];
public static byte[] EnglishUsInternational =
{
[
0x01, 0x00, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -691,11 +691,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00
];
public static byte[] EnglishUk =
{
[
0x01, 0x00, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -1037,11 +1037,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00
];
public static byte[] French =
{
[
0x01, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -1383,11 +1383,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00
];
public static byte[] FrenchCa =
{
[
0x01, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -1729,11 +1729,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00
];
public static byte[] Spanish =
{
[
0x01, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -2075,11 +2075,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00
];
public static byte[] SpanishLatin =
{
[
0x01, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -2421,11 +2421,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00
];
public static byte[] German =
{
[
0x01, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -2767,11 +2767,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00
];
public static byte[] Italian =
{
[
0x01, 0x00, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -3113,11 +3113,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00
];
public static byte[] Portuguese =
{
[
0x01, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -3459,11 +3459,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00
];
public static byte[] Russian =
{
[
0x09, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -3805,11 +3805,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00
];
public static byte[] Korean =
{
[
0x11, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -4151,11 +4151,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00
];
public static byte[] ChineseSimplified =
{
[
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -4497,11 +4497,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00
];
public static byte[] ChineseTraditional =
{
[
0x61, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -4843,7 +4843,7 @@ namespace Ryujinx.HLE.HOS.Services.Settings
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
0x00, 0x00, 0x00, 0x00
];
};
}

View File

@ -17,7 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
private BsdContext()
{
_fds = new List<IFileDescriptor>();
_fds = [];
}
public ISocket RetrieveSocket(int socketFd)
@ -47,7 +47,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
public List<IFileDescriptor> RetrieveFileDescriptorsFromMask(ReadOnlySpan<byte> mask)
{
List<IFileDescriptor> fds = new();
List<IFileDescriptor> fds = [];
for (int i = 0; i < mask.Length; i++)
{

View File

@ -16,11 +16,11 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
[Service("bsd:u", false)]
class IClient : IpcService
{
private static readonly List<IPollManager> _pollManagers = new()
{
private static readonly List<IPollManager> _pollManagers =
[
EventFileDescriptorPollManager.Instance,
ManagedSocketPollManager.Instance,
};
ManagedSocketPollManager.Instance
];
private BsdContext _context;
private readonly bool _isPrivileged;
@ -265,7 +265,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
for (int i = 0; i < eventsByPollManager.Length; i++)
{
eventsByPollManager[i] = new List<PollEvent>();
eventsByPollManager[i] = [];
foreach (PollEvent evnt in events)
{
@ -361,12 +361,12 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
events[i] = new PollEvent(pollEventData, fileDescriptor);
}
List<PollEvent> discoveredEvents = new();
List<PollEvent> discoveredEvents = [];
List<PollEvent>[] eventsByPollManager = new List<PollEvent>[_pollManagers.Count];
for (int i = 0; i < eventsByPollManager.Length; i++)
{
eventsByPollManager[i] = new List<PollEvent>();
eventsByPollManager[i] = [];
foreach (PollEvent evnt in events)
{

View File

@ -28,7 +28,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
{
updatedCount = 0;
List<ManualResetEvent> waiters = new();
List<ManualResetEvent> waiters = [];
for (int i = 0; i < events.Count; i++)
{

View File

@ -27,9 +27,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
public LinuxError Poll(List<PollEvent> events, int timeoutMilliseconds, out int updatedCount)
{
List<ISocketImpl> readEvents = new();
List<ISocketImpl> writeEvents = new();
List<ISocketImpl> errorEvents = new();
List<ISocketImpl> readEvents = [];
List<ISocketImpl> writeEvents = [];
List<ISocketImpl> errorEvents = [];
updatedCount = 0;
@ -123,9 +123,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
public LinuxError Select(List<PollEvent> events, int timeout, out int updatedCount)
{
List<ISocketImpl> readEvents = new();
List<ISocketImpl> writeEvents = new();
List<ISocketImpl> errorEvents = new();
List<ISocketImpl> readEvents = [];
List<ISocketImpl> writeEvents = [];
List<ISocketImpl> errorEvents = [];
updatedCount = 0;

View File

@ -604,7 +604,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
private static List<AddrInfoSerialized> DeserializeAddrInfos(IVirtualMemoryManager memory, ulong address, ulong size)
{
List<AddrInfoSerialized> result = new();
List<AddrInfoSerialized> result = [];
ReadOnlySpan<byte> data = memory.GetSpan(address, (int)size);

View File

@ -19,14 +19,15 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Proxy
[GeneratedRegex(@"^accounts\.nintendo\.com$", RegexOpts)]
private static partial Regex BlockedHost6();
private static readonly Regex[] _blockedHosts = {
private static readonly Regex[] _blockedHosts =
[
BlockedHost1(),
BlockedHost2(),
BlockedHost3(),
BlockedHost4(),
BlockedHost5(),
BlockedHost6(),
};
BlockedHost6()
];
public static bool IsHostBlocked(string host)
{

View File

@ -44,7 +44,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Proxy
continue;
}
string[] entry = line.Split(new[] { ' ', '\t' }, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
string[] entry = line.Split([' ', '\t'], StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
// Hosts file example entry:
// 127.0.0.1 localhost loopback
@ -92,9 +92,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Proxy
return new IPHostEntry
{
AddressList = new[] { hostEntry.Value },
AddressList = [hostEntry.Value],
HostName = hostEntry.Key,
Aliases = Array.Empty<string>(),
Aliases = [],
};
}
}

View File

@ -66,7 +66,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
ConsumerListener = null;
ConsumerUsageBits = 0;
Queue = new List<BufferItem>();
Queue = [];
// TODO: CreateGraphicBufferAlloc?

View File

@ -12,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock
public SystemClockContextUpdateCallback()
{
_operationEventList = new List<KWritableEvent>();
_operationEventList = [];
Context = new SystemClockContext();
_hasContext = false;
}

View File

@ -32,11 +32,12 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
private const long AverageSecondsPerYear = 31556952;
private const long SecondsPerRepeat = YearsPerRepeat * AverageSecondsPerYear;
private static readonly int[] _yearLengths = { DaysPerNYear, DaysPerLYear };
private static readonly int[][] _monthsLengths = {
new[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
new[] { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
};
private static readonly int[] _yearLengths = [DaysPerNYear, DaysPerLYear];
private static readonly int[][] _monthsLengths =
[
[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
[31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
];
private static ReadOnlySpan<byte> TimeZoneDefaultRule => ",M4.1.0,M10.5.0"u8;

View File

@ -100,7 +100,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
StreamReader reader = new(binaryListFile.Get.AsStream());
List<string> locationNameList = new();
List<string> locationNameList = [];
string locationName;
while ((locationName = reader.ReadLine()) != null)
@ -112,7 +112,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
}
else
{
LocationNameCache = new[] { "UTC" };
LocationNameCache = ["UTC"];
Logger.Error?.Print(LogClass.ServiceTime, TimeZoneSystemTitleMissingErrorMessage);
}
@ -124,10 +124,10 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
if (string.IsNullOrEmpty(tzBinaryContentPath))
{
return new[] { (0, "UTC", "UTC") };
return [(0, "UTC", "UTC")];
}
List<(int Offset, string Location, string Abbr)> outList = new();
List<(int Offset, string Location, string Abbr)> outList = [];
long now = DateTimeOffset.Now.ToUnixTimeSeconds();
using (IStorage ncaStorage = new LocalStorage(VirtualFileSystem.SwitchPathToSystemPath(tzBinaryContentPath), FileAccess.Read, FileMode.Open))
using (IFileSystem romfs = new Nca(_virtualFileSystem.KeySet, ncaStorage).OpenFileSystem(NcaSectionType.Data, _fsIntegrityCheckLevel))
@ -217,7 +217,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
public ResultCode LoadLocationNameList(uint index, out string[] outLocationNameArray, uint maxLength)
{
List<string> locationNameList = new();
List<string> locationNameList = [];
for (int i = 0; i < LocationNameCache.Length && i < maxLength; i++)
{
@ -231,7 +231,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
// If the location name is too long, error out.
if (locationName.Length > 0x24)
{
outLocationNameArray = Array.Empty<string>();
outLocationNameArray = [];
return ResultCode.LocationNameTooLong;
}

View File

@ -34,7 +34,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService
public IApplicationDisplayService(ViServiceType serviceType)
{
_serviceType = serviceType;
_displayInfo = new List<DisplayInfo>();
_displayInfo = [];
_openDisplays = new Dictionary<ulong, DisplayState>();
void AddDisplayInfo(string name, bool layerLimitEnabled, ulong layerLimitMax, ulong width, ulong height)

View File

@ -4,7 +4,8 @@ namespace Ryujinx.HLE.HOS.SystemState
{
public class SystemStateMgr
{
internal static string[] LanguageCodes = {
internal static string[] LanguageCodes =
[
"ja",
"en-US",
"fr",
@ -22,8 +23,8 @@ namespace Ryujinx.HLE.HOS.SystemState
"es-419",
"zh-Hans",
"zh-Hant",
"pt-BR",
};
"pt-BR"
];
internal long DesiredKeyboardLayout { get; private set; }

View File

@ -26,12 +26,13 @@ namespace Ryujinx.HLE.HOS.Tamper
public ITamperProgram Compile(string name, IEnumerable<string> rawInstructions)
{
string[] addresses = {
string[] addresses =
[
$" Executable address: 0x{_exeAddress:X16}",
$" Heap address : 0x{_heapAddress:X16}",
$" Alias address : 0x{_aliasAddress:X16}",
$" Aslr address : 0x{_aslrAddress:X16}",
};
$" Aslr address : 0x{_aslrAddress:X16}"
];
Logger.Debug?.Print(LogClass.TamperMachine, $"Compiling Atmosphere cheat {name}...\n{string.Join('\n', addresses)}");

View File

@ -73,11 +73,11 @@ namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters
void Emit(Type operationType, IOperand rhs = null)
{
List<IOperand> operandList = new()
{
List<IOperand> operandList =
[
destinationRegister,
leftHandSideRegister,
};
leftHandSideRegister
];
if (rhs != null)
{

View File

@ -11,7 +11,7 @@ namespace Ryujinx.HLE.HOS.Tamper
public OperationBlock(byte[] baseInstruction)
{
BaseInstruction = baseInstruction;
Operations = new List<IOperation>();
Operations = [];
}
}
}

View File

@ -4,7 +4,7 @@ namespace Ryujinx.HLE.Loaders.Processes
{
// Binaries from exefs are loaded into mem in this order. Do not change.
public static readonly string[] ExeFsPrefixes =
{
[
"rtld",
"main",
"subsdk0",
@ -17,8 +17,8 @@ namespace Ryujinx.HLE.Loaders.Processes
"subsdk7",
"subsdk8",
"subsdk9",
"sdk",
};
"sdk"
];
public const string MainNpdmPath = "/main.npdm";