Avalonia - Couple fixes and improvements (#3451)

* fix updater check crash

* remove line

* reduce cheat window sizes

* enable tiered compilation and r2r

* remove warning on LaunchState

* remove warnings related to tasks

* addressed review

* undo csproj indentation

* fix tabs in axaml file

* remove double line

* remove R2R
This commit is contained in:
Emmanuel Hansen 2022-07-11 22:25:33 +00:00 committed by GitHub
parent 14ae4e276f
commit 7d9a5feccb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 141 additions and 80 deletions

View file

@ -23,6 +23,7 @@ using System;
using System.Buffers; using System.Buffers;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using static LibHac.Fs.ApplicationSaveDataManagement; using static LibHac.Fs.ApplicationSaveDataManagement;
using Path = System.IO.Path; using Path = System.IO.Path;
@ -77,8 +78,12 @@ namespace Ryujinx.Ava.Common
if (result.IsFailure()) if (result.IsFailure())
{ {
ContentDialogHelper.CreateErrorDialog(_owner, Dispatcher.UIThread.Post(async () =>
string.Format(LocaleManager.Instance["DialogMessageCreateSaveErrorMessage"], result.ToStringWithName())); {
await ContentDialogHelper.CreateErrorDialog(
_owner,
string.Format(LocaleManager.Instance["DialogMessageCreateSaveErrorMessage"], result.ToStringWithName()));
});
return false; return false;
} }
@ -94,8 +99,11 @@ namespace Ryujinx.Ava.Common
return true; return true;
} }
ContentDialogHelper.CreateErrorDialog(_owner, Dispatcher.UIThread.Post(async () =>
string.Format(LocaleManager.Instance["DialogMessageFindSaveErrorMessage"], result.ToStringWithName())); {
await ContentDialogHelper.CreateErrorDialog(_owner,
string.Format(LocaleManager.Instance["DialogMessageFindSaveErrorMessage"], result.ToStringWithName()));
});
return false; return false;
} }
@ -137,7 +145,7 @@ namespace Ryujinx.Ava.Common
} }
} }
public static async void ExtractSection(NcaSectionType ncaSectionType, string titleFilePath, public static async Task ExtractSection(NcaSectionType ncaSectionType, string titleFilePath,
int programIndex = 0) int programIndex = 0)
{ {
OpenFolderDialog folderDialog = new() { Title = LocaleManager.Instance["FolderDialogExtractTitle"] }; OpenFolderDialog folderDialog = new() { Title = LocaleManager.Instance["FolderDialogExtractTitle"] };
@ -222,9 +230,9 @@ namespace Ryujinx.Ava.Common
{ {
Logger.Error?.Print(LogClass.Application, Logger.Error?.Print(LogClass.Application,
"Extraction failure. The main NCA was not present in the selected file"); "Extraction failure. The main NCA was not present in the selected file");
Dispatcher.UIThread.InvokeAsync(() => Dispatcher.UIThread.InvokeAsync(async () =>
{ {
ContentDialogHelper.CreateErrorDialog(_owner, LocaleManager.Instance["DialogNcaExtractionMainNcaNotFoundErrorMessage"]); await ContentDialogHelper.CreateErrorDialog(_owner, LocaleManager.Instance["DialogNcaExtractionMainNcaNotFoundErrorMessage"]);
}); });
return; return;
} }
@ -263,9 +271,9 @@ namespace Ryujinx.Ava.Common
{ {
Logger.Error?.Print(LogClass.Application, Logger.Error?.Print(LogClass.Application,
$"LibHac returned error code: {resultCode.Value.ErrorCode}"); $"LibHac returned error code: {resultCode.Value.ErrorCode}");
Dispatcher.UIThread.InvokeAsync(() => Dispatcher.UIThread.InvokeAsync(async () =>
{ {
ContentDialogHelper.CreateErrorDialog(_owner, LocaleManager.Instance["DialogNcaExtractionCheckLogErrorMessage"]); await ContentDialogHelper.CreateErrorDialog(_owner, LocaleManager.Instance["DialogNcaExtractionCheckLogErrorMessage"]);
}); });
} }
else if (resultCode.Value.IsSuccess()) else if (resultCode.Value.IsSuccess())
@ -288,9 +296,9 @@ namespace Ryujinx.Ava.Common
} }
catch (ArgumentException ex) catch (ArgumentException ex)
{ {
Dispatcher.UIThread.InvokeAsync(() => Dispatcher.UIThread.InvokeAsync(async () =>
{ {
ContentDialogHelper.CreateErrorDialog(_owner, ex.Message); await ContentDialogHelper.CreateErrorDialog(_owner, ex.Message);
}); });
} }
} }

