mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-03-14 20:50:18 +00:00
Use Enum generic overloads
This commit is contained in:
parent
ce71f9144e
commit
391d484b5f
10 changed files with 11 additions and 11 deletions
|
@ -94,7 +94,7 @@ namespace Ryujinx.Common.Logging
|
||||||
|
|
||||||
static Logger()
|
static Logger()
|
||||||
{
|
{
|
||||||
m_EnabledClasses = new bool[Enum.GetNames(typeof(LogClass)).Length];
|
m_EnabledClasses = new bool[Enum.GetNames<LogClass>().Length];
|
||||||
|
|
||||||
for (int index = 0; index < m_EnabledClasses.Length; index++)
|
for (int index = 0; index < m_EnabledClasses.Length; index++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.OpenGL
|
||||||
|
|
||||||
static FormatTable()
|
static FormatTable()
|
||||||
{
|
{
|
||||||
int tableSize = Enum.GetNames(typeof(Format)).Length;
|
int tableSize = Enum.GetNames<Format>().Length;
|
||||||
|
|
||||||
Table = new FormatInfo[tableSize];
|
Table = new FormatInfo[tableSize];
|
||||||
TableImage = new SizedInternalFormat[tableSize];
|
TableImage = new SizedInternalFormat[tableSize];
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.OpenGL.Queries
|
||||||
|
|
||||||
public Counters()
|
public Counters()
|
||||||
{
|
{
|
||||||
int count = Enum.GetNames(typeof(CounterType)).Length;
|
int count = Enum.GetNames<CounterType>().Length;
|
||||||
|
|
||||||
_counterQueues = new CounterQueue[count];
|
_counterQueues = new CounterQueue[count];
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ namespace Ryujinx.HLE.FileSystem.Content
|
||||||
_contentDictionary = new SortedDictionary<(ulong, NcaContentType), string>();
|
_contentDictionary = new SortedDictionary<(ulong, NcaContentType), string>();
|
||||||
_locationEntries = new Dictionary<StorageId, LinkedList<LocationEntry>>();
|
_locationEntries = new Dictionary<StorageId, LinkedList<LocationEntry>>();
|
||||||
|
|
||||||
foreach (StorageId storageId in Enum.GetValues(typeof(StorageId)))
|
foreach (StorageId storageId in Enum.GetValues<StorageId>())
|
||||||
{
|
{
|
||||||
string contentDirectory = null;
|
string contentDirectory = null;
|
||||||
string contentPathString = null;
|
string contentPathString = null;
|
||||||
|
|
|
@ -1021,7 +1021,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
|
|
||||||
HidVibrationDeviceType vibrationDeviceType = HidVibrationDeviceType.None;
|
HidVibrationDeviceType vibrationDeviceType = HidVibrationDeviceType.None;
|
||||||
|
|
||||||
if (Enum.IsDefined(typeof(NpadStyleIndex), deviceType))
|
if (Enum.IsDefined<NpadStyleIndex>(deviceType))
|
||||||
{
|
{
|
||||||
vibrationDeviceType = HidVibrationDeviceType.LinearResonantActuator;
|
vibrationDeviceType = HidVibrationDeviceType.LinearResonantActuator;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace Ryujinx.HLE.HOS.SystemState
|
||||||
SystemLanguage.TraditionalChinese => TitleLanguage.Taiwanese,
|
SystemLanguage.TraditionalChinese => TitleLanguage.Taiwanese,
|
||||||
SystemLanguage.Chinese or
|
SystemLanguage.Chinese or
|
||||||
SystemLanguage.SimplifiedChinese => TitleLanguage.Chinese,
|
SystemLanguage.SimplifiedChinese => TitleLanguage.Chinese,
|
||||||
_ => Enum.Parse<TitleLanguage>(Enum.GetName(typeof(SystemLanguage), language)),
|
_ => Enum.Parse<TitleLanguage>(Enum.GetName<SystemLanguage>(language)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ namespace Ryujinx.Input.Motion.CemuHook
|
||||||
private readonly Dictionary<int, Dictionary<int, MotionInput>> _motionData;
|
private readonly Dictionary<int, Dictionary<int, MotionInput>> _motionData;
|
||||||
private readonly Dictionary<int, UdpClient> _clients;
|
private readonly Dictionary<int, UdpClient> _clients;
|
||||||
|
|
||||||
private readonly bool[] _clientErrorStatus = new bool[Enum.GetValues(typeof(PlayerIndex)).Length];
|
private readonly bool[] _clientErrorStatus = new bool[Enum.GetValues<PlayerIndex>().Length];
|
||||||
private readonly long[] _clientRetryTimer = new long[Enum.GetValues(typeof(PlayerIndex)).Length];
|
private readonly long[] _clientRetryTimer = new long[Enum.GetValues<PlayerIndex>().Length];
|
||||||
private NpadManager _npadManager;
|
private NpadManager _npadManager;
|
||||||
|
|
||||||
public Client(NpadManager npadManager)
|
public Client(NpadManager npadManager)
|
||||||
|
|
|
@ -150,7 +150,7 @@ namespace Ryujinx.Input.GTK3
|
||||||
|
|
||||||
static GTK3MappingHelper()
|
static GTK3MappingHelper()
|
||||||
{
|
{
|
||||||
var inputKeys = Enum.GetValues(typeof(Key));
|
var inputKeys = Enum.GetValues<Key>();
|
||||||
|
|
||||||
// GtkKey is not contiguous and quite large, so use a dictionary instead of an array.
|
// GtkKey is not contiguous and quite large, so use a dictionary instead of an array.
|
||||||
_gtkKeyMapping = new Dictionary<GtkKey, Key>();
|
_gtkKeyMapping = new Dictionary<GtkKey, Key>();
|
||||||
|
|
|
@ -1209,7 +1209,7 @@ namespace Ryujinx.Ui
|
||||||
{
|
{
|
||||||
AspectRatio aspectRatio = ConfigurationState.Instance.Graphics.AspectRatio.Value;
|
AspectRatio aspectRatio = ConfigurationState.Instance.Graphics.AspectRatio.Value;
|
||||||
|
|
||||||
ConfigurationState.Instance.Graphics.AspectRatio.Value = ((int)aspectRatio + 1) > Enum.GetNames(typeof(AspectRatio)).Length - 1 ? AspectRatio.Fixed4x3 : aspectRatio + 1;
|
ConfigurationState.Instance.Graphics.AspectRatio.Value = ((int)aspectRatio + 1) > Enum.GetNames<AspectRatio>().Length - 1 ? AspectRatio.Fixed4x3 : aspectRatio + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Row_Clicked(object sender, ButtonReleaseEventArgs args)
|
private void Row_Clicked(object sender, ButtonReleaseEventArgs args)
|
||||||
|
|
|
@ -181,7 +181,7 @@ namespace Ryujinx.Ui.Windows
|
||||||
_fsAccessLogToggle.Click();
|
_fsAccessLogToggle.Click();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (GraphicsDebugLevel level in Enum.GetValues(typeof(GraphicsDebugLevel)))
|
foreach (GraphicsDebugLevel level in Enum.GetValues<GraphicsDebugLevel>())
|
||||||
{
|
{
|
||||||
_graphicsDebugLevel.Append(level.ToString(), level.ToString());
|
_graphicsDebugLevel.Append(level.ToString(), level.ToString());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue