diff --git a/distribution/macos/create_macos_build.sh b/distribution/macos/create_macos_build.sh
index 7405073d2..80594a40a 100755
--- a/distribution/macos/create_macos_build.sh
+++ b/distribution/macos/create_macos_build.sh
@@ -35,12 +35,12 @@ EXECUTABLE_SUB_PATH=Contents/MacOS/Ryujinx
rm -rf "$TEMP_DIRECTORY"
mkdir -p "$TEMP_DIRECTORY"
-DOTNET_COMMON_ARGS="-p:DebugType=embedded -p:Version=$VERSION -p:SourceRevisionId=$SOURCE_REVISION_ID --self-contained true $EXTRA_ARGS"
+DOTNET_COMMON_ARGS=(-p:DebugType=embedded -p:Version="$VERSION" -p:SourceRevisionId="$SOURCE_REVISION_ID" --self-contained true $EXTRA_ARGS)
dotnet restore
-dotnet build -c $CONFIGURATION src/Ryujinx.Ava
-dotnet publish -c $CONFIGURATION -r osx-arm64 -o "$TEMP_DIRECTORY/publish_arm64" $DOTNET_COMMON_ARGS src/Ryujinx.Ava
-dotnet publish -c $CONFIGURATION -r osx-x64 -o "$TEMP_DIRECTORY/publish_x64" $DOTNET_COMMON_ARGS src/Ryujinx.Ava
+dotnet build -c "$CONFIGURATION" src/Ryujinx.Ava
+dotnet publish -c "$CONFIGURATION" -r osx-arm64 -o "$TEMP_DIRECTORY/publish_arm64" "${DOTNET_COMMON_ARGS[@]}" src/Ryujinx.Ava
+dotnet publish -c "$CONFIGURATION" -r osx-x64 -o "$TEMP_DIRECTORY/publish_x64" "${DOTNET_COMMON_ARGS[@]}" src/Ryujinx.Ava
# Get rid of the support library for ARMeilleure for x64 (that's only for arm64)
rm -rf "$TEMP_DIRECTORY/publish_x64/libarmeilleure-jitsupport.dylib"
@@ -104,10 +104,10 @@ fi
echo "Creating archive"
pushd "$OUTPUT_DIRECTORY"
-tar --exclude "Ryujinx.app/Contents/MacOS/Ryujinx" -cvf $RELEASE_TAR_FILE_NAME Ryujinx.app 1> /dev/null
-python3 "$BASE_DIR/distribution/misc/add_tar_exec.py" $RELEASE_TAR_FILE_NAME "Ryujinx.app/Contents/MacOS/Ryujinx" "Ryujinx.app/Contents/MacOS/Ryujinx"
-gzip -9 < $RELEASE_TAR_FILE_NAME > $RELEASE_TAR_FILE_NAME.gz
-rm $RELEASE_TAR_FILE_NAME
+tar --exclude "Ryujinx.app/Contents/MacOS/Ryujinx" -cvf "$RELEASE_TAR_FILE_NAME" Ryujinx.app 1> /dev/null
+python3 "$BASE_DIR/distribution/misc/add_tar_exec.py" "$RELEASE_TAR_FILE_NAME" "Ryujinx.app/Contents/MacOS/Ryujinx" "Ryujinx.app/Contents/MacOS/Ryujinx"
+gzip -9 < "$RELEASE_TAR_FILE_NAME" > "$RELEASE_TAR_FILE_NAME.gz"
+rm "$RELEASE_TAR_FILE_NAME"
popd
echo "Done"
\ No newline at end of file
diff --git a/distribution/macos/updater.sh b/distribution/macos/updater.sh
index 4d7dcdf23..12e4c3aa1 100755
--- a/distribution/macos/updater.sh
+++ b/distribution/macos/updater.sh
@@ -5,7 +5,7 @@ set -e
INSTALL_DIRECTORY=$1
NEW_APP_DIRECTORY=$2
APP_PID=$3
-APP_ARGUMENTS="${@:4}"
+APP_ARGUMENTS=("${@:4}")
error_handler() {
local lineno="$1"
@@ -33,7 +33,7 @@ trap 'error_handler ${LINENO}' ERR
attempt=0
while true; do
- if lsof -p $APP_PID +r 1 &>/dev/null || ps -p "$APP_PID" &>/dev/null; then
+ if lsof -p "$APP_PID" +r 1 &>/dev/null || ps -p "$APP_PID" &>/dev/null; then
if [ "$attempt" -eq 4 ]; then
exit 1
fi
@@ -53,5 +53,5 @@ mv "$NEW_APP_DIRECTORY" "$INSTALL_DIRECTORY"
if [ "$#" -le 3 ]; then
open -a "$INSTALL_DIRECTORY"
else
- open -a "$INSTALL_DIRECTORY" --args "$APP_ARGUMENTS"
-fi
+ open -a "$INSTALL_DIRECTORY" --args "${APP_ARGUMENTS[@]}"
+fi
\ No newline at end of file
diff --git a/src/Ryujinx.Ava/AppHost.cs b/src/Ryujinx.Ava/AppHost.cs
index 7526f7fe7..9584ac5f6 100644
--- a/src/Ryujinx.Ava/AppHost.cs
+++ b/src/Ryujinx.Ava/AppHost.cs
@@ -33,6 +33,7 @@ using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.HLE.Loaders.Processes;
using Ryujinx.Input;
using Ryujinx.Input.HLE;
+using Ryujinx.Ui.App.Common;
using Ryujinx.Ui.Common;
using Ryujinx.Ui.Common.Configuration;
using Ryujinx.Ui.Common.Helper;
@@ -696,7 +697,7 @@ namespace Ryujinx.Ava
DiscordIntegrationModule.SwitchToPlayingState(Device.Processes.ActiveApplication.ProgramIdText, Device.Processes.ActiveApplication.Name);
- _viewModel.ApplicationLibrary.LoadAndSaveMetaData(Device.Processes.ActiveApplication.ProgramIdText, appMetadata =>
+ ApplicationLibrary.LoadAndSaveMetaData(Device.Processes.ActiveApplication.ProgramIdText, appMetadata =>
{
appMetadata.LastPlayed = DateTime.UtcNow;
});
diff --git a/src/Ryujinx.Ava/UI/Controls/ApplicationContextMenu.axaml.cs b/src/Ryujinx.Ava/UI/Controls/ApplicationContextMenu.axaml.cs
index fba24d68b..b01c7c5e3 100644
--- a/src/Ryujinx.Ava/UI/Controls/ApplicationContextMenu.axaml.cs
+++ b/src/Ryujinx.Ava/UI/Controls/ApplicationContextMenu.axaml.cs
@@ -42,7 +42,7 @@ namespace Ryujinx.Ava.UI.Controls
{
viewModel.SelectedApplication.Favorite = !viewModel.SelectedApplication.Favorite;
- viewModel.ApplicationLibrary.LoadAndSaveMetaData(viewModel.SelectedApplication.TitleId, appMetadata =>
+ ApplicationLibrary.LoadAndSaveMetaData(viewModel.SelectedApplication.TitleId, appMetadata =>
{
appMetadata.Favorite = viewModel.SelectedApplication.Favorite;
});
diff --git a/src/Ryujinx.Ava/UI/Models/SaveModel.cs b/src/Ryujinx.Ava/UI/Models/SaveModel.cs
index e8486459b..cc9b67681 100644
--- a/src/Ryujinx.Ava/UI/Models/SaveModel.cs
+++ b/src/Ryujinx.Ava/UI/Models/SaveModel.cs
@@ -3,6 +3,7 @@ using LibHac.Ncm;
using Ryujinx.Ava.UI.ViewModels;
using Ryujinx.Ava.UI.Windows;
using Ryujinx.HLE.FileSystem;
+using Ryujinx.Ui.App.Common;
using System;
using System.IO;
using System.Linq;
@@ -74,7 +75,7 @@ namespace Ryujinx.Ava.UI.Models
}
else
{
- var appMetadata = MainWindow.MainWindowViewModel.ApplicationLibrary.LoadAndSaveMetaData(TitleIdString);
+ var appMetadata = ApplicationLibrary.LoadAndSaveMetaData(TitleIdString);
Title = appMetadata.Title ?? TitleIdString;
}
diff --git a/src/Ryujinx.Ava/UI/Renderer/EmbeddedWindow.cs b/src/Ryujinx.Ava/UI/Renderer/EmbeddedWindow.cs
index 3b2c32e3f..c5dd9332c 100644
--- a/src/Ryujinx.Ava/UI/Renderer/EmbeddedWindow.cs
+++ b/src/Ryujinx.Ava/UI/Renderer/EmbeddedWindow.cs
@@ -239,28 +239,28 @@ namespace Ryujinx.Ava.UI.Renderer
IPlatformHandle CreateMacOS()
{
// Create a new CAMetalLayer.
- IntPtr layerClass = ObjectiveC.objc_getClass("CAMetalLayer");
- IntPtr metalLayer = ObjectiveC.IntPtr_objc_msgSend(layerClass, "alloc");
- ObjectiveC.objc_msgSend(metalLayer, "init");
+ ObjectiveC.Object layerObject = new("CAMetalLayer");
+ ObjectiveC.Object metalLayer = layerObject.GetFromMessage("alloc");
+ metalLayer.SendMessage("init");
// Create a child NSView to render into.
- IntPtr nsViewClass = ObjectiveC.objc_getClass("NSView");
- IntPtr child = ObjectiveC.IntPtr_objc_msgSend(nsViewClass, "alloc");
- ObjectiveC.objc_msgSend(child, "init", new ObjectiveC.NSRect(0, 0, 0, 0));
+ ObjectiveC.Object nsViewObject = new("NSView");
+ ObjectiveC.Object child = nsViewObject.GetFromMessage("alloc");
+ child.SendMessage("init", new ObjectiveC.NSRect(0, 0, 0, 0));
// Make its renderer our metal layer.
- ObjectiveC.objc_msgSend(child, "setWantsLayer:", 1);
- ObjectiveC.objc_msgSend(child, "setLayer:", metalLayer);
- ObjectiveC.objc_msgSend(metalLayer, "setContentsScale:", Program.DesktopScaleFactor);
+ child.SendMessage("setWantsLayer:", 1);
+ child.SendMessage("setLayer:", metalLayer);
+ metalLayer.SendMessage("setContentsScale:", Program.DesktopScaleFactor);
// Ensure the scale factor is up to date.
_updateBoundsCallback = rect =>
{
- ObjectiveC.objc_msgSend(metalLayer, "setContentsScale:", Program.DesktopScaleFactor);
+ metalLayer.SendMessage("setContentsScale:", Program.DesktopScaleFactor);
};
- IntPtr nsView = child;
- MetalLayer = metalLayer;
+ IntPtr nsView = child.ObjPtr;
+ MetalLayer = metalLayer.ObjPtr;
NsView = nsView;
return new PlatformHandle(nsView, "NSView");
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