wip bindings upgrade

This commit is contained in:
goaaats 2025-04-06 20:59:23 +02:00
parent bd7e56850a
commit 0690cce995
272 changed files with 139041 additions and 1541 deletions

View file

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DisableRuntimeMarshalling>true</DisableRuntimeMarshalling>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="HexaGen.Runtime" Version="1.1.17" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Dalamud.ImGui\Dalamud.ImGui.csproj" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,33 @@
using System.Reflection;
namespace Dalamud.Bindings.ImPlot
{
using HexaGen.Runtime;
using System.Diagnostics;
public static class ImPlotConfig
{
public static bool AotStaticLink;
}
public static unsafe partial class ImPlot
{
static ImPlot()
{
if (ImPlotConfig.AotStaticLink)
{
InitApi(new NativeLibraryContext(Process.GetCurrentProcess().MainModule!.BaseAddress));
}
else
{
// InitApi(new NativeLibraryContext(LibraryLoader.LoadLibrary(GetLibraryName, null)));
InitApi(new NativeLibraryContext(Path.Combine(Path.GetDirectoryName(Assembly.GetCallingAssembly().Location)!, GetLibraryName() + ".dll")));
}
}
public static string GetLibraryName()
{
return "cimplot";
}
}
}

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Juna Meinhold
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

109
imgui/Dalamud.ImPlot/Tm.cs Normal file
View file

@ -0,0 +1,109 @@
namespace Dalamud.Bindings.ImPlot
{
using System;
public struct Tm : IEquatable<Tm>
{
/// <summary>
/// seconds after the minute - [0, 60] including leap second
/// </summary>
public int Sec;
/// <summary>
/// minutes after the hour - [0, 59]
/// </summary>
public int Min;
/// <summary>
/// hours since midnight - [0, 23]
/// </summary>
public int Hour;
/// <summary>
/// day of the month - [1, 31]
/// </summary>
public int MDay;
/// <summary>
/// months since January - [0, 11]
/// </summary>
public int Mon;
/// <summary>
/// years since 1900
/// </summary>
public int Year;
/// <summary>
/// days since Sunday - [0, 6]
/// </summary>
public int WDay;
/// <summary>
/// days since January 1 - [0, 365]
/// </summary>
public int YDay;
/// <summary>
/// daylight savings time flag
/// </summary>
public int IsDst;
public override bool Equals(object? obj)
{
return obj is Tm tm && Equals(tm);
}
public bool Equals(Tm other)
{
return Sec == other.Sec &&
Min == other.Min &&
Hour == other.Hour &&
MDay == other.MDay &&
Mon == other.Mon &&
Year == other.Year &&
WDay == other.WDay &&
YDay == other.YDay &&
IsDst == other.IsDst;
}
public override int GetHashCode()
{
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
HashCode hash = new HashCode();
hash.Add(Sec);
hash.Add(Min);
hash.Add(Hour);
hash.Add(MDay);
hash.Add(Mon);
hash.Add(Year);
hash.Add(WDay);
hash.Add(YDay);
hash.Add(IsDst);
return hash.ToHashCode();
#else
int hash = 17;
hash = hash * 31 + Sec.GetHashCode();
hash = hash * 31 + Min.GetHashCode();
hash = hash * 31 + Hour.GetHashCode();
hash = hash * 31 + MDay.GetHashCode();
hash = hash * 31 + Mon.GetHashCode();
hash = hash * 31 + Year.GetHashCode();
hash = hash * 31 + WDay.GetHashCode();
hash = hash * 31 + YDay.GetHashCode();
hash = hash * 31 + IsDst.GetHashCode();
return hash;
#endif
}
public static bool operator ==(Tm left, Tm right)
{
return left.Equals(right);
}
public static bool operator !=(Tm left, Tm right)
{
return !(left == right);
}
}
}