Manual overloads for ImGui functions accepting text (#2319)

* wip2

* Implement AutoUtf8Buffer

* reformat

* Work on manual bindings

* restructure

* Name scripts properly

* Update utility functions to use ImU8String

* add overloads

* Add more overloads

* Use ImGuiWindow from gen, support AddCallback

* Use LibraryImport for custom ImGuiNative functinos

* Make manual overloads for string-returning functinos

* Make all overloads with self as its first parameter extension methods

* Fix overload resolution by removing unnecessary

* in => scoped in

* Fix compilation errors
This commit is contained in:
srkizer 2025-08-05 03:14:00 +09:00 committed by GitHub
parent 0c63541864
commit c69329f592
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
293 changed files with 61312 additions and 754 deletions

View file

@ -0,0 +1,27 @@
// <auto-generated/>
using HexaGen.Runtime;
using System;
using System.Diagnostics;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Dalamud.Bindings.ImGui;
public unsafe partial class ImGui
{
}
// DISCARDED: internal static int DataTypeFormatStringNative(byte* buf, int bufSize, ImGuiDataType dataType, void* pData, byte* format)
// DISCARDED: internal static int ImFormatStringNative(byte* buf, nuint bufSize, byte* fmt)
// DISCARDED: internal static int ImFormatStringVNative(byte* buf, nuint bufSize, byte* fmt, nuint args)
// DISCARDED: internal static byte* ImParseFormatTrimDecorationsNative(byte* format, byte* buf, nuint bufSize)
// DISCARDED: ImParseFormatTrimDecorationsS
// DISCARDED: internal static int ImTextStrFromUtf8Native(ushort* outBuf, int outBufSize, byte* inText, byte* inTextEnd, byte** inRemaining)
// DISCARDED: internal static int ImTextStrToUtf8Native(byte* outBuf, int outBufSize, ushort* inText, ushort* inTextEnd)
// DISCARDED: internal static byte InputTextNative(byte* label, byte* buf, nuint bufSize, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* userData)
// DISCARDED: internal static byte InputTextExNative(byte* label, byte* hint, byte* buf, int bufSize, Vector2 sizeArg, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* userData)
// DISCARDED: internal static byte InputTextMultilineNative(byte* label, byte* buf, nuint bufSize, Vector2 size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* userData)
// DISCARDED: internal static byte InputTextWithHintNative(byte* label, byte* hint, byte* buf, nuint bufSize, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* userData)
// DISCARDED: internal static byte TempInputTextNative(ImRect bb, uint id, byte* label, byte* buf, int bufSize, ImGuiInputTextFlags flags)

View file

@ -0,0 +1,92 @@
// <auto-generated/>
using HexaGen.Runtime;
using System;
using System.Diagnostics;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Dalamud.Bindings.ImGui;
public unsafe partial class ImGuiNative
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte InputText(byte* label, byte* buf, nuint bufSize, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* userData)
{
return ((delegate* unmanaged[Cdecl]<byte*, byte*, nuint, ImGuiInputTextFlags, delegate*<ImGuiInputTextCallbackData*, int>, void*, byte>)ImGui.funcTable[1268])(label, buf, bufSize, flags, (delegate*<ImGuiInputTextCallbackData*, int>)Utils.GetFunctionPointerForDelegate(callback), userData);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte InputTextMultiline(byte* label, byte* buf, nuint bufSize, Vector2 size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* userData)
{
return ((delegate* unmanaged[Cdecl]<byte*, byte*, nuint, Vector2, ImGuiInputTextFlags, delegate*<ImGuiInputTextCallbackData*, int>, void*, byte>)ImGui.funcTable[1269])(label, buf, bufSize, size, flags, (delegate*<ImGuiInputTextCallbackData*, int>)Utils.GetFunctionPointerForDelegate(callback), userData);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte InputTextWithHint(byte* label, byte* hint, byte* buf, nuint bufSize, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* userData)
{
return ((delegate* unmanaged[Cdecl]<byte*, byte*, byte*, nuint, ImGuiInputTextFlags, delegate*<ImGuiInputTextCallbackData*, int>, void*, byte>)ImGui.funcTable[1270])(label, hint, buf, bufSize, flags, (delegate*<ImGuiInputTextCallbackData*, int>)Utils.GetFunctionPointerForDelegate(callback), userData);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int ImFormatString(byte* buf, nuint bufSize, byte* fmt)
{
return ((delegate* unmanaged[Cdecl]<byte*, nuint, byte*, int>)ImGui.funcTable[1271])(buf, bufSize, fmt);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int ImFormatStringV(byte* buf, nuint bufSize, byte* fmt, nuint args)
{
return ((delegate* unmanaged[Cdecl]<byte*, nuint, byte*, nuint, int>)ImGui.funcTable[1272])(buf, bufSize, fmt, args);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte* ImParseFormatTrimDecorations(byte* format, byte* buf, nuint bufSize)
{
return ((delegate* unmanaged[Cdecl]<byte*, byte*, nuint, byte*>)ImGui.funcTable[1273])(format, buf, bufSize);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int ImTextStrToUtf8(byte* outBuf, int outBufSize, ushort* inText, ushort* inTextEnd)
{
return ((delegate* unmanaged[Cdecl]<byte*, int, ushort*, ushort*, int>)ImGui.funcTable[1274])(outBuf, outBufSize, inText, inTextEnd);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int ImTextStrFromUtf8(ushort* outBuf, int outBufSize, byte* inText, byte* inTextEnd, byte** inRemaining)
{
return ((delegate* unmanaged[Cdecl]<ushort*, int, byte*, byte*, byte**, int>)ImGui.funcTable[1275])(outBuf, outBufSize, inText, inTextEnd, inRemaining);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int DataTypeFormatString(byte* buf, int bufSize, ImGuiDataType dataType, void* pData, byte* format)
{
return ((delegate* unmanaged[Cdecl]<byte*, int, ImGuiDataType, void*, byte*, int>)ImGui.funcTable[1276])(buf, bufSize, dataType, pData, format);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte InputTextEx(byte* label, byte* hint, byte* buf, int bufSize, Vector2 sizeArg, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* userData)
{
return ((delegate* unmanaged[Cdecl]<byte*, byte*, byte*, int, Vector2, ImGuiInputTextFlags, delegate*<ImGuiInputTextCallbackData*, int>, void*, byte>)ImGui.funcTable[1277])(label, hint, buf, bufSize, sizeArg, flags, (delegate*<ImGuiInputTextCallbackData*, int>)Utils.GetFunctionPointerForDelegate(callback), userData);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte TempInputText(ImRect bb, uint id, byte* label, byte* buf, int bufSize, ImGuiInputTextFlags flags)
{
return ((delegate* unmanaged[Cdecl]<ImRect, uint, byte*, byte*, int, ImGuiInputTextFlags, byte>)ImGui.funcTable[1278])(bb, id, label, buf, bufSize, flags);
}
}