mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-14 20:54:16 +01:00
Merge branch 'intree_imgui'
This commit is contained in:
commit
61dd058a6e
3 changed files with 35 additions and 9 deletions
|
|
@ -8,7 +8,7 @@ using Dalamud.Utility;
|
||||||
|
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Internal;
|
namespace Dalamud.Interface.Internal.Asserts;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class responsible for registering and handling ImGui asserts.
|
/// Class responsible for registering and handling ImGui asserts.
|
||||||
|
|
@ -36,7 +36,7 @@ internal class AssertHandler : IDisposable
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether ImGui asserts should be shown to the user.
|
/// Gets or sets a value indicating whether ImGui asserts should be shown to the user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ShowAsserts { get; set; } = false;
|
public bool ShowAsserts { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register the cimgui assert handler with the native library.
|
/// Register the cimgui assert handler with the native library.
|
||||||
|
|
@ -93,7 +93,7 @@ internal class AssertHandler : IDisposable
|
||||||
var gitHubUrl = GetRepoUrl();
|
var gitHubUrl = GetRepoUrl();
|
||||||
var showOnGitHubButton = new TaskDialogButton
|
var showOnGitHubButton = new TaskDialogButton
|
||||||
{
|
{
|
||||||
Text = "Show on GitHub",
|
Text = "Open GitHub",
|
||||||
AllowCloseDialog = false,
|
AllowCloseDialog = false,
|
||||||
Enabled = !gitHubUrl.IsNullOrEmpty(),
|
Enabled = !gitHubUrl.IsNullOrEmpty(),
|
||||||
};
|
};
|
||||||
|
|
@ -108,9 +108,14 @@ internal class AssertHandler : IDisposable
|
||||||
Text = "Break",
|
Text = "Break",
|
||||||
AllowCloseDialog = true,
|
AllowCloseDialog = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var disableButton = new TaskDialogButton
|
||||||
|
{
|
||||||
|
Text = "Disable for this session",
|
||||||
|
AllowCloseDialog = true,
|
||||||
|
};
|
||||||
|
|
||||||
var ignoreButton = TaskDialogButton.Ignore;
|
var ignoreButton = TaskDialogButton.Ignore;
|
||||||
var abortButton = TaskDialogButton.Abort;
|
|
||||||
|
|
||||||
TaskDialogButton? result = null;
|
TaskDialogButton? result = null;
|
||||||
void DialogThreadStart()
|
void DialogThreadStart()
|
||||||
|
|
@ -119,7 +124,7 @@ internal class AssertHandler : IDisposable
|
||||||
// this session since it already loaded visual styles...
|
// this session since it already loaded visual styles...
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
|
|
||||||
var page = new TaskDialogPage()
|
var page = new TaskDialogPage
|
||||||
{
|
{
|
||||||
Heading = "ImGui assertion failed",
|
Heading = "ImGui assertion failed",
|
||||||
Caption = "Dalamud",
|
Caption = "Dalamud",
|
||||||
|
|
@ -135,8 +140,8 @@ internal class AssertHandler : IDisposable
|
||||||
[
|
[
|
||||||
showOnGitHubButton,
|
showOnGitHubButton,
|
||||||
breakButton,
|
breakButton,
|
||||||
|
disableButton,
|
||||||
ignoreButton,
|
ignoreButton,
|
||||||
abortButton,
|
|
||||||
],
|
],
|
||||||
DefaultButton = showOnGitHubButton,
|
DefaultButton = showOnGitHubButton,
|
||||||
};
|
};
|
||||||
|
|
@ -157,9 +162,9 @@ internal class AssertHandler : IDisposable
|
||||||
{
|
{
|
||||||
Debugger.Break();
|
Debugger.Break();
|
||||||
}
|
}
|
||||||
else if (result == abortButton)
|
else if (result == disableButton)
|
||||||
{
|
{
|
||||||
Environment.Exit(-1);
|
this.ShowAsserts = false;
|
||||||
}
|
}
|
||||||
else if (result == ignoreButton)
|
else if (result == ignoreButton)
|
||||||
{
|
{
|
||||||
|
|
@ -171,7 +176,7 @@ internal class AssertHandler : IDisposable
|
||||||
{
|
{
|
||||||
[DllImport("cimgui", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("cimgui", CallingConvention = CallingConvention.Cdecl)]
|
||||||
#pragma warning disable SA1300
|
#pragma warning disable SA1300
|
||||||
public static extern void igCustom_SetAssertCallback(AssertCallbackDelegate callback);
|
public static extern void igCustom_SetAssertCallback(AssertCallbackDelegate? callback);
|
||||||
#pragma warning restore SA1300
|
#pragma warning restore SA1300
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -19,6 +19,7 @@ using Dalamud.Hooking.Internal;
|
||||||
using Dalamud.Hooking.WndProcHook;
|
using Dalamud.Hooking.WndProcHook;
|
||||||
using Dalamud.Interface.ImGuiNotification;
|
using Dalamud.Interface.ImGuiNotification;
|
||||||
using Dalamud.Interface.ImGuiNotification.Internal;
|
using Dalamud.Interface.ImGuiNotification.Internal;
|
||||||
|
using Dalamud.Interface.Internal.Asserts;
|
||||||
using Dalamud.Interface.Internal.DesignSystem;
|
using Dalamud.Interface.Internal.DesignSystem;
|
||||||
using Dalamud.Interface.Internal.ReShadeHandling;
|
using Dalamud.Interface.Internal.ReShadeHandling;
|
||||||
using Dalamud.Interface.ManagedFontAtlas;
|
using Dalamud.Interface.ManagedFontAtlas;
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,26 @@ public class SettingsTabExperimental : SettingsTab
|
||||||
new GapSettingsEntry(5, true),
|
new GapSettingsEntry(5, true),
|
||||||
|
|
||||||
new DevPluginsSettingsEntry(),
|
new DevPluginsSettingsEntry(),
|
||||||
|
|
||||||
|
new SettingsEntry<bool>(
|
||||||
|
Loc.Localize(
|
||||||
|
"DalamudSettingEnableImGuiAsserts",
|
||||||
|
"Enable ImGui asserts"),
|
||||||
|
Loc.Localize(
|
||||||
|
"DalamudSettingEnableImGuiAssertsHint",
|
||||||
|
"If this setting is enabled, a window containing further details will be shown when an internal assertion in ImGui fails.\nWe recommend enabling this when developing plugins."),
|
||||||
|
c => Service<InterfaceManager>.Get().ShowAsserts,
|
||||||
|
(v, _) => Service<InterfaceManager>.Get().ShowAsserts = v),
|
||||||
|
|
||||||
|
new SettingsEntry<bool>(
|
||||||
|
Loc.Localize(
|
||||||
|
"DalamudSettingEnableImGuiAssertsAtStartup",
|
||||||
|
"Always enable ImGui asserts at startup"),
|
||||||
|
Loc.Localize(
|
||||||
|
"DalamudSettingEnableImGuiAssertsAtStartupHint",
|
||||||
|
"This will enable ImGui asserts every time the game starts."),
|
||||||
|
c => c.ImGuiAssertsEnabledAtStartup ?? false,
|
||||||
|
(v, c) => c.ImGuiAssertsEnabledAtStartup = v),
|
||||||
|
|
||||||
new GapSettingsEntry(5, true),
|
new GapSettingsEntry(5, true),
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue