Apply SYS4INI logical resolution

This commit is contained in:
gamer147
2026-07-28 21:55:53 -04:00
parent 2e8265f6cc
commit c6f1a60e79
13 changed files with 501 additions and 64 deletions

View File

@@ -201,7 +201,7 @@ The meaningful consumer catalog is:
| Setting group | Native Himegari effect | Classification |
|---|---|---|
| `CREATEOBJECT`, `DRAWMODE` | `CreateObject=2` selects only the retained D3D/object backend; `DrawMode=1` selects its matching draw/text path. Startup verifies that bit `1 << DrawMode` exists in the backend mask. | Active renderer selection |
| `SCREENX`, `SCREENY` | Replaces the generic `640x480` fallback with the `800x600` logical canvas before window/surface creation. | Active core profile |
| `SCREENX`, `SCREENY` | Replaces the generic `640x480` fallback with the `800x600` logical canvas before window/surface creation. The port now parses and applies these dimensions to its logical canvas and default windowed client size. | Active core profile; implemented |
| `FONT`, `ENABLEANTIFONT`, `ANTIFONTVERSION` | Seeds MS Mincho, enables `message:UseAntiFont`, selects the grayscale glyph-outline path, and records antialias version 3. | Active text profile |
| `DEPENDMOVIESOUND` | Supplies the default movie-audio dependency/routing policy when movie opcode flags do not force another route. | Active media policy |
| `FULLSCREENBIT`, `ALWAYSBACKUPSURFACE` | These are read only inside the legacy `CreateObject & 1` DirectDraw branch of `engine_initialize_graphics_from_settings@0x406480`. Himegari selects only bit 2, so its 32-bit/zero values do not drive the active renderer. | Valid compatibility settings, inert for this profile |
@@ -222,17 +222,19 @@ The meaningful consumer catalog is:
| `REGKEY` | A nonzero value activates `registration_validate_key_file@0x46fc80`, which opens `SYS4RK.BIN`, validates its header/transformed payload and both CRC variants, and publishes the registration result. | Native registration/key validation |
| `COPYRIGHT`, `RCVERSION` | Both are imported; no later direct consumer of the exact registry keys was found in this image. | Loaded product metadata |
This is intentionally a native-behavior catalog, not a mandate to reproduce every Win32-era switch. The
current port already preserves the shipped result of several settings through profile-specific constants:
the `800x600` canvas, requested Mincho/Gothic faces, save version 3.10, and movie/audio behavior. It
deliberately redirects the native AppData path to Godot `user://SAVE`, and it should not reproduce legacy
DirectDraw selection or native registration/key validation.
This is intentionally a native-behavior catalog, not a mandate to reproduce every Win32-era switch.
`Sys4AssetCatalog` now parses the ordered trailer once, retaining unknown pairs for diagnostics, and projects
`SCREENX`/`SCREENY` into one validated engine-owned logical canvas. Godot uses that value for its content-scale
base, default windowed client, backbuffer/compositor bounds, primary surface, movie/layout fallbacks, and input
coordinates. AGE's independent `640x480` defaults apply for missing or invalid dimensions. The port still
preserves requested Mincho/Gothic faces, save version 3.10, and movie/audio behavior through their existing
paths; those keys have not yet been migrated to the parsed registry.
The actionable generic-profile gap is that `Sys4AssetCatalog` still parses only the directory and the frontend
hard-codes the important results. A future configuration/profile slice should expose the typed trailer values
once and let the runtime apply only cross-platform semantic settings. In particular, click-cancel, Auto/Skip
coexistence, cursor policy, redraw policy, and wheel action ids must be decided from this evidence instead of
AGE's compiled defaults. No runtime behavior changes were made as part of this investigation.
The remaining generic-profile gap is semantic application of further portable settings. In particular,
click-cancel, Auto/Skip coexistence, cursor policy, redraw policy, and wheel action ids must be decided from
this evidence instead of AGE's compiled defaults. The port deliberately redirects the native AppData path to
Godot `user://SAVE`, and it should not reproduce legacy DirectDraw selection or native registration/key
validation.
### ops `0x1a2`/`0x1a3` store and restore shared `SAVE.DAT` integer cells (resolved 2026-07-20)

View File

