From d3a6a8f66ecd90e2b99dcf9c196b52faee2e145c Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Wed, 11 Dec 2024 16:21:13 -0600 Subject: [PATCH] hia: Fix last used profile loading, (hopefully) fixed logo loading --- src/Ryujinx/Headless/HeadlessRyujinx.cs | 24 ++++++++++++++++-------- src/Ryujinx/Headless/Options.cs | 7 +++---- src/Ryujinx/Headless/WindowBase.cs | 2 +- src/Ryujinx/Ryujinx.csproj | 2 +- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/Ryujinx/Headless/HeadlessRyujinx.cs b/src/Ryujinx/Headless/HeadlessRyujinx.cs index 7f3f697f5..1a2fef64d 100644 --- a/src/Ryujinx/Headless/HeadlessRyujinx.cs +++ b/src/Ryujinx/Headless/HeadlessRyujinx.cs @@ -141,7 +141,11 @@ namespace Ryujinx.Headless string configurationPath = null; // Now load the configuration as the other subsystems are now registered - if (File.Exists(localConfigurationPath)) + if (customConfigPath != null && File.Exists(customConfigPath)) + { + configurationPath = customConfigPath; + } + else if (File.Exists(localConfigurationPath)) { configurationPath = localConfigurationPath; } @@ -149,10 +153,6 @@ namespace Ryujinx.Headless { configurationPath = appDataConfigurationPath; } - else if (customConfigPath != null && File.Exists(customConfigPath)) - { - configurationPath = customConfigPath; - } if (configurationPath == null) { @@ -411,12 +411,20 @@ namespace Ryujinx.Headless static void Load(string[] originalArgs, Options option) { Initialize(); - + + bool useLastUsedProfile = false; + if (option.InheritConfig) - option.InheritMainConfig(originalArgs, ConfigurationState.Instance, out _inputConfiguration); - + { + option.InheritMainConfig(originalArgs, ConfigurationState.Instance, out _inputConfiguration, + out useLastUsedProfile); + } + AppDataManager.Initialize(option.BaseDataDir); + if (useLastUsedProfile && AccountSaveDataManager.GetLastUsedUser().TryGet(out var profile)) + option.UserProfile = profile.Name; + // Check if keys exists. if (!File.Exists(Path.Combine(AppDataManager.KeysDirPath, "prod.keys"))) { diff --git a/src/Ryujinx/Headless/Options.cs b/src/Ryujinx/Headless/Options.cs index 3a807cb42..50654dc2f 100644 --- a/src/Ryujinx/Headless/Options.cs +++ b/src/Ryujinx/Headless/Options.cs @@ -17,11 +17,10 @@ namespace Ryujinx.Headless { // General - public void InheritMainConfig(string[] originalArgs, ConfigurationState configurationState, out List inputConfigs) + public void InheritMainConfig(string[] originalArgs, ConfigurationState configurationState, out List inputConfigs, out bool needsProfileSet) { - if (NeedsOverride(nameof(UserProfile)) && AccountSaveDataManager.GetLastUsedUser().TryGet(out var profile)) - UserProfile = profile.Name; - + needsProfileSet = NeedsOverride(nameof(UserProfile)); + if (NeedsOverride(nameof(IsFullscreen))) IsFullscreen = configurationState.UI.StartFullscreen; diff --git a/src/Ryujinx/Headless/WindowBase.cs b/src/Ryujinx/Headless/WindowBase.cs index f318494ce..21bee368a 100644 --- a/src/Ryujinx/Headless/WindowBase.cs +++ b/src/Ryujinx/Headless/WindowBase.cs @@ -137,7 +137,7 @@ namespace Ryujinx.Headless private void SetWindowIcon() { - Stream iconStream = typeof(WindowBase).Assembly.GetManifestResourceStream("Ryujinx.Ryujinx.bmp"); + Stream iconStream = typeof(Program).Assembly.GetManifestResourceStream("HeadlessLogo"); byte[] iconBytes = new byte[iconStream!.Length]; if (iconStream.Read(iconBytes, 0, iconBytes.Length) != iconBytes.Length) diff --git a/src/Ryujinx/Ryujinx.csproj b/src/Ryujinx/Ryujinx.csproj index 8412044c7..561bbc646 100644 --- a/src/Ryujinx/Ryujinx.csproj +++ b/src/Ryujinx/Ryujinx.csproj @@ -163,7 +163,7 @@ - +