Compare commits

...
Author SHA1 Message Date
poli0981andClaude Opus 5.5 fdd0eb855c feat(rules): RE Engine and FromSoftware are detected; engines are shown by name
Items 2 and 3 of the owner's beta.6 list, checked on the owner's disk first.

- re_engine: `re_chunk_000.pak` beside the executable, the exact name (a
  glob without a star is the whole leaf, so a patch archive alone is not
  it). RESIDENT EVIL 2 and the Onimusha demo carry it.
- fromsoftware: a `*.bhd` AND a `*.bdt` sibling - DARK SOULS II
  (GameDataEbl), III (Data0-5), ELDEN RING (Data0-3) and Sekiro (Data1-5).
  The request said `.bht`; on disk it is `.bdt`. No `Game\` requirement:
  Sekiro has none, and "the parent folder is named X" is not a signal type.
- Both after the RPG Maker rules and before godot (whose *.pck also matches
  a loose Wwise bank). rulesVersion 2026.09.2, so every row re-detects.
  None of the other 80 Steam titles on the owner's disk has either marker.
- Fixtures engines/re_engine and engines/fromsoftware; the
  every_engine_marker canary carries both and still expects unity; its
  README said "four engines" while it held six.

The App shows engines by name (Formats.Engine: proper nouns, an unknown or
user-typed id passes through) on the card and the game page, where it
showed `rpgmaker_mv`; a test holds every shipped rule's id to its own name.
A hand-added executable whose name says nothing (Game.exe) is named from
RPG Maker's System.json gameTitle, else the nearest non-runtime folder
(GameTitleGuess + RpgMakerTitle), so HHW's swiftshader\Game.exe is "HELLO,
HELLO WORLD!" and not "Game". GameLibrary's misplaced doc comment fixed.

Engine detection never feeds the guard: ELDEN RING stays refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 02:52:23 +07:00
28 changed files with 407 additions and 13 deletions

No files matched your search

+10
View File
@@ -27,6 +27,16 @@ under a `## [x.y.z] - date` heading in the same commit that bumps `VERSION`, the
## [Unreleased]
### Added
- **RE Engine and FromSoftware games are detected.** Capcom's RE Engine titles (RESIDENT EVIL 2/3/4/7/Village, Devil
May Cry 5, Monster Hunter Rise/Wilds, Street Fighter 6, Dragon's Dogma 2, Onimusha…) by their `re_chunk_000.pak`
archive; FromSoftware's (DARK SOULS II/III, ELDEN RING, Sekiro…) by their `.bhd` + `.bdt` archive pairs. Both are
relative signals — a file layout, not a proof — like every engine rule. Every game in the library is re-detected on
the next sweep. Engines are now shown by name ("RPG Maker MV/MZ", "Unreal Engine") instead of the rule's id
(`rpgmaker_mv`). A game added by hand whose executable says nothing (`Game.exe`) is named after the game — RPG
Maker's own title when the folder carries one, else its folder — instead of "Game".
### Fixed
- **Another game's `Game.exe` no longer runs under a library entry — no wrong name, no second session.** On
+21
View File
@@ -137,6 +137,8 @@ Recorded as a residual risk, not as a solved problem.
| GameMaker | `data.win` | `N/A` |
| RPG Maker MV/MZ | `nw.dll` **and** `package.json` siblings (since 2026-09-16) | `N/A` — the `.js` header needs a `from` that `strings_regex` lacks |
| RPG Maker XP/VX/VX Ace | `RGSS1*`/`RGSS2*`/`RGSS3*.dll` sibling **or** a `*.rgssad`/`*.rgss2a`/`*.rgss3a` archive (since 2026-09-16) | `N/A` — one rule, the variant unnamed |
| RE Engine (Capcom) | `re_chunk_000.pak` sibling, the exact name (since 2026-09-23) | `N/A` |
| FromSoftware | a `*.bhd` **and** a `*.bdt` sibling (since 2026-09-23) | `N/A` |
| Ren'Py | `renpy/` dir **or** `*.rpa` | `renpy/__init__` strings / `log.txt` first line |
| CryEngine | `CrySystem.dll` | FileVersion |
| Source | `gameinfo.txt` + `bin/engine.dll` | `N/A` |
@@ -160,6 +162,25 @@ Order matters (first match wins). Engine is user-overridable.
> `every_engine_marker` canary carries both engines' markers and still expects `unity`. `rulesVersion` is
> `2026.09.1`, so the sweep's cache key changes and every game is re-detected on the next pass.
> **RE Engine and FromSoftware, 2026-09-23 (owner request, "mang tính tương đối" — a relative signal, not a proof).**
> Both are file-layout signals, checked on the owner's disk before they were written. **RE Engine:** every Capcom RE
> Engine title ships its content as `re_chunk_000.pak` beside the executable, with patches as
> `re_chunk_000.pak.patch_00N.pak` (RESIDENT EVIL 2 and the Onimusha demo). The rule names the base archive exactly — a
> glob without a star is the whole leaf name — so a patch archive alone is not it. **FromSoftware:** the studio's
> titles keep their data as `.bhd` header + `.bdt` data pairs beside the executable — DARK SOULS II
> (`GameDataEbl.bhd/.bdt`), DARK SOULS III (`Data0`–`Data5`), ELDEN RING (`Data0`–`Data3`, plus `DLC`) and Sekiro
> (`Data1`–`Data5`). The request described the second extension as `.bht`; on disk it is **`.bdt`**. An `all` group
> over the two globs — half a pair is not a pair. The request also described a `<Game>\Game\` layout; it is not a
> signal here, because Sekiro has no `Game\` folder and "the parent folder is named X" is not a signal type anyway.
> None of the owner's other 80 Steam titles carries either marker. Both rules sit after the RPG Maker rules and
> before `godot`, whose `*.pck` would also match a loose Wwise sound bank (an `Unknown` there would stop the walk
> before these rules). Fixtures `engines/re_engine` and `engines/fromsoftware`; the `every_engine_marker` canary
> carries both engines' markers and still expects `unity`. `rulesVersion` is `2026.09.2`, so every stored game is
> re-detected on the next sweep. Engine detection never feeds the guard: ELDEN RING stays refused by its anti-cheat
> whatever engine it is shown as. **Engines are shown by name since the same date** (`Formats.Engine` in the App —
> proper nouns, not resources; an unknown id, or one the user typed, passes through): the game card and page used
> to show the raw id (`rpgmaker_mv`).
⛔ *(kept for the record — the two rows above were the ones this note described)* **Two rows cannot be expressed in schemaVersion 2**, and are documented rather than half-implemented — a rule that exists but never fires is worse than one that is absent, because it reads as coverage:
- ~~**RPG Maker MV/MZ.** The signal is `nw.dll` **and** (`www/` **or** `package.json`) — a nested group, and `signalGroup` sets `maxProperties: 1` with its own `$comment` saying nesting is unsupported in v2.~~ Its version is a header inside a sibling `.js`, and `strings_regex` carries no `from`, so it cannot be aimed at a file other than the executable.
+18 -1
View File
@@ -41,7 +41,7 @@
"level, which made it a check that could not fire."
],
"schemaVersion": 2,
"rulesVersion": "2026.09.1",
"rulesVersion": "2026.09.2",
"engines": [
{
@@ -84,6 +84,23 @@
] },
"version": null
},
{
"id": "re_engine",
"name": "RE Engine",
"signals": { "any": [
{ "type": "sibling_glob", "value": "re_chunk_000.pak" }
] },
"version": null
},
{
"id": "fromsoftware",
"name": "FromSoftware",
"signals": { "all": [
{ "type": "sibling_glob", "value": "*.bhd" },
{ "type": "sibling_glob", "value": "*.bdt" }
] },
"version": null
},
{
"id": "godot",
"name": "Godot",
+22
View File
@@ -129,6 +129,28 @@ public static class Formats
_ => Strings.Exit_Normal,
};
/// <summary>
/// The engine id as the engine's name (2026-09-23): a proper noun, the same in every language (the glossary rule
/// above). The ids are the rules file's; one this table does not know — a newer rule, or an engine the user typed —
/// passes through as it is, never blank.
/// </summary>
public static string Engine(string? id) => id switch
{
null => string.Empty,
"unity" => "Unity",
"unreal" => "Unreal Engine",
"rpgmaker_mv" => "RPG Maker MV/MZ",
"rpgmaker_rgss" => "RPG Maker XP/VX/VX Ace",
"re_engine" => "RE Engine",
"fromsoftware" => "FromSoftware",
"godot" => "Godot",
"gamemaker" => "GameMaker",
"renpy" => "Ren'Py",
"cryengine" => "CryEngine",
"source" => "Source",
_ => id,
};
/// <summary>The platform token as its store name.</summary>
public static string Platform(string? token) => token switch
{
+7 -4
View File
@@ -1,6 +1,8 @@
using System.IO;
using FrameLedger.Application.Import;
using FrameLedger.Application.Persistence;
using FrameLedger.Domain.Consent;
using FrameLedger.Infrastructure.Import;
using FrameLedger.Infrastructure.Io;
namespace FrameLedger.App.Services;
@@ -60,17 +62,18 @@ public sealed class GameLibrary
return null;
}
string name = Path.GetFileNameWithoutExtension(normalised);
// A generic executable (Game.exe) is named from the game's own title or its folder, not "Game" (2026-09-23).
string name = GameTitleGuess.Guess(normalised, () => RpgMakerTitle.TryRead(normalised));
return await _games.EnsureAsync(fingerprint.Value, name, ct).ConfigureAwait(false);
}
/// <summary>Whether the row's executable is where the row says (2026-09-22): the page's "not found" line, nothing else.</summary>
public static bool ExecutableExists(string normalisedExePath) => ExecutableIdentity.Read(normalisedExePath) is not null;
/// <summary>
/// Points the row at another executable; null when the file cannot be read, false when another row owns that path.
/// The caller revokes consent over the pipe FIRST, as removal does: the table write only downgrades.
/// </summary>
/// <summary>Whether the row's executable is where the row says (2026-09-22): the page's "not found" line, nothing else.</summary>
public static bool ExecutableExists(string normalisedExePath) => ExecutableIdentity.Read(normalisedExePath) is not null;
public async Task<bool?> ChangeExecutableAsync(long gameId, string exePath, CancellationToken ct = default)
{
ArgumentException.ThrowIfNullOrWhiteSpace(exePath);
@@ -15,7 +15,7 @@ public sealed class GameCardViewModel
Id = card.Row.Id;
Name = card.Row.Name;
PlatformText = Formats.Platform(card.Row.Platform);
EngineText = card.Row.Engine ?? string.Empty;
EngineText = Formats.Engine(card.Row.Engine);
HookOn = card.Row.HookEnabled;
HookText = HookOn ? Strings.Games_Card_HookOn : Strings.Games_Card_HookOff;
SessionCount = card.Summary?.SessionCount ?? 0;
@@ -604,7 +604,7 @@ public sealed partial class GameDetailViewModel : ObservableObject
}
private static string EngineText(GameRow row) =>
row.Engine is null ? string.Empty : row.EngineVersion is null ? row.Engine : row.Engine + " " + row.EngineVersion;
row.Engine is null || row.EngineVersion is null ? Formats.Engine(row.Engine) : Formats.Engine(row.Engine) + " " + row.EngineVersion;
private static Domain.Metrics.Tri DefaultOf(GameRow row, TriStateKind kind) => kind switch
{
@@ -0,0 +1,54 @@
namespace FrameLedger.Application.Import;
/// <summary>
/// The name an entry gets when the user adds an executable by hand (2026-09-23). The file name is the right answer for
/// <c>DarkSoulsIII.exe</c> and the wrong one for <c>Game.exe</c>: every RPG Maker game, and a good share of engine
/// runtimes, ship an executable whose name says nothing about the game. For those the engine's own title wins when there
/// is one (RPG Maker's <c>System.json</c> <c>gameTitle</c>), then the nearest folder that is not a runtime folder — so
/// <i>HELLO, HELLO WORLD!</i>'s <c>swiftshader\Game.exe</c> is "HELLO, HELLO WORLD!", not "Game" or "swiftshader".
/// </summary>
public static class GameTitleGuess
{
// Executable stems that name a runtime or a role, never a game.
private static readonly HashSet<string> _generic = new(StringComparer.OrdinalIgnoreCase)
{
"game", "nw", "launcher", "launch", "start", "play", "main", "app", "client", "run", "runtime", "engine",
"player", "bootstrap", "bootstrapper", "win64", "shipping",
};
// Folders an engine puts its executable in; the game's name is above them.
private static readonly HashSet<string> _runtimeFolders = new(StringComparer.OrdinalIgnoreCase)
{
"swiftshader", "bin", "binaries", "win64", "win32", "x64", "x86", "www", "nw", "game", "exe", "app", "runtime",
};
/// <summary>
/// The name for <paramref name="exePath"/>: its file name when that names something, else <paramref name="engineTitle"/>
/// (asked only then — it reads a file), else the nearest folder that is not a runtime folder, else the file name.
/// </summary>
public static string Guess(string exePath, Func<string?>? engineTitle = null)
{
ArgumentException.ThrowIfNullOrWhiteSpace(exePath);
string stem = Path.GetFileNameWithoutExtension(exePath);
if (!_generic.Contains(stem))
{
return stem;
}
if (engineTitle?.Invoke() is { } title && !string.IsNullOrWhiteSpace(title))
{
return title.Trim();
}
for (string? dir = Path.GetDirectoryName(exePath); !string.IsNullOrEmpty(dir); dir = Path.GetDirectoryName(dir))
{
string name = Path.GetFileName(dir);
if (name.Length > 0 && !_runtimeFolders.Contains(name))
{
return name;
}
}
return stem;
}
}
@@ -7,8 +7,10 @@ namespace FrameLedger.Domain.Detection;
/// It holds signals, never groups. The schema forbids nesting in v2
/// (<c>maxProperties: 1</c> plus its own <c>$comment</c>), so that constraint is
/// expressed as a type here rather than as a validation rule someone has to
/// remember. It is also why two <c>05_DETECTION</c> engine rows — both RPG Maker
/// variants — cannot be expressed at all in this schema version.
/// remember. This remark used to say it is why both RPG Maker rows could not be
/// expressed; since 2026-09-16 both are, without nesting (<c>05_DETECTION</c>
/// §Engine signatures), and FromSoftware's two archive halves are one <c>all</c>
/// group (2026-09-23).
/// </remarks>
public sealed record SignalGroup
{
@@ -0,0 +1,59 @@
using System.Text.Json;
namespace FrameLedger.Infrastructure.Import;
/// <summary>
/// An RPG Maker MV/MZ game's own title (2026-09-23): <c>gameTitle</c> in <c>data\System.json</c> — under <c>www\</c> for
/// MV, at the root for MZ — beside the executable or up to two folders above it (a launcher-fronted game keeps its
/// runtime in a subfolder: <i>HELLO, HELLO WORLD!</i>'s is <c>swiftshader\</c>). Read only when the executable's own name
/// says nothing (<c>Game.exe</c>), and bounded: a file over 1 MiB, an unreadable one or one without the field is null.
/// </summary>
public static class RpgMakerTitle
{
private const long _maxBytes = 1024 * 1024;
/// <summary>The title, or null when there is none to be read.</summary>
public static string? TryRead(string exePath)
{
ArgumentException.ThrowIfNullOrWhiteSpace(exePath);
string? dir = Path.GetDirectoryName(exePath);
for (int up = 0; up <= 2 && !string.IsNullOrEmpty(dir); up++, dir = Path.GetDirectoryName(dir))
{
foreach (string relative in (string[])[Path.Combine("www", "data", "System.json"), Path.Combine("data", "System.json")])
{
if (TryTitle(Path.Combine(dir, relative)) is { } title)
{
return title;
}
}
}
return null;
}
private static string? TryTitle(string path)
{
try
{
var file = new FileInfo(path);
if (!file.Exists || file.Length > _maxBytes)
{
return null;
}
using FileStream stream = file.OpenRead();
using JsonDocument doc = JsonDocument.Parse(stream);
return doc.RootElement.ValueKind == JsonValueKind.Object
&& doc.RootElement.TryGetProperty("gameTitle", out JsonElement title)
&& title.ValueKind == JsonValueKind.String
&& title.GetString() is { } text
&& !string.IsNullOrWhiteSpace(text)
? text.Trim()
: null;
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or JsonException)
{
return null;
}
}
}
@@ -1,4 +1,5 @@
using System.Globalization;
using System.IO;
using FluentAssertions;
using FrameLedger.App.Services;
using FrameLedger.Domain.Sessions;
@@ -87,4 +88,39 @@ public sealed class FormatsTests
Formats.Platform("steam").Should().Be("Steam");
Formats.Platform("none").Should().BeEmpty();
}
/// <summary>The engine ids as names (2026-09-23): proper nouns in every language; an id this table does not know passes through.</summary>
[Fact]
public void EnginesAreNamedAndAnUnknownIdPassesThrough()
{
Formats.Engine("re_engine").Should().Be("RE Engine");
Formats.Engine("fromsoftware").Should().Be("FromSoftware");
Formats.Engine("rpgmaker_mv").Should().Be("RPG Maker MV/MZ");
Formats.Engine("unreal").Should().Be("Unreal Engine");
Formats.Engine("My Own Engine").Should().Be("My Own Engine", "an engine the user typed is shown as typed");
Formats.Engine(null).Should().BeEmpty();
}
/// <summary>
/// Every engine the shipped rules can detect has a name here, and it is the rule's own <c>name</c> (2026-09-23): a rule
/// added without one would show its raw id on every card that engine lands on — which is what every engine did until
/// this date.
/// </summary>
[Fact]
public void EveryShippedEngineIdIsShownByItsRulesName()
{
var dir = new DirectoryInfo(AppContext.BaseDirectory);
while (dir is not null && !File.Exists(Path.Combine(dir.FullName, "FrameLedger.slnx")))
{
dir = dir.Parent;
}
dir.Should().NotBeNull("the check needs the repository's rules file");
using System.Text.Json.JsonDocument rules = System.Text.Json.JsonDocument.Parse(File.ReadAllText(Path.Combine(dir!.FullName, "rules", "detection-rules.json")));
List<(string Id, string Name)> engines = [.. rules.RootElement.GetProperty("engines").EnumerateArray()
.Select(static e => (e.GetProperty("id").GetString()!, e.GetProperty("name").GetString()!))];
engines.Should().NotBeEmpty();
engines.Should().AllSatisfy(static e => Formats.Engine(e.Id).Should().Be(e.Name, $"the rule '{e.Id}' names its engine"));
}
}
@@ -61,6 +61,34 @@ public sealed class GameLibraryTests
(await s.Library.AddAsync(Path.Combine(Path.GetTempPath(), "does-not-exist-" + Guid.NewGuid().ToString("N") + ".exe"), Ct)).Should().BeNull();
}
/// <summary>
/// A hand-added <c>Game.exe</c> is named after its game (2026-09-23): RPG Maker's own title when the folder carries one,
/// else the nearest folder that is not a runtime folder — never "Game". <i>HELLO, HELLO WORLD!</i>'s runtime lives in
/// <c>swiftshader\</c>, a folder below its title.
/// </summary>
[Fact]
public async Task AGenericExecutableIsNamedAfterItsGame()
{
await using ScratchLedger s = await ScratchLedger.OpenAsync();
string root = Path.Combine(Path.GetTempPath(), "fl-app-name-" + Guid.NewGuid().ToString("N"));
string titled = Path.Combine(root, "hello-hello-world", "HELLO, HELLO WORLD!", "swiftshader", "Game.exe");
string untitled = Path.Combine(root, "Some Game", "Game.exe");
Directory.CreateDirectory(Path.Combine(Path.GetDirectoryName(titled)!, "www", "data"));
Directory.CreateDirectory(Path.GetDirectoryName(untitled)!);
await File.WriteAllBytesAsync(titled, [0x4D, 0x5A, 0, 0], Ct);
await File.WriteAllBytesAsync(untitled, [0x4D, 0x5A, 0, 0], Ct);
await File.WriteAllTextAsync(Path.Combine(Path.GetDirectoryName(titled)!, "www", "data", "System.json"), "{\"gameTitle\":\"HELLO, HELLO WORLD!\"}", Ct);
try
{
(await s.Library.AddAsync(titled, Ct))!.Name.Should().Be("HELLO, HELLO WORLD!", "the engine's own title");
(await s.Library.AddAsync(untitled, Ct))!.Name.Should().Be("Some Game", "the folder, when there is no title to read");
}
finally
{
Directory.Delete(root, recursive: true);
}
}
[Fact]
public async Task RecentAndTotalsAcrossGames()
{
@@ -0,0 +1,40 @@
using FluentAssertions;
using FrameLedger.Application.Import;
namespace FrameLedger.Application.Tests.Import;
/// <summary>The name a hand-added executable gets (2026-09-23): its own when it names something, else the game's.</summary>
public sealed class GameTitleGuessTests
{
[Theory]
[InlineData(@"D:\SteamLibrary\steamapps\common\DARK SOULS III\Game\DarkSoulsIII.exe", "DarkSoulsIII")]
[InlineData(@"D:\SteamLibrary\steamapps\common\ELDEN RING\Game\eldenring.exe", "eldenring")]
[InlineData(@"D:\another\it\hello-hello-world\HELLO, HELLO WORLD!\swiftshader\Game.exe", "HELLO, HELLO WORLD!")]
[InlineData(@"D:\another\it\996IR version 1.2.2 (Windows)\996ir\Game.exe", "996ir")]
[InlineData(@"C:\Games\Some Title\bin\x64\launcher.exe", "Some Title")]
[InlineData(@"C:\Game.exe", "Game")]
public void AGenericExecutableIsNamedByTheNearestFolderThatIsNotARuntimeFolder(string exe, string expected)
{
GameTitleGuess.Guess(exe).Should().Be(expected);
}
[Fact]
public void TheEngineTitleWinsForAGenericNameAndIsNotAskedForOne()
{
int asked = 0;
GameTitleGuess.Guess(@"D:\another\it\hello-hello-world\HELLO, HELLO WORLD!\swiftshader\Game.exe", () =>
{
asked++;
return " HELLO, HELLO WORLD! ";
}).Should().Be("HELLO, HELLO WORLD!");
GameTitleGuess.Guess(@"C:\Games\Title\Title.exe", () =>
{
asked++;
return "never";
}).Should().Be("Title");
asked.Should().Be(1, "the engine title is read only when the file name says nothing");
GameTitleGuess.Guess(@"C:\Games\Title\Game.exe", static () => " ").Should().Be("Title", "a blank title is no title");
}
}
@@ -132,6 +132,38 @@ public sealed class RuleEvaluatorTests
m.Rule.Should().BeNull("an undetermined walk must not report a later rule as the winner");
}
/// <summary>
/// The shipped <c>fromsoftware</c> rule's shape (2026-09-23): an <c>all</c> group needs every signal, so a <c>.bhd</c>
/// archive header without its <c>.bdt</c> data is not the engine's archive pair.
/// </summary>
[Fact]
public void AllGroup_NeedsEverySignal_AsFromSoftwaresTwoArchiveHalvesDo()
{
DetectionRuleSet rules = Rules(engines:
[
Engine("fromsoftware", AllOf(Signal(DetectionSignalType.SiblingGlob, "*.bhd"), Signal(DetectionSignalType.SiblingGlob, "*.bdt"))),
]);
var evaluator = new RuleEvaluator(rules);
evaluator.MatchEngine(Snapshot(files: ["eldenring.exe", "Data0.bhd"])).Rule.Should().BeNull("half an archive pair is not the pair");
evaluator.MatchEngine(Snapshot(files: ["eldenring.exe", "Data0.bhd", "Data0.bdt"])).Rule!.Id.Should().Be("fromsoftware");
evaluator.MatchEngine(Snapshot(files: ["DarkSoulsII.exe", "GameDataEbl.bhd", "GameDataEbl.bdt"])).Rule!.Id.Should().Be("fromsoftware");
}
/// <summary>
/// The shipped <c>re_engine</c> rule's shape (2026-09-23): a glob with no star is the whole leaf name, so
/// <c>re_chunk_000.pak</c> matches the base archive and not a patch archive named after it.
/// </summary>
[Fact]
public void SiblingGlob_WithoutAStar_IsTheWholeName()
{
DetectionRuleSet rules = Rules(engines: [Engine("re_engine", AnyOf(Signal(DetectionSignalType.SiblingGlob, "re_chunk_000.pak")))]);
var evaluator = new RuleEvaluator(rules);
evaluator.MatchEngine(Snapshot(files: ["re2.exe", "re_chunk_000.pak", "re_chunk_000.pak.patch_001.pak"])).Rule!.Id.Should().Be("re_engine");
evaluator.MatchEngine(Snapshot(files: ["re2.exe", "re_chunk_000.pak.patch_001.pak"])).Rule.Should().BeNull();
}
[Fact]
public void EngineWalk_EveryRuleCleanlyMissing_IsARealAnswer()
{
@@ -0,0 +1,67 @@
using FluentAssertions;
using FrameLedger.Infrastructure.Import;
namespace FrameLedger.Infrastructure.Tests.Import;
/// <summary>RPG Maker's own title for a hand-added <c>Game.exe</c> (2026-09-23), read from real files in a scratch tree.</summary>
public sealed class RpgMakerTitleTests : IDisposable
{
private readonly string _root = Path.Combine(Path.GetTempPath(), "fl-rpgtitle-" + Guid.NewGuid().ToString("N"));
public void Dispose()
{
try
{
Directory.Delete(_root, recursive: true);
}
catch (IOException)
{
}
}
private string Write(string relative, string content)
{
string path = Path.Combine(_root, relative);
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
File.WriteAllText(path, content);
return path;
}
[Fact]
public void AnMvTitleBesideTheExecutableIsRead()
{
string exe = Write(@"HHW\swiftshader\Game.exe", "");
Write(@"HHW\swiftshader\www\data\System.json", "{\"gameTitle\":\"HELLO, HELLO WORLD!\",\"locale\":\"en_US\"}");
RpgMakerTitle.TryRead(exe).Should().Be("HELLO, HELLO WORLD!");
}
[Fact]
public void AnMzTitleAFolderAboveIsRead()
{
string exe = Write(@"MZ\runtime\Game.exe", "");
Write(@"MZ\data\System.json", "{\"gameTitle\":\" An MZ Game \"}");
RpgMakerTitle.TryRead(exe).Should().Be("An MZ Game");
}
[Theory]
[InlineData("{\"locale\":\"en_US\"}")]
[InlineData("{\"gameTitle\":\"\"}")]
[InlineData("{\"gameTitle\":42}")]
[InlineData("not json")]
[InlineData("[]")]
public void NoUsableTitleIsNull(string content)
{
string exe = Write(@"Bad\Game.exe", "");
Write(@"Bad\www\data\System.json", content);
RpgMakerTitle.TryRead(exe).Should().BeNull();
}
[Fact]
public void NoFileIsNull()
{
RpgMakerTitle.TryRead(Write(@"None\Game.exe", "")).Should().BeNull();
}
}
+4 -3
View File
@@ -50,9 +50,10 @@ They are not extra cases; they are what stops the rest being decorative.
- `canaries/no_engine` — **over-match.** If the evaluator ever matches
everything, every positive fixture above still passes. Only this one goes red.
- `canaries/every_engine_marker` — **under-match and ordering.** Four engines'
markers are present at once; exactly one engine must be reported, and it must
be the first in the array.
- `canaries/every_engine_marker` — **under-match and ordering.** Eight engines'
markers are present at once (this line said "four" while the directory held
six; RE Engine's and FromSoftware's joined them 2026-09-23); exactly one
engine must be reported, and it must be the first in the array.
Together they assert both directions, which is the rule the rest of this
repository is held to.
Whitespace-only changes.
Whitespace-only changes.
@@ -1 +1 @@
{ "engine": "unity", "platform": null, "capabilities": [], "$why": "UNDER-MATCH CANARY. Markers for unity, rpgmaker_mv, rpgmaker_rgss, gamemaker, godot and renpy are all present. Exactly one engine must be reported and it must be the first in the array - an evaluator returning a set, or the last match, fails here and nowhere else." }
{ "engine": "unity", "platform": null, "capabilities": [], "$why": "UNDER-MATCH CANARY. Markers for unity, rpgmaker_mv, rpgmaker_rgss, re_engine, fromsoftware, gamemaker, godot and renpy are all present. Exactly one engine must be reported and it must be the first in the array - an evaluator returning a set, or the last match, fails here and nowhere else." }
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1 @@
{ "engine": "fromsoftware", "platform": null, "capabilities": [], "$why": "A .bhd archive header and its .bdt data beside the executable, as DARK SOULS II/III, ELDEN RING and Sekiro ship them (checked on disk 2026-09-23; Sekiro has no Game folder, so the rule does not ask for one). Both halves are required: an all group." }
+1
View File
@@ -0,0 +1 @@
{ "engine": "re_engine", "platform": null, "capabilities": [], "$why": "re_chunk_000.pak, the base archive every RE Engine title ships (RE2 and the Onimusha demo checked on disk 2026-09-23), beside a patch archive. The rule names the base file exactly: a patch archive alone is not it." }
View File
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.