Linux: Fix file picker not launching from disabling core dumps

Core dumps are disabled by default on Linux, but this prevents access to the file picker due to security hardening. To work around this, core dumps are selectively enabled and disabled around the file picker tasks.
This commit is contained in:
KeatonTheBot
2026-01-14 17:05:32 -06:00
parent 7d0947cac6
commit 253f47c971
10 changed files with 139 additions and 4 deletions
@@ -10,6 +10,7 @@ using Ryujinx.Ava.UI.Helpers;
using Ryujinx.Ava.UI.ViewModels;
using Ryujinx.Ava.UI.Windows;
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Utilities;
using Ryujinx.HLE.HOS;
using Ryujinx.UI.App.Common;
using Ryujinx.UI.Common.Helper;
@@ -391,6 +392,8 @@ namespace Ryujinx.Ava.UI.Controls
public async void ExtractApplicationLogo_Click(object sender, RoutedEventArgs args)
{
OsUtils.SetCoreDumpable(true);
var viewModel = (sender as MenuItem)?.DataContext as MainWindowViewModel;
if (viewModel?.SelectedApplication is { } selectedApp)
@@ -420,6 +423,11 @@ namespace Ryujinx.Ava.UI.Controls
fileStream.Write(selectedApp.Icon);
}
}
if (!Program.CoreDumpArg)
{
OsUtils.SetCoreDumpable(false);
}
}
public void CreateApplicationShortcut_Click(object sender, RoutedEventArgs args)
@@ -7,6 +7,7 @@ using DynamicData;
using FluentAvalonia.UI.Controls;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.UI.Helpers;
using Ryujinx.Common.Utilities;
using Ryujinx.UI.App.Common;
using Ryujinx.UI.Common.Models;
using System.Collections.Generic;
@@ -137,6 +138,8 @@ namespace Ryujinx.Ava.UI.ViewModels
public async void Add()
{
OsUtils.SetCoreDumpable(true);
var result = await _storageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
{
Title = LocaleManager.Instance[LocaleKeys.SelectDlcDialogTitle],
@@ -167,6 +170,11 @@ namespace Ryujinx.Ava.UI.ViewModels
{
await ShowNewDlcAddedDialog(totalDlcAdded);
}
if (!Program.CoreDumpArg)
{
OsUtils.SetCoreDumpable(false);
}
}
private bool AddDownloadableContent(string path, out int numDlcAdded)
@@ -1140,6 +1140,8 @@ namespace Ryujinx.Ava.UI.ViewModels
private async Task LoadContentFromFolder(LocaleKeys localeMessageAddedKey, LocaleKeys localeMessageRemovedKey, LoadContentFromFolderDelegate onDirsSelected)
{
OsUtils.SetCoreDumpable(true);
var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
{
Title = LocaleManager.Instance[LocaleKeys.OpenFolderDialogTitle],
@@ -1163,6 +1165,11 @@ namespace Ryujinx.Ava.UI.ViewModels
msg, "", "", "", LocaleManager.Instance[LocaleKeys.InputDialogOk], (int)Symbol.Checkmark);
});
}
if (!Program.CoreDumpArg)
{
OsUtils.SetCoreDumpable(false);
}
}
#endregion
@@ -1241,6 +1248,8 @@ namespace Ryujinx.Ava.UI.ViewModels
public async Task InstallFirmwareFromFile()
{
OsUtils.SetCoreDumpable(true);
var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
{
AllowMultiple = false,
@@ -1271,10 +1280,17 @@ namespace Ryujinx.Ava.UI.ViewModels
{
await HandleFirmwareInstallation(result[0].Path.LocalPath);
}
if (!Program.CoreDumpArg)
{
OsUtils.SetCoreDumpable(false);
}
}
public async Task InstallFirmwareFromFolder()
{
OsUtils.SetCoreDumpable(true);
var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
{
AllowMultiple = false,
@@ -1284,10 +1300,17 @@ namespace Ryujinx.Ava.UI.ViewModels
{
await HandleFirmwareInstallation(result[0].Path.LocalPath);
}
if (!Program.CoreDumpArg)
{
OsUtils.SetCoreDumpable(false);
}
}
public async Task InstallKeysFromFile()
{
OsUtils.SetCoreDumpable(true);
var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
{
AllowMultiple = false,
@@ -1318,10 +1341,17 @@ namespace Ryujinx.Ava.UI.ViewModels
{
await HandleKeysInstallation(result[0].Path.LocalPath);
}
if (!Program.CoreDumpArg)
{
OsUtils.SetCoreDumpable(false);
}
}
public async Task InstallKeysFromFolder()
{
OsUtils.SetCoreDumpable(true);
var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
{
AllowMultiple = false,
@@ -1331,6 +1361,11 @@ namespace Ryujinx.Ava.UI.ViewModels
{
await HandleKeysInstallation(result[0].Path.LocalPath);
}
if (!Program.CoreDumpArg)
{
OsUtils.SetCoreDumpable(false);
}
}
public void OpenRyujinxFolder()
@@ -1432,6 +1467,8 @@ namespace Ryujinx.Ava.UI.ViewModels
public async Task OpenFile()
{
OsUtils.SetCoreDumpable(true);
var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
{
Title = LocaleManager.Instance[LocaleKeys.OpenFileDialogTitle],
@@ -1503,6 +1540,11 @@ namespace Ryujinx.Ava.UI.ViewModels
await ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance[LocaleKeys.MenuBarFileOpenFromFileError]);
}
}
if (!Program.CoreDumpArg)
{
OsUtils.SetCoreDumpable(false);
}
}
public async Task LoadDlcFromFolder()
@@ -1523,6 +1565,8 @@ namespace Ryujinx.Ava.UI.ViewModels
public async Task OpenFolder()
{
OsUtils.SetCoreDumpable(true);
var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
{
Title = LocaleManager.Instance[LocaleKeys.OpenFolderDialogTitle],
@@ -1539,6 +1583,11 @@ namespace Ryujinx.Ava.UI.ViewModels
await LoadApplication(applicationData);
}
if (!Program.CoreDumpArg)
{
OsUtils.SetCoreDumpable(false);
}
}
public async Task LoadApplication(ApplicationData application, bool startFullscreen = false)
@@ -1706,6 +1755,8 @@ namespace Ryujinx.Ava.UI.ViewModels
}
public async Task OpenBinFile()
{
OsUtils.SetCoreDumpable(true);
if (AppHost.Device.System.SearchingForAmiibo(out _) && IsGameRunning)
{
var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
@@ -1724,6 +1775,11 @@ namespace Ryujinx.Ava.UI.ViewModels
{
AppHost.Device.System.ScanAmiiboFromBin(result[0].Path.LocalPath);
}
if (!Program.CoreDumpArg)
{
OsUtils.SetCoreDumpable(false);
}
}
}
@@ -296,6 +296,8 @@ namespace Ryujinx.Ava.UI.ViewModels
public async void Add()
{
OsUtils.SetCoreDumpable(true);
var result = await _storageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
{
Title = LocaleManager.Instance[LocaleKeys.SelectModDialogTitle],
@@ -306,6 +308,11 @@ namespace Ryujinx.Ava.UI.ViewModels
{
AddMod(new DirectoryInfo(folder.Path.LocalPath));
}
if (!Program.CoreDumpArg)
{
OsUtils.SetCoreDumpable(false);
}
}
public void DeleteAll()
@@ -6,6 +6,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using FluentAvalonia.UI.Controls;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.UI.Helpers;
using Ryujinx.Common.Utilities;
using Ryujinx.UI.App.Common;
using Ryujinx.UI.Common.Models;
using System.Collections.Generic;
@@ -154,6 +155,8 @@ namespace Ryujinx.Ava.UI.ViewModels
public async Task Add()
{
OsUtils.SetCoreDumpable(true);
var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
{
AllowMultiple = true,
@@ -183,6 +186,11 @@ namespace Ryujinx.Ava.UI.ViewModels
{
await ShowNewUpdatesAddedDialog(totalUpdatesAdded);
}
if (!Program.CoreDumpArg)
{
OsUtils.SetCoreDumpable(false);
}
}
public void Save()
@@ -3,6 +3,7 @@ using Avalonia.Interactivity;
using Avalonia.Platform.Storage;
using Avalonia.VisualTree;
using Ryujinx.Ava.UI.ViewModels;
using Ryujinx.Common.Utilities;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -20,6 +21,8 @@ namespace Ryujinx.Ava.UI.Views.Settings
private async void AddGameDirButton_OnClick(object sender, RoutedEventArgs e)
{
OsUtils.SetCoreDumpable(true);
string path = GameDirPathBox.Text;
if (!string.IsNullOrWhiteSpace(path) && Directory.Exists(path) && !ViewModel.GameDirectories.Contains(path))
@@ -43,6 +46,11 @@ namespace Ryujinx.Ava.UI.Views.Settings
}
}
}
if (!Program.CoreDumpArg)
{
OsUtils.SetCoreDumpable(false);
}
}
private void RemoveGameDirButton_OnClick(object sender, RoutedEventArgs e)
@@ -63,6 +71,8 @@ namespace Ryujinx.Ava.UI.Views.Settings
private async void AddAutoloadDirButton_OnClick(object sender, RoutedEventArgs e)
{
OsUtils.SetCoreDumpable(true);
string path = AutoloadDirPathBox.Text;
if (!string.IsNullOrWhiteSpace(path) && Directory.Exists(path) && !ViewModel.AutoloadDirectories.Contains(path))
@@ -86,6 +96,11 @@ namespace Ryujinx.Ava.UI.Views.Settings
}
}
}
if (!Program.CoreDumpArg)
{
OsUtils.SetCoreDumpable(false);
}
}
private void RemoveAutoloadDirButton_OnClick(object sender, RoutedEventArgs e)
@@ -8,6 +8,7 @@ using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.UI.Controls;
using Ryujinx.Ava.UI.Models;
using Ryujinx.Ava.UI.ViewModels;
using Ryujinx.Common.Utilities;
using Ryujinx.HLE.FileSystem;
using SkiaSharp;
using System.Collections.Generic;
@@ -63,6 +64,8 @@ namespace Ryujinx.Ava.UI.Views.User
private async void Import_OnClick(object sender, RoutedEventArgs e)
{
OsUtils.SetCoreDumpable(true);
if (this.GetVisualRoot() is Window window)
{
var result = await window.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
@@ -85,6 +88,11 @@ namespace Ryujinx.Ava.UI.Views.User
_parent.GoBack();
}
}
if (!Program.CoreDumpArg)
{
OsUtils.SetCoreDumpable(false);
}
}
private void GoBack(object sender, RoutedEventArgs e)