Compare commits

..

5 Commits

Author SHA1 Message Date
maj00r
3dfcbca711 fix: the Steam overlay no longer draws its frame counter over the starter
Steam puts its overlay into the starter, the game it launches. In a
window's own redirection surface ANGLE draws through a swap chain of
that window, and the overlay hooks its Present and draws the frame
counter and notifications over the starter. Every window now draws
into a DirectComposition surface, which is drawn without a Present and
still keeps away from the WinUI composition visual that came up black
on 25H2. The redirection surface stays only as the fallback.
2026-11-28 19:38:44 +01:00
dependabot[bot]
9668b4d3b6 build(deps): bump actions/setup-dotnet from 6.0.0 to 6.1.0 (#39)
Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 6.0.0 to 6.1.0.
- [Release notes](https://github.com/actions/setup-dotnet/releases)
- [Commits](a98b56852c...0f4a354dd5)

---
updated-dependencies:
- dependency-name: actions/setup-dotnet
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-27 18:06:07 +01:00
maj00r
42591bcddd Merge pull request #62 from MaSzyna-EU07/fix/ini-keeps-unknown-values
fix(settings): keep eu07.ini values the starter does not know until changed by hand
2026-11-27 04:06:04 +01:00
maj00r
50ca332438 fix: windows of the starter no longer come up black on Windows 11 25H2 (#63)
* fix: windows of the starter no longer come up black on Windows 11 25H2

Avalonia composes each window through a WinUI composition visual by
default, and on 25H2 that visual was often left empty: the main window
or a dialog opened later stayed black while the others drew. The
starter has no see-through windows or backdrops, so every window now
draws into its own redirection surface, still on the graphics card.
--software-render comes after and keeps its own options.

* test: the choice between window surfaces and the processor is covered

The choice moves out of Program, which no test runs, into
WindowSurfaces, where both branches are tested. Sonar's quality gate
failed on the coverage of the new code.

---------

Co-authored-by: maj00r <maj00r@host>
2026-11-27 04:00:39 +01:00
maj00r
4f749ff576 fix(physics): a // comment in a .fiz is skipped, as the game does (#61)
Include parameters written one per line with a // note after them
("68 //MaxLoad") gave the note's words as parameters of their own, so
LoadAccepted=(p3) in db/zans_v1 read "68" and the load list showed a number.

Co-authored-by: maj00r <maj00r@host>
2026-11-24 19:40:07 +01:00
7 changed files with 117 additions and 4 deletions

View File

@@ -52,7 +52,7 @@ jobs:
persist-credentials: false
- name: Setup .NET 10
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: 10.0.x
@@ -142,7 +142,7 @@ jobs:
persist-credentials: false
- name: Setup .NET 10
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: 10.0.x

View File

@@ -62,7 +62,7 @@ jobs:
persist-credentials: false
- name: Setup .NET 10
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: 10.0.x

View File

@@ -65,6 +65,36 @@ public class PhysicsAndAssetsTests
Assert.Equal(125, physics.VMax);
}
[Fact]
public void Comments_between_include_parameters_are_not_parameters()
{
// As in the game: db/zans_v1/astra_rail_14_96m_86m3_ke_1.fiz feeds zans.fiz.inc this way.
const string fiz = """
include
zans.fiz.inc
21000 //masa
68 //MaxLoad
aviation_fuel,crude_oil,petrol
14.96 //L
end
""";
var installation = new TestInstallation(new InMemoryFileSystem()
.WithFile(Fiz("db", "zans_v1", "astra"), fiz)
.WithFile(TestInstallation.At("dynamic", "db", "zans_v1", "zans.fiz.inc"),
"""
Param. Category=train M=(p1) Vmax=100 # masa [kg]
Load: MaxLoad=(p2) LoadQ=tonns LoadAccepted=(p3) LoadSpeed=0.1
Dimensions: L=(p4) H=4.285
"""));
var physics = installation.Physics.For("db/zans_v1/", "astra")!;
Assert.Equal(21000, physics.Mass);
Assert.Equal(68, physics.MaxLoad);
Assert.Equal("aviation_fuel,crude_oil,petrol", physics.LoadAccepted);
Assert.Equal(14.96, physics.Length);
}
[Fact]
public void An_include_named_in_other_case_is_followed()
{

View File

@@ -0,0 +1,46 @@
using Avalonia;
using StarterNG.Infrastructure;
namespace StarterNG.Tests;
public class WindowSurfacesTests
{
[Fact]
public void Windows_draws_into_a_directcomposition_surface_and_never_through_winui_composition()
{
var options = WindowSurfaces.Win32Options;
Assert.Equal(Win32CompositionMode.DirectComposition, options.CompositionMode.First());
Assert.DoesNotContain(Win32CompositionMode.WinUIComposition, options.CompositionMode);
}
[Fact]
public void The_window_surface_is_only_the_fallback()
{
// There ANGLE presents through a swap chain, and the Steam overlay draws over it.
Assert.Equal(Win32CompositionMode.RedirectionSurface, WindowSurfaces.Win32Options.CompositionMode.Last());
}
[Fact]
public void No_swap_chain_of_its_own_is_asked_for()
{
Assert.DoesNotContain(Win32CompositionMode.LowLatencyDxgiSwapChain, WindowSurfaces.Win32Options.CompositionMode);
}
[Fact]
public void The_graphics_card_still_draws()
{
Assert.Equal(new Win32PlatformOptions().RenderingMode, WindowSurfaces.Win32Options.RenderingMode);
Assert.Contains(Win32RenderingMode.AngleEgl, WindowSurfaces.Win32Options.RenderingMode);
}
[Theory]
[InlineData(false)]
[InlineData(true)]
public void The_options_go_to_the_same_builder_with_or_without_the_processor(bool softwareRender)
{
var builder = AppBuilder.Configure<Avalonia.Application>();
Assert.Same(builder, WindowSurfaces.ApplyTo(builder, softwareRender));
}
}

View File

@@ -265,10 +265,14 @@ public sealed class FizPhysicsRepository : IPhysicsRepository
var sb = new StringBuilder();
foreach (string line in text.Split('\n'))
{
// Both kinds the game skips: "68 //MaxLoad" passes one include parameter, not two.
string stripped = line;
int comment = stripped.IndexOf('#');
if (comment >= 0)
stripped = stripped[..comment];
int slashes = stripped.IndexOf("//", StringComparison.Ordinal);
if (slashes >= 0)
stripped = stripped[..slashes];
sb.Append(stripped).Append(' ');
}

View File

@@ -0,0 +1,32 @@
using Avalonia;
namespace StarterNG.Infrastructure;
/// <summary>
/// On Windows the graphics card draws each window of the starter into a DirectComposition
/// surface, not into Avalonia's default WinUI composition visual. On Windows 11 25H2 that
/// visual was left empty on many starts: the main window, or a dialog opened later,
/// stayed black while the others drew, and came back only now and then.
/// The window's own redirection surface is only the fallback: there ANGLE draws through a
/// swap chain of the window, and the Steam overlay, which Steam puts into the starter as
/// the game it launches, hooks that swap chain's Present and draws its frame counter and
/// notifications over the starter. A composition surface is drawn without a Present.
/// </summary>
public static class WindowSurfaces
{
public static Win32PlatformOptions Win32Options => new()
{
CompositionMode = new[]
{
Win32CompositionMode.DirectComposition,
Win32CompositionMode.RedirectionSurface
}
};
/// <summary>
/// The options a platform reads are the last given, so the processor, when asked
/// for, draws with <see cref="SoftwareRender"/>'s own and these are left out.
/// </summary>
public static AppBuilder ApplyTo(AppBuilder builder, bool softwareRender) =>
softwareRender ? SoftwareRender.ApplyTo(builder) : builder.With(Win32Options);
}

View File

@@ -73,8 +73,9 @@ static class Program
};
}
// Without the switch the graphics card draws, into the window surfaces.
private static AppBuilder WithSoftwareRenderIfAsked(this AppBuilder builder) =>
_softwareRender ? SoftwareRender.ApplyTo(builder) : builder;
WindowSurfaces.ApplyTo(builder, _softwareRender);
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()