Revert .NET 10 to .NET 9

See merge request kenji-nx/ryujinx!19
This commit is contained in:
BeZide
2026-01-21 10:03:25 -06:00
committed by KeatonTheBot
parent 2c1b7bc667
commit 6d36f471dd
39 changed files with 464 additions and 108 deletions
+16 -4
View File
@@ -359,7 +359,10 @@ namespace ARMeilleure.Translation
IntervalTreeNode<TK, TV> tmp = LeftOf(replacementNode) ?? RightOf(replacementNode);
tmp?.Parent = ParentOf(replacementNode);
if (tmp != null)
{
tmp.Parent = ParentOf(replacementNode);
}
if (ParentOf(replacementNode) == null)
{
@@ -567,7 +570,10 @@ namespace ARMeilleure.Translation
{
IntervalTreeNode<TK, TV> right = RightOf(node);
node.Right = LeftOf(right);
node.Right?.Parent = node;
if (node.Right != null)
{
node.Right.Parent = node;
}
IntervalTreeNode<TK, TV> nodeParent = ParentOf(node);
right.Parent = nodeParent;
if (nodeParent == null)
@@ -595,7 +601,10 @@ namespace ARMeilleure.Translation
{
IntervalTreeNode<TK, TV> left = LeftOf(node);
node.Left = RightOf(left);
node.Left?.Parent = node;
if (node.Left != null)
{
node.Left.Parent = node;
}
IntervalTreeNode<TK, TV> nodeParent = ParentOf(node);
left.Parent = nodeParent;
if (nodeParent == null)
@@ -642,7 +651,10 @@ namespace ARMeilleure.Translation
/// <param name="color">Color (Boolean)</param>
private static void SetColor(IntervalTreeNode<TK, TV> node, bool color)
{
node?.Color = color;
if (node != null)
{
node.Color = color;
}
}
/// <summary>
@@ -15,6 +15,7 @@ using System.Threading;
using System.Timers;
using static ARMeilleure.Translation.PTC.PtcFormatter;
using Timer = System.Timers.Timer;
using System.Linq;
namespace ARMeilleure.Translation.PTC
{
@@ -58,16 +58,16 @@ namespace Ryujinx.Audio.Backends.CompatLayer
switch (realSampleFormat)
{
case SampleFormat.PcmInt8:
PcmHelper.ConvertSampleToPcm8(MemoryMarshal.Cast<byte, sbyte>(new Span<byte>(convertedSamples)), samples);
PcmHelper.ConvertSampleToPcm8(MemoryMarshal.Cast<byte, sbyte>(convertedSamples), samples);
break;
case SampleFormat.PcmInt24:
PcmHelper.ConvertSampleToPcm24(convertedSamples, samples);
break;
case SampleFormat.PcmInt32:
PcmHelper.ConvertSampleToPcm32(MemoryMarshal.Cast<byte, int>(new Span<byte>(convertedSamples)), samples);
PcmHelper.ConvertSampleToPcm32(MemoryMarshal.Cast<byte, int>(convertedSamples), samples);
break;
case SampleFormat.PcmFloat:
PcmHelper.ConvertSampleToPcmFloat(MemoryMarshal.Cast<byte, float>(new Span<byte>(convertedSamples)), samples);
PcmHelper.ConvertSampleToPcmFloat(MemoryMarshal.Cast<byte, float>(convertedSamples), samples);
break;
default:
throw new NotImplementedException($"Sample format conversion from {_userSampleFormat} to {realSampleFormat} not implemented.");
@@ -27,7 +27,7 @@ namespace Ryujinx.Audio.Integration
public void AppendBuffer(ReadOnlySpan<short> data, uint channelCount)
{
data.CopyTo(MemoryMarshal.Cast<byte, short>(new Span<byte>(_buffer)));
data.CopyTo(MemoryMarshal.Cast<byte, short>(_buffer));
_session.QueueBuffer(new AudioBuffer
{
@@ -384,7 +384,10 @@ namespace Ryujinx.Common.Collections
IntervalTreeNode<TKey, TValue> tmp = LeftOf(replacementNode) ?? RightOf(replacementNode);
tmp?.Parent = ParentOf(replacementNode);
if (tmp != null)
{
tmp.Parent = ParentOf(replacementNode);
}
if (ParentOf(replacementNode) == null)
{
@@ -232,7 +232,10 @@ namespace Ryujinx.Common.Collections
parent = ParentOf(element);
color = ColorOf(element);
child?.Parent = parent;
if (child != null)
{
child.Parent = parent;
}
if (parent == null)
{
@@ -252,7 +255,8 @@ namespace Ryujinx.Common.Collections
element.Right = old.Right;
element.Parent = old.Parent;
element.Predecessor = old.Predecessor;
element.Predecessor?.Successor = element;
if (element.Predecessor != null)
element.Predecessor.Successor = element;
if (ParentOf(old) == null)
{
@@ -285,7 +289,10 @@ namespace Ryujinx.Common.Collections
parent = ParentOf(nodeToDelete);
color = ColorOf(nodeToDelete);
child?.Parent = parent;
if (child != null)
{
child.Parent = parent;
}
if (parent == null)
{
@@ -304,9 +311,11 @@ namespace Ryujinx.Common.Collections
{
RestoreBalanceAfterRemoval(child);
}
old.Successor?.Predecessor = old.Predecessor;
old.Predecessor?.Successor = old.Successor;
if (old.Successor != null)
old.Successor.Predecessor = old.Predecessor;
if (old.Predecessor != null)
old.Predecessor.Successor = old.Successor;
return old;
}
@@ -238,7 +238,10 @@ namespace Ryujinx.Common.Collections
{
T right = RightOf(node);
node.Right = LeftOf(right);
node.Right?.Parent = node;
if (node.Right != null)
{
node.Right.Parent = node;
}
T nodeParent = ParentOf(node);
right.Parent = nodeParent;
if (nodeParent == null)
@@ -264,7 +267,10 @@ namespace Ryujinx.Common.Collections
{
T left = LeftOf(node);
node.Left = RightOf(left);
node.Left?.Parent = node;
if (node.Left != null)
{
node.Left.Parent = node;
}
T nodeParent = ParentOf(node);
left.Parent = nodeParent;
if (nodeParent == null)
@@ -307,7 +313,10 @@ namespace Ryujinx.Common.Collections
/// <param name="color">Color (Boolean)</param>
protected static void SetColor(T node, bool color)
{
node?.Color = color;
if (node != null)
{
node.Color = color;
}
}
/// <summary>
@@ -318,7 +318,10 @@ namespace Ryujinx.Common.Collections
Node<TKey, TValue> tmp = LeftOf(replacementNode) ?? RightOf(replacementNode);
tmp?.Parent = ParentOf(replacementNode);
if (tmp != null)
{
tmp.Parent = ParentOf(replacementNode);
}
if (ParentOf(replacementNode) == null)
{
+12 -3
View File
@@ -150,7 +150,10 @@ namespace Ryujinx.Cpu.AppleHv
// Entry is a block but is not aligned, we need to turn it into a table.
ref ulong pte = ref level.AsSpan()[l];
nextTable = CreateTable(pte, depth + 1);
level.Next?[l] = nextTable;
if (level.Next != null)
{
level.Next[l] = nextTable;
}
// Now that we have a table, we can handle it like the first case.
UnmapImpl(nextTable, depth + 1, va, chunckSize);
@@ -166,7 +169,10 @@ namespace Ryujinx.Cpu.AppleHv
if (nextTable != null)
{
nextTable.Allocation.Dispose();
level.Next?[l] = null;
if (level.Next != null)
{
level.Next[l] = null;
}
}
level.AsSpan()[l] = 0UL;
@@ -215,7 +221,10 @@ namespace Ryujinx.Cpu.AppleHv
{
// Entry is a block but is not aligned, we need to turn it into a table.
nextTable = CreateTable(pte, depth + 1);
level.Next?[l] = nextTable;
if (level.Next != null)
{
level.Next[l] = nextTable;
}
// Now that we have a table, we can handle it like the first case.
UpdateAttributes(nextTable, depth + 1, va, chunckSize, newAttr);
@@ -170,7 +170,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
{
var memoryManager = _channel.MemoryManager;
var data = MemoryMarshal.Cast<int, byte>(new Span<int>(_buffer))[.._size];
var data = MemoryMarshal.Cast<int, byte>(_buffer)[.._size];
if (_isLinear && _lineCount == 1)
{
@@ -1068,10 +1068,16 @@ namespace Ryujinx.Graphics.Gpu.Image
}
else
{
entry?.CacheNode = _lruCache.AddLast(entry);
if (entry != null)
{
entry.CacheNode = _lruCache.AddLast(entry);
}
}
entry?.CacheTimestamp = ++_currentTimestamp;
if (entry != null)
{
entry.CacheTimestamp = ++_currentTimestamp;
}
RemoveLeastUsedEntries();
@@ -84,7 +84,10 @@ namespace Ryujinx.Graphics.Gpu.Memory
for (int i = 0; i < count; i++)
{
ICounterEvent evt = _items[index + i].Event;
evt?.Invalid = true;
if (evt != null)
{
evt.Invalid = true;
}
}
_items.RemoveRange(index, count);
@@ -139,7 +139,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
start = sizeAligned;
}
var outSpan = MemoryMarshal.Cast<byte, uint>(new Span<byte>(output));
var outSpan = MemoryMarshal.Cast<byte, uint>(output);
var dataSpan = MemoryMarshal.Cast<byte, uint>(data);
for (int i = start / sizeof(uint); i < dataSpan.Length; i++)
{
@@ -26,8 +26,12 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
// - Both branches are jumping to the same location.
// In this case, the branch on the current block can be removed,
// as the next block is going to jump to the same place anyway.
if (nextBlock == null)
{
return false;
}
if (nextBlock?.Operations.First?.Value is not Operation next)
if (nextBlock.Operations.First?.Value is not Operation next)
{
return false;
}
@@ -1,4 +1,5 @@
using System;
using System.Linq;
namespace Ryujinx.Graphics.Vulkan
{
+1
View File
@@ -5,6 +5,7 @@ using Silk.NET.Vulkan;
using Silk.NET.Vulkan.Extensions.KHR;
using System;
using VkFormat = Silk.NET.Vulkan.Format;
using System.Linq;
namespace Ryujinx.Graphics.Vulkan
{
@@ -885,7 +885,10 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
result = new NestedName(name, prev);
}
context?.FinishWithTemplateArguments = false;
if (context != null)
{
context.FinishWithTemplateArguments = false;
}
return result;
}
@@ -1065,7 +1068,10 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
return null;
}
context?.CtorDtorConversion = true;
if (context != null)
{
context.CtorDtorConversion = true;
}
return new ConversionOperatorType(type);
default:
@@ -1333,7 +1339,10 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
_position++;
context?.CtorDtorConversion = true;
if (context != null)
{
context.CtorDtorConversion = true;
}
if (isInherited && ParseName(context) == null)
{
@@ -1353,7 +1362,10 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
_position++;
context?.CtorDtorConversion = true;
if (context != null)
{
context.CtorDtorConversion = true;
}
return new CtorDtorNameType(prev, true);
}
@@ -2956,10 +2968,16 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
BaseNode result = null;
CvType cv = new(ParseCvQualifiers(), null);
context?.Cv = cv;
if (context != null)
{
context.Cv = cv;
}
SimpleReferenceType Ref = ParseRefQualifiers();
context?.Ref = Ref;
if (context != null)
{
context.Ref = Ref;
}
if (ConsumeIf("St"))
{
@@ -3004,7 +3022,10 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
}
result = new NameTypeWithTemplateArguments(result, templateArgument);
context?.FinishWithTemplateArguments = true;
if (context != null)
{
context.FinishWithTemplateArguments = true;
}
_substitutionList.Add(result);
continue;
@@ -3194,7 +3215,10 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
return null;
}
context?.FinishWithTemplateArguments = true;
if (context != null)
{
context.FinishWithTemplateArguments = true;
}
return new NameTypeWithTemplateArguments(substitution, templateArguments);
}
@@ -3214,7 +3238,10 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
return null;
}
context?.FinishWithTemplateArguments = true;
if (context != null)
{
context.FinishWithTemplateArguments = true;
}
return new NameTypeWithTemplateArguments(result, templateArguments);
}
@@ -177,7 +177,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
if (previousThread != nextThread)
{
previousThread?.LastScheduledTime = PerformanceCounter.ElapsedTicks;
if (previousThread != null)
{
previousThread.LastScheduledTime = PerformanceCounter.ElapsedTicks;
}
_state.SelectedThread = nextThread;
_state.NeedsScheduling = true;
@@ -1301,8 +1301,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
context.Memory.Read(context.Request.PtrBuff[1].Position, vibrationValueBuffer);
Span<VibrationDeviceHandle> deviceHandles = MemoryMarshal.Cast<byte, VibrationDeviceHandle>(new Span<byte>(vibrationDeviceHandleBuffer));
Span<VibrationValue> vibrationValues = MemoryMarshal.Cast<byte, VibrationValue>(new Span<byte>(vibrationValueBuffer));
Span<VibrationDeviceHandle> deviceHandles = MemoryMarshal.Cast<byte, VibrationDeviceHandle>(vibrationDeviceHandleBuffer);
Span<VibrationValue> vibrationValues = MemoryMarshal.Cast<byte, VibrationValue>(vibrationValueBuffer);
if (!deviceHandles.IsEmpty && vibrationValues.Length == deviceHandles.Length)
{
@@ -85,7 +85,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv
NvDeviceFile deviceFile = (NvDeviceFile)constructor?.Invoke([context, _clientMemory, _owner]);
deviceFile?.Path = path;
if (deviceFile != null)
{
deviceFile.Path = path;
}
fd = DeviceFileIdRegistry.Add(deviceFile);
@@ -10,6 +10,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Linq;
namespace Ryujinx.HLE.HOS.Services.Ro
{
@@ -1169,7 +1169,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
public override void DestroyAtExit()
{
_context?.Dispose();
if (_context != null) {
_context.Dispose();
}
}
}
}
@@ -58,7 +58,10 @@ namespace Ryujinx.Memory.Tracking
{
foreach (var handle in _handles)
{
handle?.RegisterAction((_, _) => action(handle.Address, handle.Size));
if (handle != null)
{
handle?.RegisterAction((_, _) => action(handle.Address, handle.Size));
}
}
}
@@ -66,7 +69,10 @@ namespace Ryujinx.Memory.Tracking
{
foreach (var handle in _handles)
{
handle?.RegisterPreciseAction((_, _, write) => action(handle.Address, handle.Size, write));
if (handle != null)
{
handle?.RegisterPreciseAction((_, _, write) => action(handle.Address, handle.Size, write));
}
}
}
+8 -2
View File
@@ -504,12 +504,18 @@ namespace Ryujinx.Ava
private void UpdateIgnoreMissingServicesState(object sender, ReactiveEventArgs<bool> args)
{
Device?.Configuration.IgnoreMissingServices = args.NewValue;
if (Device != null)
{
Device.Configuration.IgnoreMissingServices = args.NewValue;
}
}
private void UpdateAspectRatioState(object sender, ReactiveEventArgs<AspectRatio> args)
{
Device?.Configuration.AspectRatio = args.NewValue;
if (Device != null)
{
Device.Configuration.AspectRatio = args.NewValue;
}
}
private void UpdateAntiAliasing(object sender, ReactiveEventArgs<AntiAliasing> e)
@@ -167,7 +167,10 @@ namespace Ryujinx.Ava.UI.Controls
private void Message_TextInput(object sender, TextInputEventArgs e)
{
_host?.IsPrimaryButtonEnabled = _checkLength(Message.Length) && _checkInput(Message);
if (_host != null)
{
_host.IsPrimaryButtonEnabled = _checkLength(Message.Length) && _checkInput(Message);
}
}
private void Message_KeyUp(object sender, KeyEventArgs e)
@@ -37,7 +37,10 @@ namespace Ryujinx.Ava.UI.Controls
private void SearchBox_OnKeyUp(object sender, KeyEventArgs args)
{
(DataContext as MainWindowViewModel)?.SearchText = (sender as TextBox)?.Text;
if (DataContext is MainWindowViewModel model)
{
model.SearchText = (sender as TextBox)?.Text;
}
}
}
}
@@ -38,7 +38,10 @@ namespace Ryujinx.Ava.UI.Controls
private void SearchBox_OnKeyUp(object sender, KeyEventArgs args)
{
(DataContext as MainWindowViewModel)?.SearchText = (sender as TextBox)?.Text;
if (DataContext is MainWindowViewModel model)
{
model.SearchText = (sender as TextBox)?.Text;
}
}
private async void IdString_OnClick(object sender, RoutedEventArgs e)
@@ -68,8 +68,10 @@ namespace Ryujinx.Ava.UI.Views.Input
if (_changeSlider != -1.0f && _changeSlider != (float)check.Value)
{
var viewModel = (DataContext as ControllerInputViewModel);
viewModel?.ParentModel.IsModified = true;
if (DataContext is ControllerInputViewModel viewModel)
{
viewModel.ParentModel.IsModified = true;
}
_changeSlider = (float)check.Value;
}
@@ -48,8 +48,12 @@ namespace Ryujinx.Ava.UI.Views.User
break;
}
((ContentDialog)_parent.Parent)?.Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - " +
$"{(_isNewUser ? LocaleManager.Instance[LocaleKeys.UserEditorTitleCreate] : LocaleManager.Instance[LocaleKeys.UserEditorTitle])}";
ContentDialog dialog = ((ContentDialog)_parent.Parent);
if (dialog != null)
{
dialog.Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - " +
$"{(_isNewUser ? LocaleManager.Instance[LocaleKeys.UserEditorTitleCreate] : LocaleManager.Instance[LocaleKeys.UserEditorTitle])}";
}
DataContext = TempProfile;
@@ -42,7 +42,12 @@ namespace Ryujinx.Ava.UI.Views.User
(_parent, _profile) = ((NavigationDialogHost, TempProfile))arg.Parameter;
_contentManager = _parent.ContentManager;
((ContentDialog)_parent.Parent)?.Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {LocaleManager.Instance[LocaleKeys.ProfileImageSelectionHeader]}";
ContentDialog parent = ((ContentDialog)_parent.Parent);
if (parent != null)
{
parent.Title =
$"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {LocaleManager.Instance[LocaleKeys.ProfileImageSelectionHeader]}";
}
if (Program.PreviewerDetached)
{
@@ -31,7 +31,12 @@ namespace Ryujinx.Ava.UI.Views.User
_parent = parent;
((ContentDialog)_parent.Parent)?.Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {LocaleManager.Instance[LocaleKeys.UserProfilesRecoverHeading]}";
ContentDialog dialog = ((ContentDialog)_parent.Parent);
if (dialog != null)
{
dialog.Title =
$"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {LocaleManager.Instance[LocaleKeys.UserProfilesRecoverHeading]}";
}
break;
}
@@ -58,7 +58,12 @@ namespace Ryujinx.Ava.UI.Views.User
}
DataContext = ViewModel = new UserSaveManagerViewModel(_accountManager);
((ContentDialog)_parent.Parent)?.Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {ViewModel.SaveManagerHeading}";
ContentDialog dialog = ((ContentDialog)_parent.Parent);
if (dialog != null)
{
dialog.Title =
$"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {ViewModel.SaveManagerHeading}";
}
Task.Run(LoadSaves);
}
@@ -42,7 +42,10 @@ namespace Ryujinx.Ava.UI.Views.User
if (arg.NavigationMode == NavigationMode.Back)
{
((ContentDialog)_parent.Parent)?.Title = LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle];
if (_parent.Parent != null)
{
((ContentDialog)_parent.Parent).Title = LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle];
}
}
DataContext = ViewModel;