Skip to content

Commit 7ffa5eb

Browse files
committed
2.1.0.0
1 parent ae3f581 commit 7ffa5eb

29 files changed

+682
-287
lines changed

.github/workflows/nightly.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ jobs:
77
name: Windows nightly builds
88
runs-on: windows-latest
99
steps:
10-
- uses: actions/checkout@v3
11-
- uses: actions/setup-dotnet@v3
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-dotnet@v4
1212
with:
1313
dotnet-version: 9.0.x
1414
- name: Install dependencies
@@ -18,7 +18,7 @@ jobs:
1818
- name: Publish
1919
run: dotnet publish Alpha/Alpha.csproj --self-contained false --output ./artifacts
2020
- name: Upload artifacts
21-
uses: actions/upload-artifact@v3
21+
uses: actions/upload-artifact@v4
2222
with:
2323
name: Alpha
2424
path: ./artifacts

Alpha/Alpha.csproj

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<Version>2.0.0.5</Version>
3+
<Version>2.1.0.0</Version>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>net9.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
@@ -10,28 +10,28 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.11.0"/>
14-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0"/>
13+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.13.0"/>
14+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.3"/>
1515

1616
<PackageReference Include="Lumina" Version="5.6.1"/>
17-
<PackageReference Include="Lumina.Excel" Version="7.1.3" />
17+
<PackageReference Include="Lumina.Excel" Version="7.2.1"/>
1818

19-
<PackageReference Include="Serilog.Extensions.Hosting" Version="8.0.0"/>
19+
<PackageReference Include="Serilog.Extensions.Hosting" Version="9.0.0"/>
2020
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0"/>
2121
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0"/>
2222

23-
<!-- No idea who owns this package but it's the only updated one I could find -->
24-
<PackageReference Include="Hexa.NET.ImGui" Version="2.1.10"/>
25-
<PackageReference Include="Hexa.NET.Utilities" Version="2.1.8"/>
26-
<PackageReference Include="Hexa.NET.ImGui.Backends" Version="1.0.5"/>
27-
<PackageReference Include="Hexa.NET.ImGui.Backends.SDL2" Version="1.0.5"/>
28-
<PackageReference Include="Hexa.NET.ImGui.Backends.GLFW" Version="1.0.5"/>
29-
<PackageReference Include="Hexa.NET.OpenGL3" Version="1.0.1"/>
30-
<PackageReference Include="Silk.NET.SDL" Version="2.21.0" ExcludeAssets="native"/>
23+
<PackageReference Include="Hexa.NET.ImGui" Version="2.2.6"/>
24+
<PackageReference Include="Hexa.NET.Utilities" Version="2.2.2"/>
25+
<PackageReference Include="Hexa.NET.ImGui.Backends" Version="1.0.14"/>
26+
<PackageReference Include="Hexa.NET.ImGui.Backends.SDL2" Version="1.0.14"/>
27+
<PackageReference Include="Hexa.NET.ImGui.Backends.GLFW" Version="1.0.14"/>
28+
<PackageReference Include="Hexa.NET.OpenGL3" Version="1.1.0"/>
29+
<PackageReference Include="Silk.NET.SDL" Version="2.22.0"/>
3130

3231
<PackageReference Include="NativeFileDialog.Extended" Version="1.2.0"/>
3332

34-
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5"/>
35-
<PackageReference Include="System.Text.Json" Version="9.0.0"/>
33+
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.7"/>
34+
35+
<PackageReference Include="YamlDotNet" Version="16.3.0"/>
3636
</ItemGroup>
3737
</Project>

Alpha/Config.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
using System.Text.Json;
33
using System.Text.Json.Nodes;
44
using System.Text.Json.Serialization;
5+
using Alpha.Services.Excel;
6+
using Lumina.Data;
57
using Serilog;
68

