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

@ -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)