Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Remove dependency on the MainWindow #6

Open
wants to merge 173 commits into
base: avalonia
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 171 commits
Commits
Show all changes
173 commits
Select commit Hold shift + click to select a range
303f440
add avalonia ui
emmauss May 6, 2021
8d46a10
Extend localization to most of the UI, some bugfixes
gdkchan May 10, 2021
efa6673
add model for controller viewmodel.
emmauss May 10, 2021
7f58f81
Cleanup Part.1
AcK77 May 11, 2021
7f48d9b
Rewrite LocaleManager to use JSON files, move Images
AcK77 May 11, 2021
506c7c6
New loading screen for shader and PPTC cache load
gdkchan May 11, 2021
5cc3b22
Fixes
emmauss May 11, 2021
95a124f
Make cache load progress show
gdkchan May 11, 2021
155ffe1
Fix GLFW window sizes with DPI scaling
gdkchan May 11, 2021
cae0268
New cache load progress layout
gdkchan May 12, 2021
d996a28
update nuget packages
emmauss May 12, 2021
9217a3e
fix crash that may occur if renderer is not yet realized, but its scr…
emmauss May 12, 2021
acbf0b8
Improve icon color picker
gdkchan May 13, 2021
7f124c4
French translation
AcK77 May 14, 2021
7b422f8
Program.cs cleanup
AcK77 May 14, 2021
2d067f7
Hide Statusbar separators
AcK77 May 14, 2021
0dfe344
Cleanup TitleUpdateWindow
AcK77 May 14, 2021
fdc38cd
Cleanup DLC window and fix TitleUpdate
AcK77 May 14, 2021
b0a07cb
Fix buttons hover
AcK77 May 14, 2021
8b9b7db
Fix buttons foreground color
AcK77 May 14, 2021
8f0202b
Cleanup and design fix of MainWindow
AcK77 May 14, 2021
e79677e
Cleanup and redesign Settings Window, more fixes in MainWindow
AcK77 May 15, 2021
894ba44
Ability to change language during runtime (some binding are missing)
AcK77 May 15, 2021
227173e
Allow updating labels with dynamic values in locale
emmauss May 15, 2021
5695a09
Add locale binding on status bar
AcK77 May 15, 2021
41b9ea7
update avalonia with latest changes from main gui
emmauss Jul 22, 2021
17feeb1
contentdialog wip
emmauss Jul 22, 2021
e7840bc
fix style issues
emmauss Jul 22, 2021
e4d2160
WIP changes
AcK77 Jul 22, 2021
1b53a67
style fixes. readded saving of controller profiles
emmauss Jul 23, 2021
bfd7e7e
add more content dialogs
emmauss Jul 23, 2021
e9eb14d
fix mainwindow scaling
emmauss Jul 23, 2021
620e23f
style fixes
emmauss Jul 23, 2021
61377b0
replaced message boxes with content dialogs. restore some styles
emmauss Jul 23, 2021
1b9bdf6
set default color picker color to white
emmauss Jul 23, 2021
2b3fbcc
style fixes. fix crash on stating a game after closing another one. f…
emmauss Jul 24, 2021
4ce01a0
add update check, direct launch, saving input profile. fix input prof…
emmauss Jul 24, 2021
71edc99
show dialog on exi if game is running, pick icon from apps run with L…
emmauss Jul 24, 2021
8a940bb
use nca icon as default load icon, fix down dpad button, add back dir…
emmauss Jul 24, 2021
35859e5
update style, adjust trigger panels, fix glfw crash
emmauss Jul 25, 2021
361b708
fix touch, make host handler dialogs grow
emmauss Jul 25, 2021
115bb4b
fix name being cut of in game list
emmauss Jul 25, 2021
6c852cc
make applet windows nonresizeable
emmauss Jul 25, 2021
a6d7241
style adjustments to applet windows
emmauss Jul 25, 2021
7ff7be1
lauch settings from controller applet
emmauss Jul 25, 2021
cb0a89c
fix content dialog display on linux, apply controller type and player…
emmauss Jul 26, 2021
f6488a6
fixes
emmauss Jul 26, 2021
15eb790
Update locales, fix indentation, some spelling, remove some unused en…
gdkchan Jul 26, 2021
386a305
update build script
emmauss Jul 26, 2021
fb73e9c
fixes
emmauss Jul 26, 2021
4c2cd7d
set min sizes for windows, and make settings resizeable
emmauss Jul 27, 2021
4b05d52
fix crash on tabing
emmauss Jul 27, 2021
0cf2b1d
align ans hide system version label
emmauss Jul 27, 2021
d39cfd6
change seperator height in settings
emmauss Jul 27, 2021
b58d372
make render control adapt to available space. Apply changes to aspect…
emmauss Jul 27, 2021
343745b
Show error message when loading an old gtk profile, one not support b…
emmauss Jul 27, 2021
aa092c8
fix saving other players
emmauss Jul 27, 2021
8309c62
Unblock input after changing config
emmauss Jul 27, 2021
a72be78
focus focus on render control, fix fullscreen issue
emmauss Jul 27, 2021
68e3138
implement hide ui
emmauss Jul 27, 2021
cd8dc6a
fix anisotropy not being saved correctly
emmauss Jul 27, 2021
c97627a
reduce font size
emmauss Jul 27, 2021
4e7b933
ensure controllers types are loaded.
emmauss Jul 27, 2021
91d46db
fix exit error message
emmauss Jul 27, 2021
b7ef22d
fix crash if no firmware is installed
emmauss Jul 28, 2021
6a6dacf
force dark theme
emmauss Jul 28, 2021
120ed5a
change hide ui shortcut to F4, read shortcuts when rendering control …
emmauss Jul 28, 2021
c87c026
remove 1px border at bottom of rendering control
emmauss Jul 28, 2021
8551971
update controller settings design
emmauss Jul 29, 2021
4453090
fix sorting for game list, adjusted settings window size
emmauss Jul 29, 2021
f88981c
fix left right toggles
emmauss Jul 29, 2021
f9b34c3
fixes
emmauss Jul 29, 2021
1fb391d
load device when loading profiles
emmauss Jul 29, 2021
8267a03
fix detection of nintendo style controllers
emmauss Jul 29, 2021
6c9271f
style fixes
emmauss Jul 30, 2021
76deec8
reduce font size, use contentdialog for profile dialog
emmauss Aug 2, 2021
ab27a82
use content dialog for input dialog
emmauss Aug 2, 2021
e8d40dc
reduce size of avatar window, add confirmation on deleting a profile,…
emmauss Aug 2, 2021
ec6c59a
fixup about window
emmauss Aug 2, 2021
288da55
add title to color picker
emmauss Aug 2, 2021
c98d613
add titles to open dialogs
emmauss Aug 2, 2021
5c7b7ec
fix gamelist height
emmauss Aug 2, 2021
f6f8c61
add custom themes
emmauss Aug 4, 2021
e75da6a
update nuget packages
emmauss Aug 4, 2021
de1cd2b
fix load background
emmauss Aug 4, 2021
1e83bb1
rename DatagridBackgroundColor to ThemeContentBackgroundColor
emmauss Aug 5, 2021
8ddb427
rename style in base files
emmauss Aug 5, 2021
a8ee982
remove separator in title update window
emmauss Aug 5, 2021
5437542
allow restarting window when theme loading fails
emmauss Aug 5, 2021
80e2ab9
remove tbus option
emmauss Aug 5, 2021
c786d6c
add brush for listbox
emmauss Aug 6, 2021
91546d0
motion window wip
emmauss Aug 6, 2021
5a419df
rumble wip
emmauss Aug 6, 2021
9afe423
prevent adding the same update file, sort updates
emmauss Aug 6, 2021
d1885f9
sort updates
emmauss Aug 6, 2021
3da0b30
preventing adding the same dlc again
emmauss Aug 6, 2021
9f32252
added some style keys
emmauss Aug 8, 2021
6444422
fix rumber and cemu hook motion options. numberbox is bugged currently
emmauss Aug 8, 2021
d9a6275
add dialog text to locale
emmauss Aug 10, 2021
0527bed
enforce some datagrid styles
emmauss Aug 10, 2021
b81f87c
cleanup xaml files
emmauss Aug 12, 2021
43508c1
fix light theme dark backgrounds
emmauss Aug 12, 2021
b461824
fix time played sort
emmauss Aug 12, 2021
dab94fc
cleanup
emmauss Aug 13, 2021
59cb205
rebase
emmauss Aug 13, 2021
571f498
allow sort by favorite using icon
emmauss Aug 13, 2021
29552c5
reduce button sizes in controller window
emmauss Aug 13, 2021
8333544
style changes
emmauss Aug 13, 2021
306ec15
update controller style
emmauss Aug 14, 2021
2ba31d2
Update Ryujinx.Ava/Ui/Windows/ControllerSettingsWindow.axaml
emmauss Aug 15, 2021
94ac355
Update Ryujinx.Ava/Ui/Windows/ControllerSettingsWindow.axaml
emmauss Aug 15, 2021
9becdad
Update Ryujinx.Ava/Ui/Windows/ControllerSettingsWindow.axaml
emmauss Aug 15, 2021
6ddafb6
Update Ryujinx.Ava/Ui/Windows/ControllerSettingsWindow.axaml
emmauss Aug 15, 2021
296b8f4
Apply suggestions from code review
emmauss Aug 15, 2021
0e02c8a
scale controller image by height
emmauss Aug 17, 2021
9857c46
fix mouse binding
emmauss Aug 21, 2021
1ec3b69
fix touch using main window instead of renderer control
emmauss Aug 22, 2021
05218bb
update avalonia
emmauss Aug 25, 2021
93cbb78
Rebased. address comments
emmauss Aug 29, 2021
05c712d
typ
emmauss Aug 29, 2021
f7f15c1
prevent accessing firmware installer and profile when game is running
emmauss Aug 30, 2021
4916eec
set background context to 3.3 forward compatible
emmauss Aug 31, 2021
0558e5e
fix hotkeys persisting. fix enable motion not saving
emmauss Aug 31, 2021
d2ca1b0
replace profiles collection with avalonia list
emmauss Sep 3, 2021
86d3eb9
fix motion settings not saving
emmauss Sep 12, 2021
644b403
fix controller device reloading issue
emmauss Sep 12, 2021
1380c83
make profile box editable
emmauss Sep 12, 2021
5112b6c
rebased, addresed Mutant's comment
emmauss Sep 12, 2021
f005a50
rebased
emmauss Sep 19, 2021
a94a1ea
fix rumble values not update on ui
emmauss Sep 19, 2021
414f90a
fix default config loading when a custom profile is loaded
emmauss Sep 19, 2021
2001780
fix default not loading when device is changed
emmauss Sep 19, 2021
790139b
added missing lines to english locale
emmauss Sep 21, 2021
74b7434
wip grid
emmauss Sep 26, 2021
0828733
wip
emmauss Sep 27, 2021
525dd93
add gridview
emmauss Oct 2, 2021
0b1b114
fix grid context menu commands
emmauss Oct 4, 2021
3fb992e
replace show gui column options with dropdown
emmauss Oct 7, 2021
791eb7a
fix crash when updating status bar while shader and pptc caches are l…
emmauss Oct 7, 2021
e906e74
support alt+enter for making mainwindow fullscreen
emmauss Oct 7, 2021
6287ee0
reduce controller window width a bit
emmauss Oct 7, 2021
d5730c1
Update portuguese translation
gdkchan Oct 7, 2021
a77cd3a
update theme loader
emmauss Oct 8, 2021
5f2f853
apply sort and filter on load
emmauss Oct 8, 2021
a349f8f
Add menu gesture text for hotkeys
emmauss Oct 9, 2021
f63b4d8
hide sort text when in list mode
emmauss Oct 9, 2021
907605d
rebases. implement inline swkbd(wip)
emmauss Oct 16, 2021
8f425ee
fix inline keyboard logo resource and theme
emmauss Oct 17, 2021
7e2af33
fix build
emmauss Oct 17, 2021
2cc8555
revert avalonia update
emmauss Oct 17, 2021
cac1583
wip
emmauss Oct 18, 2021
62e2a4f
wwip
emmauss Oct 18, 2021
e28c244
fix inline keyboard
emmauss Oct 18, 2021
7647728
fix crash when exiting inline keyboard
emmauss Oct 19, 2021
34a1077
improved load screen, make it last the whole of the loading process
emmauss Oct 19, 2021
d759afe
fix inline keyboard
emmauss Oct 19, 2021
3e6ce3b
do not read monitor dpi settings. glfw and avalonia adjusts tot scale…
emmauss Oct 19, 2021
6d84b9d
add tooltips to settings window
emmauss Oct 24, 2021
c672a95
add tooltips to main window
emmauss Oct 26, 2021
a359d80
add grid sizes
emmauss Oct 26, 2021
940b254
fix window dpi issues, make fav star resize with game ciew
emmauss Oct 31, 2021
af4763c
rebased
emmauss Oct 31, 2021
3569f0b
update fav star sizes. add missing tooltips to locale
emmauss Nov 1, 2021
9a96624
fix tooltip
emmauss Nov 1, 2021
2f5402d
fix a couple of typos in English locale
MetrosexualGarbodor Nov 2, 2021
171a7c1
update avalonia package
emmauss Nov 13, 2021
ca23db7
style updates, cleanup markup
emmauss Nov 16, 2021
cd07fab
Dependency on MainWindow removed
MichalSy Nov 28, 2021
4d6a225
Dependency on MainWindow removed
MichalSy Nov 28, 2021
56f33d8
Dependency on MainWindow removed
MichalSy Nov 28, 2021
414976c
Dependency on MainWindow removed
MichalSy Nov 28, 2021
95757f1
PR Review
MichalSy Nov 28, 2021
d413d3d
Check if hotkey mapping is available
MichalSy Nov 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ jobs:
- name: Publish Ryujinx.Headless.SDL2
run: dotnet publish -c "${{ matrix.configuration }}" -r "${{ matrix.DOTNET_RUNTIME_IDENTIFIER }}" -o ./publish_sdl2_headless /p:Version="1.0.0" /p:DebugType=embedded /p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" /p:ExtraDefineConstants=DISABLE_UPDATER Ryujinx.Headless.SDL2
if: github.event_name == 'pull_request'
- name: Publish Ryujinx.Ava
run: dotnet publish -c "${{ matrix.configuration }}" -r "${{ matrix.DOTNET_RUNTIME_IDENTIFIER }}" -o ./publish_ava /p:Version="1.0.0" /p:DebugType=embedded /p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" /p:ExtraDefineConstants=DISABLE_UPDATER Ryujinx.Ava
if: github.event_name == 'pull_request'
- name: Upload Ryujinx artifact
uses: actions/upload-artifact@v2
with:
Expand All @@ -80,3 +83,9 @@ jobs:
name: ryujinx-headless-sdl2-${{ matrix.configuration }}-1.0.0+${{ steps.git_short_hash.outputs.result }}-${{ matrix.RELEASE_ZIP_OS_NAME }}
path: publish_sdl2_headless
if: github.event_name == 'pull_request'
- name: Upload Ryujinx.Ava artifact
uses: actions/upload-artifact@v2
with:
name: ryujinx-ava-${{ matrix.configuration }}-1.0.0+${{ steps.git_short_hash.outputs.result }}-${{ matrix.RELEASE_ZIP_OS_NAME }}
path: publish_ava
if: github.event_name == 'pull_request'
10 changes: 10 additions & 0 deletions Ryujinx.Ava/App.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Application
x:Class="Ryujinx.Ava.App"
xmlns="https://github.com/avaloniaui"
xmlns:sty="using:FluentAvalonia.Styling"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Styles>
<FluentTheme Mode="Dark" />
<sty:FluentAvaloniaTheme RequestedTheme="Dark" />
</Application.Styles>
</Application>
164 changes: 164 additions & 0 deletions Ryujinx.Ava/App.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using Avalonia.Styling;
using Avalonia.Threading;
using FluentAvalonia.Styling;
using IX.System.IO;
using Ryujinx.Ava.Common;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.Ui.Controls;
using Ryujinx.Ava.Ui.Windows;
using Ryujinx.Common;
using Ryujinx.Configuration;
using System;
using System.Linq;
using System.Diagnostics;
using Ryujinx.Common.Logging;