79
namespace Alpha;
@@ -31,6 +33,8 @@ public class Config : IDisposable {
3133
public bool AlwaysShowOffsets;
3234
public bool HighlightLinks = true;
3335
public bool LineHeightImages;
36+
public Language DefaultLanguage = Language.English;
37+
public SchemaProvider SchemaProvider = SchemaProvider.ExdSchema;
3438

3539
public static Config Load() {
3640
Config config;

Alpha/Gui/Components.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static void DrawPathLists(PathListService pathList) {
8383
});
8484
if (disabled) ImGui.EndDisabled();
8585

86-
if (ImGui.BeginTable("Path Lists Table", 3, ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingFixedFit)) {
86+
if (ImGui.BeginTable("Path Lists Table", 2, ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingFixedFit)) {
8787
ImGui.TableSetupColumn("Name");
8888
ImGui.TableSetupColumn("Actions");
8989
ImGui.TableHeadersRow();
@@ -136,4 +136,18 @@ public static void DrawFakeHamburger(Action draw) {
136136

137137
return ret;
138138
}
139+
140+
public static bool DrawEnumCombo<T>(string label, ref T current, T[] values, string[]? names = null)
141+
where T : struct, Enum {
142+
var realNames = names ?? values.Select(x => x.ToString()).ToArray();
143+
var idx = Array.IndexOf(values, current);
144+
if (idx == -1) idx = 0;
145+
146+
if (ImGui.Combo(label, ref idx, realNames, realNames.Length)) {
147+
current = values[idx];
148+
return true;
149+
} else {
150+
return false;
151+
}
152+
}
139153
}

Alpha/Gui/ImGuiWrapper.cs

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Numerics;
2+
using System.Runtime.InteropServices;
23
using Hexa.NET.ImGui;
34
using Hexa.NET.ImGui.Backends.GLFW;
45
using Hexa.NET.ImGui.Backends.OpenGL3;
@@ -14,10 +15,12 @@ public unsafe class ImGuiWrapper : IDisposable {
1415
private readonly Sdl sdl;
1516
private readonly Silk.NET.SDL.Window* window;
1617
private readonly uint windowId;
17-
private readonly void* glContext;
18+
private readonly NativeContext context;
19+
private readonly GL gl;
1820
private readonly ImGuiContext* imguiContext;
1921

2022
public bool Exiting;
23+
2124
public Vector2 WindowPos {
2225
get {
2326
int x;
@@ -69,8 +72,8 @@ public ImGuiWrapper(
6972
}
7073
}
7174

72-
this.glContext = this.sdl.GLCreateContext(this.window);
73-
GL.InitApi(new SdlNativeContext(this.sdl));
75+
this.context = new NativeContext(this.sdl, this.window);
76+
this.gl = new GL(this.context);
7477

7578
this.imguiContext = ImGui.CreateContext();
7679
ImGui.SetCurrentContext(this.imguiContext);
@@ -81,19 +84,23 @@ public ImGuiWrapper(
8184
.AddDefaultFont()
8285
.SetOption(config => { config.FontBuilderFlags |= (uint) ImGuiFreeTypeBuilderFlags.LoadColor; });
8386

87+
var io = ImGui.GetIO();
88+
io.IniFilename = (byte*) Marshal.StringToHGlobalAnsi(iniPath + "\0");
89+
8490
const string cjkFont = "C:/Windows/Fonts/msyh.ttc";
8591
if (File.Exists(cjkFont)) {
86-
var ranges = ImGui.GetIO().Fonts.GetGlyphRangesJapanese();
92+
var ranges = io.Fonts.GetGlyphRangesJapanese();
8793
builder.AddFontFromFileTTF(cjkFont, 13f, ranges);
8894
}
8995

9096
builder.Build();
9197

92-
ImGuiImplSDL2.InitForOpenGL((SDLWindow*) this.window, this.glContext);
98+
ImGuiImplSDL2.InitForOpenGL((SDLWindow*) this.window, (void*) this.context.Handle);
9399
ImGuiImplGLFW.SetCurrentContext(ImGui.GetCurrentContext());
94100

95101
ImGuiImplOpenGL3.SetCurrentContext(ImGui.GetCurrentContext());
96102
ImGuiImplOpenGL3.Init((string) null!);
103+
97104
ImGuiImplOpenGL3.NewFrame();
98105
}
99106

@@ -120,14 +127,14 @@ public void Render(Action draw) {
120127

121128
draw();
122129

123-
this.sdl.GLMakeCurrent(this.window, this.glContext);
124-
GL.BindFramebuffer(GLFramebufferTarget.Framebuffer, 0);
130+
this.sdl.GLMakeCurrent(this.window, (void*) this.context.Handle);
131+
this.gl.BindFramebuffer(GLFramebufferTarget.Framebuffer, 0);
125132

126133
const float grey = 40 / 255f;
127-
GL.ClearColor(grey, grey, grey, 1f);
134+
this.gl.ClearColor(grey, grey, grey, 1f);
128135

129136
// ReSharper disable once BitwiseOperatorOnEnumWithoutFlags
130-
GL.Clear(GLClearBufferMask.ColorBufferBit | GLClearBufferMask.DepthBufferBit);
137+
this.gl.Clear(GLClearBufferMask.ColorBufferBit | GLClearBufferMask.DepthBufferBit);
131138

132139
ImGui.Render();
133140
ImGui.EndFrame();
@@ -154,7 +161,7 @@ public void Dispose() {
154161
ImGui.SetCurrentContext(null);
155162
ImGui.DestroyContext(this.imguiContext);
156163

157-
this.sdl.GLDeleteContext(this.glContext);
164+
this.context.Dispose();
158165
this.sdl.DestroyWindow(this.window);
159166
this.sdl.Quit();
160167
}
@@ -167,39 +174,52 @@ public nint CreateTexture(byte[] data, int width, int height) {
167174
}
168175

169176
fixed (byte* dataPtr = data) {
170-
var texture = GL.GenTexture();
171-
GL.BindTexture(GLTextureTarget.Texture2D, texture);
177+
var texture = this.gl.GenTexture();
178+
this.gl.BindTexture(GLTextureTarget.Texture2D, texture);
172179

173-
GL.TexParameteri(GLTextureTarget.Texture2D, GLTextureParameterName.MinFilter,
180+
this.gl.TexParameteri(GLTextureTarget.Texture2D, GLTextureParameterName.MinFilter,
174181
(int) GLTextureMinFilter.Linear);
175-
GL.TexParameteri(GLTextureTarget.Texture2D, GLTextureParameterName.MagFilter,
182+
this.gl.TexParameteri(GLTextureTarget.Texture2D, GLTextureParameterName.MagFilter,
176183
(int) GLTextureMagFilter.Linear);
177184

178-
GL.PixelStorei(GLPixelStoreParameter.UnpackRowLength, 0);
179-
GL.TexImage2D(GLTextureTarget.Texture2D, 0, GLInternalFormat.Rgba, width, height, 0, GLPixelFormat.Rgba,
185+
this.gl.PixelStorei(GLPixelStoreParameter.UnpackRowLength, 0);
186+
this.gl.TexImage2D(GLTextureTarget.Texture2D, 0, GLInternalFormat.Rgba, width, height, 0,
187+
GLPixelFormat.Rgba,
180188
GLPixelType.UnsignedByte, (nint) dataPtr);
181189

182190
return (nint) texture;
183191
}
184192
}
185193

186194
public void DestroyTexture(nint texture) {
187-
GL.DeleteTexture((uint) texture);
195+
this.gl.DeleteTexture((uint) texture);
188196
}
189197

190-
public class SdlNativeContext(Sdl sdl) : INativeContext {
191-
public nint GetProcAddress(string procName) {
192-
return (nint) sdl.GLGetProcAddress(procName);
198+
private class NativeContext(Sdl sdl, Silk.NET.SDL.Window* window) : IGLContext {
199+
private void* glContext = sdl.GLCreateContext(window);
200+
public nint Handle => (nint) this.glContext;
201+
public bool IsCurrent => sdl.GLGetCurrentContext() == this.glContext;
202+
203+
public void Dispose() {
204+
if (this.glContext != null) {
205+
sdl.GLDeleteContext(this.glContext);
206+
this.glContext = null;
207+
}
193208
}
194209

195210
public bool TryGetProcAddress(string procName, out nint procAddress) {
196-
return (procAddress = (nint) sdl.GLGetProcAddress(procName)) != nint.Zero;
211+
procAddress = (nint) sdl.GLGetProcAddress(procName);
212+
return procAddress != 0;
197213
}
198214

199-
public bool IsExtensionSupported(string extensionName) {
200-
return sdl.GLExtensionSupported(extensionName) != 0;
201-
}
215+
public nint GetProcAddress(string procName)
216+
=> (nint) sdl.GLGetProcAddress(procName);
217+
218+
public bool IsExtensionSupported(string extensionName)
219+
=> sdl.GLExtensionSupported(extensionName) != 0;
202220

203-
public void Dispose() { }
221+
public void MakeCurrent() => sdl.GLMakeCurrent(window, this.glContext);
222+
public void SwapBuffers() => sdl.GLSwapWindow(window);
223+
public void SwapInterval(int interval) => sdl.GLSetSwapInterval(interval);
204224
}
205225
}

Alpha/Gui/ListClipper.cs

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)