View file

@ -73,8 +73,11 @@ namespace Ryujinx.Modules
} }
catch catch
{ {
ContentDialogHelper.CreateWarningDialog(mainWindow, LocaleManager.Instance["DialogUpdaterConvertFailedMessage"], LocaleManager.Instance["DialogUpdaterCancelUpdateMessage"]);
Logger.Error?.Print(LogClass.Application, "Failed to convert the current Ryujinx version!"); Logger.Error?.Print(LogClass.Application, "Failed to convert the current Ryujinx version!");
Dispatcher.UIThread.Post(async () =>
{
await ContentDialogHelper.CreateWarningDialog(mainWindow, LocaleManager.Instance["DialogUpdaterConvertFailedMessage"], LocaleManager.Instance["DialogUpdaterCancelUpdateMessage"]);
});
return; return;
} }
@ -106,7 +109,10 @@ namespace Ryujinx.Modules
{ {
if (showVersionUpToDate) if (showVersionUpToDate)
{ {
ContentDialogHelper.CreateUpdaterInfoDialog(mainWindow, LocaleManager.Instance["DialogUpdaterAlreadyOnLatestVersionMessage"], ""); Dispatcher.UIThread.Post(async () =>
{
await ContentDialogHelper.CreateUpdaterInfoDialog(mainWindow, LocaleManager.Instance["DialogUpdaterAlreadyOnLatestVersionMessage"], "");
});
} }
return; return;
@ -121,7 +127,10 @@ namespace Ryujinx.Modules
{ {
if (showVersionUpToDate) if (showVersionUpToDate)
{ {
ContentDialogHelper.CreateUpdaterInfoDialog(mainWindow, LocaleManager.Instance["DialogUpdaterAlreadyOnLatestVersionMessage"], ""); Dispatcher.UIThread.Post(async () =>
{
await ContentDialogHelper.CreateUpdaterInfoDialog(mainWindow, LocaleManager.Instance["DialogUpdaterAlreadyOnLatestVersionMessage"], "");
});
} }
return; return;
@ -131,7 +140,10 @@ namespace Ryujinx.Modules
catch (Exception exception) catch (Exception exception)
{ {
Logger.Error?.Print(LogClass.Application, exception.Message); Logger.Error?.Print(LogClass.Application, exception.Message);
ContentDialogHelper.CreateErrorDialog(mainWindow, LocaleManager.Instance["DialogUpdaterFailedToGetVersionMessage"]); Dispatcher.UIThread.Post(async () =>
{
await ContentDialogHelper.CreateErrorDialog(mainWindow, LocaleManager.Instance["DialogUpdaterFailedToGetVersionMessage"]);
});
return; return;
} }
@ -142,8 +154,11 @@ namespace Ryujinx.Modules
} }
catch catch
{ {
ContentDialogHelper.CreateWarningDialog(mainWindow, LocaleManager.Instance["DialogUpdaterConvertFailedGithubMessage"], LocaleManager.Instance["DialogUpdaterCancelUpdateMessage"]);
Logger.Error?.Print(LogClass.Application, "Failed to convert the received Ryujinx version from Github!"); Logger.Error?.Print(LogClass.Application, "Failed to convert the received Ryujinx version from Github!");
Dispatcher.UIThread.Post(async () =>
{
await ContentDialogHelper.CreateWarningDialog(mainWindow, LocaleManager.Instance["DialogUpdaterConvertFailedGithubMessage"], LocaleManager.Instance["DialogUpdaterCancelUpdateMessage"]);
});
return; return;
} }
@ -152,7 +167,10 @@ namespace Ryujinx.Modules
{ {
if (showVersionUpToDate) if (showVersionUpToDate)
{ {
ContentDialogHelper.CreateUpdaterInfoDialog(mainWindow, LocaleManager.Instance["DialogUpdaterAlreadyOnLatestVersionMessage"], ""); Dispatcher.UIThread.Post(async () =>
{
await ContentDialogHelper.CreateUpdaterInfoDialog(mainWindow, LocaleManager.Instance["DialogUpdaterAlreadyOnLatestVersionMessage"], "");
});
} }
Running = false; Running = false;
@ -180,10 +198,12 @@ namespace Ryujinx.Modules
_buildSize = -1; _buildSize = -1;
} }
} }
Dispatcher.UIThread.Post(async () =>
// Show a message asking the user if they want to update {
UpdaterWindow updateDialog = new(mainWindow, newVersion, _buildUrl); // Show a message asking the user if they want to update
await updateDialog.ShowDialog(mainWindow); UpdaterWindow updateDialog = new(mainWindow, newVersion, _buildUrl);
await updateDialog.ShowDialog(mainWindow);
});
} }
private static HttpClient ConstructHttpClient() private static HttpClient ConstructHttpClient()
@ -522,6 +542,7 @@ namespace Ryujinx.Modules
updateDialog.ButtonBox.IsVisible = true; updateDialog.ButtonBox.IsVisible = true;
} }
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
public static bool CanUpdate(bool showWarnings, StyleableWindow parent) public static bool CanUpdate(bool showWarnings, StyleableWindow parent)
{ {
#if !DISABLE_UPDATER #if !DISABLE_UPDATER
@ -577,6 +598,7 @@ namespace Ryujinx.Modules
return false; return false;
#endif #endif
} }
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
// NOTE: This method should always reflect the latest build layout.s // NOTE: This method should always reflect the latest build layout.s
private static IEnumerable<string> EnumerateFilesToDelete() private static IEnumerable<string> EnumerateFilesToDelete()

View file

@ -5,8 +5,6 @@
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Version>1.0.0-dirty</Version> <Version>1.0.0-dirty</Version>
<TieredCompilation>false</TieredCompilation>
<TieredCompilationQuickJit>false</TieredCompilationQuickJit>
<DefineConstants Condition=" '$(ExtraDefineConstants)' != '' ">$(DefineConstants);$(ExtraDefineConstants)</DefineConstants> <DefineConstants Condition=" '$(ExtraDefineConstants)' != '' ">$(DefineConstants);$(ExtraDefineConstants)</DefineConstants>
<RootNamespace>Ryujinx.Ava</RootNamespace> <RootNamespace>Ryujinx.Ava</RootNamespace>
<ApplicationIcon>Ryujinx.ico</ApplicationIcon> <ApplicationIcon>Ryujinx.ico</ApplicationIcon>

View file

@ -92,7 +92,7 @@ namespace Ryujinx.Ava.Ui.Applet
} }
catch (Exception ex) catch (Exception ex)
{ {
ContentDialogHelper.CreateErrorDialog(_parent, string.Format(LocaleManager.Instance["DialogMessageDialogErrorExceptionMessage"], ex)); await ContentDialogHelper.CreateErrorDialog(_parent, string.Format(LocaleManager.Instance["DialogMessageDialogErrorExceptionMessage"], ex));
dialogCloseEvent.Set(); dialogCloseEvent.Set();
} }
@ -126,7 +126,7 @@ namespace Ryujinx.Ava.Ui.Applet
catch (Exception ex) catch (Exception ex)
{ {
error = true; error = true;
ContentDialogHelper.CreateErrorDialog(_parent, string.Format(LocaleManager.Instance["DialogSoftwareKeyboardErrorExceptionMessage"], ex)); await ContentDialogHelper.CreateErrorDialog(_parent, string.Format(LocaleManager.Instance["DialogSoftwareKeyboardErrorExceptionMessage"], ex));
} }
finally finally
{ {
@ -181,7 +181,7 @@ namespace Ryujinx.Ava.Ui.Applet
catch (Exception ex) catch (Exception ex)
{ {
dialogCloseEvent.Set(); dialogCloseEvent.Set();
ContentDialogHelper.CreateErrorDialog(_parent, string.Format(LocaleManager.Instance["DialogErrorAppletErrorExceptionMessage"], ex)); await ContentDialogHelper.CreateErrorDialog(_parent, string.Format(LocaleManager.Instance["DialogErrorAppletErrorExceptionMessage"], ex));
} }
}); });

View file

@ -235,7 +235,7 @@ namespace Ryujinx.Ava.Ui.Controls
return new(mainText, secondaryText); return new(mainText, secondaryText);
} }
internal static async void CreateUpdaterInfoDialog(StyleableWindow window, string primary, string secondaryText) internal static async Task CreateUpdaterInfoDialog(StyleableWindow window, string primary, string secondaryText)
{ {
await ShowContentDialog( await ShowContentDialog(
window, window,
@ -248,7 +248,7 @@ namespace Ryujinx.Ava.Ui.Controls
(int)Symbol.Important); (int)Symbol.Important);
} }
internal static async void ShowNotAvailableMessage(StyleableWindow window) internal static async Task ShowNotAvailableMessage(StyleableWindow window)
{ {
// Temporary placeholder for features to be added // Temporary placeholder for features to be added
await ShowContentDialog( await ShowContentDialog(
@ -262,7 +262,7 @@ namespace Ryujinx.Ava.Ui.Controls
(int)Symbol.Important); (int)Symbol.Important);
} }
internal static async void CreateWarningDialog(StyleableWindow window, string primary, string secondaryText) internal static async Task CreateWarningDialog(StyleableWindow window, string primary, string secondaryText)
{ {
await ShowContentDialog( await ShowContentDialog(
window, window,
@ -275,7 +275,7 @@ namespace Ryujinx.Ava.Ui.Controls
(int)Symbol.Important); (int)Symbol.Important);
} }
internal static async void CreateErrorDialog(StyleableWindow owner, string errorMessage, string secondaryErrorMessage = "") internal static async Task CreateErrorDialog(StyleableWindow owner, string errorMessage, string secondaryErrorMessage = "")
{ {
Logger.Error?.Print(LogClass.Application, errorMessage); Logger.Error?.Print(LogClass.Application, errorMessage);

View file

@ -658,7 +658,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
return config; return config;
} }
public void LoadProfile() public async void LoadProfile()
{ {
if (Device == 0) if (Device == 0)
{ {
@ -700,9 +700,9 @@ namespace Ryujinx.Ava.Ui.ViewModels
catch (JsonException) { } catch (JsonException) { }
catch (InvalidOperationException) catch (InvalidOperationException)
{ {
ContentDialogHelper.CreateErrorDialog(_owner.GetVisualRoot() as StyleableWindow,
String.Format(LocaleManager.Instance["DialogProfileInvalidProfileErrorMessage"], ProfileName));
Logger.Error?.Print(LogClass.Configuration, $"Profile {ProfileName} is incompatible with the current input configuration system."); Logger.Error?.Print(LogClass.Configuration, $"Profile {ProfileName} is incompatible with the current input configuration system.");
await ContentDialogHelper.CreateErrorDialog(_owner.GetVisualRoot() as StyleableWindow,
String.Format(LocaleManager.Instance["DialogProfileInvalidProfileErrorMessage"], ProfileName));
return; return;
} }
@ -736,7 +736,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
if (ProfileName == LocaleManager.Instance["ControllerSettingsProfileDefault"]) if (ProfileName == LocaleManager.Instance["ControllerSettingsProfileDefault"])
{ {
ContentDialogHelper.CreateErrorDialog(_owner.GetVisualRoot() as StyleableWindow, LocaleManager.Instance["DialogProfileDefaultProfileOverwriteErrorMessage"]); await ContentDialogHelper.CreateErrorDialog(_owner.GetVisualRoot() as StyleableWindow, LocaleManager.Instance["DialogProfileDefaultProfileOverwriteErrorMessage"]);
return; return;
} }
@ -769,7 +769,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
} }
else else
{ {
ContentDialogHelper.CreateErrorDialog(_owner.GetVisualRoot() as StyleableWindow, LocaleManager.Instance["DialogProfileInvalidProfileNameErrorMessage"]); await ContentDialogHelper.CreateErrorDialog(_owner.GetVisualRoot() as StyleableWindow, LocaleManager.Instance["DialogProfileInvalidProfileNameErrorMessage"]);
} }
} }
} }

View file

