diff --git a/UndertaleModTool/Editors/UndertaleCodeEditor.xaml.cs b/UndertaleModTool/Editors/UndertaleCodeEditor.xaml.cs index 687f4163d..b599b94b7 100644 --- a/UndertaleModTool/Editors/UndertaleCodeEditor.xaml.cs +++ b/UndertaleModTool/Editors/UndertaleCodeEditor.xaml.cs @@ -298,7 +298,22 @@ private async void UserControl_DataContextChanged(object sender, DependencyPrope CurrentDecompiled = null; CurrentDisassembled = null; - if (MainWindow.CodeEditorDecompile != Unstated) //if opened from the code search results "link" + // If there is no override (e.g. from opened tab) + if (MainWindow.CodeEditorDecompile == Unstated) + { + if (!SettingsWindow.OpenDisassemblyByDefault) + { + CodeModeTabs.SelectedItem = DecompiledTab; + MainWindow.CodeEditorDecompile = Decompile; + } + else + { + CodeModeTabs.SelectedItem = DisassemblyTab; + MainWindow.CodeEditorDecompile = DontDecompile; + } + } + + if (MainWindow.CodeEditorDecompile != Unstated) { if (MainWindow.CodeEditorDecompile == DontDecompile && code != CurrentDisassembled) { diff --git a/UndertaleModTool/Settings.cs b/UndertaleModTool/Settings.cs index bb8d26825..122f6d33d 100644 --- a/UndertaleModTool/Settings.cs +++ b/UndertaleModTool/Settings.cs @@ -53,6 +53,7 @@ public class Settings public bool EnableDarkMode { get; set; } = false; public bool ShowDebuggerOption { get; set; } = false; + public bool OpenDisassemblyByDefault { get; set; } = false; public static Settings Instance; diff --git a/UndertaleModTool/Windows/SettingsWindow.xaml b/UndertaleModTool/Windows/SettingsWindow.xaml index dcdc08c04..996d95a88 100644 --- a/UndertaleModTool/Windows/SettingsWindow.xaml +++ b/UndertaleModTool/Windows/SettingsWindow.xaml @@ -60,24 +60,27 @@ - + + - - + - + + - - - + - - - + + + - - - + + + + + + + @@ -93,6 +96,7 @@ + Open application data folder Update app to latest commit diff --git a/UndertaleModTool/Windows/SettingsWindow.xaml.cs b/UndertaleModTool/Windows/SettingsWindow.xaml.cs index f0d7aa257..8a6174d7b 100644 --- a/UndertaleModTool/Windows/SettingsWindow.xaml.cs +++ b/UndertaleModTool/Windows/SettingsWindow.xaml.cs @@ -209,6 +209,16 @@ public static bool ShowDebuggerOption } } + public static bool OpenDisassemblyByDefault + { + get => Settings.Instance.OpenDisassemblyByDefault; + set + { + Settings.Instance.OpenDisassemblyByDefault = value; + Settings.Save(); + } + } + public bool UpdateButtonEnabled { get => UpdateAppButton.IsEnabled;