@@ -3521,6 +3521,30 @@ SYS4INI-sized logical canvas into that window using the aspect-preserving/letter
partial overrides, minimum sizes, fullscreen interaction, integer scaling, and alternate stretch/crop
policies belongs to that second slice's configuration design.
### Result (implemented 2026-07-28)
The first slice is complete. `Sys4AssetCatalog` now consumes the bounded base-S4IC trailer after its
existing directory parse and exposes ordered `Sys4StartupSettings`; lookup is case-insensitive and
last-value-wins while unknown keys remain available for future profiles. `Sys4LogicalCanvas` projects
`SCREENX`/`SCREENY` with independent `640x480` fallbacks and rejects dimensions above the bounded
dimension/pixel allocation policy.
Godot loads the catalog before presentation allocation and reuses that instance for normal script/asset
startup. The selected canvas owns the root content-scale base, initial windowed client request,
backbuffer/pixel allocation, GPU and software destination bounds, whole-screen fills, primary and movie
surface fallbacks, fallback ADV layout, and pointer coordinates. `GodotAdvHost` receives the validated
size explicitly, and the platform-neutral retained-surface fill now derives its zero-size fallback from
the destination image. `project.godot` retains only AGE's generic `640x480` bootstrap fallback. No
runtime production literal `800`/`600` remains; authored Himegari data and unrelated regression fixtures
were left unchanged.
Verification passed with 443 engine tests, including installed 36-pair/`800x600`, synthetic
`1024x576`, independent fallback, duplicate/unknown, malformed/unsafe, and non-800 retained-fill cases.
The Godot C# project builds with zero warnings, and the threaded headless selftest reports
`logical-canvas=800x600`. Its synthetic headless physical window is not a client-size oracle; ordinary
windowed startup directly requests the same validated dimensions. Physical window overrides remain the
second slice described above.
## ADV requested-face selection implemented (2026-07-28)
Opcode `0x1a5` is no longer a presentation no-op. The VM retains its requested face in

View File

@@ -27,7 +27,7 @@ or replaced before claiming portable exports.
| Area | Current dependency | Runtime impact | Portability status / future action |
|---|---|---|---|
| SYS4INI per-game startup profile | `Sys4AssetCatalog` currently parses only the asset directory; the frontend hard-codes Himegari's important results. Native SYS4INI also carries canvas, text, ADV input/skip, save ABI/path, audio, legacy renderer, and Windows registration settings | The port has the correct `800x600`, requested faces, save 3.10, and redirected `user://SAVE` result, but does not source `CancelMesSkipOnClick`, `CoexistMesSkip`, cursor/redraw policy, or wheel action ids from the trailer | First parse `SCREENX`/`SCREENY` into a platform-neutral logical canvas and default the physical window to it; later boot parameters may vary only the physical window while Godot scales/letterboxes the unchanged canvas. Apply further semantic keys explicitly, translate save roots through the host, and classify DirectDraw/fullscreen-bit and registration/key settings as native compatibility metadata. Canonical inventory and consumers: `sys4-format-notes.md` and `engine-re.md` |
| SYS4INI per-game startup profile | `Sys4AssetCatalog` parses and retains the bounded ordered startup trailer; `Sys4LogicalCanvas` applies `SCREENX`/`SCREENY` with AGE's independent `640x480` fallbacks. Native SYS4INI also carries text, ADV input/skip, save ABI/path, audio, legacy renderer, and Windows registration settings | Godot now uses the selected canvas for content scaling, backbuffers/compositor bounds, primary surfaces, layout/input fallbacks, and the matching default windowed client. The port still does not source `CancelMesSkipOnClick`, `CoexistMesSkip`, cursor/redraw policy, or wheel action ids from the trailer | Add later boot parameters that vary only the physical window while Godot scales/letterboxes the unchanged canvas. Apply further semantic keys explicitly, translate save roots through the host, and classify DirectDraw/fullscreen-bit and registration/key settings as native compatibility metadata. Canonical inventory and consumers: `sys4-format-notes.md` and `engine-re.md` |
| Retained graphics presentation | Backend-neutral `GfxState`; accepted default Godot `Sprite2D` GPU stage plus the retained software pixel oracle, using runtime `ImageTexture`, canvas transforms/materials, and no native graphics API | GPU backend caches static/color-key variants, updates dynamic surfaces, handles retained range transitions, and falls back whole-frame for the legacy host screen-transition path | Godot owns D3D/Vulkan/Metal/OpenGL selection; validate shader/blend/filter behavior per target rather than adding a platform renderer |
| AGE movie decode (`0x236` scene movies; `0x20f` modal LOGO/OP/ED) | `FfmpegMovieDecoder` is the sole factory over the project-owned `native/age_movie_ffmpeg` ABI | Windows-x64 passes the complete 213-payload installed video/audio corpus gate plus audible LOGO/OP/CHAPTER playback | Add target-specific native builds and export packaging |
| Movie integration | Each surface owns a unique playback-instance id; `MovieRuntime` owns `IMovieDecoder` from an injected factory; video-only streams use monotonic pacing while audio-bearing streams use the Godot output clock | Concurrent/restarted uses of one asset have independent frame/audio/completion/teardown state; managed code is no longer Windows-annotated, while only the win-x64 native bundle exists today | Add Linux/macOS native builds and smoke gates |