@ -1047,8 +1047,11 @@ namespace Ryujinx.Ava.Ui.ViewModels
if (!ulong.TryParse(selection.TitleId, NumberStyles.HexNumber, CultureInfo.InvariantCulture, if (!ulong.TryParse(selection.TitleId, NumberStyles.HexNumber, CultureInfo.InvariantCulture,
out ulong titleIdNumber)) out ulong titleIdNumber))
{ {
ContentDialogHelper.CreateErrorDialog(_owner, Dispatcher.UIThread.Post(async () =>
LocaleManager.Instance["DialogRyujinxErrorMessage"], LocaleManager.Instance["DialogInvalidTitleIdErrorMessage"]); {
await ContentDialogHelper.CreateErrorDialog(_owner,
LocaleManager.Instance["DialogRyujinxErrorMessage"], LocaleManager.Instance["DialogInvalidTitleIdErrorMessage"]);
});
return; return;
} }
@ -1155,7 +1158,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
} }
catch (Exception e) catch (Exception e)
{ {
ContentDialogHelper.CreateErrorDialog(_owner, string.Format(LocaleManager.Instance["DialogPPTCDeletionErrorMessage"], file.Name, e)); await ContentDialogHelper.CreateErrorDialog(_owner, string.Format(LocaleManager.Instance["DialogPPTCDeletionErrorMessage"], file.Name, e));
} }
} }
} }
@ -1216,7 +1219,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
} }
catch (Exception e) catch (Exception e)
{ {
ContentDialogHelper.CreateErrorDialog(_owner, string.Format(LocaleManager.Instance["DialogPPTCDeletionErrorMessage"], directory.Name, e)); await ContentDialogHelper.CreateErrorDialog(_owner, string.Format(LocaleManager.Instance["DialogPPTCDeletionErrorMessage"], directory.Name, e));
} }
} }
} }
@ -1229,7 +1232,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
} }
catch (Exception e) catch (Exception e)
{ {
ContentDialogHelper.CreateErrorDialog(_owner, string.Format(LocaleManager.Instance["ShaderCachePurgeError"], file.Name, e)); await ContentDialogHelper.CreateErrorDialog(_owner, string.Format(LocaleManager.Instance["ShaderCachePurgeError"], file.Name, e));
} }
} }
} }
@ -1310,8 +1313,11 @@ namespace Ryujinx.Ava.Ui.ViewModels
if (!ulong.TryParse(selection.TitleId, NumberStyles.HexNumber, CultureInfo.InvariantCulture, if (!ulong.TryParse(selection.TitleId, NumberStyles.HexNumber, CultureInfo.InvariantCulture,
out ulong titleIdNumber)) out ulong titleIdNumber))
{ {
ContentDialogHelper.CreateErrorDialog(_owner, Dispatcher.UIThread.Post(async () =>
LocaleManager.Instance["DialogRyujinxErrorMessage"], LocaleManager.Instance["DialogInvalidTitleIdErrorMessage"]); {
await ContentDialogHelper.CreateErrorDialog(_owner,
LocaleManager.Instance["DialogRyujinxErrorMessage"], LocaleManager.Instance["DialogInvalidTitleIdErrorMessage"]);
});
return; return;
} }
@ -1333,8 +1339,11 @@ namespace Ryujinx.Ava.Ui.ViewModels
if (!ulong.TryParse(selection.TitleId, NumberStyles.HexNumber, CultureInfo.InvariantCulture, if (!ulong.TryParse(selection.TitleId, NumberStyles.HexNumber, CultureInfo.InvariantCulture,
out ulong titleIdNumber)) out ulong titleIdNumber))
{ {
ContentDialogHelper.CreateErrorDialog(_owner, Dispatcher.UIThread.Post(async () =>
LocaleManager.Instance["DialogRyujinxErrorMessage"], LocaleManager.Instance["DialogInvalidTitleIdErrorMessage"]); {
await ContentDialogHelper.CreateErrorDialog(_owner,
LocaleManager.Instance["DialogRyujinxErrorMessage"], LocaleManager.Instance["DialogInvalidTitleIdErrorMessage"]);
});
return; return;
} }
@ -1350,30 +1359,30 @@ namespace Ryujinx.Ava.Ui.ViewModels
ApplicationHelper.OpenSaveDir(in filter, titleId, data.ControlHolder, data.TitleName); ApplicationHelper.OpenSaveDir(in filter, titleId, data.ControlHolder, data.TitleName);
} }
private void ExtractLogo() private async void ExtractLogo()
{ {
var selection = SelectedApplication; var selection = SelectedApplication;
if (selection != null) if (selection != null)
{ {
ApplicationHelper.ExtractSection(NcaSectionType.Logo, selection.Path); await ApplicationHelper.ExtractSection(NcaSectionType.Logo, selection.Path);
} }
} }
private void ExtractRomFs() private async void ExtractRomFs()
{ {
var selection = SelectedApplication; var selection = SelectedApplication;
if (selection != null) if (selection != null)
{ {
ApplicationHelper.ExtractSection(NcaSectionType.Data, selection.Path); await ApplicationHelper.ExtractSection(NcaSectionType.Data, selection.Path);
} }
} }
private void ExtractExeFs() private async void ExtractExeFs()
{ {
var selection = SelectedApplication; var selection = SelectedApplication;
if (selection != null) if (selection != null)
{ {
ApplicationHelper.ExtractSection(NcaSectionType.Code, selection.Path); await ApplicationHelper.ExtractSection(NcaSectionType.Code, selection.Path);
} }
} }
@ -1382,7 +1391,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
_owner.Close(); _owner.Close();
} }
private async void HandleFirmwareInstallation(string path) private async Task HandleFirmwareInstallation(string path)
{ {
try try
{ {
@ -1392,7 +1401,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
if (firmwareVersion == null) if (firmwareVersion == null)
{ {
ContentDialogHelper.CreateErrorDialog(_owner, string.Format(LocaleManager.Instance["DialogFirmwareInstallerFirmwareNotFoundErrorMessage"], filename)); await ContentDialogHelper.CreateErrorDialog(_owner, string.Format(LocaleManager.Instance["DialogFirmwareInstallerFirmwareNotFoundErrorMessage"], filename));
return; return;
} }
@ -1457,11 +1466,11 @@ namespace Ryujinx.Ava.Ui.ViewModels
} }
catch (Exception ex) catch (Exception ex)
{ {
Dispatcher.UIThread.InvokeAsync(() => Dispatcher.UIThread.InvokeAsync(async () =>
{ {
waitingDialog.Close(); waitingDialog.Close();
ContentDialogHelper.CreateErrorDialog(_owner, ex.Message); await ContentDialogHelper.CreateErrorDialog(_owner, ex.Message);
}); });
} }
finally finally
@ -1482,7 +1491,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
} }
catch (Exception ex) catch (Exception ex)
{ {
ContentDialogHelper.CreateErrorDialog(_owner, ex.Message); await ContentDialogHelper.CreateErrorDialog(_owner, ex.Message);
} }
} }
@ -1497,7 +1506,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
if (file != null && file.Length > 0) if (file != null && file.Length > 0)
{ {
HandleFirmwareInstallation(file[0]); await HandleFirmwareInstallation(file[0]);
} }
} }
@ -1509,7 +1518,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
if (!string.IsNullOrWhiteSpace(folder)) if (!string.IsNullOrWhiteSpace(folder))
{ {
HandleFirmwareInstallation(folder); await HandleFirmwareInstallation(folder);
} }
} }
} }

