diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj index 342177c96..20a5918b7 100644 --- a/Dalamud/Dalamud.csproj +++ b/Dalamud/Dalamud.csproj @@ -8,7 +8,7 @@ - 7.5.0.1 + 7.5.0.2 XIV Launcher addon framework $(DalamudVersion) $(DalamudVersion) diff --git a/Dalamud/EntryPoint.cs b/Dalamud/EntryPoint.cs index 9cd31d7ae..8fa9e70a0 100644 --- a/Dalamud/EntryPoint.cs +++ b/Dalamud/EntryPoint.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using Dalamud.Configuration.Internal; using Dalamud.Logging.Internal; +using Dalamud.Plugin.Internal; using Dalamud.Support; using Dalamud.Utility; using Newtonsoft.Json; @@ -325,10 +326,29 @@ public sealed class EntryPoint info = $"{ex.TargetSite.DeclaringType.Assembly.GetName().Name}, {ex.TargetSite.DeclaringType.FullName}::{ex.TargetSite.Name}"; } + var pluginInfo = string.Empty; + var supportText = ", please visit us on Discord for more help."; + try + { + var pm = Service.GetNullable(); + var plugin = pm?.FindCallingPlugin(new StackTrace(ex)); + if (plugin != null) + { + pluginInfo = $"Plugin that caused this:\n{plugin.Name}\n\nClick \"Yes\" and remove it.\n\n"; + + if (plugin.Manifest.IsThirdParty) + supportText = string.Empty; + } + } + catch + { + // ignored + } + const MessageBoxType flags = NativeFunctions.MessageBoxType.YesNo | NativeFunctions.MessageBoxType.IconError | NativeFunctions.MessageBoxType.SystemModal; var result = MessageBoxW( Process.GetCurrentProcess().MainWindowHandle, - $"An internal error in a Dalamud plugin occurred.\nThe game must close.\n\nType: {ex.GetType().Name}\n{info}\n\nMore information has been recorded separately, please contact us in our Discord or on GitHub.\n\nDo you want to disable all plugins the next time you start the game?", + $"An internal error in a Dalamud plugin occurred.\nThe game must close.\n\n{ex.GetType().Name}\n{info}\n\n{pluginInfo}More information has been recorded separately{supportText}.\n\nDo you want to disable all plugins the next time you start the game?", "Dalamud", flags); diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index e873b1047..560c1e61a 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -90,7 +90,6 @@ internal class PluginInstallerWindow : Window, IDisposable private bool feedbackModalIncludeException = false; private PluginManifest? feedbackPlugin = null; private bool feedbackIsTesting = false; - private bool feedbackIsAnonymous = false; private int updatePluginCount = 0; private List? updatedPlugins; @@ -789,42 +788,22 @@ internal class PluginInstallerWindow : Window, IDisposable ImGui.Spacing(); - if (ImGui.Checkbox(Locs.FeedbackModal_ContactAnonymous, ref this.feedbackIsAnonymous)) - { - if (this.feedbackIsAnonymous) - this.feedbackModalContact = string.Empty; - } + ImGui.InputText(Locs.FeedbackModal_ContactInformation, ref this.feedbackModalContact, 100); - if (this.feedbackIsAnonymous) - { - ImGui.BeginDisabled(); - ImGui.InputText(Locs.FeedbackModal_ContactInformation, ref this.feedbackModalContact, 0); - ImGui.EndDisabled(); - ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed); - ImGui.Text(Locs.FeedbackModal_ContactAnonymousWarning); - ImGui.PopStyleColor(); - } - else - { - ImGui.InputText(Locs.FeedbackModal_ContactInformation, ref this.feedbackModalContact, 100); + ImGui.SameLine(); - ImGui.SameLine(); - - if (ImGui.Button(Locs.FeedbackModal_ContactInformationDiscordButton)) + if (ImGui.Button(Locs.FeedbackModal_ContactInformationDiscordButton)) + { + Process.Start(new ProcessStartInfo(Locs.FeedbackModal_ContactInformationDiscordUrl) { - Process.Start(new ProcessStartInfo(Locs.FeedbackModal_ContactInformationDiscordUrl) - { - UseShellExecute = true, - }); - } - - ImGui.Text(Locs.FeedbackModal_ContactInformationHelp); - - ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed); - ImGui.Text(Locs.FeedbackModal_ContactInformationWarning); - ImGui.PopStyleColor(); + UseShellExecute = true, + }); } + ImGui.Text(Locs.FeedbackModal_ContactInformationHelp); + + ImGui.TextColored(ImGuiColors.DalamudRed, Locs.FeedbackModal_ContactInformationWarning); + ImGui.Spacing(); ImGui.Checkbox(Locs.FeedbackModal_IncludeLastError, ref this.feedbackModalIncludeException); @@ -839,7 +818,7 @@ internal class PluginInstallerWindow : Window, IDisposable if (ImGui.Button(Locs.ErrorModalButton_Ok, new Vector2(buttonWidth, 40))) { - if (!this.feedbackIsAnonymous && string.IsNullOrWhiteSpace(this.feedbackModalContact)) + if (string.IsNullOrWhiteSpace(this.feedbackModalContact)) { this.ShowErrorModal(Locs.FeedbackModal_ContactInformationRequired) .ContinueWith(_ => @@ -905,7 +884,6 @@ internal class PluginInstallerWindow : Window, IDisposable this.feedbackModalBody = string.Empty; this.feedbackModalContact = Service.Get().LastFeedbackContactDetails; this.feedbackModalIncludeException = false; - this.feedbackIsAnonymous = false; } else { @@ -3318,7 +3296,7 @@ internal class PluginInstallerWindow : Window, IDisposable public static string FeedbackModal_ContactInformationWarning => Loc.Localize("InstallerFeedbackContactInfoWarning", "Do not submit in-game character names."); - public static string FeedbackModal_ContactInformationRequired => Loc.Localize("InstallerFeedbackContactInfoRequired", "Contact information has not been provided. If you do not want to provide contact information, tick on \"{0}\" above.").Format(FeedbackModal_ContactAnonymous); + public static string FeedbackModal_ContactInformationRequired => Loc.Localize("InstallerFeedbackContactInfoRequired", "Contact information has not been provided. We require contact information to respond to questions, or to request additional information to troubleshoot problems."); public static string FeedbackModal_ContactInformationDiscordButton => Loc.Localize("ContactInformationDiscordButton", "Join Goat Place Discord"); diff --git a/Dalamud/Plugin/Internal/PluginManager.cs b/Dalamud/Plugin/Internal/PluginManager.cs index 15d975d0b..c382ce3d8 100644 --- a/Dalamud/Plugin/Internal/PluginManager.cs +++ b/Dalamud/Plugin/Internal/PluginManager.cs @@ -1300,14 +1300,14 @@ Thanks and have fun!"; } /// - /// Get the plugin that called this method by walking the stack, + /// Get the plugin that called this method by walking the provided stack trace, /// or null, if it cannot be determined. /// At the time, this is naive and shouldn't be used for security-critical checks. /// + /// The trace to walk. /// The calling plugin, or null. - public LocalPlugin? FindCallingPlugin() + public LocalPlugin? FindCallingPlugin(StackTrace trace) { - var trace = new StackTrace(); foreach (var frame in trace.GetFrames()) { var declaringType = frame.GetMethod()?.DeclaringType; @@ -1328,6 +1328,14 @@ Thanks and have fun!"; return null; } + /// + /// Get the plugin that called this method by walking the stack, + /// or null, if it cannot be determined. + /// At the time, this is naive and shouldn't be used for security-critical checks. + /// + /// The calling plugin, or null. + public LocalPlugin? FindCallingPlugin() => this.FindCallingPlugin(new StackTrace()); + private void DetectAvailablePluginUpdates() { var updatablePlugins = new List();