Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/create-release-branch-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- name: Bump version in Directory.Build.props
id: bump
uses: vers-one/dotnet-project-version-updater@v1.7
uses: vers-one/dotnet-project-version-updater@v1.8
with:
file: "Directory.Build.props"
version: ${{ inputs.versionBump }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/label-merged-issues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Label linked issues as merged
uses: actions/github-script@v8
uses: actions/github-script@v9
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand Down
5 changes: 1 addition & 4 deletions Daybreak.API/Daybreak.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@
<PackageReference Include="Serilog.Settings.Configuration" />
<PackageReference Include="Serilog.Sinks.Console" />
<PackageReference Include="Serilog.Sinks.File" />
<PackageReference Include="Swashbuckle.AspNetCore" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" />
<PackageReference Include="Scalar.AspNetCore" />
<PackageReference Include="SystemExtensions.NetStandard.Generators" PrivateAssets="all" />
<PackageReference Include="ZLinq" />
</ItemGroup>
Expand Down
2 changes: 0 additions & 2 deletions Daybreak.API/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ private static WebApplication CreateApplication(int port)
.WithRoutes()
.WithHealthChecks();

builder.Services.AddOpenApi();

// Add CORS policy - allow localhost and trusted community sites
builder.Services.AddCors(options =>
{
Expand Down
382 changes: 375 additions & 7 deletions Daybreak.API/Interop/GWCA.cs

Large diffs are not rendered by default.

14 changes: 1 addition & 13 deletions Daybreak.API/Swagger/WebApplicationBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using Microsoft.AspNetCore.Http.Json;
using Microsoft.AspNetCore.Routing.Constraints;
using Microsoft.Extensions.Options;
using Swashbuckle.AspNetCore.SwaggerGen;
using System.Text.Json;
using Microsoft.AspNetCore.Routing.Constraints;

namespace Daybreak.API.Swagger;

Expand All @@ -11,14 +7,6 @@ public static class WebApplicationBuilderExtensions
public static WebApplicationBuilder WithSwagger(this WebApplicationBuilder builder)
{
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddTransient<ISerializerDataContractResolver>(sp =>
{
var opts = sp.GetRequiredService<IOptions<JsonOptions>>().Value?.SerializerOptions
?? new JsonSerializerOptions(JsonSerializerDefaults.Web);

return new JsonSerializerDataContractResolver(opts);
});
builder.Services.Configure<RouteOptions>(static options =>
{
options.SetParameterPolicy<RegexInlineRouteConstraint>("regex");
Expand Down
8 changes: 5 additions & 3 deletions Daybreak.API/Swagger/WebApplicationExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
namespace Daybreak.API.Swagger;
using Scalar.AspNetCore;

namespace Daybreak.API.Swagger;

public static class WebApplicationExtensions
{
public static WebApplication UseSwaggerWithUI(this WebApplication app)
{
app.UseSwagger();
app.UseSwaggerUI();
app.MapOpenApi();
app.MapScalarApiReference();
return app;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ is null

if (!args.Any(a => a.StartsWith("-character")))
{
args.AddRange(PopulateCommandLineArgs("-character", "Daybreak") ?? []);
args.AddRange(PopulateCommandLineArgs("-character", " ") ?? []);
}

var process = new Process()
Expand Down
5 changes: 3 additions & 2 deletions Daybreak.Core/Services/TarGz/TarGzExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ private bool ExtractToDirectoryInternal(

// Use ReaderFactory which properly handles nested archives like .tar.gz
using var stream = File.OpenRead(sourceFile);
using var reader = ReaderFactory.OpenReader(stream, new ReaderOptions { ExtractFullPath = true, Overwrite = true });
using var reader = ReaderFactory.OpenReader(stream);
var extractionOptions = new ExtractionOptions { ExtractFullPath = true, Overwrite = true };

var processedEntries = 0;

Expand All @@ -68,7 +69,7 @@ private bool ExtractToDirectoryInternal(
progressTracker(0.5, entryKey);

// Extract the entry
reader.WriteEntryToDirectory(destinationDirectory);
reader.WriteEntryToDirectory(destinationDirectory, extractionOptions);

processedEntries++;
}
Expand Down
25 changes: 20 additions & 5 deletions Daybreak.Generators/GenerateGWCABindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -500,19 +500,22 @@
ConstantsNode node,
Dictionary<string, string> typeMap,
HashSet<string> namespaceClassNames,
int indent)
int indent,
string? emitNameOverride = null)
{
var pad = new string(' ', indent);

// If the node has nothing to emit (no enums, no consts, no children with content), skip
if (!HasAnyContent(node))
return;

var emitName = emitNameOverride ?? SanitizeIdentifier(node.Name);

// Always emit a partial class wrapper — C# allows multiple partial
// declarations for the same nested class, so this merges cleanly
// with any class already emitted by the export tree.
sb.AppendLine();
sb.AppendLine($"{pad}public static partial class {SanitizeIdentifier(node.Name)}");
sb.AppendLine($"{pad}public static partial class {emitName}");
sb.AppendLine($"{pad}{{");

var innerIndent = indent + 4;
Expand Down Expand Up @@ -543,8 +546,12 @@
foreach (var member in enumDef.Members)
{
var csType = MapCppTypeToCs(enumDef.UnderlyingType);
var memberName = SanitizeIdentifier(member.Name);
// CS0542: member names cannot be the same as their enclosing type
if (memberName == emitName)
memberName += "_";
var comment = member.Comment is not null ? $" // {member.Comment}" : "";
sb.AppendLine($"{innerPad}internal const {csType} {SanitizeIdentifier(member.Name)} = {member.Value};{comment}");
sb.AppendLine($"{innerPad}internal const {csType} {memberName} = {member.Value};{comment}");
}
}
}
Expand All @@ -554,8 +561,12 @@
{
var csType = MapCppTypeToCs(field.CppType);
var value = field.Value;
var fieldName = SanitizeIdentifier(field.Name);
// CS0542: member names cannot be the same as their enclosing type
if (fieldName == emitName)
fieldName += "_";
var comment = field.Comment is not null ? $" // {field.Comment}" : "";
sb.AppendLine($"{innerPad}internal const {csType} {SanitizeIdentifier(field.Name)} = {value};{comment}");
sb.AppendLine($"{innerPad}internal const {csType} {fieldName} = {value};{comment}");
}

// Type aliases are now emitted to GuildWars namespace, not nested GWCA classes
Expand All @@ -567,7 +578,11 @@
// Emit children
foreach (var child in node.Children.Values.OrderBy(c => c.Name, StringComparer.Ordinal))
{
EmitConstantsNode(sb, child, typeMap, namespaceClassNames, innerIndent);
// CS0542: nested class name cannot be the same as enclosing type
string? childNameOverride = null;
if (SanitizeIdentifier(child.Name) == emitName)
childNameOverride = SanitizeIdentifier(child.Name) + "_";
EmitConstantsNode(sb, child, typeMap, namespaceClassNames, innerIndent, childNameOverride);
}

sb.AppendLine($"{pad}}}");
Expand Down Expand Up @@ -1098,7 +1113,7 @@

emittedNames.Add(alias.AliasName);

var innerType = alias.TemplateArg.Replace("::", ".").Trim();

Check warning on line 1116 in Daybreak.Generators/GenerateGWCABindings.cs

View workflow job for this annotation

GitHub Actions / build-windows

Dereference of a possibly null reference.

Check warning on line 1116 in Daybreak.Generators/GenerateGWCABindings.cs

View workflow job for this annotation

GitHub Actions / build-windows

Dereference of a possibly null reference.

Check warning on line 1116 in Daybreak.Generators/GenerateGWCABindings.cs

View workflow job for this annotation

GitHub Actions / cd / build-x86

Dereference of a possibly null reference.
// Handle pointer types (e.g., "Item *" -> "nint")
if (innerType.EndsWith("*"))
innerType = "nint";
Expand Down
4 changes: 0 additions & 4 deletions Daybreak.Injector/Daybreak.Injector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Reloaded.Assembler" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Daybreak.Shared\Daybreak.Shared.csproj" />
</ItemGroup>
Expand Down
52 changes: 20 additions & 32 deletions Daybreak.Injector/StubInjector.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Daybreak.Shared.Models;
using Reloaded.Assembler;
using System.Diagnostics;
using System.Text;

Expand All @@ -8,36 +7,26 @@ namespace Daybreak.Injector;
public static class StubInjector
{
/// <summary>
/// ebp+8 is the dll path pointer
/// 0xDEADBEEF is a placeholder to be patched later for LoadLibraryA
/// 0xFEEDF00D is a placeholder to be patched later for GetProcAddress
/// Pre-assembled x86 stub bytecode.
/// 0xDEADBEEF is a placeholder to be patched later for LoadLibraryA.
/// 0xFEEDF00D is a placeholder to be patched later for GetProcAddress.
/// </summary>
const string Asm = @"
use32
push ebp
mov ebp, esp

mov esi, [ebp+8] ; ESI = &INJECT_DATA (kept unchanged)

; -------- LoadLibraryA(dllPath) ------------------------------
push dword [esi] ; dllPath
mov eax, 0xDEADBEEF ; patched → LoadLibraryA
call eax ; EAX = hModule

; -------- GetProcAddress(hModule, funcName) ------------------
push dword [esi+4] ; funcName
push eax ; hModule (still in EAX)
mov eax, 0xFEEDF00D ; patched → GetProcAddress
call eax ; EAX = exported EntryPoint

; -------- call EntryPoint() ----------------------------------
call eax ; calls EntryPoint
; xor eax, eax ; thread exit-code 0

; -------- return EntryPoint() response -----------------------
leave ; = mov esp, ebp / pop ebp
ret 4 ; stdcall: pop lpParameter
";
private static readonly byte[] StubTemplate =
[
0x55, // push ebp
0x89, 0xE5, // mov ebp, esp
0x8B, 0x75, 0x08, // mov esi, [ebp+8]
0xFF, 0x36, // push dword [esi] ; dllPath
0xB8, 0xEF, 0xBE, 0xAD, 0xDE, // mov eax, 0xDEADBEEF ; -> LoadLibraryA
0xFF, 0xD0, // call eax
0xFF, 0x76, 0x04, // push dword [esi+4] ; funcName
0x50, // push eax ; hModule
0xB8, 0x0D, 0xF0, 0xED, 0xFE, // mov eax, 0xFEEDF00D ; -> GetProcAddress
0xFF, 0xD0, // call eax
0xFF, 0xD0, // call eax ; EntryPoint()
0xC9, // leave
0xC2, 0x04, 0x00, // ret 4 ; stdcall cleanup
];

public static InjectorResponses.InjectResult Inject(Process target, string dllPath, string entryPoint, out int exitCode)
{
Expand All @@ -51,8 +40,7 @@ public static InjectorResponses.InjectResult Inject(Process target, string dllPa
return InjectorResponses.InjectResult.InvalidProcess;
}

using var assembler = new Assembler();
var stubBytes = assembler.Assemble(Asm);
var stubBytes = (byte[])StubTemplate.Clone();

// patch placeholders
var hKernel = NativeMethods.GetModuleHandle("kernel32.dll");
Expand Down
4 changes: 2 additions & 2 deletions Dependencies/GWCA/Include/GWCA/GWCAVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#define GWCA_VERSION_MAJOR 3
#define GWCA_VERSION_MINOR 3
#define GWCA_VERSION_PATCH 1
#define GWCA_VERSION_PATCH 2
#define GWCA_VERSION_BUILD 0
#define GWCA_VERSION "3.3.1.0"
#define GWCA_VERSION "3.3.2.0"

namespace GWCA {
constexpr int VersionMajor = GWCA_VERSION_MAJOR;
Expand Down
Binary file modified Dependencies/GWCA/gwca.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<NoWarn>$(NoWarn);IL2104;IL3053;IL3000;IL3002;NU1701;CS0108</NoWarn>

<Version>0.9.10.5</Version>
<Version>0.9.10.6</Version>

<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
50 changes: 23 additions & 27 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,45 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="CommunityToolkit.Authentication.Msal" Version="7.1.4" />
<PackageVersion Include="coverlet.collector" Version="8.0.0" />
<PackageVersion Include="coverlet.collector" Version="10.0.0" />
<PackageVersion Include="DiffPlex" Version="1.9.0" />
<PackageVersion Include="Elastic.OpenTelemetry" Version="1.3.0" />
<PackageVersion Include="FluentAssertions" Version="8.8.0" />
<PackageVersion Include="FluentAssertions" Version="8.9.0" />
<PackageVersion Include="HtmlAgilityPack" Version="1.12.4" />
<PackageVersion Include="ini-parser-netstandard" Version="2.5.3" />
<PackageVersion Include="MegaApiClient" Version="1.10.5" />
<PackageVersion Include="MemoryPack" Version="1.21.4" />
<PackageVersion Include="MemoryPack.Generator" Version="1.21.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.3.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="5.3.0-2.25625.1" />
<PackageVersion Include="Microsoft.AspNetCore.Components" Version="10.0.3" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.3" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="5.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components" Version="10.0.6" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.6" />
<PackageVersion Include="Microsoft.Authentication.WebAssembly.Msal" Version="9.0.8" />
<PackageVersion Include="Microsoft.CorrelationVector" Version="1.0.42" />
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.3" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Embedded" Version="10.0.3" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.3" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="10.0.3" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.3" />
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.6" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Embedded" Version="10.0.6" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.6" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="10.0.6" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.6" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.14.0" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.14.0" />
<PackageVersion Include="Microsoft.Identity.Client" Version="4.82.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.3800.47" />
<PackageVersion Include="Microsoft.Identity.Client" Version="4.83.3" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.4.0" />
<PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.3912.50" />
<PackageVersion Include="MinHook.NET" Version="1.1.2" />
<PackageVersion Include="MSTest.TestAdapter" Version="4.1.0" />
<PackageVersion Include="MSTest.TestFramework" Version="4.1.0" />
<PackageVersion Include="MSTest.TestAdapter" Version="4.2.1" />
<PackageVersion Include="MSTest.TestFramework" Version="4.2.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="NSubstitute.Analyzers.CSharp" Version="1.0.17" />
<PackageVersion Include="Net.Sdk.Web.Extensions" Version="0.8.13" />
<PackageVersion Include="Net.Sdk.Web.Extensions.SourceGenerators" Version="0.9.5" />
<PackageVersion Include="OpenTelemetry.Exporter.Console" Version="1.15.0" />
<PackageVersion Include="Net.Sdk.Web.Extensions.SourceGenerators" Version="0.9.6" />
<PackageVersion Include="OpenTelemetry.Exporter.Console" Version="1.15.2" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.15.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.15.0" />
<PackageVersion Include="PeNet" Version="6.0.0" />
<PackageVersion Include="Photino.Blazor" Version="4.0.13" />
<PackageVersion Include="Plumsy" Version="1.2.0" />
<PackageVersion Include="Reloaded.Assembler" Version="1.0.16" />
<PackageVersion Include="securifybv.ShellLink" Version="0.1.0" />
<PackageVersion Include="Serilog" Version="4.3.1" />
<PackageVersion Include="Serilog.Enrichers.Environment" Version="3.0.1" />
Expand All @@ -54,17 +53,14 @@
<PackageVersion Include="Serilog.Sinks.Debug" Version="3.0.0" />
<PackageVersion Include="Serilog.Sinks.File" Version="7.0.0" />
<PackageVersion Include="SevenZipExtractor" Version="1.0.19" />
<PackageVersion Include="SharpCompress" Version="0.46.2" />
<PackageVersion Include="SharpCompress" Version="0.47.4" />
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.12" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="10.1.4" />
<PackageVersion Include="Swashbuckle.AspNetCore.Swagger" Version="10.1.4" />
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerGen" Version="10.1.4" />
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerUI" Version="10.1.4" />
<PackageVersion Include="Scalar.AspNetCore" Version="2.14.1" />
<PackageVersion Include="Sybil" Version="0.8.4" />
<PackageVersion Include="System.IO.Compression" Version="4.3.0" />
<PackageVersion Include="System.Diagnostics.PerformanceCounter" Version="10.0.3" />
<PackageVersion Include="System.Drawing.Common" Version="10.0.3" />
<PackageVersion Include="System.Security.Cryptography.ProtectedData" Version="10.0.3" />
<PackageVersion Include="System.Diagnostics.PerformanceCounter" Version="10.0.6" />
<PackageVersion Include="System.Drawing.Common" Version="10.0.6" />
<PackageVersion Include="System.Security.Cryptography.ProtectedData" Version="10.0.6" />
<PackageVersion Include="System.Linq.Async" Version="6.0.3" />
<PackageVersion Include="System.Reflection.Metadata" Version="9.0.10" />
<PackageVersion Include="System.Text.Json" Version="9.0.10" />
Expand All @@ -74,6 +70,6 @@
<PackageVersion Include="SystemExtensions.NetStandard.Generators" Version="0.1.7" />
<PackageVersion Include="TrailBlazr" Version="0.3.1" />
<PackageVersion Include="zgabi.ManagedXZ" Version="1.0.2" />
<PackageVersion Include="ZLinq" Version="1.5.5" />
<PackageVersion Include="ZLinq" Version="1.5.6" />
</ItemGroup>
</Project>
Loading