mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Merge pull request #1653 from KazWolfe/crash-menu
feat: Add "deref nullptr in hook" crash item
This commit is contained in:
commit
63f32322f5
1 changed files with 43 additions and 20 deletions
|
|
@ -12,6 +12,7 @@ using Dalamud.Game.ClientState.Conditions;
|
||||||
using Dalamud.Game.ClientState.Keys;
|
using Dalamud.Game.ClientState.Keys;
|
||||||
using Dalamud.Game.Gui;
|
using Dalamud.Game.Gui;
|
||||||
using Dalamud.Game.Internal;
|
using Dalamud.Game.Internal;
|
||||||
|
using Dalamud.Hooking;
|
||||||
using Dalamud.Interface.Animation.EasingFunctions;
|
using Dalamud.Interface.Animation.EasingFunctions;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
using Dalamud.Interface.Internal.ManagedAsserts;
|
using Dalamud.Interface.Internal.ManagedAsserts;
|
||||||
|
|
@ -189,6 +190,8 @@ internal class DalamudInterface : IDisposable, IServiceType
|
||||||
this.creditsDarkeningAnimation.Point2 = new Vector2(CreditsDarkeningMaxAlpha);
|
this.creditsDarkeningAnimation.Point2 = new Vector2(CreditsDarkeningMaxAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private delegate nint CrashDebugDelegate(nint self);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the number of frames since Dalamud has loaded.
|
/// Gets the number of frames since Dalamud has loaded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -745,27 +748,47 @@ internal class DalamudInterface : IDisposable, IServiceType
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
if (ImGui.MenuItem("Access Violation"))
|
if (ImGui.BeginMenu("Crash game"))
|
||||||
{
|
{
|
||||||
Marshal.ReadByte(IntPtr.Zero);
|
if (ImGui.MenuItem("Access Violation"))
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui.MenuItem("Crash game (nullptr)"))
|
|
||||||
{
|
|
||||||
unsafe
|
|
||||||
{
|
{
|
||||||
var framework = Framework.Instance();
|
Marshal.ReadByte(IntPtr.Zero);
|
||||||
framework->UIModule = (UIModule*)0;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui.MenuItem("Crash game (non-nullptr)"))
|
if (ImGui.MenuItem("Set UiModule to NULL"))
|
||||||
{
|
|
||||||
unsafe
|
|
||||||
{
|
{
|
||||||
var framework = Framework.Instance();
|
unsafe
|
||||||
framework->UIModule = (UIModule*)0x12345678;
|
{
|
||||||
|
var framework = Framework.Instance();
|
||||||
|
framework->UIModule = (UIModule*)0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui.MenuItem("Set UiModule to invalid ptr"))
|
||||||
|
{
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
var framework = Framework.Instance();
|
||||||
|
framework->UIModule = (UIModule*)0x12345678;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui.MenuItem("Deref nullptr in Hook"))
|
||||||
|
{
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
var hook = Hook<CrashDebugDelegate>.FromAddress(
|
||||||
|
(nint)UIModule.StaticVTable.GetUIInputData,
|
||||||
|
self =>
|
||||||
|
{
|
||||||
|
_ = *(byte*)0;
|
||||||
|
return (nint)UIModule.Instance()->GetUIInputData();
|
||||||
|
});
|
||||||
|
hook.Enable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.MenuItem("Report crashes at shutdown", null, this.configuration.ReportShutdownCrashes))
|
if (ImGui.MenuItem("Report crashes at shutdown", null, this.configuration.ReportShutdownCrashes))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue