diff --git a/src/Ryujinx.Common/Collections/IntervalTree.cs b/src/Ryujinx.Common/Collections/IntervalTree.cs
index b5188cc7e..2ea260a5f 100644
--- a/src/Ryujinx.Common/Collections/IntervalTree.cs
+++ b/src/Ryujinx.Common/Collections/IntervalTree.cs
@@ -7,9 +7,9 @@ namespace Ryujinx.Common.Collections
///
/// An Augmented Interval Tree based off of the "TreeDictionary"'s Red-Black Tree. Allows fast overlap checking of ranges.
///
- /// Key
- /// Value
- public class IntervalTree : IntrusiveRedBlackTreeImpl> where K : IComparable
+ /// Key
+ /// Value
+ public class IntervalTree : IntrusiveRedBlackTreeImpl> where TKey : IComparable
{
private const int ArrayGrowthSize = 32;
@@ -22,11 +22,11 @@ namespace Ryujinx.Common.Collections
/// Overlaps array to place results in
/// Number of values found
/// is null
- public int Get(K key, ref V[] overlaps)
+ public int Get(TKey key, ref TValue[] overlaps)
{
ArgumentNullException.ThrowIfNull(key);
- IntervalTreeNode node = GetNode(key);
+ IntervalTreeNode node = GetNode(key);
if (node == null)
{
@@ -39,7 +39,7 @@ namespace Ryujinx.Common.Collections
}
int overlapsCount = 0;
- foreach (RangeNode value in node.Values)
+ foreach (RangeNode value in node.Values)
{
overlaps[overlapsCount++] = value.Value;
}
@@ -56,7 +56,7 @@ namespace Ryujinx.Common.Collections
/// Index to start writing results into the array. Defaults to 0
/// Number of values found
/// or is null
- public int Get(K start, K end, ref V[] overlaps, int overlapCount = 0)
+ public int Get(TKey start, TKey end, ref TValue[] overlaps, int overlapCount = 0)
{
ArgumentNullException.ThrowIfNull(start);
ArgumentNullException.ThrowIfNull(end);
@@ -73,7 +73,7 @@ namespace Ryujinx.Common.Collections
/// End of the range to insert
/// Value to add
/// , or are null
- public void Add(K start, K end, V value)
+ public void Add(TKey start, TKey end, TValue value)
{
ArgumentNullException.ThrowIfNull(start);
ArgumentNullException.ThrowIfNull(end);
@@ -89,7 +89,7 @@ namespace Ryujinx.Common.Collections
/// Value to remove
/// is null
/// Number of deleted values
- public int Remove(K key, V value)
+ public int Remove(TKey key, TValue value)
{
ArgumentNullException.ThrowIfNull(key);
@@ -104,9 +104,9 @@ namespace Ryujinx.Common.Collections
/// Adds all the nodes in the dictionary into .
///
/// A list of all RangeNodes sorted by Key Order
- public List> AsList()
+ public List> AsList()
{
- List> list = new List>();
+ List> list = new();
AddToList(Root, list);
@@ -122,7 +122,7 @@ namespace Ryujinx.Common.Collections
///
/// The node to search for RangeNodes within
/// The list to add RangeNodes to
- private void AddToList(IntervalTreeNode node, List> list)
+ private void AddToList(IntervalTreeNode node, List> list)
{
if (node == null)
{
@@ -142,11 +142,11 @@ namespace Ryujinx.Common.Collections
/// Key of the node to get
/// Node reference in the tree
/// is null
- private IntervalTreeNode GetNode(K key)
+ private IntervalTreeNode GetNode(TKey key)
{
ArgumentNullException.ThrowIfNull(key);
- IntervalTreeNode node = Root;
+ IntervalTreeNode node = Root;
while (node != null)
{
int cmp = key.CompareTo(node.Start);
@@ -173,7 +173,7 @@ namespace Ryujinx.Common.Collections
/// End of the range
/// Overlaps array to place results in
/// Overlaps count to update
- private void GetValues(IntervalTreeNode node, K start, K end, ref V[] overlaps, ref int overlapCount)
+ private void GetValues(IntervalTreeNode node, TKey start, TKey end, ref TValue[] overlaps, ref int overlapCount)
{
if (node == null || start.CompareTo(node.Max) >= 0)
{
@@ -188,7 +188,7 @@ namespace Ryujinx.Common.Collections
if (start.CompareTo(node.End) < 0)
{
// Contains this node. Add overlaps to list.
- foreach (RangeNode overlap in node.Values)
+ foreach (RangeNode overlap in node.Values)
{
if (start.CompareTo(overlap.End) < 0)
{
@@ -212,9 +212,9 @@ namespace Ryujinx.Common.Collections
/// Start of the range to insert
/// End of the range to insert
/// Value to insert
- private void Insert(K start, K end, V value)
+ private void Insert(TKey start, TKey end, TValue value)
{
- IntervalTreeNode newNode = BSTInsert(start, end, value);
+ IntervalTreeNode newNode = BSTInsert(start, end, value);
RestoreBalanceAfterInsertion(newNode);
}
@@ -223,10 +223,10 @@ namespace Ryujinx.Common.Collections
/// This should only be called if the max increases - not for rebalancing or removals.
///
/// The node to start propagating from
- private void PropagateIncrease(IntervalTreeNode node)
+ private static void PropagateIncrease(IntervalTreeNode node)
{
- K max = node.Max;
- IntervalTreeNode ptr = node;
+ TKey max = node.Max;
+ IntervalTreeNode ptr = node;
while ((ptr = ptr.Parent) != null)
{
@@ -246,13 +246,13 @@ namespace Ryujinx.Common.Collections
/// This fully recalculates the max value from all children when there is potential for it to decrease.
///
/// The node to start propagating from
- private void PropagateFull(IntervalTreeNode node)
+ private static void PropagateFull(IntervalTreeNode node)
{
- IntervalTreeNode ptr = node;
+ IntervalTreeNode ptr = node;
do
{
- K max = ptr.End;
+ TKey max = ptr.End;
if (ptr.Left != null && ptr.Left.Max.CompareTo(max) > 0)
{
@@ -278,10 +278,10 @@ namespace Ryujinx.Common.Collections
/// End of the range to insert
/// Value to insert
/// The inserted Node
- private IntervalTreeNode BSTInsert(K start, K end, V value)
+ private IntervalTreeNode BSTInsert(TKey start, TKey end, TValue value)
{
- IntervalTreeNode parent = null;
- IntervalTreeNode node = Root;
+ IntervalTreeNode parent = null;
+ IntervalTreeNode node = Root;
while (node != null)
{
@@ -297,7 +297,7 @@ namespace Ryujinx.Common.Collections
}
else
{
- node.Values.Add(new RangeNode(start, end, value));
+ node.Values.Add(new RangeNode(start, end, value));
if (end.CompareTo(node.End) > 0)
{
@@ -313,7 +313,7 @@ namespace Ryujinx.Common.Collections
return node;
}
}
- IntervalTreeNode newNode = new IntervalTreeNode(start, end, value, parent);
+ IntervalTreeNode newNode = new(start, end, value, parent);
if (newNode.Parent == null)
{
Root = newNode;
@@ -338,9 +338,9 @@ namespace Ryujinx.Common.Collections
/// Key to search for
/// Value to delete
/// Number of deleted values
- private int Delete(K key, V value)
+ private int Delete(TKey key, TValue value)
{
- IntervalTreeNode nodeToDelete = GetNode(key);
+ IntervalTreeNode nodeToDelete = GetNode(key);
if (nodeToDelete == null)
{
@@ -362,7 +362,7 @@ namespace Ryujinx.Common.Collections
return removed;
}
- IntervalTreeNode replacementNode;
+ IntervalTreeNode replacementNode;
if (LeftOf(nodeToDelete) == null || RightOf(nodeToDelete) == null)
{
@@ -373,7 +373,7 @@ namespace Ryujinx.Common.Collections
replacementNode = PredecessorOf(nodeToDelete);
}
- IntervalTreeNode tmp = LeftOf(replacementNode) ?? RightOf(replacementNode);
+ IntervalTreeNode tmp = LeftOf(replacementNode) ?? RightOf(replacementNode);
if (tmp != null)
{
@@ -413,7 +413,7 @@ namespace Ryujinx.Common.Collections
#endregion
- protected override void RotateLeft(IntervalTreeNode node)
+ protected override void RotateLeft(IntervalTreeNode node)
{
if (node != null)
{
@@ -423,7 +423,7 @@ namespace Ryujinx.Common.Collections
}
}
- protected override void RotateRight(IntervalTreeNode node)
+ protected override void RotateRight(IntervalTreeNode node)
{
if (node != null)
{
@@ -433,7 +433,7 @@ namespace Ryujinx.Common.Collections
}
}
- public bool ContainsKey(K key)
+ public bool ContainsKey(TKey key)
{
ArgumentNullException.ThrowIfNull(key);
@@ -444,15 +444,15 @@ namespace Ryujinx.Common.Collections
///
/// Represents a value and its start and end keys.
///
- ///
- ///
- public readonly struct RangeNode
+ ///
+ ///
+ public readonly struct RangeNode
{
- public readonly K Start;
- public readonly K End;
- public readonly V Value;
+ public readonly TKey Start;
+ public readonly TKey End;
+ public readonly TValue Value;
- public RangeNode(K start, K end, V value)
+ public RangeNode(TKey start, TKey end, TValue value)
{
Start = start;
End = end;
@@ -463,36 +463,36 @@ namespace Ryujinx.Common.Collections
///
/// Represents a node in the IntervalTree which contains start and end keys of type K, and a value of generic type V.
///
- /// Key type of the node
- /// Value type of the node
- public class IntervalTreeNode : IntrusiveRedBlackTreeNode>
+ /// Key type of the node
+ /// Value type of the node
+ public class IntervalTreeNode : IntrusiveRedBlackTreeNode>
{
///
/// The start of the range.
///
- internal K Start;
+ internal TKey Start;
///
/// The end of the range - maximum of all in the Values list.
///
- internal K End;
+ internal TKey End;
///
/// The maximum end value of this node and all its children.
///
- internal K Max;
+ internal TKey Max;
///
/// Values contained on the node that shares a common Start value.
///
- internal List> Values;
+ internal List> Values;
- internal IntervalTreeNode(K start, K end, V value, IntervalTreeNode parent)
+ internal IntervalTreeNode(TKey start, TKey end, TValue value, IntervalTreeNode parent)
{
Start = start;
End = end;
Max = end;
- Values = new List> { new RangeNode(start, end, value) };
+ Values = new List> { new RangeNode(start, end, value) };
Parent = parent;
}
}
diff --git a/src/Ryujinx.Common/Collections/IntrusiveRedBlackTree.cs b/src/Ryujinx.Common/Collections/IntrusiveRedBlackTree.cs
index 0063d91e4..9e56f707b 100644
--- a/src/Ryujinx.Common/Collections/IntrusiveRedBlackTree.cs
+++ b/src/Ryujinx.Common/Collections/IntrusiveRedBlackTree.cs
@@ -180,11 +180,6 @@ namespace Ryujinx.Common.Collections
parent.Right = child;
}
- if (ParentOf(element) == old)
- {
- parent = element;
- }
-
element.Color = old.Color;
element.Left = old.Left;
element.Right = old.Right;
@@ -258,11 +253,11 @@ namespace Ryujinx.Common.Collections
/// Tree to search at
/// Key of the node to be found
/// Node that is equal to
- public static N GetNodeByKey(this IntrusiveRedBlackTree tree, K key)
- where N : IntrusiveRedBlackTreeNode, IComparable, IComparable
- where K : struct
+ public static TNode GetNodeByKey(this IntrusiveRedBlackTree tree, TKey key)
+ where TNode : IntrusiveRedBlackTreeNode, IComparable, IComparable
+ where TKey : struct
{
- N node = tree.RootNode;
+ TNode node = tree.RootNode;
while (node != null)
{
int cmp = node.CompareTo(key);
diff --git a/src/Ryujinx.Common/Collections/IntrusiveRedBlackTreeImpl.cs b/src/Ryujinx.Common/Collections/IntrusiveRedBlackTreeImpl.cs
index bcb2e2a23..49f97223a 100644
--- a/src/Ryujinx.Common/Collections/IntrusiveRedBlackTreeImpl.cs
+++ b/src/Ryujinx.Common/Collections/IntrusiveRedBlackTreeImpl.cs
@@ -10,7 +10,7 @@ namespace Ryujinx.Common.Collections
{
protected const bool Black = true;
protected const bool Red = false;
- protected T Root = null;
+ protected T Root;
internal T RootNode => Root;
diff --git a/src/Ryujinx.Common/Collections/IntrusiveRedBlackTreeNode.cs b/src/Ryujinx.Common/Collections/IntrusiveRedBlackTreeNode.cs
index 7143240da..8480d51ad 100644
--- a/src/Ryujinx.Common/Collections/IntrusiveRedBlackTreeNode.cs
+++ b/src/Ryujinx.Common/Collections/IntrusiveRedBlackTreeNode.cs
@@ -13,4 +13,4 @@ namespace Ryujinx.Common.Collections
public T Predecessor => IntrusiveRedBlackTreeImpl.PredecessorOf((T)this);
public T Successor => IntrusiveRedBlackTreeImpl.SuccessorOf((T)this);
}
-}
\ No newline at end of file
+}
diff --git a/src/Ryujinx.Common/Collections/TreeDictionary.cs b/src/Ryujinx.Common/Collections/TreeDictionary.cs
index d118a30cc..ff1794883 100644
--- a/src/Ryujinx.Common/Collections/TreeDictionary.cs
+++ b/src/Ryujinx.Common/Collections/TreeDictionary.cs
@@ -8,9 +8,9 @@ namespace Ryujinx.Common.Collections
///
/// Dictionary that provides the ability for O(logN) Lookups for keys that exist in the Dictionary, and O(logN) lookups for keys immediately greater than or less than a specified key.
///
- /// Key
- /// Value
- public class TreeDictionary : IntrusiveRedBlackTreeImpl>, IDictionary where K : IComparable
+ /// Key
+ /// Value
+ public class TreeDictionary : IntrusiveRedBlackTreeImpl>, IDictionary where TKey : IComparable
{
#region Public Methods
@@ -20,11 +20,11 @@ namespace Ryujinx.Common.Collections
/// Key of the node value to get
/// Value associated w/
/// is null
- public V Get(K key)
+ public TValue Get(TKey key)
{
ArgumentNullException.ThrowIfNull(key);
- Node node = GetNode(key);
+ Node node = GetNode(key);
if (node == null)
{
@@ -42,7 +42,7 @@ namespace Ryujinx.Common.Collections
/// Key of the node to add
/// Value of the node to add
/// or are null
- public void Add(K key, V value)
+ public void Add(TKey key, TValue value)
{
ArgumentNullException.ThrowIfNull(key);
ArgumentNullException.ThrowIfNull(value);
@@ -55,7 +55,7 @@ namespace Ryujinx.Common.Collections
///
/// Key of the node to remove
/// is null
- public void Remove(K key)
+ public void Remove(TKey key)
{
ArgumentNullException.ThrowIfNull(key);
@@ -71,9 +71,9 @@ namespace Ryujinx.Common.Collections
/// Key for which to find the floor value of
/// Key of node immediately less than
/// is null
- public K Floor(K key)
+ public TKey Floor(TKey key)
{
- Node node = FloorNode(key);
+ Node node = FloorNode(key);
if (node != null)
{
return node.Key;
@@ -87,9 +87,9 @@ namespace Ryujinx.Common.Collections
/// Key for which to find the ceiling node of
/// Key of node immediately greater than
/// is null
- public K Ceiling(K key)
+ public TKey Ceiling(TKey key)
{
- Node node = CeilingNode(key);
+ Node node = CeilingNode(key);
if (node != null)
{
return node.Key;
@@ -102,12 +102,12 @@ namespace Ryujinx.Common.Collections
///
/// Key to find the successor of
/// Value
- public K SuccessorOf(K key)
+ public TKey SuccessorOf(TKey key)
{
- Node node = GetNode(key);
+ Node node = GetNode(key);
if (node != null)
{
- Node successor = SuccessorOf(node);
+ Node successor = SuccessorOf(node);
return successor != null ? successor.Key : default;
}
@@ -119,12 +119,12 @@ namespace Ryujinx.Common.Collections
///
/// Key to find the predecessor of
/// Value
- public K PredecessorOf(K key)
+ public TKey PredecessorOf(TKey key)
{
- Node node = GetNode(key);
+ Node node = GetNode(key);
if (node != null)
{
- Node predecessor = PredecessorOf(node);
+ Node predecessor = PredecessorOf(node);
return predecessor != null ? predecessor.Key : default;
}
@@ -137,19 +137,19 @@ namespace Ryujinx.Common.Collections
/// The key/value pairs will be added in Level Order.
///
/// List to add the tree pairs into
- public List> AsLevelOrderList()
+ public List> AsLevelOrderList()
{
- List> list = new List>();
+ List> list = new();
- Queue> nodes = new Queue>();
+ Queue> nodes = new();
if (this.Root != null)
{
nodes.Enqueue(this.Root);
}
- while (nodes.TryDequeue(out Node node))
+ while (nodes.TryDequeue(out Node node))
{
- list.Add(new KeyValuePair(node.Key, node.Value));
+ list.Add(new KeyValuePair(node.Key, node.Value));
if (node.Left != null)
{
nodes.Enqueue(node.Left);
@@ -166,9 +166,9 @@ namespace Ryujinx.Common.Collections
/// Adds all the nodes in the dictionary into .
///
/// A list of all KeyValuePairs sorted by Key Order
- public List> AsList()
+ public List> AsList()
{
- List> list = new List>();
+ List> list = new();
AddToList(Root, list);
@@ -184,7 +184,7 @@ namespace Ryujinx.Common.Collections
///
/// The node to search for nodes within
/// The list to add node to
- private void AddToList(Node node, List> list)
+ private void AddToList(Node node, List> list)
{
if (node == null)
{
@@ -193,7 +193,7 @@ namespace Ryujinx.Common.Collections
AddToList(node.Left, list);
- list.Add(new KeyValuePair(node.Key, node.Value));
+ list.Add(new KeyValuePair(node.Key, node.Value));
AddToList(node.Right, list);
}
@@ -204,11 +204,11 @@ namespace Ryujinx.Common.Collections
/// Key of the node to get
/// Node reference in the tree
/// is null
- private Node GetNode(K key)
+ private Node GetNode(TKey key)
{
ArgumentNullException.ThrowIfNull(key);
- Node node = Root;
+ Node node = Root;
while (node != null)
{
int cmp = key.CompareTo(node.Key);
@@ -235,9 +235,9 @@ namespace Ryujinx.Common.Collections
///
/// Key of the node to insert
/// Value of the node to insert
- private void Insert(K key, V value)
+ private void Insert(TKey key, TValue value)
{
- Node newNode = BSTInsert(key, value);
+ Node newNode = BSTInsert(key, value);
RestoreBalanceAfterInsertion(newNode);
}
@@ -251,10 +251,10 @@ namespace Ryujinx.Common.Collections
/// Key of the node to insert
/// Value of the node to insert
/// The inserted Node
- private Node BSTInsert(K key, V value)
+ private Node BSTInsert(TKey key, TValue value)
{
- Node parent = null;
- Node node = Root;
+ Node parent = null;
+ Node node = Root;
while (node != null)
{
@@ -274,7 +274,7 @@ namespace Ryujinx.Common.Collections
return node;
}
}
- Node newNode = new Node(key, value, parent);
+ Node newNode = new(key, value, parent);
if (newNode.Parent == null)
{
Root = newNode;
@@ -296,14 +296,17 @@ namespace Ryujinx.Common.Collections
///
/// Key of the node to delete
/// The deleted Node
- private Node Delete(K key)
+ private Node Delete(TKey key)
{
// O(1) Retrieval
- Node nodeToDelete = GetNode(key);
+ Node nodeToDelete = GetNode(key);
- if (nodeToDelete == null) return null;
+ if (nodeToDelete == null)
+ {
+ return null;
+ }
- Node replacementNode;
+ Node replacementNode;
if (LeftOf(nodeToDelete) == null || RightOf(nodeToDelete) == null)
{
@@ -314,7 +317,7 @@ namespace Ryujinx.Common.Collections
replacementNode = PredecessorOf(nodeToDelete);
}
- Node tmp = LeftOf(replacementNode) ?? RightOf(replacementNode);
+ Node tmp = LeftOf(replacementNode) ?? RightOf(replacementNode);
if (tmp != null)
{
@@ -354,11 +357,11 @@ namespace Ryujinx.Common.Collections
/// Key for which to find the floor node of
/// Node whose key is immediately less than or equal to , or null if no such node is found.
/// is null
- private Node FloorNode(K key)
+ private Node FloorNode(TKey key)
{
ArgumentNullException.ThrowIfNull(key);
- Node tmp = Root;
+ Node tmp = Root;
while (tmp != null)
{
@@ -382,8 +385,8 @@ namespace Ryujinx.Common.Collections
}
else
{
- Node parent = tmp.Parent;
- Node ptr = tmp;
+ Node parent = tmp.Parent;
+ Node ptr = tmp;
while (parent != null && ptr == parent.Left)
{
ptr = parent;
@@ -406,11 +409,11 @@ namespace Ryujinx.Common.Collections
/// Key for which to find the ceiling node of
/// Node whose key is immediately greater than or equal to , or null if no such node is found.
/// is null
- private Node CeilingNode(K key)
+ private Node CeilingNode(TKey key)
{
ArgumentNullException.ThrowIfNull(key);
- Node tmp = Root;
+ Node tmp = Root;
while (tmp != null)
{
@@ -434,8 +437,8 @@ namespace Ryujinx.Common.Collections
}
else
{
- Node parent = tmp.Parent;
- Node ptr = tmp;
+ Node parent = tmp.Parent;
+ Node ptr = tmp;
while (parent != null && ptr == parent.Right)
{
ptr = parent;
@@ -457,44 +460,44 @@ namespace Ryujinx.Common.Collections
#region Interface Implementations
// Method descriptions are not provided as they are already included as part of the interface.
- public bool ContainsKey(K key)
+ public bool ContainsKey(TKey key)
{
ArgumentNullException.ThrowIfNull(key);
return GetNode(key) != null;
}
- bool IDictionary.Remove(K key)
+ bool IDictionary.Remove(TKey key)
{
int count = Count;
Remove(key);
return count > Count;
}
- public bool TryGetValue(K key, [MaybeNullWhen(false)] out V value)
+ public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
{
ArgumentNullException.ThrowIfNull(key);
- Node node = GetNode(key);
+ Node node = GetNode(key);
value = node != null ? node.Value : default;
return node != null;
}
- public void Add(KeyValuePair item)
+ public void Add(KeyValuePair item)
{
ArgumentNullException.ThrowIfNull(item.Key);
Add(item.Key, item.Value);
}
- public bool Contains(KeyValuePair item)
+ public bool Contains(KeyValuePair item)
{
if (item.Key == null)
{
return false;
}
- Node node = GetNode(item.Key);
+ Node node = GetNode(item.Key);
if (node != null)
{
return node.Key.Equals(item.Key) && node.Value.Equals(item.Value);
@@ -502,27 +505,27 @@ namespace Ryujinx.Common.Collections
return false;
}
- public void CopyTo(KeyValuePair[] array, int arrayIndex)
+ public void CopyTo(KeyValuePair[] array, int arrayIndex)
{
if (arrayIndex < 0 || array.Length - arrayIndex < this.Count)
{
throw new ArgumentOutOfRangeException(nameof(arrayIndex));
}
- SortedList list = GetKeyValues();
+ SortedList list = GetKeyValues();
int offset = 0;
for (int i = arrayIndex; i < array.Length && offset < list.Count; i++)
{
- array[i] = new KeyValuePair(list.Keys[i], list.Values[i]);
+ array[i] = new KeyValuePair(list.Keys[i], list.Values[i]);
offset++;
}
}
- public bool Remove(KeyValuePair item)
+ public bool Remove(KeyValuePair item)
{
- Node node = GetNode(item.Key);
+ Node node = GetNode(item.Key);
if (node == null)
{
@@ -539,7 +542,7 @@ namespace Ryujinx.Common.Collections
return false;
}
- public IEnumerator> GetEnumerator()
+ public IEnumerator> GetEnumerator()
{
return GetKeyValues().GetEnumerator();
}
@@ -549,13 +552,13 @@ namespace Ryujinx.Common.Collections
return GetKeyValues().GetEnumerator();
}
- public ICollection Keys => GetKeyValues().Keys;
+ public ICollection Keys => GetKeyValues().Keys;
- public ICollection Values => GetKeyValues().Values;
+ public ICollection Values => GetKeyValues().Values;
public bool IsReadOnly => false;
- public V this[K key]
+ public TValue this[TKey key]
{
get => Get(key);
set => Add(key, value);
@@ -569,16 +572,16 @@ namespace Ryujinx.Common.Collections
/// Returns a sorted list of all the node keys / values in the tree.
///
/// List of node keys
- private SortedList GetKeyValues()
+ private SortedList GetKeyValues()
{
- SortedList set = new SortedList();
- Queue> queue = new Queue>();
+ SortedList set = new();
+ Queue> queue = new();
if (Root != null)
{
queue.Enqueue(Root);
}
- while (queue.TryDequeue(out Node node))
+ while (queue.TryDequeue(out Node node))
{
set.Add(node.Key, node.Value);
if (null != node.Left)
@@ -600,14 +603,14 @@ namespace Ryujinx.Common.Collections
///
/// Represents a node in the TreeDictionary which contains a key and value of generic type K and V, respectively.
///
- /// Key of the node
- /// Value of the node
- public class Node : IntrusiveRedBlackTreeNode> where K : IComparable
+ /// Key of the node
+ /// Value of the node
+ public class Node : IntrusiveRedBlackTreeNode> where TKey : IComparable
{
- internal K Key;
- internal V Value;
+ internal TKey Key;
+ internal TValue Value;
- internal Node(K key, V value, Node parent)
+ internal Node(TKey key, TValue value, Node parent)
{
Key = key;
Value = value;
diff --git a/src/Ryujinx.Common/Configuration/AntiAliasing.cs b/src/Ryujinx.Common/Configuration/AntiAliasing.cs
index 159108ae4..9ab0458cd 100644
--- a/src/Ryujinx.Common/Configuration/AntiAliasing.cs
+++ b/src/Ryujinx.Common/Configuration/AntiAliasing.cs
@@ -11,6 +11,6 @@ namespace Ryujinx.Common.Configuration
SmaaLow,
SmaaMedium,
SmaaHigh,
- SmaaUltra
+ SmaaUltra,
}
-}
\ No newline at end of file
+}
diff --git a/src/Ryujinx.Common/Configuration/AppDataManager.cs b/src/Ryujinx.Common/Configuration/AppDataManager.cs
index b685e7064..1dbc1f0ce 100644
--- a/src/Ryujinx.Common/Configuration/AppDataManager.cs
+++ b/src/Ryujinx.Common/Configuration/AppDataManager.cs
@@ -18,7 +18,7 @@ namespace Ryujinx.Common.Configuration
{
UserProfile,
Portable,
- Custom
+ Custom,
}
public static LaunchMode Mode { get; private set; }
@@ -34,7 +34,7 @@ namespace Ryujinx.Common.Configuration
private const string DefaultModsDir = "mods";
public static string CustomModsPath { get; set; }
- public static string CustomSdModsPath {get; set; }
+ public static string CustomSdModsPath { get; set; }
public static string CustomNandPath { get; set; } // TODO: Actually implement this into VFS
public static string CustomSdCardPath { get; set; } // TODO: Actually implement this into VFS
@@ -151,7 +151,7 @@ namespace Ryujinx.Common.Configuration
}
}
- public static string GetModsPath() => CustomModsPath ?? Directory.CreateDirectory(Path.Combine(BaseDirPath, DefaultModsDir)).FullName;
+ public static string GetModsPath() => CustomModsPath ?? Directory.CreateDirectory(Path.Combine(BaseDirPath, DefaultModsDir)).FullName;
public static string GetSdModsPath() => CustomSdModsPath ?? Directory.CreateDirectory(Path.Combine(BaseDirPath, DefaultSdcardDir, "atmosphere")).FullName;
}
-}
\ No newline at end of file
+}
diff --git a/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs b/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs
index 5e97ed19c..c9bf24650 100644
--- a/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs
+++ b/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs
@@ -11,7 +11,7 @@ namespace Ryujinx.Common.Configuration
Fixed16x10,
Fixed21x9,
Fixed32x9,
- Stretched
+ Stretched,
}
public static class AspectRatioExtensions
@@ -25,12 +25,14 @@ namespace Ryujinx.Common.Configuration
{
return aspectRatio switch
{
+#pragma warning disable IDE0055 // Disable formatting
AspectRatio.Fixed4x3 => 4.0f,
AspectRatio.Fixed16x9 => 16.0f,
AspectRatio.Fixed16x10 => 16.0f,
AspectRatio.Fixed21x9 => 21.0f,
AspectRatio.Fixed32x9 => 32.0f,
- _ => 16.0f
+ _ => 16.0f,
+#pragma warning restore IDE0055
};
}
@@ -38,12 +40,14 @@ namespace Ryujinx.Common.Configuration
{
return aspectRatio switch
{
+#pragma warning disable IDE0055 // Disable formatting
AspectRatio.Fixed4x3 => 3.0f,
AspectRatio.Fixed16x9 => 9.0f,
AspectRatio.Fixed16x10 => 10.0f,
AspectRatio.Fixed21x9 => 9.0f,
AspectRatio.Fixed32x9 => 9.0f,
- _ => 9.0f
+ _ => 9.0f,
+#pragma warning restore IDE0055
};
}
@@ -51,13 +55,15 @@ namespace Ryujinx.Common.Configuration
{
return aspectRatio switch
{
+#pragma warning disable IDE0055 // Disable formatting
AspectRatio.Fixed4x3 => "4:3",
AspectRatio.Fixed16x9 => "16:9",
AspectRatio.Fixed16x10 => "16:10",
AspectRatio.Fixed21x9 => "21:9",
AspectRatio.Fixed32x9 => "32:9",
- _ => "Stretched"
+ _ => "Stretched",
+#pragma warning restore IDE0055
};
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Ryujinx.Common/Configuration/DownloadableContentContainer.cs b/src/Ryujinx.Common/Configuration/DownloadableContentContainer.cs
index b6ae2f3fb..f9e68a3c2 100644
--- a/src/Ryujinx.Common/Configuration/DownloadableContentContainer.cs
+++ b/src/Ryujinx.Common/Configuration/DownloadableContentContainer.cs
@@ -10,4 +10,4 @@ namespace Ryujinx.Common.Configuration
[JsonPropertyName("dlc_nca_list")]
public List DownloadableContentNcaList { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Ryujinx.Common/Configuration/DownloadableContentJsonSerializerContext.cs b/src/Ryujinx.Common/Configuration/DownloadableContentJsonSerializerContext.cs
index 132c45a44..0dbc0a301 100644
--- a/src/Ryujinx.Common/Configuration/DownloadableContentJsonSerializerContext.cs
+++ b/src/Ryujinx.Common/Configuration/DownloadableContentJsonSerializerContext.cs
@@ -8,4 +8,4 @@ namespace Ryujinx.Common.Configuration
public partial class DownloadableContentJsonSerializerContext : JsonSerializerContext
{
}
-}
\ No newline at end of file
+}
diff --git a/src/Ryujinx.Common/Configuration/DownloadableContentNca.cs b/src/Ryujinx.Common/Configuration/DownloadableContentNca.cs
index 80b67300e..dded719cf 100644
--- a/src/Ryujinx.Common/Configuration/DownloadableContentNca.cs
+++ b/src/Ryujinx.Common/Configuration/DownloadableContentNca.cs
@@ -7,8 +7,8 @@ namespace Ryujinx.Common.Configuration
[JsonPropertyName("path")]
public string FullPath { get; set; }
[JsonPropertyName("title_id")]
- public ulong TitleId { get; set; }
+ public ulong TitleId { get; set; }
[JsonPropertyName("is_enabled")]
- public bool Enabled { get; set; }
+ public bool Enabled { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Ryujinx.Common/Configuration/Hid/Controller/GamepadInputId.cs b/src/Ryujinx.Common/Configuration/Hid/Controller/GamepadInputId.cs
index ad1fa6673..78bc46f21 100644
--- a/src/Ryujinx.Common/Configuration/Hid/Controller/GamepadInputId.cs
+++ b/src/Ryujinx.Common/Configuration/Hid/Controller/GamepadInputId.cs
@@ -53,6 +53,6 @@ namespace Ryujinx.Common.Configuration.Hid.Controller
SingleLeftTrigger1,
SingleRightTrigger1,
- Count
+ Count,
}
-}
\ No newline at end of file
+}
diff --git a/src/Ryujinx.Common/Configuration/Hid/Controller/GenericControllerInputConfig.cs b/src/Ryujinx.Common/Configuration/Hid/Controller/GenericControllerInputConfig.cs
index d7f0e7881..abc245bc4 100644
--- a/src/Ryujinx.Common/Configuration/Hid/Controller/GenericControllerInputConfig.cs
+++ b/src/Ryujinx.Common/Configuration/Hid/Controller/GenericControllerInputConfig.cs
@@ -4,7 +4,7 @@ using System.Text.Json.Serialization;
namespace Ryujinx.Common.Configuration.Hid.Controller
{
- public class GenericControllerInputConfig