From d0f95f5884665c5fa3580422154736a597d4547c Mon Sep 17 00:00:00 2001 From: Salvador Cipolla Date: Sun, 6 Oct 2024 00:07:53 -0300 Subject: [PATCH 1/3] Add warning for the new FSO 24.2 settings system --- Knossos.NET/Classes/Knossos.cs | 35 +++++++++++++++++++ Knossos.NET/Models/GlobalSettings.cs | 3 ++ Knossos.NET/Views/GlobalSettingsView.axaml | 3 ++ Knossos.NET/Views/Windows/MessageBox.axaml.cs | 18 ++++++++-- 4 files changed, 56 insertions(+), 3 deletions(-) diff --git a/Knossos.NET/Classes/Knossos.cs b/Knossos.NET/Classes/Knossos.cs index 9ec507c3..aa746708 100644 --- a/Knossos.NET/Classes/Knossos.cs +++ b/Knossos.NET/Classes/Knossos.cs @@ -11,6 +11,7 @@ using System.Linq; using Avalonia.Platform; using VP.NET; +using static System.Net.Mime.MediaTypeNames; namespace Knossos.NET { @@ -1162,6 +1163,40 @@ public static async void PlayMod(Mod mod, FsoExecType fsoExecType, bool standalo Log.Add(Log.LogSeverity.Information, "Knossos.PlayMod()", "Used cmdLine : " + cmdline); + if (MainWindow.instance != null && globalSettings.warnNewSettingsSystem) + { + try + { + var fsoVersion = new SemanticVersion(fsoBuild.version); + var newSettingsVersion = new SemanticVersion("24.2.0-RC"); + if(fsoVersion >= newSettingsVersion) + { + await Dispatcher.UIThread.InvokeAsync(async () => { + try + { + var res = await MessageBox.Show(MainWindow.instance, "Starting from FSO version 24.2.0 a new in-game settings system was implemented,\n" + + "Launcher settings, like video, audio or input, and cmdline arguments of those categories not longer have an effect.\n" + + "Settings must be changed ingame by going to 'Options' and then pressing the F3 key.", "New FSO settings system", MessageBox.MessageBoxButtons.DontWarnAgainOK); + + if (res == MessageBox.MessageBoxResult.DontWarnAgain) + { + globalSettings.warnNewSettingsSystem = false; + globalSettings.Save(); + } + } + catch + { + //fail silently, this is not important + } + }); + } + } + catch + { + //fail silently, this is not important + } + } + //Launch FSO!!! var fsoResult = await fsoBuild.RunFSO(fsoExecType, cmdline, rootPath, false); diff --git a/Knossos.NET/Models/GlobalSettings.cs b/Knossos.NET/Models/GlobalSettings.cs index 50f57084..0ba510d3 100644 --- a/Knossos.NET/Models/GlobalSettings.cs +++ b/Knossos.NET/Models/GlobalSettings.cs @@ -118,6 +118,8 @@ public AutoUpdateFsoBuilds(bool stable = false, bool rc = false, bool nightly = public int devModSort { get; set; } = 0; [JsonPropertyName("auto_update_fso_builds")] public AutoUpdateFsoBuilds autoUpdateBuilds { get; set; } = new AutoUpdateFsoBuilds(); + [JsonPropertyName("warn_new_settings_system")] + public bool warnNewSettingsSystem { get; set; } = true; /* FSO Settings that use the fs2_open.ini are json ignored */ @@ -608,6 +610,7 @@ public void Load() prefixCMD = tempSettings.prefixCMD; envVars = tempSettings.envVars; showDevOptions = tempSettings.showDevOptions; + warnNewSettingsSystem = tempSettings.warnNewSettingsSystem; if (MainWindowViewModel.Instance != null) MainWindowViewModel.Instance.sharedSortType = tempSettings.sortType; diff --git a/Knossos.NET/Views/GlobalSettingsView.axaml b/Knossos.NET/Views/GlobalSettingsView.axaml index a4b7c320..ab16624f 100644 --- a/Knossos.NET/Views/GlobalSettingsView.axaml +++ b/Knossos.NET/Views/GlobalSettingsView.axaml @@ -143,6 +143,7 @@ + As of FSO version 24.2 video settings not longer have any effect and is only intended to use with old versions. On 24.2 or newer you can change settings ingame by going to "Options" and pressing F3 to display all settings. @@ -243,6 +244,7 @@ + As of FSO version 24.2 audio settings not longer have any effect and is only intended to use with old versions. On 24.2 or newer you can change settings ingame by going to "Options" and pressing F3 to display all settings. @@ -314,6 +316,7 @@ + As of FSO version 24.2 input settings not longer have any effect and is only intended to use with old versions. On 24.2 or newer you can change settings ingame by going to "Options" and pressing F3 to display all settings. Show(Window? parent, string text, string ti var result = MessageBoxResult.OK; - void AddButton(string caption, MessageBoxResult r, bool def = false, string classes = "") + void AddButton(string caption, MessageBoxResult r, bool def = false, string classes = "", int buttonWidth = -1) { var button = new Button { Content = caption, Width = 100}; button.Click += (_, __) => { @@ -60,6 +62,10 @@ void AddButton(string caption, MessageBoxResult r, bool def = false, string clas { button.Classes.Add(classes); } + if (buttonWidth != -1) + { + button.Width = buttonWidth; + } buttonPanel.Children.Add(button); if (def) { @@ -93,6 +99,12 @@ void AddButton(string caption, MessageBoxResult r, bool def = false, string clas AddButton("Details", MessageBoxResult.Details, false, "Option"); } + if (buttons == MessageBoxButtons.DontWarnAgainOK) + { + AddButton("OK", MessageBoxResult.OK, true, "Accept"); + AddButton("Don't warn again", MessageBoxResult.DontWarnAgain, false, "Option", 150); + } + var tcs = new TaskCompletionSource(); msgbox.Closed += delegate { tcs.TrySetResult(result); }; From b9726c4457e6b332afd35b46054251ac9836d70a Mon Sep 17 00:00:00 2001 From: Salvador Cipolla Date: Sun, 6 Oct 2024 00:10:37 -0300 Subject: [PATCH 2/3] remove sneaky include i didnt add or wanted --- Knossos.NET/Classes/Knossos.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Knossos.NET/Classes/Knossos.cs b/Knossos.NET/Classes/Knossos.cs index aa746708..f9d0c9ba 100644 --- a/Knossos.NET/Classes/Knossos.cs +++ b/Knossos.NET/Classes/Knossos.cs @@ -11,7 +11,6 @@ using System.Linq; using Avalonia.Platform; using VP.NET; -using static System.Net.Mime.MediaTypeNames; namespace Knossos.NET { From 4550e424a933767b0604f139643197a8e388ee5c Mon Sep 17 00:00:00 2001 From: Salvador Cipolla Date: Sun, 6 Oct 2024 22:11:50 -0300 Subject: [PATCH 3/3] Suggested changes --- Knossos.NET/Classes/Knossos.cs | 6 +++--- Knossos.NET/Views/GlobalSettingsView.axaml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Knossos.NET/Classes/Knossos.cs b/Knossos.NET/Classes/Knossos.cs index f9d0c9ba..b827c0e5 100644 --- a/Knossos.NET/Classes/Knossos.cs +++ b/Knossos.NET/Classes/Knossos.cs @@ -1173,9 +1173,9 @@ public static async void PlayMod(Mod mod, FsoExecType fsoExecType, bool standalo await Dispatcher.UIThread.InvokeAsync(async () => { try { - var res = await MessageBox.Show(MainWindow.instance, "Starting from FSO version 24.2.0 a new in-game settings system was implemented,\n" + - "Launcher settings, like video, audio or input, and cmdline arguments of those categories not longer have an effect.\n" + - "Settings must be changed ingame by going to 'Options' and then pressing the F3 key.", "New FSO settings system", MessageBox.MessageBoxButtons.DontWarnAgainOK); + var res = await MessageBox.Show(MainWindow.instance, "Starting from FSO version 24.2.0 a new in-game settings system was implemented.\n" + + "Launcher settings, such as video, audio or input, and Command Line arguments of those categories no longer have an effect by default.\n" + + "Settings for most mods using FSO version 24.2.0 or higher must be now changed in-game by going to the 'Options' menu, where you will see additional methods for accessing and setting these new in-game options.", "New FSO settings system", MessageBox.MessageBoxButtons.DontWarnAgainOK); if (res == MessageBox.MessageBoxResult.DontWarnAgain) { diff --git a/Knossos.NET/Views/GlobalSettingsView.axaml b/Knossos.NET/Views/GlobalSettingsView.axaml index ab16624f..d1201081 100644 --- a/Knossos.NET/Views/GlobalSettingsView.axaml +++ b/Knossos.NET/Views/GlobalSettingsView.axaml @@ -143,7 +143,7 @@ - As of FSO version 24.2 video settings not longer have any effect and is only intended to use with old versions. On 24.2 or newer you can change settings ingame by going to "Options" and pressing F3 to display all settings. + Note, video settings for most mods using FSO version 24.2.0 or higher will need to be changed in-game by default. You can change in-game settings by going to "Options" menu of the mod you are playing. @@ -244,7 +244,7 @@ - As of FSO version 24.2 audio settings not longer have any effect and is only intended to use with old versions. On 24.2 or newer you can change settings ingame by going to "Options" and pressing F3 to display all settings. + Note, audio settings for most mods using FSO version 24.2.0 or higher will need to be changed in-game by default. You can change in-game settings by going to "Options" menu of the mod you are playing.. @@ -316,7 +316,7 @@ - As of FSO version 24.2 input settings not longer have any effect and is only intended to use with old versions. On 24.2 or newer you can change settings ingame by going to "Options" and pressing F3 to display all settings. + Note, input settings for most mods using FSO version 24.2.0 or higher will need to be changed in-game by default. You can change in-game settings by going to "Options" menu of the mod you are playing.