View file

@ -1,3 +1,4 @@
using Avalonia.Threading;
using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.Ui.Controls; using Ryujinx.Ava.Ui.Controls;
using Ryujinx.Ava.Ui.Windows; using Ryujinx.Ava.Ui.Windows;
@ -141,8 +142,12 @@ namespace Ryujinx.Ava.Ui.ViewModels
if (profile == null) if (profile == null)
{ {
ContentDialogHelper.CreateErrorDialog(_owner, Dispatcher.UIThread.Post(async () =>
LocaleManager.Instance["DialogUserProfileDeletionWarningMessage"]); {
await ContentDialogHelper.CreateErrorDialog(_owner,
LocaleManager.Instance["DialogUserProfileDeletionWarningMessage"]);
});
return; return;
} }

View file

@ -7,7 +7,6 @@
xmlns:model="clr-namespace:Ryujinx.Ava.Ui.Models" xmlns:model="clr-namespace:Ryujinx.Ava.Ui.Models"
xmlns:window="clr-namespace:Ryujinx.Ava.Ui.Windows" xmlns:window="clr-namespace:Ryujinx.Ava.Ui.Windows"
mc:Ignorable="d" mc:Ignorable="d"
SizeToContent="Height"
Width="500" MinHeight="500" Height="500" Width="500" MinHeight="500" Height="500"
WindowStartupLocation="CenterOwner" WindowStartupLocation="CenterOwner"
MinWidth="500"> MinWidth="500">
@ -45,6 +44,13 @@
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
Name="CheatsView" Name="CheatsView"
MinHeight="300"> MinHeight="300">
<TreeView.Styles>
<Styles>
<Style Selector="TreeViewItem:empty /template/ ItemsPresenter">
<Setter Property="IsVisible" Value="False"/>
</Style>
</Styles>
</TreeView.Styles>
<TreeView.DataTemplates> <TreeView.DataTemplates>
<TreeDataTemplate DataType="model:CheatsList" ItemsSource="{Binding}"> <TreeDataTemplate DataType="model:CheatsList" ItemsSource="{Binding}">
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal"> <StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
@ -56,9 +62,9 @@
</StackPanel> </StackPanel>
</TreeDataTemplate> </TreeDataTemplate>
<DataTemplate x:DataType="model:CheatModel"> <DataTemplate x:DataType="model:CheatModel">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <StackPanel Orientation="Horizontal" Margin="0" HorizontalAlignment="Left">
<CheckBox IsChecked="{Binding IsEnabled}" MinWidth="20" /> <CheckBox IsChecked="{Binding IsEnabled}" Padding="0" Margin="5,0" MinWidth="20" />
<TextBlock Text="{Binding CleanName}" /> <TextBlock Text="{Binding CleanName}" VerticalAlignment="Center" />
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
</TreeView.DataTemplates> </TreeView.DataTemplates>

View file

@ -2,6 +2,7 @@ using Avalonia;
using Avalonia.Collections; using Avalonia.Collections;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using Avalonia.Threading;
using LibHac.Common; using LibHac.Common;
using LibHac.Fs; using LibHac.Fs;
using LibHac.Fs.Fsa; using LibHac.Fs.Fsa;
@ -21,6 +22,7 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
using Path = System.IO.Path; using Path = System.IO.Path;
namespace Ryujinx.Ava.Ui.Windows namespace Ryujinx.Ava.Ui.Windows
@ -125,15 +127,18 @@ namespace Ryujinx.Ava.Ui.Windows
} }
catch (Exception ex) catch (Exception ex)
{ {
ContentDialogHelper.CreateErrorDialog(this, Dispatcher.UIThread.InvokeAsync(async () =>
{
await ContentDialogHelper.CreateErrorDialog(this,
string.Format(LocaleManager.Instance[ string.Format(LocaleManager.Instance[
"DialogDlcLoadNcaErrorMessage"], ex.Message, containerPath)); "DialogDlcLoadNcaErrorMessage"], ex.Message, containerPath));
});
} }
return null; return null;
} }
private void AddDlc(string path) private async Task AddDlc(string path)
{ {
if (!File.Exists(path) || Dlcs.FirstOrDefault(x => x.ContainerPath == path) != null) if (!File.Exists(path) || Dlcs.FirstOrDefault(x => x.ContainerPath == path) != null)
{ {
@ -175,7 +180,7 @@ namespace Ryujinx.Ava.Ui.Windows
if (!containsDlc) if (!containsDlc)
{ {
ContentDialogHelper.CreateErrorDialog(this, LocaleManager.Instance["DialogDlcNoDlcErrorMessage"]); await ContentDialogHelper.CreateErrorDialog(this, LocaleManager.Instance["DialogDlcNoDlcErrorMessage"]);
} }
} }
} }
@ -214,7 +219,7 @@ namespace Ryujinx.Ava.Ui.Windows
{ {
foreach (string file in files) foreach (string file in files)
{ {
AddDlc(file); await AddDlc(file);
} }
} }
} }

View file