View File

@@ -681,12 +681,12 @@ scaling, and other game-specific defaults therefore belong in the selected game
surface state rather than in a forked frontend. The source is now known: after its asset directory and
VM-bank metadata, SYS4INI carries a typed per-game startup-settings record. Himegari uses it for the
canvas, text face/raster mode, ADV input/skip policy, save ABI/path, audio initialization, and native
Windows compatibility metadata. A future generic profile loader should parse that record once, preserve
unknown/profile-specific data for diagnostics, apply cross-platform semantic settings through explicit
runtime seams, and classify legacy renderer/registration switches rather than blindly emulating them.
The current frontend's scattered Himegari constants are acceptable while gameplay is the priority, but
they are not the multi-profile architecture. The first bounded implementation slice will source the
logical canvas from `SCREENX`/`SCREENY` and use it as the default windowed size; a second slice will add
Windows compatibility metadata. The runtime now parses that record once and preserves unknown/profile-
specific data for diagnostics; semantic settings are applied through explicit cross-platform seams while
legacy renderer/registration switches remain classified rather than blindly emulated. The first bounded
application slice is complete: `SCREENX`/`SCREENY` select the validated logical canvas, all presentation
allocations and primary bounds consume it, and it is the default windowed size. Other settings remain on
their existing paths while gameplay is the priority. A second slice will add
independent physical `--window-width`/`--window-height` overrides without changing VM coordinates or
surface geometry. The executable task plan and gates live in `phase-a-slice-plan.md`. This experiment was
diagnostic only; no Kamidori support or `0x1be` semantics were implemented.

View File

@@ -21,7 +21,7 @@ per format.
`SYS4INI.BIN` is not only the asset catalog. Its `S4IC` LZSS stream begins with the archive names and
80-byte file records documented in `asset-resolution-re.md`, then continues with VM-bank metadata and a
NUL-delimited per-game engine-settings trailer. `tools/parse_sys4ini.py` currently consumes only the
directory prefix.
directory prefix; the C# runtime catalog continues through the trailer and exposes the ordered pairs.
After the directory prefix, Himegari's decompressed stream has this tail:
@@ -90,6 +90,13 @@ that the authored logical canvas is per-game data. Fullscreen/display-mode setti
these logical dimensions. `USEAPPDATAFOLDER` and `SAVEPATH` select the native Windows save root; fixed
save filenames remain AGE policy rather than trailer or script strings.
`Sys4AssetCatalog` now parses this bounded trailer for base `S4IC` catalogs. It preserves ordered unknown
pairs for diagnostics and offers case-insensitive, last-value-wins lookup; this is intentionally more
permissive than AGE's fixed registry so unimplemented keys in another profile remain inspectable.
`Sys4LogicalCanvas` is the first semantic projection: `SCREENX` and `SCREENY` fall back independently to
AGE's registered `640x480` defaults when absent or nonpositive/nonnumeric, while unsafe RGBA allocations
are rejected before presentation construction. Append `S4AC` catalogs do not own startup settings.
## Native persistence files — Himegari 3.10
This section is the canonical binary-format specification for the persistence files used by Himegari.