From e66cfc5b3f7368d21c1ccb852a61ce155d288add Mon Sep 17 00:00:00 2001 From: Miepee <38186597+Miepee@users.noreply.github.com> Date: Wed, 5 Jan 2022 14:53:44 +0100 Subject: [PATCH] add unsupported label when ran from wine --- AM2RLauncher/AM2RLauncher/AM2RLauncher.csproj | 1 + .../AM2RLauncher/MainForm/MainForm.Methods.cs | 3 +++ .../AM2RLauncher/MainForm/MainForm.UI.cs | 22 ++++++++++++++++--- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/AM2RLauncher/AM2RLauncher/AM2RLauncher.csproj b/AM2RLauncher/AM2RLauncher/AM2RLauncher.csproj index 0b9dc2e..8d7561c 100644 --- a/AM2RLauncher/AM2RLauncher/AM2RLauncher.csproj +++ b/AM2RLauncher/AM2RLauncher/AM2RLauncher.csproj @@ -27,6 +27,7 @@ + diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Methods.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Methods.cs index e2e2f33..c3b5850 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Methods.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Methods.cs @@ -552,6 +552,9 @@ namespace AM2RLauncher stream.WriteLine("AM2RLauncher " + VERSION + " log generated at " + date); + if (isThisRunningFromWine) + stream.WriteLine("Using WINE!"); + stream.Flush(); stream.Close(); diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs index 462a211..c3ebdbb 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs @@ -95,6 +95,11 @@ namespace AM2RLauncher /// static private bool? isAM2R11InstalledCache = null; + /// + /// Checks if the AM2RLauncher is run via WINE. + /// + static private bool isThisRunningFromWine = false; + public MainForm() { // Exit if we're already running the AM2RLauncher @@ -127,8 +132,18 @@ namespace AM2RLauncher log.Info("Mutex check passed. Entering main thread."); log.Info("Current Launcher Version: " + VERSION); log.Info("Current Platform-ID is: " + Platform.ID); + + // Log wine + if (Platform.IsWinForms) + { + if (Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\\Wine") != null) + { + isThisRunningFromWine = true; + log.Info("Currently running from WINE!"); + } + } // Log distro and version (if it exists) - if (Platform.IsGtk) + else if (Platform.IsGtk) { string osRelease = File.ReadAllText("/etc/os-release"); Regex lineRegex = new Regex(".*=.*"); @@ -385,7 +400,7 @@ namespace AM2RLauncher // Version number label - versionLabel = new Label { Text = "v" + VERSION, Width = 48, TextAlignment = TextAlignment.Right, TextColor = colGreen, Font = new Font(SystemFont.Default, 12) }; + versionLabel = new Label { Text = "v" + VERSION + (isThisRunningFromWine ? "-WINE" : ""), Width = 48, TextAlignment = TextAlignment.Right, TextColor = colGreen, Font = new Font(SystemFont.Default, 12) }; // Tie everything together var mainLayout = new DynamicLayout(); @@ -397,7 +412,8 @@ namespace AM2RLauncher mainLayout.AddColumn(null, centerInterface, null); mainLayout.AddSpace(); - mainLayout.AddColumn(versionLabel, null); + // Yes, I'm hardcoding this string. Linux users can english. + mainLayout.AddColumn(versionLabel, isThisRunningFromWine ? new Label { Text = "Unsupported", TextColor = colRed, TextAlignment = TextAlignment.Right } : null); drawable.Content = mainLayout;