@ -120,8 +120,6 @@ namespace Ryujinx.Ava.Ui.Windows
InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL2GamepadDriver()); InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL2GamepadDriver());
LoadGameList(); LoadGameList();
CheckLaunchState();
} }
_rendererWaitEvent = new AutoResetEvent(false); _rendererWaitEvent = new AutoResetEvent(false);
@ -451,7 +449,7 @@ namespace Ryujinx.Ava.Ui.Windows
RefreshFirmwareStatus(); RefreshFirmwareStatus();
} }
protected async void CheckLaunchState() protected void CheckLaunchState()
{ {
if (ShowKeyErrorOnLoad) if (ShowKeyErrorOnLoad)
{ {
@ -470,7 +468,7 @@ namespace Ryujinx.Ava.Ui.Windows
if (ConfigurationState.Instance.CheckUpdatesOnStart.Value && Updater.CanUpdate(false, this)) if (ConfigurationState.Instance.CheckUpdatesOnStart.Value && Updater.CanUpdate(false, this))
{ {
await Updater.BeginParse(this, false).ContinueWith(task => Updater.BeginParse(this, false).ContinueWith(task =>
{ {
Logger.Error?.Print(LogClass.Application, $"Updater Error: {task.Exception}"); Logger.Error?.Print(LogClass.Application, $"Updater Error: {task.Exception}");
}, TaskContinuationOptions.OnlyOnFaulted); }, TaskContinuationOptions.OnlyOnFaulted);
@ -537,6 +535,13 @@ namespace Ryujinx.Ava.Ui.Windows
LoadHotKeys(); LoadHotKeys();
} }
protected override void OnOpened(EventArgs e)
{
base.OnOpened(e);
CheckLaunchState();
}
public static void UpdateGraphicsConfig() public static void UpdateGraphicsConfig()
{ {
int resScale = ConfigurationState.Instance.Graphics.ResScale; int resScale = ConfigurationState.Instance.Graphics.ResScale;

View file

@ -24,6 +24,7 @@ using System.Text;
using Path = System.IO.Path; using Path = System.IO.Path;
using SpanHelpers = LibHac.Common.SpanHelpers; using SpanHelpers = LibHac.Common.SpanHelpers;
using LibHac.Tools.FsSystem; using LibHac.Tools.FsSystem;
using Avalonia.Threading;
namespace Ryujinx.Ava.Ui.Windows namespace Ryujinx.Ava.Ui.Windows
{ {
@ -151,14 +152,20 @@ namespace Ryujinx.Ava.Ui.Windows
} }
else else
{ {
ContentDialogHelper.CreateErrorDialog(this, Dispatcher.UIThread.Post(async () =>
LocaleManager.Instance["DialogUpdateAddUpdateErrorMessage"]); {
await ContentDialogHelper.CreateErrorDialog(this,
LocaleManager.Instance["DialogUpdateAddUpdateErrorMessage"]);
});
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
ContentDialogHelper.CreateErrorDialog(this, Dispatcher.UIThread.Post(async () =>
string.Format(LocaleManager.Instance["DialogDlcLoadNcaErrorMessage"], ex.Message, path)); {
await ContentDialogHelper.CreateErrorDialog(this,
string.Format(LocaleManager.Instance["DialogDlcLoadNcaErrorMessage"], ex.Message, path));
});
} }
} }
} }

View file

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
@ -6,8 +6,6 @@
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Version>1.0.0-dirty</Version> <Version>1.0.0-dirty</Version>
<TieredCompilation>false</TieredCompilation>
<TieredCompilationQuickJit>false</TieredCompilationQuickJit>
<DefineConstants Condition=" '$(ExtraDefineConstants)' != '' ">$(DefineConstants);$(ExtraDefineConstants)</DefineConstants> <DefineConstants Condition=" '$(ExtraDefineConstants)' != '' ">$(DefineConstants);$(ExtraDefineConstants)</DefineConstants>
</PropertyGroup> </PropertyGroup>

View file

@ -6,8 +6,6 @@
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Version>1.0.0-dirty</Version> <Version>1.0.0-dirty</Version>
<TieredCompilation>false</TieredCompilation>
<TieredCompilationQuickJit>false</TieredCompilationQuickJit>
<DefineConstants Condition=" '$(ExtraDefineConstants)' != '' ">$(DefineConstants);$(ExtraDefineConstants)</DefineConstants> <DefineConstants Condition=" '$(ExtraDefineConstants)' != '' ">$(DefineConstants);$(ExtraDefineConstants)</DefineConstants>
<!-- As we already provide GTK3 on Windows via GtkSharp.Dependencies this is redundant. --> <!-- As we already provide GTK3 on Windows via GtkSharp.Dependencies this is redundant. -->
<SkipGtkInstall>true</SkipGtkInstall> <SkipGtkInstall>true</SkipGtkInstall>