misc: Tweak NullReferenceException fixes

This commit is contained in:
KeatonTheBot 2025-10-30 08:59:45 -05:00
parent e3ee28605d
commit a6c0eabf49
23 changed files with 143 additions and 128 deletions

View file

@ -327,17 +327,14 @@ namespace Ryujinx.Common.Collections
{ {
Root = newNode; Root = newNode;
} }
else if (parent != null && start.CompareTo(parent.Start) < 0) else if (start.CompareTo(parent!.Start) < 0)
{ {
parent.Left = newNode; parent.Left = newNode;
} }
else else
{
if (parent != null)
{ {
parent.Right = newNode; parent.Right = newNode;
} }
}
PropagateIncrease(newNode); PropagateIncrease(newNode);
Count++; Count++;

View file

@ -278,17 +278,14 @@ namespace Ryujinx.Common.Collections
{ {
Root = newNode; Root = newNode;
} }
else if (parent != null && key.CompareTo(parent.Key) < 0) else if (key.CompareTo(parent.Key) < 0)
{ {
parent.Left = newNode; parent.Left = newNode;
} }
else else
{
if (parent != null)
{ {
parent.Right = newNode; parent.Right = newNode;
} }
}
Count++; Count++;
return newNode; return newNode;
} }

View file

@ -388,12 +388,7 @@ namespace Ryujinx.Cpu.Jit.HostTracked
_treeLock.ExitReadLock(); _treeLock.ExitReadLock();
} }
if (_firstPagePa != null) return _firstPagePa != null ? (_backingMemory, _firstPagePa.Value) : (null, 0);
{
return (_backingMemory, _firstPagePa.Value);
}
return (null, 0);
} }
public PrivateRange GetPrivateAllocation(ulong va) public PrivateRange GetPrivateAllocation(ulong va)

View file

@ -391,7 +391,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
// Range list must be consistent for this operation // Range list must be consistent for this operation
if (_migrationTarget != null) if (_migrationTarget != null)
{ {
_migrationTarget!.WaitForAndFlushRanges(address, size); _migrationTarget.WaitForAndFlushRanges(address, size);
return; return;
} }

View file

@ -210,7 +210,7 @@ namespace Ryujinx.Graphics.OpenGL.Effects.Smaa
var dispatchY = BitUtils.DivRoundUp(view.Height, IPostProcessingEffect.LocalGroupSize); var dispatchY = BitUtils.DivRoundUp(view.Height, IPostProcessingEffect.LocalGroupSize);
int previousProgram = GL.GetInteger(GetPName.CurrentProgram); int previousProgram = GL.GetInteger(GetPName.CurrentProgram);
GL.BindImageTexture(0, edgeOutput.Handle, 0, false, 0, TextureAccess.ReadWrite, SizedInternalFormat.Rgba8); GL.BindImageTexture(0, edgeOutput!.Handle, 0, false, 0, TextureAccess.ReadWrite, SizedInternalFormat.Rgba8);
GL.UseProgram(_edgeShaderPrograms[Quality]); GL.UseProgram(_edgeShaderPrograms[Quality]);
view.Bind(0); view.Bind(0);
GL.Uniform1(_inputUniform, 0); GL.Uniform1(_inputUniform, 0);
@ -219,7 +219,7 @@ namespace Ryujinx.Graphics.OpenGL.Effects.Smaa
GL.DispatchCompute(dispatchX, dispatchY, 1); GL.DispatchCompute(dispatchX, dispatchY, 1);
GL.MemoryBarrier(MemoryBarrierFlags.ShaderImageAccessBarrierBit); GL.MemoryBarrier(MemoryBarrierFlags.ShaderImageAccessBarrierBit);
GL.BindImageTexture(0, blendOutput.Handle, 0, false, 0, TextureAccess.ReadWrite, SizedInternalFormat.Rgba8); GL.BindImageTexture(0, blendOutput!.Handle, 0, false, 0, TextureAccess.ReadWrite, SizedInternalFormat.Rgba8);
GL.UseProgram(_blendShaderPrograms[Quality]); GL.UseProgram(_blendShaderPrograms[Quality]);
edgeOutput.Bind(0); edgeOutput.Bind(0);
areaTexture?.Bind(1); areaTexture?.Bind(1);
@ -232,7 +232,7 @@ namespace Ryujinx.Graphics.OpenGL.Effects.Smaa
GL.DispatchCompute(dispatchX, dispatchY, 1); GL.DispatchCompute(dispatchX, dispatchY, 1);
GL.MemoryBarrier(MemoryBarrierFlags.ShaderImageAccessBarrierBit); GL.MemoryBarrier(MemoryBarrierFlags.ShaderImageAccessBarrierBit);
GL.BindImageTexture(0, textureView.Handle, 0, false, 0, TextureAccess.ReadWrite, SizedInternalFormat.Rgba8); GL.BindImageTexture(0, textureView!.Handle, 0, false, 0, TextureAccess.ReadWrite, SizedInternalFormat.Rgba8);
GL.UseProgram(_neighbourShaderPrograms[Quality]); GL.UseProgram(_neighbourShaderPrograms[Quality]);
view.Bind(0); view.Bind(0);
blendOutput.Bind(1); blendOutput.Bind(1);

