mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Upgrade cimgui, use custom FindWindowByName instead of hardcoded offset
This commit is contained in:
parent
33605e3ace
commit
bf491525f6
2 changed files with 6 additions and 13 deletions
|
|
@ -105,25 +105,18 @@ internal sealed unsafe partial class DrawListTextureWrap
|
|||
[FieldOffset(0x2C0)]
|
||||
public ImDrawListPtr DrawList;
|
||||
|
||||
private static nint pfnImGuiFindWindowByName;
|
||||
[DllImport("cimgui", CallingConvention = CallingConvention.Cdecl)]
|
||||
#pragma warning disable SA1300
|
||||
public static extern ImGuiWindow* igCustom_FindWindowByName(byte* inherit);
|
||||
#pragma warning restore SA1300
|
||||
|
||||
public static ref ImGuiWindow FindWindowByName(ReadOnlySpan<char> name)
|
||||
{
|
||||
var nb = Encoding.UTF8.GetByteCount(name);
|
||||
var buf = stackalloc byte[nb + 1];
|
||||
buf[Encoding.UTF8.GetBytes(name, new(buf, nb))] = 0;
|
||||
if (pfnImGuiFindWindowByName == 0)
|
||||
{
|
||||
pfnImGuiFindWindowByName =
|
||||
Process
|
||||
.GetCurrentProcess()
|
||||
.Modules
|
||||
.Cast<ProcessModule>()
|
||||
.First(x => x.ModuleName == "cimgui.dll")
|
||||
.BaseAddress + 0x357F0;
|
||||
}
|
||||
|
||||
return ref *((delegate* unmanaged<byte*, ImGuiWindow*>)pfnImGuiFindWindowByName)(buf);
|
||||
return ref *igCustom_FindWindowByName(buf);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 0xF0)]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 122ee16819437eea7eefe0c04398b44174106d86
|
||||
Subproject commit 27c8565f631b004c3266373890e41ecc627f775b
|
||||
Loading…
Add table
Add a link
Reference in a new issue