namespace Ryujinx.Ava
{
public class App : Avalonia.Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}

public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow();
}

base.OnFrameworkInitializationCompleted();

if (Program.PreviewerDetached)
{
ApplyConfiguredTheme();

ConfigurationState.Instance.Ui.BaseStyle.Event += ThemeChanged_Event;
ConfigurationState.Instance.Ui.CustomThemePath.Event += ThemeChanged_Event;
ConfigurationState.Instance.Ui.EnableCustomTheme.Event += CustomThemeChanged_Event;
}
}

private void CustomThemeChanged_Event(object sender, ReactiveEventArgs<bool> e)
{
try
{
ApplyConfiguredTheme();
}
catch (Exception)
{
Logger.Warning?.Print(LogClass.Application, "Failed to Apply Theme. A restart is needed to apply the selected theme");

ShowRestartDialog();
}
}

private async void ShowRestartDialog()
{
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
Dispatcher.UIThread.InvokeAsync(async () =>
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
var result = await ContentDialogHelper.CreateConfirmationDialog(
(desktop.MainWindow as MainWindow).SettingsWindow,
LocaleManager.Instance["DialogThemeRestartMessage"],
LocaleManager.Instance["DialogThemeRestartSubMessage"], LocaleManager.Instance["InputDialogYes"], LocaleManager.Instance["InputDialogNo"], LocaleManager.Instance["DialogRestartRequiredMessage"]);

if (result == UserResult.Yes)
{
var path = Process.GetCurrentProcess().MainModule.FileName;
var info = new ProcessStartInfo() {FileName = path, UseShellExecute = false};
var proc = Process.Start(info);
desktop.Shutdown();
Environment.Exit(0);
}
}
});
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
}

private void ThemeChanged_Event(object sender, ReactiveEventArgs<string> e)
{
try
{
ApplyConfiguredTheme();
}
catch (Exception)
{
Logger.Warning?.Print(LogClass.Application, "Failed to Apply Theme. A restart is needed to apply the selected theme");

ShowRestartDialog();
}
}

private void ApplyConfiguredTheme()
{
string baseStyle = ConfigurationState.Instance.Ui.BaseStyle;
string themePath = ConfigurationState.Instance.Ui.CustomThemePath;
bool enableCustomTheme = ConfigurationState.Instance.Ui.EnableCustomTheme;

if (string.IsNullOrWhiteSpace(baseStyle))
{
ConfigurationState.Instance.Ui.BaseStyle.Value = "Dark";

baseStyle = ConfigurationState.Instance.Ui.BaseStyle;
}

var theme = AvaloniaLocator.Current.GetService<FluentAvaloniaTheme>();

theme.RequestedTheme = baseStyle;

var currentStyles = this.Styles;

if (currentStyles.Count > 2)
{
currentStyles.RemoveRange(2, currentStyles.Count - 1);
}

IStyle newStyles = null;

newStyles = (Styles)AvaloniaXamlLoader.Load(new Uri($"avares://Ryujinx.Ava/Assets/Styles/Base{baseStyle}.xaml", UriKind.Absolute));

if (currentStyles.Count == 3)
{
currentStyles[2] = newStyles;
}
else
{
currentStyles.Add(newStyles);
}

if (enableCustomTheme)
{
if (!string.IsNullOrWhiteSpace(themePath))
{
try
{
var themeContent = System.IO.File.ReadAllText(themePath);
var customStyle = AvaloniaRuntimeXamlLoader.Parse<IStyle>(themeContent);

if (currentStyles.Count == 4)
{
currentStyles[3] = customStyle;
}
else
{
currentStyles.Add(customStyle);
}
}
catch (Exception ex)
{
Logger.Error?.Print(LogClass.Application, $"Failed to Apply Custom Theme. Error: {ex.Message}");
}
}
}
}
}
}
Loading