View file

@ -63,13 +63,10 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
{ {
INode lastOp = GetLastOp(); INode lastOp = GetLastOp();
if (lastOp is Operation operation && IsControlFlowInst(operation.Inst)) if (lastOp is Operation operation && IsControlFlowInst(operation.Inst) && Operations.Last != null)
{
if (Operations.Last != null)
{ {
Operations.AddBefore(Operations.Last, node); Operations.AddBefore(Operations.Last, node);
} }
}
else else
{ {
Operations.AddLast(node); Operations.AddLast(node);

View file

@ -1693,7 +1693,7 @@ namespace Ryujinx.Graphics.Vulkan
var pipeline = pbp == PipelineBindPoint.Compute var pipeline = pbp == PipelineBindPoint.Compute
? _newState.CreateComputePipeline(Gd, Device, _program, PipelineCache) ? _newState.CreateComputePipeline(Gd, Device, _program, PipelineCache)
: _newState.CreateGraphicsPipeline(Gd, Device, _program, PipelineCache, _renderPass.Get(Cbs).Value); : _newState.CreateGraphicsPipeline(Gd, Device, _program, PipelineCache, _renderPass!.Get(Cbs).Value);
if (pipeline == null) if (pipeline == null)
{ {

View file

@ -134,7 +134,7 @@ namespace Ryujinx.Graphics.Vulkan
// Register this render pass with all render target views. // Register this render pass with all render target views.
if (fb != null) if (hasFramebuffer)
{ {
var textures = fb.GetAttachmentViews(); var textures = fb.GetAttachmentViews();

View file

@ -19,29 +19,41 @@ namespace Ryujinx.HLE.Generators
generator.EnterScope($"partial class IUserInterface"); generator.EnterScope($"partial class IUserInterface");
generator.EnterScope($"public IpcService? GetServiceInstance(Type type, ServiceCtx context, object? parameter = null)"); generator.EnterScope($"public IpcService? GetServiceInstance(Type type, ServiceCtx context, object? parameter = null)");
if (syntaxReceiver != null)
{
foreach (var className in syntaxReceiver.Types) foreach (var className in syntaxReceiver.Types)
{ {
if (className.Modifiers.Any(SyntaxKind.AbstractKeyword) || className.Modifiers.Any(SyntaxKind.PrivateKeyword) || !className.AttributeLists.Any(x => x.Attributes.Any(y => y.ToString().StartsWith("Service")))) if (className.Modifiers.Any(SyntaxKind.AbstractKeyword) ||
className.Modifiers.Any(SyntaxKind.PrivateKeyword) ||
!className.AttributeLists.Any(x => x.Attributes.Any(y => y.ToString().StartsWith("Service"))))
continue; continue;
var name = GetFullName(className, context).Replace("global::", ""); var name = GetFullName(className, context).Replace("global::", "");
if (!name.StartsWith("Ryujinx.HLE.HOS.Services")) if (!name.StartsWith("Ryujinx.HLE.HOS.Services"))
continue; continue;
var constructors = className.ChildNodes().Where(x => x.IsKind(SyntaxKind.ConstructorDeclaration)).Select(y => y as ConstructorDeclarationSyntax); var constructors = className.ChildNodes().Where(x => x.IsKind(SyntaxKind.ConstructorDeclaration))
.Select(y => y as ConstructorDeclarationSyntax);
if (!constructors.Any(x => x != null && x.ParameterList.Parameters.Count >= 1)) if (!constructors.Any(x => x?.ParameterList.Parameters.Count >= 1))
continue; continue;
if (constructors.FirstOrDefault(x => x != null && x.ParameterList.Parameters.Count >= 1).ParameterList.Parameters[0].Type.ToString() == "ServiceCtx") if (constructors.FirstOrDefault(x => x?.ParameterList.Parameters.Count >= 1)
.ParameterList.Parameters[0].Type.ToString() == "ServiceCtx")
{ {
generator.EnterScope($"if (type == typeof({GetFullName(className, context)}))"); generator.EnterScope($"if (type == typeof({GetFullName(className, context)}))");
if (constructors.Any(x => x != null && x.ParameterList.Parameters.Count == 2)) if (constructors.Any(x => x?.ParameterList.Parameters.Count == 2))
{
var type = constructors
.FirstOrDefault(x => x?.ParameterList.Parameters.Count == 2).ParameterList
.Parameters[1].Type;
if (type?.SyntaxTree != null)
{ {
var type = constructors.FirstOrDefault(x => x != null && x.ParameterList.Parameters.Count == 2).ParameterList.Parameters[1].Type;
var model = context.Compilation.GetSemanticModel(type.SyntaxTree); var model = context.Compilation.GetSemanticModel(type.SyntaxTree);
var typeSymbol = model.GetSymbolInfo(type).Symbol as INamedTypeSymbol; var typeSymbol = model.GetSymbolInfo(type).Symbol as INamedTypeSymbol;
var fullName = typeSymbol?.ToString(); var fullName = typeSymbol?.ToString();
generator.EnterScope("if (parameter != null)"); generator.EnterScope("if (parameter != null)");
generator.AppendLine($"return new {GetFullName(className, context)}(context, ({fullName})parameter);"); generator.AppendLine($"return new {GetFullName(className, context)}(context, ({fullName})parameter);");
}
generator.LeaveScope(); generator.LeaveScope();
} }
@ -53,6 +65,7 @@ namespace Ryujinx.HLE.Generators
generator.LeaveScope(); generator.LeaveScope();
} }
} }
}
generator.AppendLine("return null;"); generator.AppendLine("return null;");
generator.LeaveScope(); generator.LeaveScope();

View file

@ -60,12 +60,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
KernelContext.CriticalSection.Enter(); KernelContext.CriticalSection.Enter();
if (list.Count != 0) if (list.Count != 0 && list.First != null)
{
if (list.First != null)
{ {
session = list.First.Value; session = list.First.Value;
}
list.RemoveFirst(); list.RemoveFirst();
} }

View file

@ -32,14 +32,11 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
public ref T GetRef<T>(ulong offset) where T : unmanaged public ref T GetRef<T>(ulong offset) where T : unmanaged
{ {
if (_pageList.Nodes.Count == 1) if (_pageList.Nodes.Count == 1 && _pageList.Nodes.First != null)
{
if (_pageList.Nodes.First != null)
{ {
ulong address = _pageList.Nodes.First.Value.Address - DramMemoryMap.DramBase; ulong address = _pageList.Nodes.First.Value.Address - DramMemoryMap.DramBase;
return ref _context.Memory.GetRef<T>(address + offset); return ref _context.Memory.GetRef<T>(address + offset);
} }
}
throw new NotImplementedException("Non-contiguous shared memory is not yet supported."); throw new NotImplementedException("Non-contiguous shared memory is not yet supported.");
} }

View file

@ -164,11 +164,14 @@ namespace Ryujinx.HLE.HOS.Services.Nv
Logger.Debug?.Print(LogClass.ServiceNv, $"Deallocation resulted in new free range from 0x{expandedStart:X} to 0x{expandedEnd:X}."); Logger.Debug?.Print(LogClass.ServiceNv, $"Deallocation resulted in new free range from 0x{expandedStart:X} to 0x{expandedEnd:X}.");
_tree.Add(expandedStart, expandedEnd); _tree.Add(expandedStart, expandedEnd);
if (node != null)
{
LinkedListNode<ulong> nodePtr = _list.AddAfter(node, expandedStart); LinkedListNode<ulong> nodePtr = _list.AddAfter(node, expandedStart);
_dictionary[expandedStart] = nodePtr; _dictionary[expandedStart] = nodePtr;
} }
} }
} }
}
/// <summary> /// <summary>
/// Gets the address of an unused (free) region of the specified size. /// Gets the address of an unused (free) region of the specified size.
@ -196,12 +199,15 @@ namespace Ryujinx.HLE.HOS.Services.Nv
if (address < AddressSpaceSize) if (address < AddressSpaceSize)
{ {
bool reachedEndOfAddresses = false; bool reachedEndOfAddresses = false;
ulong targetAddress; ulong targetAddress = 0;
if (start == DefaultStart) if (start == DefaultStart)
{
if (_list.Last != null)
{ {
Logger.Debug?.Print(LogClass.ServiceNv, $"Target address set to start of the last available range: 0x{_list.Last.Value:X}."); Logger.Debug?.Print(LogClass.ServiceNv, $"Target address set to start of the last available range: 0x{_list.Last.Value:X}.");
targetAddress = _list.Last.Value; targetAddress = _list.Last.Value;
} }
}
else else
{ {
targetAddress = _tree.Floor(address); targetAddress = _tree.Floor(address);

View file

@ -97,8 +97,8 @@ namespace Ryujinx.HLE.HOS.Services.Sm
IpcService service = GetServiceInstance(type, context, serviceAttribute.Parameter); IpcService service = GetServiceInstance(type, context, serviceAttribute.Parameter);
service.TrySetServer(_commonServer); service?.TrySetServer(_commonServer);
service.Server.AddSessionObj(session.ServerSession, service); service?.Server.AddSessionObj(session.ServerSession, service);
} }
else else
{ {

View file

@ -61,7 +61,7 @@ namespace Ryujinx.Horizon.Generators.Hipc
{ {
HipcSyntaxReceiver syntaxReceiver = (HipcSyntaxReceiver)context.SyntaxReceiver; HipcSyntaxReceiver syntaxReceiver = (HipcSyntaxReceiver)context.SyntaxReceiver;
if (syntaxReceiver?.CommandInterfaces != null) if (syntaxReceiver != null)
{ {
foreach (var commandInterface in syntaxReceiver.CommandInterfaces) foreach (var commandInterface in syntaxReceiver.CommandInterfaces)
{ {
@ -98,7 +98,8 @@ namespace Ryujinx.Horizon.Generators.Hipc
generator.LeaveScope(); generator.LeaveScope();
generator.LeaveScope(); generator.LeaveScope();
context.AddSource($"{GetNamespaceName(commandInterface.ClassDeclarationSyntax)}.{className}.g.cs", generator.ToString()); context.AddSource($"{GetNamespaceName(commandInterface.ClassDeclarationSyntax)}.{className}.g.cs",
generator.ToString());
} }
} }
} }
@ -244,7 +245,7 @@ namespace Ryujinx.Horizon.Generators.Hipc
"ReadOnlySpan<byte> inRawData, " + "ReadOnlySpan<byte> inRawData, " +
"ref Span<CmifOutHeader> outHeader)"); "ref Span<CmifOutHeader> outHeader)");
bool returnsResult = method.ReturnType != null && GetCanonicalTypeName(compilation, method.ReturnType) == TypeResult; bool returnsResult = GetCanonicalTypeName(compilation, method.ReturnType) == TypeResult;
if (returnsResult || buffersCount != 0 || inObjectsCount != 0) if (returnsResult || buffersCount != 0 || inObjectsCount != 0)
{ {
@ -567,16 +568,11 @@ namespace Ryujinx.Horizon.Generators.Hipc
if (symbol != null) if (symbol != null)
{ {
foreach (var attribute in symbol.GetAttributes()) return (from attribute in symbol.GetAttributes()
{ where attribute.AttributeClass?.ToDisplayString() == attributeName
if (attribute.AttributeClass?.ToDisplayString() == attributeName) from kv in attribute.NamedArguments
{ where kv.Key == argName
foreach (var kv in attribute.NamedArguments.Where(kv => kv.Key == argName)) select kv.Value.ToCSharpString()).FirstOrDefault();
{
return kv.Value.ToCSharpString();
}
}
}
} }
return null; return null;
@ -717,13 +713,18 @@ namespace Ryujinx.Horizon.Generators.Hipc
private static bool IsObject(Compilation compilation, ParameterSyntax parameter) private static bool IsObject(Compilation compilation, ParameterSyntax parameter)
{ {
SyntaxNode syntaxNode = parameter.Type; SyntaxNode syntaxNode = parameter.Type;
TypeInfo typeInfo = compilation.GetSemanticModel(syntaxNode!.SyntaxTree).GetTypeInfo(syntaxNode); if (syntaxNode != null)
{
TypeInfo typeInfo = compilation.GetSemanticModel(syntaxNode.SyntaxTree).GetTypeInfo(syntaxNode);
return typeInfo.Type != null && return typeInfo.Type != null &&
(typeInfo.Type.ToDisplayString() == TypeIServiceObject || (typeInfo.Type.ToDisplayString() == TypeIServiceObject ||
typeInfo.Type.AllInterfaces.Any(x => x.ToDisplayString() == TypeIServiceObject)); typeInfo.Type.AllInterfaces.Any(x => x.ToDisplayString() == TypeIServiceObject));
} }
return false;
}
private static bool IsProcessId(Compilation compilation, ParameterSyntax parameter) private static bool IsProcessId(Compilation compilation, ParameterSyntax parameter)
{ {
return HasAttribute(compilation, parameter, TypeClientProcessIdAttribute) && return HasAttribute(compilation, parameter, TypeClientProcessIdAttribute) &&

View file

@ -164,7 +164,9 @@ namespace Ryujinx.Horizon.Kernel.Generators
where attributeArg.Expression.Kind() == SyntaxKind.NumericLiteralExpression where attributeArg.Expression.Kind() == SyntaxKind.NumericLiteralExpression
select (LiteralExpressionSyntax)attributeArg.Expression select (LiteralExpressionSyntax)attributeArg.Expression
into numericLiteral into numericLiteral
select new SyscallIdAndName((int)numericLiteral.Token.Value, method.Identifier.Text)); let tokenValue = numericLiteral.Token.Value
where tokenValue != null
select new SyscallIdAndName((int)tokenValue, method.Identifier.Text));
} }
} }
} }

View file

@ -88,7 +88,8 @@ namespace Ryujinx.Ava.UI.Models
private void UpdateBackground() private void UpdateBackground()
{ {
var currentApplication = Avalonia.Application.Current; var currentApplication = Avalonia.Application.Current;
currentApplication!.Styles.TryGetResource("ControlFillColorSecondary", currentApplication.ActualThemeVariant, out object color); object color = null;
currentApplication?.Styles.TryGetResource("ControlFillColorSecondary", currentApplication.ActualThemeVariant, out color);
if (color is not null) if (color is not null)
{ {

View file

@ -525,16 +525,16 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
{ {
ProfilesList.Clear(); ProfilesList.Clear();
string basePath = GetProfileBasePath() ?? string.Empty; string basePath = GetProfileBasePath();
if (!Directory.Exists(basePath)) if (!Directory.Exists(basePath))
{ {
Directory.CreateDirectory(basePath); Directory.CreateDirectory(basePath ?? string.Empty);
} }
ProfilesList.Add((LocaleManager.Instance[LocaleKeys.ControllerSettingsProfileDefault])); ProfilesList.Add((LocaleManager.Instance[LocaleKeys.ControllerSettingsProfileDefault]));
foreach (string profile in Directory.GetFiles(basePath, "*.json", SearchOption.AllDirectories)) foreach (string profile in Directory.GetFiles(basePath ?? string.Empty, "*.json", SearchOption.AllDirectories))
{ {
ProfilesList.Add(Path.GetFileNameWithoutExtension(profile)); ProfilesList.Add(Path.GetFileNameWithoutExtension(profile));
} }

View file

@ -1555,11 +1555,11 @@ namespace Ryujinx.Ava.UI.ViewModels
private void Update_StatusBar(object sender, StatusUpdatedEventArgs args) private void Update_StatusBar(object sender, StatusUpdatedEventArgs args)
{ {
if (ShowMenuAndStatusBar && !ShowLoadProgress) if (ShowMenuAndStatusBar && !ShowLoadProgress && Application.Current != null)
{ {
Dispatcher.UIThread.InvokeAsync(() => Dispatcher.UIThread.InvokeAsync(() =>
{ {
Application.Current!.Styles.TryGetResource(args.VSyncMode, Application.Current.Styles.TryGetResource(args.VSyncMode,
Application.Current.ActualThemeVariant, Application.Current.ActualThemeVariant,
out object color); out object color);

View file

@ -9,6 +9,7 @@ using Ryujinx.Ava.UI.ViewModels.Input;
using Ryujinx.Common.Configuration.Hid.Controller; using Ryujinx.Common.Configuration.Hid.Controller;
using Ryujinx.Input; using Ryujinx.Input;
using Ryujinx.Input.Assigner; using Ryujinx.Input.Assigner;
using System;
using StickInputId = Ryujinx.Common.Configuration.Hid.Controller.StickInputId; using StickInputId = Ryujinx.Common.Configuration.Hid.Controller.StickInputId;
namespace Ryujinx.Ava.UI.Views.Input namespace Ryujinx.Ava.UI.Views.Input
@ -68,9 +69,7 @@ namespace Ryujinx.Ava.UI.Views.Input
if (_changeSlider != -1.0f && _changeSlider != (float)check.Value) if (_changeSlider != -1.0f && _changeSlider != (float)check.Value)
{ {
if (DataContext is ControllerInputViewModel viewModel)
var viewModel = (DataContext as ControllerInputViewModel);
if (viewModel != null)
{ {
viewModel.ParentModel.IsModified = true; viewModel.ParentModel.IsModified = true;
} }
@ -119,7 +118,10 @@ namespace Ryujinx.Ava.UI.Views.Input
PointerPressed += MouseClick; PointerPressed += MouseClick;
var viewModel = (DataContext as ControllerInputViewModel); if (DataContext is not ControllerInputViewModel viewModel)
{
return;
}
IKeyboard keyboard = (IKeyboard)viewModel.ParentModel.AvaloniaKeyboardDriver.GetGamepad("0"); // Open Avalonia keyboard for cancel operations. IKeyboard keyboard = (IKeyboard)viewModel.ParentModel.AvaloniaKeyboardDriver.GetGamepad("0"); // Open Avalonia keyboard for cancel operations.
IButtonAssigner assigner = CreateButtonAssigner(isStick); IButtonAssigner assigner = CreateButtonAssigner(isStick);
@ -234,13 +236,14 @@ namespace Ryujinx.Ava.UI.Views.Input
private IButtonAssigner CreateButtonAssigner(bool forStick) private IButtonAssigner CreateButtonAssigner(bool forStick)
{ {
IButtonAssigner assigner; if (DataContext is not ControllerInputViewModel controllerInputViewModel)
{
return null;
}
var controllerInputViewModel = DataContext as ControllerInputViewModel; IButtonAssigner assigner = new GamepadButtonAssigner(
controllerInputViewModel.ParentModel.SelectedGamepad,
assigner = new GamepadButtonAssigner( ((StandardControllerInputConfig)controllerInputViewModel.ParentModel.Config).TriggerThreshold,
controllerInputViewModel?.ParentModel.SelectedGamepad,
(controllerInputViewModel.ParentModel.Config as StandardControllerInputConfig).TriggerThreshold,
forStick); forStick);
return assigner; return assigner;

View file

@ -36,7 +36,7 @@ namespace Ryujinx.Ava.UI.Views.Settings
{ {
base.OnPointerReleased(e); base.OnPointerReleased(e);
if (!_currentAssigner?.ToggledButton?.IsPointerOver ?? false) if (!_currentAssigner?.ToggledButton.IsPointerOver ?? false)
{ {
_currentAssigner.Cancel(); _currentAssigner.Cancel();
} }

View file

@ -63,8 +63,9 @@ namespace Ryujinx.Ava.UI.Views.User
private async void Import_OnClick(object sender, RoutedEventArgs e) private async void Import_OnClick(object sender, RoutedEventArgs e)
{ {
var window = this.GetVisualRoot() as Window; if (this.GetVisualRoot() is Window window)
var result = await window?.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions {
var result = await window.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
{ {
AllowMultiple = false, AllowMultiple = false,
FileTypeFilter = new List<FilePickerFileType> FileTypeFilter = new List<FilePickerFileType>
@ -84,6 +85,7 @@ namespace Ryujinx.Ava.UI.Views.User
_parent.GoBack(); _parent.GoBack();
} }
} }
}
private void GoBack(object sender, RoutedEventArgs e) private void GoBack(object sender, RoutedEventArgs e)
{ {

View file

@ -41,9 +41,12 @@ namespace Ryujinx.Ava.UI.Views.User
} }
if (arg.NavigationMode == NavigationMode.Back) if (arg.NavigationMode == NavigationMode.Back)
{
if (_parent.Parent != null)
{ {
((ContentDialog)_parent.Parent).Title = LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]; ((ContentDialog)_parent.Parent).Title = LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle];
} }
}
DataContext = ViewModel; DataContext = ViewModel;
} }

View file

@ -516,12 +516,16 @@ namespace Ryujinx.Ava.UI.Windows
ApplicationLibrary.ApplicationCountUpdated += ApplicationLibrary_ApplicationCountUpdated; ApplicationLibrary.ApplicationCountUpdated += ApplicationLibrary_ApplicationCountUpdated;
_appLibraryAppsSubscription?.Dispose(); _appLibraryAppsSubscription?.Dispose();
if (SynchronizationContext.Current != null)
{
_appLibraryAppsSubscription = ApplicationLibrary.Applications _appLibraryAppsSubscription = ApplicationLibrary.Applications
.Connect() .Connect()
.ObserveOn(SynchronizationContext.Current) .ObserveOn(SynchronizationContext.Current)
.Bind(ViewModel.Applications) .Bind(ViewModel.Applications)
.OnItemAdded(UpdateApplicationWithLdnData) .OnItemAdded(UpdateApplicationWithLdnData)
.Subscribe(); .Subscribe();
}
ApplicationLibrary.LdnGameDataReceived += ApplicationLibrary_LdnGameDataReceived; ApplicationLibrary.LdnGameDataReceived += ApplicationLibrary_LdnGameDataReceived;
ConfigurationState.Instance.Multiplayer.Mode.Event += (sender, evt) => ConfigurationState.Instance.Multiplayer.Mode.Event += (sender, evt) =>
@ -581,7 +585,7 @@ namespace Ryujinx.Ava.UI.Windows
var volumeSplitButton = sender as ToggleSplitButton; var volumeSplitButton = sender as ToggleSplitButton;
if (ViewModel.IsGameRunning) if (ViewModel.IsGameRunning)
{ {
if (volumeSplitButton is not { IsChecked: true }) if (volumeSplitButton is { IsChecked: false })
{ {
ViewModel.AppHost.Device.SetVolume(ViewModel.VolumeBeforeMute); ViewModel.AppHost.Device.SetVolume(ViewModel.VolumeBeforeMute);
} }