diff options
| author | Isaac Marovitz <42140194+IsaacMarovitz@users.noreply.github.com> | 2023-12-25 05:57:14 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-25 06:57:14 +0100 |
| commit | 19a949d0bf02fd5850d1222b2d51c3bc3e0e5670 (patch) | |
| tree | 70b7358beaf07057053c84e67f5531a8fc523178 /src/Ryujinx.Ava/UI/Windows | |
| parent | feec5ef7b354e92bff03a846285af6bf4b8fb491 (diff) | |
Ava UI: Fix crash when clicking on a cheat's name (#5860)
* Fix crash
* Remove nullable
* Hide BuildId for child nodes
* Fix warning
* Fix charset
Diffstat (limited to 'src/Ryujinx.Ava/UI/Windows')
| -rw-r--r-- | src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml | 24 | ||||
| -rw-r--r-- | src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml.cs | 14 |
2 files changed, 13 insertions, 25 deletions
diff --git a/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml b/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml index 8a5da5cc..57d5f7ef 100644 --- a/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml +++ b/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml @@ -86,28 +86,16 @@ </Style> </Styles> </TreeView.Styles> - <TreeView.DataTemplates> - <TreeDataTemplate DataType="model:CheatsList" ItemsSource="{Binding}"> + <TreeView.ItemTemplate> + <TreeDataTemplate ItemsSource="{Binding SubNodes}"> <StackPanel HorizontalAlignment="Left" Orientation="Horizontal"> <CheckBox MinWidth="20" IsChecked="{Binding IsEnabled}" /> - <TextBlock Width="150" Text="{Binding BuildId}" /> - <TextBlock Text="{Binding Path}" /> + <TextBlock Width="150" Text="{Binding CleanName}" IsVisible="{Binding !IsRootNode}" /> + <TextBlock Width="150" Text="{Binding BuildId}" IsVisible="{Binding IsRootNode}" /> + <TextBlock Text="{Binding Path}" IsVisible="{Binding IsRootNode}" /> </StackPanel> </TreeDataTemplate> - <DataTemplate x:DataType="model:CheatModel"> - <StackPanel - Margin="0" - HorizontalAlignment="Left" - Orientation="Horizontal"> - <CheckBox - MinWidth="20" - Margin="5,0" - Padding="0" - IsChecked="{Binding IsEnabled}" /> - <TextBlock VerticalAlignment="Center" Text="{Binding CleanName}" /> - </StackPanel> - </DataTemplate> - </TreeView.DataTemplates> + </TreeView.ItemTemplate> </TreeView> </Border> <DockPanel diff --git a/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml.cs b/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml.cs index 34444934..c2de67ab 100644 --- a/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml.cs +++ b/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml.cs @@ -17,7 +17,7 @@ namespace Ryujinx.Ava.UI.Windows private readonly string _enabledCheatsPath; public bool NoCheatsFound { get; } - public AvaloniaList<CheatsList> LoadedCheats { get; } + public AvaloniaList<CheatNode> LoadedCheats { get; } public string Heading { get; } public string BuildId { get; } @@ -33,7 +33,7 @@ namespace Ryujinx.Ava.UI.Windows public CheatWindow(VirtualFileSystem virtualFileSystem, string titleId, string titleName, string titlePath) { - LoadedCheats = new AvaloniaList<CheatsList>(); + LoadedCheats = new AvaloniaList<CheatNode>(); Heading = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.CheatWindowHeading, titleName, titleId.ToUpper()); BuildId = ApplicationData.GetApplicationBuildId(virtualFileSystem, titlePath); @@ -62,7 +62,7 @@ namespace Ryujinx.Ava.UI.Windows string currentCheatFile = string.Empty; string buildId = string.Empty; - CheatsList currentGroup = null; + CheatNode currentGroup = null; foreach (var cheat in mods.Cheats) { @@ -72,13 +72,13 @@ namespace Ryujinx.Ava.UI.Windows string parentPath = currentCheatFile.Replace(titleModsPath, ""); buildId = Path.GetFileNameWithoutExtension(currentCheatFile).ToUpper(); - currentGroup = new CheatsList(buildId, parentPath); + currentGroup = new CheatNode("", buildId, parentPath, true); LoadedCheats.Add(currentGroup); } - var model = new CheatModel(cheat.Name, buildId, enabled.Contains($"{buildId}-{cheat.Name}")); - currentGroup?.Add(model); + var model = new CheatNode(cheat.Name, buildId, "", false, enabled.Contains($"{buildId}-{cheat.Name}")); + currentGroup?.SubNodes.Add(model); cheatAdded++; } @@ -104,7 +104,7 @@ namespace Ryujinx.Ava.UI.Windows foreach (var cheats in LoadedCheats) { - foreach (var cheat in cheats) + foreach (var cheat in cheats.SubNodes) { if (cheat.IsEnabled) { |
