Files
frameledger/tests/FrameLedger.Domain.Tests/RpgMakerVersionTests.cs
poli0981andClaude Opus 5.5 a53ebee683 feat(detection): the engine version of Unity, Godot and RPG Maker games, read from their own files (beta.19 PR-3) (#294)
The owner's request of 2026-10-12. Rules 2026.10.1 gave: Unity's
pe_file_version stored UnityPlayer.dll's FileVersion string as it is
(2022.3.39.5118735 - the build number where the release letter belongs);
Godot's strings_regex scanned the executable's first 8 MiB while the
"Godot Engine v..." string sits 57-78 MB into both exports on the owner's
disk, so it never read one; both RPG Maker rules had version: null.

Measured read-only on 23 installs first (spike-notes section 17), then decided
in code as Unreal's is since beta.10:

- Rules 2026.10.2: unity_build, godot_build, rpgmaker_build - extractor types
  that take no parameter (the schema's enum beside unreal_build).
  StaticGameDetector makes one second read for the engine that matched;
  RuleEvaluator answers null for them as for unreal_build.
- Domain: UnityVersion (player ProductVersion, else the data file's header,
  else the player's numeric version), GodotVersion (a data pack's header,
  beside the executable or appended to it, else the executable's version
  while it is still Godot's; a zero patch dropped, as Godot names it),
  RpgMakerVersion (MZ/MV core-script header; the RGSS library Game.ini names
  -> XP/VX/VX Ace, its version or the one its name carries). New
  EngineVersionSource ids name the witness - and the maker.
- Infrastructure: UnityBuildReader, GodotBuildReader, RpgMakerBuildReader -
  version resources and at most a few kilobytes of any file; RPG Maker's files
  beside the executable or up to two folders above, as RpgMakerTitle looks.
- App: Formats.Engine(id, source) and EngineWithVersion - "RPG Maker MZ
  1.10.0", "RPG Maker VX Ace (RGSS 3.0.1)", "Unity 2022.3.39f1", "Godot 4.4.1"
  on the page, the subtitle and the card; the Engine version row says what
  each was read from, and "Not found in the game's files" once read. Strings
  en/vi/ja (ja marked review).
- Privacy Policy 2.8: section 4 names the version marks an engine keeps in its
  own files (the owner-approved wording), which also covers two reads that were
  never stated (UnityPlayer.dll's version, an RPG Maker title). The accuracy
  block, LIMITATIONS, 05_DETECTION, 06_DATA_MODEL, 08_UI and
  legal-drift-history say the same.

The shipped pipeline over the owner's installs (read-only): Unity 15 of 15,
Godot 2 of 2, RPG Maker 6 of 6, every one as measured; 24 ms to 4.1 s per
entry on the USB drive, nearly all of it the install's walk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 15:40:00 +07:00

48 lines
2.8 KiB
C#

// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using FluentAssertions;
using FrameLedger.Domain.Detection;
namespace FrameLedger.Domain.Tests;
/// <summary>
/// RPG Maker's maker and version (beta.19): the owner's six RPG Maker installs as measured on 2026-10-12 — MZ and MV by their
/// core script's header, VX Ace by its RGSS3 library — and the RGSS generations by name.
/// </summary>
public sealed class RpgMakerVersionTests
{
[Theory]
[InlineData("A Doll's Locket - Remake", "rmmz_core.js", "1.10.0", "1.10.0", EngineVersionSource.RpgMakerMzCore)]
[InlineData("Flower in Us", "rpg_core.js", "1.6.2", "1.6.2", EngineVersionSource.RpgMakerMvCore)]
[InlineData("996IR", "rpg_core.js", "1.6.2", "1.6.2", EngineVersionSource.RpgMakerMvCore)]
[InlineData("HELLO, HELLO WORLD!", "rpg_core.js", "1.6.1", "1.6.1", EngineVersionSource.RpgMakerMvCore)]
public void MzAndMvReadFromTheirCoreScript(string title, string script, string header, string version, string source) =>
RpgMakerVersion.Decide(new RpgMakerBuildFacts { CoreScript = script, CoreScriptVersion = header })
.Should().Be(new EngineVersionReading(version, source), title);
[Fact]
public void VxAceReadsFromItsRgss3Library() =>
RpgMakerVersion.Decide(new RpgMakerBuildFacts { RgssLibrary = "RGSS301.dll", RgssFileVersion = [3, 0, 1, 1] })
.Should().Be(new EngineVersionReading("3.0.1", EngineVersionSource.Rgss3Library), "City of Bones and Träumerei Chapter 2");
[Theory]
[InlineData("RGSS104E.dll", "1.0.4", EngineVersionSource.Rgss1Library)]
[InlineData("RGSS102J.dll", "1.0.2", EngineVersionSource.Rgss1Library)]
[InlineData("RGSS202E.dll", "2.0.2", EngineVersionSource.Rgss2Library)]
[InlineData("rgss300.dll", "3.0.0", EngineVersionSource.Rgss3Library)]
public void WithoutAVersionResourceTheLibrarysNameCarriesIt(string library, string version, string source) =>
RpgMakerVersion.Decide(new RpgMakerBuildFacts { RgssLibrary = library })
.Should().Be(new EngineVersionReading(version, source));
[Fact]
public void ALibraryWhoseNumbersAreNotItsGenerationsKeepsTheNameAndNothingElseIsAVersion()
{
RpgMakerVersion.Decide(new RpgMakerBuildFacts { RgssLibrary = "RGSS301.dll", RgssFileVersion = [1, 0, 0, 1] })
.Should().Be(new EngineVersionReading("3.0.1", EngineVersionSource.Rgss3Library));
RpgMakerVersion.Decide(new RpgMakerBuildFacts { RgssLibrary = "Game.dll" }).Should().Be(EngineVersionReading.None);
RpgMakerVersion.Decide(new RpgMakerBuildFacts { CoreScript = "rmmz_core.js", CoreScriptVersion = "v1" }).Should().Be(EngineVersionReading.None);
RpgMakerVersion.Decide(new RpgMakerBuildFacts()).Should().Be(EngineVersionReading.None);
}
}