Add build scripts, documentation, and smooth camera analysis for ScummVM's Ultima VIII engine
- Introduced `build-scummvm.ps1` and `run-scummvm.ps1` scripts for building and running the ScummVM project with MSVC. - Created `phase-0-evidence-compatibility-gate.md` to outline the evidence and compatibility gate for the Crusader project. - Added `smooth-camera-analysis.md` detailing the proposed smooth camera behavior and regression checks. - Documented the Visual Studio build process in `visual-studio-build.md`, including prerequisites and steps for generating the Ultima solution. - Updated `startup-map-patch-file.md` to clarify the behavior of the fixed-map and glob archives in the GOG installation.
This commit is contained in:
parent
9d253abcf9
commit
3b2561b053
10 changed files with 967 additions and 0 deletions
Binary file not shown.
|
|
@ -29,6 +29,9 @@
|
|||
},
|
||||
{
|
||||
"path": "F:/Apps/Crusader No Remorse"
|
||||
},
|
||||
{
|
||||
"path": "../scummvm"
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
|
|
|
|||
100
docs/remorse-patching-mod-system-feasibility.md
Normal file
100
docs/remorse-patching-mod-system-feasibility.md
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
# Remorse Patching and Mod-System Feasibility
|
||||
|
||||
## Conclusion
|
||||
|
||||
A third path is feasible: keep the retail `CRUSADER.EXE` as the game runtime, distribute validated data replacements and narrowly scoped executable patches, and launch the resulting modded copy under DOSBox. This is materially less work than reconstructing the game as a modern source build, but it is not a general substitute for a source port. The practical ceiling depends on the change:
|
||||
|
||||
| Change type | Feasibility | Current boundary |
|
||||
|---|---|---|
|
||||
| Replace map/archive content | High | Retail supports an alternate `STATIC\FIXED.DAT`, but evidence shows archive selection, not per-map merging or fallback. |
|
||||
| Change scripted interactions | Medium | Retail `-u` selects an alternate `EUSECODE.FLX` runtime root. Editing and rebuilding scripts is not yet a complete toolchain. |
|
||||
| Change native behavior | Medium for small hooks; low for broad additions | Existing tooling can patch NE bytes and relocation records. New code must fit a proven safe location or require more invasive executable-format work. |
|
||||
| Add large systems or replace platform/runtime behavior | Low | No general plugin ABI or native module loader is evidenced; this is where the source-port/rebuild tracks remain better suited. |
|
||||
|
||||
**Recommendation:** add a Track C to the roadmap as a curated, version-specific patch and data-mod system. Start with resource replacement and a copy-first patch manager. Treat executable changes as explicit, individually tested patch profiles, not as arbitrary plugins. The path can coexist with Tracks A and B; it optimizes for changes to the original game, not portability or broad architectural replacement.
|
||||
|
||||
## Evidence
|
||||
|
||||
### The retail game already has data override points
|
||||
|
||||
- Startup checks for `static\fixed.dat`; if present, it opens that archive and the fixed-map loader prefers its handle over the base archive. The recovered consumer selects one archive for a map read. It does not show per-entry merge or fallback to the base when an entry is missing. The base archive is opened first and remains required. See [startup-map-patch-file.md](startup-map-patch-file.md).
|
||||
- In retail No Remorse, `-u <path>` directs startup to an alternate `EUSECODE.FLX` root. The filename remains `eusecode.flx`; this replaces the active usecode runtime root rather than adding a second script layer. The path token has a small DOS-era buffer, and a failed existence check can fall through without a clear success/failure banner. See [usecode-startup-override.md](usecode-startup-override.md).
|
||||
- Fresh-game map selection is hardcoded in the executable; existing command-line warp options are a separate debug/startup path. This is evidence that behavior not covered by an external data lane may need an executable patch. See [first-mission-map-selection.md](first-mission-map-selection.md) and [command-line-parameters.md](command-line-parameters.md).
|
||||
|
||||
These lanes make map and script mods plausible without recompiling the game, but they are replacement-oriented. A mod that changes a few maps or event bodies would currently need to build a compatible complete archive/root from the target game's baseline, not assume that the retail loader merges sparse additions.
|
||||
|
||||
### Script editing is promising, but the round-trip pipeline is unfinished
|
||||
|
||||
The repository has local FLEX and class/event format evidence, byte-preserving extraction, and versioned USECODE source snapshots. The map-viewer path has an initial guarded fixed-width immediate-edit overlay. It does not yet have the complete edit, compile, class/archive rebuild, and in-game validation loop; unknown fields and opaque bytes must be preserved. See [usecode-roundtrip-ir.md](usecode-roundtrip-ir.md) and [usecode-tool-improvement-plan.md](usecode-tool-improvement-plan.md).
|
||||
|
||||
USECODE can alter behavior through the executable's existing event dispatcher, VM, and intrinsic table. It cannot by itself add a new native intrinsic or platform service, and not every opcode/intrinsic contract is understood. Therefore script mods are a credible middle tier for existing game facilities, not an unrestricted scripting API.
|
||||
|
||||
### Native patching is technically demonstrated, but fragile
|
||||
|
||||
The existing [patch_crusader_cheat_menu.ps1](../patch_crusader_cheat_menu.ps1) contains the beginnings of a reusable patcher: named patch sites, expected retail/patched patterns, unknown-state refusal, NE relocation lookup/retargeting, explicit restore targets, and post-write byte verification. The NE patch workflow documents why a relocated far call must be changed through its relocation record rather than by editing the on-disk placeholder bytes. See [raw-ne-patch-conversion.instructions.md](../.github/instructions/raw-ne-patch-conversion.instructions.md).
|
||||
|
||||
There is also concrete evidence of the ceiling and risk. The debugger patch log records multiple candidates that applied and restored cleanly on retail copies but crashed at startup. The current O/P candidates embed a small stub in a replaced code window and retarget an existing far call; their runtime status is still pending. That proves mechanical patching and relocation work are practical, not that arbitrary injected code is safe. See [retail-debugger-patch-attempts.md](retail-debugger-patch-attempts.md).
|
||||
|
||||
`CRUSADER.EXE` is a bound DOS MZ/NE executable with Phar Lap protected-mode loading and segmented far calls, not a normal Windows PE with a DLL/plugin interface. Adding a new native module or segment would involve loader-visible segment and relocation metadata, selector/address constraints, and matching calling conventions. That is a substantially riskier project than redirecting a verified existing call or replacing a bounded code window. See [phar-lap-extender.md](phar-lap-extender.md) and the NE workflow above.
|
||||
|
||||
## Proposed Track C
|
||||
|
||||
### Package model
|
||||
|
||||
Use a manifest-driven package with distinct payload types:
|
||||
|
||||
- `fixed_archive`: a complete alternate `STATIC\FIXED.DAT` for the supported target build.
|
||||
- `usecode_root`: a directory containing a compatible complete `EUSECODE.FLX` replacement and any required companion files.
|
||||
- `ne_patch`: a named set of byte-window and relocation-record edits, each with exact expected retail state, enabled state, and restore state.
|
||||
- `launcher_profile`: documented DOSBox arguments and mount/path setup needed to activate the selected payloads.
|
||||
|
||||
Each package should declare its mod ID/version, exact supported game build(s), required files, patch dependencies/conflicts, and validation notes. Do not distribute retail game binaries or assets; require the user to provide a compatible installation and generate a separate modded copy.
|
||||
|
||||
### Installer and patcher behavior
|
||||
|
||||
Build a copy-first manager rather than extending the current in-place research script directly:
|
||||
|
||||
1. Identify the executable build using a full-file fingerprint plus structural checks for the expected MZ/NE headers and segment layout.
|
||||
2. Preflight every patch site and relocation before writing anything. Accept only the exact retail state or the exact already-enabled state; refuse unknown or partially conflicting states.
|
||||
3. Apply the complete patch family to a staged copy, then re-read and verify every byte window and relocation target. Keep the original install untouched.
|
||||
4. Record the applied package set and output fingerprint. Restore by recreating the clean staged copy or applying exact captured restore data; never infer restore bytes from an unknown binary.
|
||||
5. Validate data archives with parsers and run a DOSBox smoke test for each supported build/profile. A successful byte comparison is a mechanical pass, not a runtime pass.
|
||||
|
||||
The current PowerShell patcher is useful evidence and a source of site-definition patterns, but it writes to its selected EXE path. The new manager should not inherit that in-place behavior as its default.
|
||||
|
||||
### Safe expansion order
|
||||
|
||||
1. Support inspection and dry-run for the one documented non-Japanese No Remorse retail build.
|
||||
2. Stage complete fixed-map and usecode replacements without editing the executable; test the existing loader paths independently.
|
||||
3. Add one reversible, narrow NE patch family based on a behavior with a clear runtime test and known original bytes/fixups.
|
||||
4. Add conflict detection, multi-patch composition, rollback, build fingerprints, and an automated apply/verify/restore test suite.
|
||||
5. Add USECODE editing/rebuilding only after unchanged byte-identical round trips and supported edit cases pass in the map-viewer toolchain.
|
||||
6. Consider native code injection or new NE segments only after a concrete mod requires it and a safe allocation/relocation strategy is proven.
|
||||
|
||||
## Acceptance Gates
|
||||
|
||||
A first useful release should pass all of these:
|
||||
|
||||
- It detects unsupported or modified retail executables before writing and leaves the source installation unchanged.
|
||||
- Repeated apply, inspect, and restore operations are deterministic; unknown bytes, stale fixups, and patch conflicts fail closed.
|
||||
- Data payloads reopen with independent format parsers, and the game demonstrably loads the intended alternate archive/root rather than silently using stock data.
|
||||
- Every executable patch passes exact raw-byte and NE-relocation checks, then boots and exercises the changed behavior in DOSBox on each declared build.
|
||||
- The package documents whether it replaces a whole archive, changes script behavior, or patches native code, plus known incompatibilities and recovery steps.
|
||||
|
||||
Do not call the system a general mod SDK until users can author and validate supported packages without editing patcher source or manually calculating NE offsets.
|
||||
|
||||
## Risks and Open Questions
|
||||
|
||||
- The exact supported retail executable variants and their fingerprints still need to be inventoried; addresses and relocation records must not be generalized across builds without verification.
|
||||
- The fixed-map lane's replacement behavior means even a small map mod may need a full compatible archive. Confirm the archive writer and variant-specific map coverage before promising convenient sparse map packs.
|
||||
- The `-u` path is constrained by DOS path rules and a short argument buffer; runtime confirmation and a clean activation diagnostic would reduce silent fallback risk.
|
||||
- USECODE tooling must preserve unknown class/event metadata and support offset changes before variable-length edits can be safe.
|
||||
- New native behavior may require a safe code cave, a reusable existing function, or NE segment-table changes. No general-purpose injected-code allocation area has been established.
|
||||
- Patch collisions, build differences, and interactions with other community patches are likely to dominate support cost once packages compose.
|
||||
- Mechanical apply/restore is not enough: the debugger experiments show that a patch can be byte-perfect and still corrupt startup or shared runtime behavior.
|
||||
|
||||
## Research Basis
|
||||
|
||||
This assessment uses existing repository evidence, including live-Ghidra-derived startup, archive, USECODE, and NE patch notes. No additional live Ghidra operation was needed for the feasibility decision. Before implementing a specific native patch, re-check its target in the active `CRUSADER.EXE` database and verify the exact writable copy, bytes, and relocation records against the selected retail file.
|
||||
|
||||
The source-port baseline and its remaining gaps are tracked in [remorse-windows-rebuild-roadmap.md](remorse-windows-rebuild-roadmap.md). Track C should be added there only when the user wants the roadmap itself revised; this note deliberately keeps the requested research separate.
|
||||
234
docs/scummvm-crusader-enhancement-feasibility.md
Normal file
234
docs/scummvm-crusader-enhancement-feasibility.md
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
# ScummVM Crusader Enhancement Feasibility
|
||||
|
||||
**Status:** Feasibility study; no ScummVM implementation changes made
|
||||
**Reviewed:** 2026-10-09
|
||||
**Scope:** ScummVM's Ultima VIII engine for Crusader: No Remorse and No Regret
|
||||
|
||||
## Executive Summary
|
||||
|
||||
The requested work is feasible as a staged ScummVM enhancement, but it is not one small modding feature. The engine already provides useful runtime foundations: both Crusader games are supported, fixed map objects and glob groups are parsed, camera positions are interpolated, usecode is interpreted, and the developer debugger has cheat and teleport commands. The largest gaps are user-facing integration and data ownership: maps, mission startup, and usecode are currently loaded from the expected retail resource set, while the existing cheat commands are not an in-game menu and the recovered original usecode debugger is not a working ScummVM debugger.
|
||||
|
||||
The recommended order is:
|
||||
|
||||
1. Establish per-game behavior and format regressions from the improved decompilation evidence.
|
||||
2. Add an opt-in camera mode and a player-accessible cheat/debug menu by reusing existing camera and debugger operations.
|
||||
3. Add a priority-based external data-mod layer, then custom fixed/glob map packs and mission metadata.
|
||||
4. Enable custom usecode only after resolving the local class/event parsing discrepancy against both retail variants.
|
||||
5. Treat new native intrinsics and the original usecode debugger as separate, later runtime projects. Do not make arbitrary native-code plugins part of the mod format.
|
||||
|
||||
The quickest visible wins are the camera option, cheat/debug menu, whole-file resource replacement, and focused movement/aiming corrections. Custom missions and map packs are medium-sized loader/content tasks. Arbitrary new scripted behavior and faithful usecode debugging depend on more VM, format, and per-variant validation.
|
||||
|
||||
## Existing Foundations
|
||||
|
||||
The source review was against the checked-out ScummVM tree in this workspace, primarily `engines/ultima/ultima8`. The following details affect feasibility:
|
||||
|
||||
- `CruGame::startGame()` starts on map 0 and creates the main actor. `StartCrusaderProcess` handles the intro/difficulty flow and then sends the actor to map 1, egg `0x1e`; the same process also applies a Regret-specific starting state. A custom mission therefore needs a deliberate entry point, not just more map records.
|
||||
- `World::initMaps()` creates 256 map slots. `World::switchMap()` reads fixed data by map index from `GameData::getFixed()` and manages the runtime map transition.
|
||||
- `Map::loadFixed()` parses fixed-format item records; the current record reader consumes 16 bytes per item. `GameData::loadRemorseData()` loads `static/fixed.dat` and `static/glob.flx` for Crusader.
|
||||
- `MapGlob` is a compact group of objects, not a whole map. A `GlobEgg` expands its referenced group when it enters the active fast area. `NONFIXED.DAT` is savegame state and should not be confused with authored fixed-map or glob data.
|
||||
- `CameraProcess` already tracks the controlled actor, interpolates camera positions between frames, and supports timed scrolling. Crusader map switches snap it to the avatar. The existing behavior is not an exposed PSX-style fixed-anchor/follow mode.
|
||||
- `UCMachine` receives a function table and count. Remorse and Regret use different converter and intrinsic tables; calls outside the registered table are reported as unhandled. A script ordinal alone cannot add a native function.
|
||||
- Crusader assets are opened by fixed logical filenames through `Common::File`, which resolves files through ScummVM's `SearchMan`. Same-named files in the configured search paths can therefore be replaced without editing ScummVM source. The engine does not currently present a per-mod selector, precedence UI, or manifest for additional mod directories.
|
||||
- `misc/debugger.cpp` registers developer commands including cheat enable, heal, invincibility, hack mover, and actor teleport. These are ScummVM debugger-console commands, not a player-facing in-game menu. `Cheat::heal` is a one-shot HP/energy refill; it is not continuous health recharge.
|
||||
|
||||
See the [ScummVM Crusader reference](./scummvm-crusader-reference.md) for the broader source inventory and resource list.
|
||||
|
||||
## Feasibility Matrix
|
||||
|
||||
Effort is relative to a focused ScummVM feature branch and includes tests and documentation. `M` is a contained multi-file change; `L` is a subsystem project; `XL` is a substantial runtime/UI effort.
|
||||
|
||||
| Feature | Feasibility | Effort | Main reason |
|
||||
|---|---|---:|---|
|
||||
| Accuracy guided by decompiled knowledge | High, incremental | M to XL overall | ScummVM already runs the games; improved evidence can become small parity fixes, but must be checked per binary and subsystem. |
|
||||
| External replacement of existing graphics/data files | High | S to M | Existing file opens use SearchMan; complete files can be replaced by same-name resources. A managed multi-mod layer is additional work. |
|
||||
| Custom fixed maps and glob groups | Medium-high | M to L | The map and glob parsers exist, but authored external files need an override format, validation, selection, and startup integration. |
|
||||
| Custom missions | Medium | M to L | Map switching exists, but startup and mission progression are tied to game-specific code and usecode/data conventions. |
|
||||
| Custom usecode archive loading | Medium, format-risky | L | The VM and archive loader exist, but archive parsing, event bounds, class IDs, and intrinsic compatibility must be proven for both variants. |
|
||||
| Smooth camera mode inspired by PSX | High | M | Camera tracking and interpolation exist. A selectable follow/anchor policy and time-based tuning are the missing user-facing parts. |
|
||||
| Player cheat/debug menu | High | S to M | Many useful actions exist in the developer debugger. A game gump, keybinding, and safe state semantics are still required. |
|
||||
| New weapons/items/enemies via added native intrinsics | Conditional; low for arbitrary mods | L to XL | Native functions are compiled C++ entries in variant-specific tables. Data-only additions are possible only where current generic systems already express the behavior. |
|
||||
| Reimplement the orphaned usecode debugger | Technically feasible, high risk | XL | The original UI and state logic are substantially recovered, but a working debugger needs interpreter hooks, valid live frame state, source mapping, and watches. |
|
||||
|
||||
## Feature Assessments
|
||||
|
||||
### Accuracy From Enhanced Decompilation
|
||||
|
||||
This is best treated as a continuous evidence-driven correction track, not a single feature. For each candidate behavior, record the executable address and variant, the observed behavior, the ScummVM code path, confidence, and a regression test. Prefer corrections where the decompilation establishes a direct mismatch in startup, map transitions, input, camera state, item behavior, or an intrinsic contract.
|
||||
|
||||
Do not translate low-level DOS implementation details mechanically. Preserve ScummVM's architecture and port the recovered behavior at the nearest equivalent boundary. Also do not promote a Remorse observation into a Regret fix without checking the Regret binary: the games share much of the engine but have distinct intrinsic tables, global initialization, scripts, and some startup behavior.
|
||||
|
||||
The current enhanced notes are useful as an evidence base, but some format questions remain open. The local USECODE corpus analysis disagrees with the ScummVM/Pentagram class-event count convention for sampled records. This may be an issue in the local interpretation rather than ScummVM; resolve it by comparing complete Remorse and Regret archives and event dispatch before changing the runtime or promising custom-script compatibility. See the [USECODE format specification](./usecode-format-specification.md).
|
||||
|
||||
#### Movement and Aiming Accuracy
|
||||
|
||||
These are concrete accuracy-pass items, not optional polish. ScummVM already has game-specific mover, projectile-crosshair, and target-reticle processes, so the work is primarily to recover the original rules and align those implementations.
|
||||
|
||||
- **Turning while running with a weapon drawn:** `CruAvatarMoverProcess::run()` preserves short left/right taps as pending turns, but applies them only when `_isAnimRunningWalking()` accepts the current animation. In the checked-out ScummVM source, that helper accepts only `run`, `combatRunSmallWeapon`, and `walk`; it excludes run-start and large-weapon combat-run states. The local [tap-turn analysis](./scummvm-crusader-movement-tap-turn.md) records retail `Controller_PickNextAnimByKeyevent` and `Anim_1130_0f94` evidence that the original accepts direction changes during those additional states. However, that note says the ScummVM helper was widened while the source currently present in this workspace still has the narrower gate. Reconcile that source/note mismatch before treating the behavior as fixed. Extend coverage to held and tapped turns, weapon-ready state, run startup, small/large weapon animations, and direction-mode quantization.
|
||||
- **Auto-target reticle selection:** `TargetReticleProcess` asks `CurrentMap::findBestTargetItem()` for a target in the actor's current 16-direction bucket. The selector skips broken/off-screen candidates, then prefers occluders, actors, and the nearest remaining item, using the maximum absolute X/Y/Z delta as its distance measure. That distance only ranks matches; it does not reject distant candidates. `GameMapGump::RenderSurfaceChanged()` resizes the world view to its parent render surface, so a larger ScummVM viewport can make additional objects pass the partly-on-screen filter and become eligible for auto-targeting. This supports the expanded-viewport hypothesis. A promising fix is to keep the expanded rendering but constrain player reticle eligibility to a separate logical targeting rectangle matching the original game's viewport scope. Recover the canonical rectangle and camera-relative placement from the retail targeting/viewport code first; the render notes identify a 640-pixel-wide viewport but do not yet prove that exact rectangle is the target check's contract. Check every `findBestTargetItem()` caller and scope the bound to player auto-targeting if needed, so firing, NPC target selection, and visibility rendering do not change accidentally.
|
||||
- **Manual firing crosshair:** `CrosshairProcess` is separate from the animated target reticle. It positions shape `0x4cc` a fixed 400 world units from the avatar using the mover's combat angle; `Item::fire` uses that location as a projectile destination when there is no selected target. Validate its offset, angle convention, and fallback behavior separately so a target-reticle correction does not silently change manual aim.
|
||||
|
||||
The accuracy pass should first recover the retail candidate-selection and direction-update contracts for both binaries, then add deterministic tests for same-direction near/far targets, targets just inside/outside the legacy viewport at multiple host resolutions, actor-versus-object priority, occlusion/visibility, broken targets, turning during each weapon/run animation, and projectile destination with and without a selected target. The expanded viewport explains how more candidates may become eligible; the original target rectangle and whether it is screen-, camera-, or actor-relative remain to be verified. Until that comparison is complete, treat missing turn states and the absent target-range gate as strong ScummVM-side hypotheses, not as proof of the original rules.
|
||||
|
||||
### External Data Mods
|
||||
|
||||
There are two distinct levels of support:
|
||||
|
||||
1. **Replace a complete existing resource file.** This is already close to supported: ScummVM opens fixed names such as `static/shapes.flx`, `static/fixed.dat`, and `usecode/<language>usecode.flx` through `Common::File`. A same-named resource found through the configured search paths can replace the retail file. This does not require source-file replacement.
|
||||
2. **Install, enable, order, and combine mods.** This needs a mod root or package format, a manifest, deterministic precedence, variant/language checks, conflict reporting, and a UI or configuration entry. The current `GameData` setup loads and caches archives at startup, so initial support should mount mods before game data is constructed; live reload and cache invalidation can be deferred.
|
||||
|
||||
Replacing a complete FLEX archive is not the same as replacing one object inside it. `Archive` can layer FLEX sources, but the Crusader `GameData` paths commonly construct a `RawArchive` from one file. Per-entry overlays need explicit wiring and tests. Version one should promise whole-file replacement unless object-level merging is implemented and validated.
|
||||
|
||||
### Custom Maps and Missions
|
||||
|
||||
The current loaders provide a sound base for external map content. Fixed objects are read by map index, and glob groups are decoded and expanded by glob eggs. A first custom-map format can reuse those data layouts while keeping files separate by map and mod, with the retail archives as fallback.
|
||||
|
||||
Required work includes:
|
||||
|
||||
- Define a manifest that identifies game variant, map IDs, fixed data, glob data, and an optional mission entry point.
|
||||
- Load and validate fixed records and glob groups before constructing runtime items. Check map indices against the current 256-slot map table, record truncation, shape/frame references, coordinates, glob indices, and excessive object counts.
|
||||
- Preserve glob-egg behavior and fast-area activation. A glob file that parses but is not reachable through the right egg is not a functioning map feature.
|
||||
- Support a custom mission selection/launch path with an entry map and egg or coordinate. Do not assume changing `fixed.dat` changes the start sequence.
|
||||
- Record the selected mission/mod identity in saves or reject incompatible saves clearly. Otherwise a save can resume against a different map or script set.
|
||||
|
||||
Custom missions are larger than custom maps because content also needs working transitions, usecode classes/events, assets, and any required per-mission state. The practical first milestone is a custom test map that can be launched directly, followed by a mission manifest and in-game entry route.
|
||||
|
||||
### Custom Usecode and New Native Behavior
|
||||
|
||||
Replacing the full language-specific usecode archive is mechanically easier than adding a new native intrinsic: the engine already loads a `UsecodeFlex` and executes event bodies. However, custom content still depends on class and event IDs, valid archive bounds, the VM's supported opcode behavior, and the exact Remorse or Regret intrinsic table.
|
||||
|
||||
Before accepting modified archives, add corpus-level tests that compare parsed class ranges, event slots, body offsets, and names with the retail archives for both games. Preserve unknown bytes and fail closed on malformed offsets. The current local-versus-ScummVM event-count disagreement is a release blocker for claiming general custom usecode support until it is explained.
|
||||
|
||||
For new behavior, distinguish these cases:
|
||||
|
||||
- **Use an existing intrinsic:** preferred for content mods. Scripts can use the game's existing item, actor, weapon, camera, and world APIs.
|
||||
- **Add a generic, source-implemented extension point:** feasible if it exposes a small, typed set of safe operations that can be driven by data or script parameters. Keep Remorse and Regret ordinal mappings separate and version the extension contract.
|
||||
- **Add arbitrary native code from an external mod:** not recommended. Dynamic native plugins complicate portability, compatibility, and security and do not fit a data-mod promise. A truly new engine capability should be implemented in ScummVM and reviewed as source code.
|
||||
|
||||
New weapon or item shapes may be data-driven when existing weapon/item systems can represent their behavior. New enemy behavior usually needs more than art and map placement: actor metadata, combat data, AI/process behavior, damage interactions, and usecode may all be involved. The first release should label the boundary between data-only content and features requiring an engine build.
|
||||
|
||||
### PSX-Inspired Smooth Camera
|
||||
|
||||
This is one of the lower-risk runtime additions. ScummVM already interpolates camera positions for rendering and supports scripted timed scrolls. The PSX reverse-engineering notes identify a different useful behavior: control opcodes configure a fixed camera anchor or clear it to resume normal follow, with per-level camera/runtime values also loaded from level data. This supports a selectable mode inspired by the PSX behavior, not a claim that the PSX camera is simply a smoother version of the DOS camera.
|
||||
|
||||
Recommended scope:
|
||||
|
||||
- Preserve current camera behavior as the default parity mode.
|
||||
- Add an opt-in smooth-follow/anchor mode, with camera position updated from elapsed presentation time rather than by changing simulation ticks.
|
||||
- Keep camera position separate from actor coordinates and gameplay collision/fast-area state. If camera movement changes which objects activate, use the existing game rules deliberately and test that behavior.
|
||||
- Provide a defined return-to-follow action after a fixed anchor, map transition, teleport, or save load.
|
||||
- Test convergence at different frame rates, edge clamping, scripted camera moves, pause/resume, and that camera-only motion leaves gameplay state unchanged.
|
||||
|
||||
The current [Windows rebuild roadmap](./remorse-windows-rebuild-roadmap.md) also records a smooth camera design for a separate source-port effort. Its tests and separation of camera projection from simulation are useful principles, but its code is not the ScummVM implementation.
|
||||
|
||||
### Cheat and Debug Menu
|
||||
|
||||
The requested player-facing menu is practical and should remain separate from the recovered original usecode debugger. ScummVM's developer debugger already has command paths for cheat enable, max stats/heal, invincibility, hack mover, and teleporting the main actor to a map/coordinate or egg. A new in-game gump can call shared game operations rather than duplicate those effects.
|
||||
|
||||
The exact requested options still need semantic definitions:
|
||||
|
||||
- **Immortality:** an existing invincibility toggle is available. The menu should report current state and respect the engine's cheat-enabled policy or expose that policy explicitly.
|
||||
- **Health recharge:** the existing `Cheat::heal` fills HP and energy once. Continuous recharge is a different behavior and needs a separate toggle and rate.
|
||||
- **Revival:** no equivalent menu command was found in the inspected ScummVM debugger. Define whether this means restoring the avatar after death, reloading a checkpoint, or reviving another actor before implementing it.
|
||||
- **Debug actions:** map/coordinate/egg teleport and hack mover are already represented in the debugger. Add validation and confirmation for destructive or progression-changing actions; make the cursor-target teleport use the same coordinate conversion as normal input.
|
||||
|
||||
Keep the menu opt-in and mark saves that used state-changing cheats if ScummVM's existing save/achievement policy requires it. The [Crusader binary notes](./ne-segment1.md) document the variant-specific retail cheat latch and F10 behavior; they also correct an earlier assumption that the hidden debugger was a cheat list.
|
||||
|
||||
### Orphaned Original USECODE Debugger
|
||||
|
||||
The recovered hidden menu is a usecode debugger/unit inspector, not the proposed player cheat list. It has File, Run, Breakpoints, Search, and Data menus, source and watch panes, and commands for stepping, breakpoints, inspection, and globals. The UI code is substantially present in the retail executable, but reaching it safely depends on live interpreter context.
|
||||
|
||||
The debugger notes identify the main blockers: Remorse has no recovered retail writer for the global break-state pointer and no recovered caller of its break-state constructor; its retained vtable callbacks are inert. The interpreter still has a hook that checks for the state object. No Regret evidence differs, so it needs a separate entry/bootstrap assessment rather than inheriting the Remorse conclusion. In both cases, a source pane alone does not make `RUN`, stepping, or watches correct.
|
||||
|
||||
ScummVM already has its own usecode VM, so a useful debugger should be implemented against ScummVM's VM state rather than attempting to revive the DOS far-pointer object layout. A minimal useful sequence is:
|
||||
|
||||
1. Emit structured instruction, call, return, suspend, and intrinsic events from the VM.
|
||||
2. Add stop/resume and instruction-step controls tied to class, event, and bytecode offset.
|
||||
3. Add variant-correct source/line mapping. Remorse has recovered `LINE_NUMBER` metadata in the inspected corpus; the examined Regret corpus does not, so synthetic listing rows must not be represented as original source lines.
|
||||
4. Add locals, globals, and watches only when VM values and live frame ownership can be inspected correctly.
|
||||
5. Recreate the original menus and panes only after the runtime debugger contract is stable.
|
||||
|
||||
This is a separate large project. The [debugger break-state layout](./usecode-debugger-break-state-layout.md), [retail entry analysis](./retail-debugger-entry-options.md), [`.unk` format investigation](./usecode-unk-format.md), and [standalone debugger proposal](./standalone-usecode-debugger.md) contain the current evidence and caveats.
|
||||
|
||||
## Suggested Delivery Plan
|
||||
|
||||
### Phase 0: Evidence and Compatibility Gate
|
||||
|
||||
- Build a discrepancy ledger for Remorse and Regret with binary address, confidence, ScummVM owner, and test case.
|
||||
- Add movement and targeting-reticle parity cases, including gun-ready running turns and target range/selection boundaries.
|
||||
- Resolve or isolate the usecode class/event-size discrepancy before supporting mod-authored scripts.
|
||||
- Add read-only validation of fixed records, glob groups, and usecode class/event ranges against retail files.
|
||||
|
||||
**Exit:** both retail variants load with unchanged behavior, and format tests can identify malformed or out-of-range mod data without crashing.
|
||||
|
||||
### Phase 1: Low-Risk Player Features
|
||||
|
||||
- Add a PSX-inspired optional camera mode with current behavior as the default.
|
||||
- Add a player-facing cheat/debug gump reusing existing commands where possible.
|
||||
- Decide precise recharge and revival semantics and test their save/load effects.
|
||||
|
||||
**Exit:** camera mode can be toggled and reset without simulation drift; menu actions have validated inputs and match their displayed state.
|
||||
|
||||
### Phase 2: External Mod Layer
|
||||
|
||||
- Add a variant-aware manifest and mount one or more external data roots before `GameData` loads.
|
||||
- Define precedence, conflict reporting, and whole-file replacement behavior.
|
||||
- Add a report of resolved resource path and mod owner for diagnostics.
|
||||
|
||||
**Exit:** disabling mods restores exact retail resource selection; conflict order is deterministic and covered for Remorse and Regret.
|
||||
|
||||
### Phase 3: Custom Maps and Missions
|
||||
|
||||
- Add per-map fixed and glob sources with retail fallback.
|
||||
- Add a custom mission launcher/manifest with explicit entry map and spawn target.
|
||||
- Test transitions, saves, and missing-resource behavior with a small custom scenario.
|
||||
|
||||
**Exit:** a custom mission can start, traverse at least one map transition, save/load under the same mod set, and fail clearly under a mismatched mod set.
|
||||
|
||||
### Phase 4: Custom USECODE and Extension Contract
|
||||
|
||||
- Enable replacement or mod-layer usecode archives after the Phase 0 parser gate.
|
||||
- Initially permit only existing, variant-correct intrinsics.
|
||||
- Add any new native operations in ScummVM source behind a small stable API; do not load executable code from mods.
|
||||
|
||||
**Exit:** archive tests pass for both variants; unsupported opcodes and intrinsics report actionable errors; custom event execution is deterministic in a test mission.
|
||||
|
||||
### Phase 5: Runtime USECODE Debugger
|
||||
|
||||
- Add VM trace and instruction breakpoints, then stepping and call-stack inspection.
|
||||
- Add source mapping and watches only where the data supports them.
|
||||
- Port the original menu workflow as a UI option after runtime semantics are validated.
|
||||
|
||||
**Exit:** break, continue, step, and return are repeatable on selected Remorse and Regret scripts; no synthetic line mapping is presented as authentic metadata.
|
||||
|
||||
## Cross-Cutting Risks and Decisions
|
||||
|
||||
- **Variant boundaries:** Remorse and Regret must retain separate intrinsic tables, global conventions, startup settings, and mod compatibility identifiers.
|
||||
- **Archive granularity:** replacing a whole file is simpler than overlaying one entry in a FLEX archive. State which is supported in each release.
|
||||
- **Save compatibility:** custom mission, map, or usecode changes can invalidate object IDs and event behavior. Save metadata should identify the selected mod set or reject incompatible loads.
|
||||
- **Runtime code versus data:** external mods should supply validated content, not native executable modules. New native behavior requires a ScummVM build.
|
||||
- **Debug claims:** distinguish existing developer console commands, a new player cheat menu, and the recovered original usecode debugger. They are three different surfaces.
|
||||
- **Parity claims:** use decompiled code as evidence and test material, not as proof that ScummVM already has equivalent runtime state or data layout.
|
||||
|
||||
### Mandatory ScummVM Contribution Requirements
|
||||
|
||||
Whenever implementation work writes or modifies code in the ScummVM repository, it MUST comply with the current [ScummVM AI usage guidelines](../../scummvm/AI-GUIDELINES.md). This applies to feature code, fixes, and tests; these roadmap phases do not waive or replace the project's requirements. Re-read the guidelines before each ScummVM implementation task in case they have changed.
|
||||
|
||||
In particular, AI assistance does not make an AI agent the code author: the human contributor must understand, review, test, and take sole authorship responsibility for submitted code. Keep AI use within areas the contributor understands, follow ScummVM formatting and naming conventions, avoid unreviewed generated code and excessive comments, and ensure contributions are GPLv3+-compatible. Commits and pull requests must be created by humans with human-written messages. When AI assistance contributes to development, include the required `Assisted-by: AGENT_NAME:MODEL_VERSION [TOOL1] [TOOL2]` attribution in the commit message, following the guidelines' format.
|
||||
|
||||
AI is allowed to write the code with the promise that the human verifies its validity at the end.
|
||||
|
||||
## Evidence References
|
||||
|
||||
- [ScummVM Crusader source inventory](./scummvm-crusader-reference.md)
|
||||
- [USECODE format specification](./usecode-format-specification.md)
|
||||
- [USECODE intrinsic catalog](./usecode-intrinsics-catalog.md)
|
||||
- [Remorse/Regret binary behavior notes](./ne-segment1.md)
|
||||
- [ScummVM running tap-turn analysis](./scummvm-crusader-movement-tap-turn.md)
|
||||
- [USECODE debugger break-state layout](./usecode-debugger-break-state-layout.md)
|
||||
- [Retail debugger entry analysis](./retail-debugger-entry-options.md)
|
||||
- [USECODE `.unk` format investigation](./usecode-unk-format.md)
|
||||
- [Standalone USECODE debugger proposal](./standalone-usecode-debugger.md)
|
||||
- [PSX camera and level-runtime findings](./psx/psx.md)
|
||||
- [ScummVM-style camera proposal for the separate Windows rebuild](./remorse-windows-rebuild-roadmap.md)
|
||||
|
||||
ScummVM source locations reviewed: `engines/ultima/ultima8/games/cru_game.cpp`, `games/start_crusader_process.cpp`, `games/game_data.cpp`, `world/map.cpp`, `world/map_glob.cpp`, `world/glob_egg.cpp`, `world/world.cpp`, `world/camera_process.cpp`, `world/actors/cru_avatar_mover_process.cpp`, `world/crosshair_process.cpp`, `world/target_reticle_process.cpp`, `world/current_map.cpp`, `usecode/uc_machine.cpp`, and `misc/debugger.cpp`.
|
||||
112
docs/scummvm/build-scummvm.ps1
Normal file
112
docs/scummvm/build-scummvm.ps1
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
[CmdletBinding()]
|
||||
param (
|
||||
[ValidateSet('Debug', 'Release')]
|
||||
[string]$Configuration = 'Debug',
|
||||
[switch]$RegenerateProject
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$sourceRoot = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..\..\..\scummvm'))
|
||||
$buildDirectory = Join-Path $sourceRoot 'build-msvc'
|
||||
$generatorProject = Join-Path $sourceRoot 'devtools\create_project\msvc\create_project.vcxproj'
|
||||
$generatorExecutable = Join-Path $sourceRoot 'dists\msvc\create_project.exe'
|
||||
$solution = Join-Path $buildDirectory 'scummvm.sln'
|
||||
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $sourceRoot 'configure') -PathType Leaf)) {
|
||||
throw "ScummVM source checkout was not found at '$sourceRoot'."
|
||||
}
|
||||
|
||||
$msbuildPath = $env:MSBUILD_EXE
|
||||
if ([string]::IsNullOrWhiteSpace($msbuildPath) -or -not (Test-Path -LiteralPath $msbuildPath -PathType Leaf)) {
|
||||
$msbuildCommand = Get-Command MSBuild.exe -ErrorAction SilentlyContinue
|
||||
if ($null -ne $msbuildCommand) {
|
||||
$msbuildPath = $msbuildCommand.Source
|
||||
}
|
||||
}
|
||||
if ([string]::IsNullOrWhiteSpace($msbuildPath) -or -not (Test-Path -LiteralPath $msbuildPath -PathType Leaf)) {
|
||||
throw 'MSBuild was not found. Run this script from a Visual Studio Developer PowerShell or set MSBUILD_EXE.'
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Path $buildDirectory -Force | Out-Null
|
||||
|
||||
$vcpkgRootOutput = & $msbuildPath $generatorProject '-getProperty:VcpkgRoot' '/p:Configuration=Release' '/p:Platform=Win32'
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Could not query the vcpkg root from MSBuild (exit code $LASTEXITCODE)."
|
||||
}
|
||||
$vcpkgRoot = ($vcpkgRootOutput | Out-String).Trim()
|
||||
if ([string]::IsNullOrWhiteSpace($vcpkgRoot) -or -not (Test-Path -LiteralPath (Join-Path $vcpkgRoot 'vcpkg.exe') -PathType Leaf)) {
|
||||
throw 'The vcpkg MSBuild integration was not found. Run vcpkg integrate install, then retry.'
|
||||
}
|
||||
|
||||
$localManifest = Join-Path $buildDirectory 'vcpkg.json'
|
||||
if (-not (Test-Path -LiteralPath $localManifest -PathType Leaf)) {
|
||||
$manifest = Get-Content -LiteralPath (Join-Path $sourceRoot 'vcpkg.json') -Raw | ConvertFrom-Json
|
||||
$manifest.name = 'scummvm-local-build'
|
||||
$manifest | ConvertTo-Json -Depth 100 | Set-Content -LiteralPath $localManifest -Encoding UTF8
|
||||
}
|
||||
|
||||
$registryConfiguration = Join-Path $buildDirectory 'vcpkg-configuration.json'
|
||||
if (-not (Test-Path -LiteralPath $registryConfiguration -PathType Leaf)) {
|
||||
$baseline = ''
|
||||
$bundleManifest = Join-Path $vcpkgRoot 'vcpkg-bundle.json'
|
||||
if (Test-Path -LiteralPath $bundleManifest -PathType Leaf) {
|
||||
$baseline = (Get-Content -LiteralPath $bundleManifest -Raw | ConvertFrom-Json).embeddedsha
|
||||
} else {
|
||||
$gitCommand = Get-Command git -ErrorAction SilentlyContinue
|
||||
if ($null -ne $gitCommand) {
|
||||
$baselineOutput = & $gitCommand.Source -C $vcpkgRoot rev-parse HEAD
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
$baseline = ($baselineOutput | Out-String).Trim()
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($baseline -notmatch '^[0-9a-fA-F]{40}$') {
|
||||
throw "Could not find a 40-character registry baseline in '$vcpkgRoot'."
|
||||
}
|
||||
|
||||
$configurationData = [ordered]@{
|
||||
'default-registry' = [ordered]@{
|
||||
kind = 'builtin'
|
||||
baseline = $baseline
|
||||
}
|
||||
}
|
||||
$configurationData | ConvertTo-Json -Depth 5 | Set-Content -LiteralPath $registryConfiguration -Encoding UTF8
|
||||
}
|
||||
|
||||
$buildProperties = Join-Path $buildDirectory 'Directory.Build.props'
|
||||
if (-not (Test-Path -LiteralPath $buildProperties -PathType Leaf)) {
|
||||
@'
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<VcpkgManifestRoot>$(MSBuildThisFileDirectory)</VcpkgManifestRoot>
|
||||
<VcpkgInstalledDir>$(MSBuildThisFileDirectory)vcpkg_installed</VcpkgInstalledDir>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
'@ | Set-Content -LiteralPath $buildProperties -Encoding UTF8
|
||||
}
|
||||
|
||||
if ($RegenerateProject -or -not (Test-Path -LiteralPath $solution -PathType Leaf)) {
|
||||
& $msbuildPath $generatorProject '/m' '/p:Configuration=Release' '/p:Platform=Win32' '/verbosity:minimal'
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Building create_project failed (exit code $LASTEXITCODE)."
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath $generatorExecutable -PathType Leaf)) {
|
||||
throw "The project generator was not produced at '$generatorExecutable'."
|
||||
}
|
||||
|
||||
Push-Location $buildDirectory
|
||||
try {
|
||||
& $generatorExecutable '..' '--msvc' '--vcpkg' '--disable-all-engines' '--enable-engine=ultima' '--enable-engine=ultima8'
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Generating the ScummVM solution failed (exit code $LASTEXITCODE)."
|
||||
}
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
|
||||
& $msbuildPath $solution '/m' "/p:Configuration=$Configuration" '/p:Platform=x64' '/verbosity:minimal'
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "The $Configuration x64 ScummVM build failed (exit code $LASTEXITCODE)."
|
||||
}
|
||||
307
docs/scummvm/phase-0-evidence-compatibility-gate.md
Normal file
307
docs/scummvm/phase-0-evidence-compatibility-gate.md
Normal file
|
|
@ -0,0 +1,307 @@
|
|||
# ScummVM Crusader Phase 0: Evidence and Compatibility Gate
|
||||
|
||||
**Status:** Work plan; no ScummVM source changes made
|
||||
**Parent plan:** [ScummVM Crusader enhancement feasibility](../scummvm-crusader-enhancement-feasibility.md)
|
||||
**Scope:** No Remorse and No Regret in ScummVM's Ultima VIII engine
|
||||
|
||||
## Purpose
|
||||
|
||||
Phase 0 establishes a trustworthy behavior and data-format baseline before adding player-facing features, external map content, or custom USECODE. Its job is to distinguish a verified retail rule from an implementation assumption, identify which differences are shared and which are variant-specific, and produce tests that can detect regressions without distributing game data.
|
||||
|
||||
This is an evidence and compatibility gate, not a content-mod implementation phase. It may add test fixtures, local-only comparison scripts, or narrow input-validation fixes if Phase 0 demonstrates that malformed data can reach an unsafe read. It must not change retail gameplay behavior merely to make the tests pass. Any such behavioral change should be proposed as a separately reviewed accuracy fix, backed by the evidence and regression case assembled here.
|
||||
|
||||
## Phase 0 Outcomes
|
||||
|
||||
At completion, the project should have:
|
||||
|
||||
1. A reproducible baseline for the exact ScummVM checkout, build configuration, and local Remorse and Regret game-data sets.
|
||||
2. A per-variant discrepancy ledger that ties each claim to binary/source evidence and an observable regression test.
|
||||
3. A closed or explicitly isolated answer for the Crusader USECODE class/event-count disagreement. Custom-script compatibility remains blocked while this is unresolved.
|
||||
4. Deterministic movement, targeting-reticle, and manual-crosshair cases, including display-size changes and weapon/run animation states.
|
||||
5. Read-only structural validation for retail and synthetic fixed-map, glob, and USECODE inputs, including malformed/truncated cases.
|
||||
6. A no-regression smoke result showing that both supported games still start and play through the tested baseline paths.
|
||||
|
||||
Phase 0 does not need to settle every low-confidence behavior. An issue can pass the gate as **isolated** when the uncertainty is bounded, the implementation avoids making a new compatibility promise based on it, and a follow-up has a clear evidence path. The event-count discrepancy cannot be isolated while modified USECODE archives are being advertised or loaded as supported content.
|
||||
|
||||
## Scope Boundaries
|
||||
|
||||
### Included
|
||||
|
||||
- Remorse and Regret executable/data identity and evidence provenance.
|
||||
- Existing ScummVM behavior at the source paths named in the discrepancy ledger.
|
||||
- Running turns, especially with a weapon drawn; automatic target selection; the separate projectile crosshair.
|
||||
- USECODE class headers, event tables, class/event range checks, and archive bounds.
|
||||
- `static/fixed.dat` map records and `static/glob.flx` glob records.
|
||||
- Retail startup, map transition, and save/load smoke paths needed to check that baseline behavior remains intact.
|
||||
|
||||
### Excluded
|
||||
|
||||
- The player cheat/debug gump, smooth camera feature, mod manager, custom mission launcher, and mod packaging.
|
||||
- New weapons, enemies, items, or native intrinsics.
|
||||
- Reimplementing the original DOS usecode debugger UI.
|
||||
- Broad cleanup of ScummVM's Ultima VIII engine or unrelated U8 behavior.
|
||||
- Distribution or check-in of retail executable, archive, save, screenshot, or extracted content bytes.
|
||||
|
||||
## Evidence Rules
|
||||
|
||||
Every ledger entry and test expectation should use these labels:
|
||||
|
||||
| Label | Meaning |
|
||||
|---|---|
|
||||
| `Retail-observed` | Reproduced in the named retail game build or directly verified in its executable/data. |
|
||||
| `Decompiled` | Supported by a named function/address and its call/data context; note whether the evidence is Remorse, Regret, or both. |
|
||||
| `ScummVM-source` | Directly observed in the recorded ScummVM revision and source path. |
|
||||
| `Cross-implementation` | Appears in ScummVM and another implementation; useful evidence, not proof when retail data disagrees. |
|
||||
| `Hypothesis` | Plausible interpretation awaiting a discriminating test or stronger source evidence. |
|
||||
| `Synthetic-test` | Proven only against constructed inputs; do not present as retail parity. |
|
||||
|
||||
For every binary-derived claim, record the game, executable edition/language, SHA-256, and address convention. Do not infer Regret behavior from Remorse, or vice versa. Keep file addresses, segment:offset addresses, and any flattened addresses in separate fields. Preserve unknown bytes and raw values when a format interpretation is unsettled.
|
||||
|
||||
Retail game files remain local inputs. Test reports may include hashes, counts, class/event IDs, record indices, and mismatch descriptions, but not copied proprietary payloads. Commit only synthetic fixtures and code that is permitted by the repository's contribution rules.
|
||||
|
||||
## Baseline Capture
|
||||
|
||||
Before source or test changes, record the following in the Phase 0 run log:
|
||||
|
||||
| Area | Required record |
|
||||
|---|---|
|
||||
| ScummVM tree | Repository revision, dirty/clean state, and hashes of locally modified files relevant to the engine. Do not assume the checkout is pristine. |
|
||||
| Build | Host OS/compiler, engine enablement, debug/release mode, renderer/backend, and exact build command. |
|
||||
| Display | Logical render dimensions, host window dimensions, fullscreen/scaling settings, and whether the render surface can resize during a session. |
|
||||
| Game data | Remorse/Regret edition, language, installed directory, and hashes/sizes for the executable and archives used by Phase 0. Keep paths private to the local run log if they expose user-specific directories. |
|
||||
| Startup | Fresh game to controllable avatar; record map, spawn route, game variant, and any startup warnings. |
|
||||
| Save/load | Create a save at a repeatable point, load it, and verify current map, controlled actor, weapon/combat mode, and camera state. |
|
||||
| Evidence | Ghidra notes/export revision or evidence document, function/address, test input, expected result, actual result, and confidence. |
|
||||
|
||||
Capture at least the standard ScummVM Crusader rendering size and one materially larger viewport. Record actual dimensions; do not assume a configuration option changes the logical map viewport until measured. Use the same input sequence, game build, save state, and camera/avatar state for comparisons.
|
||||
|
||||
## Discrepancy Ledger
|
||||
|
||||
Keep this table as the Phase 0 index. Expand each row with links to a test case and evidence record as work proceeds.
|
||||
|
||||
| ID | Topic | Initial status | Current evidence and question | Phase 0 disposition |
|
||||
|---|---|---|---|---|
|
||||
| `MOVE-001` | Direction changes during running weapon animations | Open | Retail Remorse decomp notes accept start-run, start-run-small/large-weapon, and combat-run-small/large-weapon movement states. The checked-out ScummVM `_isAnimRunningWalking()` currently accepts only `run`, `combatRunSmallWeapon`, and `walk`, despite the local tap-turn note claiming the helper was widened. Reconcile the source/note mismatch and separately inspect Regret. | Exact eligible states and turn quantization are tested for each supported game; any remaining variant gap is explicit. |
|
||||
| `AIM-001` | Auto-target eligibility changes with viewport size | Hypothesis, high priority | `GameMapGump::RenderSurfaceChanged()` resizes the world view to its parent. `CurrentMap::findBestTargetItem()` requires a partly-on-screen candidate, but its distance score only ranks candidates and imposes no maximum. Does the larger map viewport admit targets the original target scope excluded? What is the retail logical selection rectangle and its camera/actor anchor? | Same world state returns the same target at standard and expanded host sizes, using a retail-derived target bound if confirmed. If not confirmed, retain current behavior and block a parity claim. |
|
||||
| `AIM-002` | Auto-target scoring and refresh | Open | ScummVM prioritizes occluder flag, actor status, then max-axis distance among candidates in the exact 16-direction bucket; target process refresh cadence is separate from manual aim. Verify retail candidate eligibility, tie-breaks, refresh triggers, and no-target behavior for both games. | Candidate order, tie cases, direction edges, broken/absent objects, movement refresh, and variant differences have expected results. |
|
||||
| `AIM-003` | Manual projectile crosshair | Open | `CrosshairProcess` positions shape `0x4cc` at a fixed 400 world units using the mover combat angle. `Item::fire` may use that point when no target is selected. This is not the animated target reticle (`0x59a`). Verify origin, angle convention, height, weapon-dependent offsets, and target fallback separately. | Firing destination and crosshair position are independently tested with and without a selected target. |
|
||||
| `UC-001` | Crusader event-count formula | Blocking for custom USECODE | ScummVM reads the dword at class bytes `8..11`, subtracts one for the class base, and computes event count as `(base + 19) / 6`. Local samples instead fit `(raw_dword - 20) / 6`; observed raw values include `0x00d4`, `0x00da`, and `0x00e6`, giving 32, 33, and 35 rows under the local rule. `Usecode::get_class_event()` warns for an event ID beyond the count but continues to read the six-byte row. Determine which layout is valid for each exact archive/build. | Formula is resolved per corpus/build, or custom USECODE remains explicitly unsupported. No silent fallback between formulas. |
|
||||
| `MAP-001` | Fixed-map record extent | Open | ScummVM takes `size / 16` fixed records and reads 16 bytes per entry. A non-multiple-of-16 remainder is ignored by that loop; determine whether retail archives contain remainders and validate them. Check map archive entry count against the 256 map slots. | Retail records parse identically; truncated/remainder fixtures are rejected or reported before unsafe parsing. |
|
||||
| `MAP-002` | Glob record extent and references | Open | ScummVM reads a little-endian `u16` item count followed by six-byte entries `(x,y,z,shape,frame)`. `MapGlob::read()` asserts that the stream is at least `2 + count * 6` bytes. Verify all retail entries, glob references from eggs, shape/frame validity, and safe failure behavior. | Retail glob contents and references validate; undersized synthetic input cannot reach an assertion or out-of-bounds read through any future mod path. |
|
||||
| `VAR-001` | Shared behavior versus game-specific rules | Open | Remorse and Regret have different converter/intrinsic tables, globals, startup details, and possible input/targeting differences. | Each claim is explicitly variant-scoped or cross-checked in both games. |
|
||||
|
||||
Suggested status values: `Open`, `Evidence gathering`, `Test ready`, `Confirmed`, `Isolated`, `Blocked`. `Confirmed` requires an expected result and a repeatable test. A code comment, converter name, or single screenshot alone is not sufficient evidence.
|
||||
|
||||
## Work Packages
|
||||
|
||||
### WP0.1: Freeze the Test Baseline
|
||||
|
||||
1. Record ScummVM revision and working-tree state before making edits.
|
||||
2. Identify the exact Remorse and Regret executable/resource editions locally available; hash inputs rather than copying them into the repository.
|
||||
3. Build the Ultima VIII engine using the project's normal supported configuration. Save the complete command and output summary.
|
||||
4. Run the same fresh-start and save/load smoke path for both games.
|
||||
5. Record renderer logical dimensions and window dimensions at standard and expanded sizes.
|
||||
|
||||
**Deliverable:** a reproducible run record that names the inputs and distinguishes failures already present in the checkout from Phase 0 findings.
|
||||
|
||||
### WP0.2: Turn Evidence Into Testable Claims
|
||||
|
||||
For each discrepancy, write a short evidence card with:
|
||||
|
||||
- ID and game variant/build.
|
||||
- Retail function/address or format bytes; identify whether evidence is disassembly, decompilation, archive inspection, or runtime observation.
|
||||
- ScummVM revision, file, function, and behavior.
|
||||
- Exact difference or unresolved assumption.
|
||||
- One input sequence or fixture that distinguishes competing explanations.
|
||||
- Expected observable result and what would falsify it.
|
||||
- Confidence and known limitations.
|
||||
|
||||
Use the ledger above as the index. Keep raw evidence in existing subsystem notes where appropriate; do not duplicate large decompilation narratives here.
|
||||
|
||||
### WP0.3: Movement Turn Matrix
|
||||
|
||||
Use a fixed save or controlled input harness so animation state and movement flags are known. For Remorse and Regret separately, test:
|
||||
|
||||
| State | Input | Expected observation |
|
||||
|---|---|---|
|
||||
| Walking, weapon stowed | Hold forward; tap each turn direction | Turn is accepted and movement resumes in the intended direction. |
|
||||
| Run startup, weapon stowed | Hold run+forward; tap left/right before the run loop begins | Tap is neither lost nor applied twice. |
|
||||
| Sustained run, weapon stowed | Hold run+forward; tap left/right | One deterministic direction step while run remains held. |
|
||||
| Start-run with weapon drawn | Enter combat/run startup; tap left/right | Compare against retail-supported startup animation states; record animation and facing. |
|
||||
| Small-weapon combat run | Keep weapon ready and tap/hold left/right while running | Short taps and held turns follow the recovered distinction; weapon stays in the expected mode. |
|
||||
| Large-weapon combat run | Repeat with a large weapon where available | Do not infer support from the small-weapon branch. |
|
||||
| Direction-mode boundary | Repeat where the active animation is 8-dir versus 16-dir | Quantization matches the animation's direction mode and retail behavior. |
|
||||
| Released turn key | Tap then release before animation completion | Pending input is consumed once and cleared; no delayed extra turn. |
|
||||
|
||||
Log the last animation, movement flags before/after input, actor direction, mover angle, selected next animation, and whether an actor-animation process was canceled/restarted. This separates input sampling defects from animation eligibility and angle-update defects.
|
||||
|
||||
The existing [tap-turn note](../scummvm-crusader-movement-tap-turn.md) states that the ScummVM helper was widened, but the source reviewed for this plan has the narrower three-animation condition. Phase 0 must first establish which checkout the note describes. Do not apply the documented list as an unconditional patch before this source and variant check.
|
||||
|
||||
### WP0.4: Target Scope and Crosshair Matrix
|
||||
|
||||
Treat three behaviors as separate test subjects:
|
||||
|
||||
1. `TargetReticleProcess`: chooses an object and draws the animated target reticle.
|
||||
2. `CurrentMap::findBestTargetItem()`: shared candidate-selection implementation, also used by firing logic; identify all call sites before changing its contract.
|
||||
3. `CrosshairProcess`: positions the manual projectile-aim marker; it does not perform target selection.
|
||||
|
||||
For the auto-target path, construct a repeatable scene/save with controlled actor location, direction, and candidate items. Include candidates:
|
||||
|
||||
- On the same direction ray/bucket at near, far, and very far distances.
|
||||
- Just inside and just outside the retail-derived logical target rectangle.
|
||||
- Partly visible and fully outside the viewport.
|
||||
- In front of/behind an occluder, with and without `SI_OCCL`.
|
||||
- Actor and non-actor candidates at equal and unequal distances.
|
||||
- Broken candidates, destroyed/missing object IDs, equal-score ties, and no candidates.
|
||||
- A target that enters/leaves eligibility after movement or a display resize.
|
||||
|
||||
Run each case at standard and expanded render sizes without changing world coordinates or the camera target. Record selected object ID, target-reticle state, and whether selection changes solely because the host surface was resized.
|
||||
|
||||
The local rendering evidence records a 640-pixel-wide retail viewport (`x=0..639`) and a height derived from the active screen height, but does not yet prove that these values are the target-selection rectangle. Inspect the retail target-selection and viewport call paths to determine:
|
||||
|
||||
- Whether selection uses screen-space clipping, a fixed world-space radius, a directional cone, or another candidate gate.
|
||||
- Whether the logical area is centered on the camera, the avatar, the crosshair, or a different point.
|
||||
- Whether original HUD/status areas are excluded from the target scope.
|
||||
- Whether the gate considers an item's anchor, target point, or projected sprite bounds.
|
||||
- Whether Remorse and Regret share the same boundary and tie-breaks.
|
||||
|
||||
If evidence confirms a legacy viewport bound, model it as a target-only logical rectangle transformed with the same camera projection as the map. Do not clamp the actual ScummVM render surface. Prefer passing a policy or explicit bounds into the player-reticle path over silently changing a shared selector used by NPCs or firing. Require equality of selected target across standard and expanded host sizes for candidates outside the legacy scope, while retaining the larger visible world.
|
||||
|
||||
For manual aim, separately record crosshair screen/world positions and the resulting projectile destination when no target is selected. Then add a selected target and verify that target acquisition does not accidentally override or reposition manual aim unless retail evidence says it should.
|
||||
|
||||
### WP0.5: Resolve the USECODE Event-Count Disagreement
|
||||
|
||||
The two candidate interpretations must be evaluated on the same exact raw class objects, not on class names or converter tables alone.
|
||||
|
||||
#### Candidate calculations
|
||||
|
||||
For a class object whose little-endian dword at bytes `8..11` is `raw`:
|
||||
|
||||
- ScummVM currently computes `base = raw - 1`, then `count = (base + 19) / 6`.
|
||||
- Local extraction computes `count = (raw - 20) / 6`, requires a nonnegative extent divisible by six, and uses `raw - 1` as the body-offset anchor.
|
||||
|
||||
The local formula fits sampled Remorse records, but those samples do not settle every archive, language, or Regret build. Keep both calculations in the comparison output until the evidence selects a rule.
|
||||
|
||||
#### Required comparison
|
||||
|
||||
1. Inventory every nonempty class object in each exact Remorse and Regret USECODE archive. Preserve archive object index, class ID, name hint, object size, raw dword, and raw bytes hash.
|
||||
2. Emit both candidate counts and table ends for every class. Flag negative extents, non-six-byte extents, counts whose six-byte table exceeds the object, and formulas that produce different results.
|
||||
3. For every in-range slot under either formula, preserve the two-byte unknown word and four-byte raw event offset. Derive candidate body windows without rewriting the archive.
|
||||
4. Compare candidate event rows and body windows against observed class/event use, ScummVM runtime lookup, and local extraction results. Keep name hints separate from slot identity.
|
||||
5. Inspect boundary cases where one formula admits a slot the other excludes. Trace actual native and usecode callers to determine whether those ordinals are requested and what bytes the runtime reads.
|
||||
6. Check whether the discrepancy correlates with variant, language, executable edition, archive generation, or a different valid class-record layout.
|
||||
7. Record the selected rule and all exclusions per archive family. If evidence remains ambiguous, block custom archive editing/loading and retain the retail loader unchanged.
|
||||
|
||||
ScummVM's `Usecode::get_class_event()` warns when `eventid` is at or above the reported count but continues to read the six-byte event row. Therefore, tests must verify actual row bounds and malformed event requests; checking the warning text alone is not a safety gate. Do not use a malformed synthetic event ID to probe the retail executable.
|
||||
|
||||
The existing [USECODE format specification](../usecode-format-specification.md) and local [`extract_eusecode_flx.py`](../../tools/extract_eusecode_flx.py) are starting evidence/tools, not independent ground truth. The extractor uses the local count interpretation, so its agreement with that formula cannot by itself resolve the disagreement.
|
||||
|
||||
#### Required synthetic cases
|
||||
|
||||
- Empty archive object and non-class objects 0/1.
|
||||
- Class object shorter than the 20-byte prefix.
|
||||
- Raw dword below 20, raw dword not divisible into six-byte rows, and event table ending exactly at object end.
|
||||
- Event table one byte beyond the object end.
|
||||
- Empty event offset, one event, last event, and sparse slots.
|
||||
- Event offset before the code anchor, at the first valid body byte, equal offsets, descending offsets, and offset beyond object end.
|
||||
- Event ID exactly at the accepted count, one above it, and a very large unsigned ID.
|
||||
- FLEX table entry whose data window overflows the archive or overlaps the next object unexpectedly.
|
||||
|
||||
Synthetic cases should exercise a validator/parser under test, not depend on memory layout or assertion configuration to make invalid access observable.
|
||||
|
||||
### WP0.6: Validate Fixed Maps and Globs
|
||||
|
||||
Create a read-only validation pass that reports archive and entry structure without creating runtime `Item` instances or changing a retail file.
|
||||
|
||||
#### Fixed-map checks
|
||||
|
||||
- Validate the outer archive table and report number of entries; identify any map index outside ScummVM's 256 initialized map slots.
|
||||
- For each fixed-map object, report byte size, complete 16-byte record count, and remainder bytes. The current ScummVM reader uses integer division by 16, so a remainder must be visible rather than silently treated as a valid map.
|
||||
- Decode fields only within a complete record: unsigned disk coordinates, Z, shape, frame, flags, quality, NPC number, map number, and `next` word.
|
||||
- Check coordinate conversion and value ranges before applying ScummVM world-coordinate helpers.
|
||||
- Where shape metadata is available, check shape/frame references. Report unknown metadata separately from invalid references.
|
||||
- Preserve container-depth semantics and order in the report; do not flatten nested records for comparison.
|
||||
|
||||
#### Glob checks
|
||||
|
||||
- Validate the FLEX object boundary before parsing each glob.
|
||||
- Require a complete two-byte item count and at least `2 + count * 6` bytes before reading entries.
|
||||
- Report trailing bytes as an observation; do not silently strip them until retail files establish they are padding.
|
||||
- Decode each item as byte X/Y/Z, `u16` shape, byte frame. Validate its shape/frame when metadata is available.
|
||||
- Validate every fixed-map glob-egg reference against the loaded glob count, including empty or null glob entries.
|
||||
- Check coordinate expansion with the Crusader-specific 1024-unit block mask, 2-bit coordinate shift, and 2-unit offset, using representative eggs near block edges.
|
||||
|
||||
For malformed inputs, the expected result is a structured validation error before the current runtime parser reaches an assert or out-of-range stream read. If test evidence shows the existing parser cannot fail safely, open a narrow ScummVM hardening fix; do not make a permissive parser that truncates or invents records.
|
||||
|
||||
### WP0.7: Baseline Runtime and Final Gate Review
|
||||
|
||||
After structural and behavior tests are assembled, repeat the startup/save-load smoke path for both games from the same ScummVM revision and data hashes. Review warnings and logs against the baseline, and run the relevant ScummVM build/test targets selected in WP0.1.
|
||||
|
||||
For each ledger item, assign one final Phase 0 disposition:
|
||||
|
||||
- **Confirmed:** original rule and ScummVM expectation are supported by both evidence and a repeatable test.
|
||||
- **Isolated:** uncertainty remains, but it is bounded and no later phase relies on an unsupported behavior claim.
|
||||
- **Blocked:** current evidence does not permit safe implementation or compatibility claims. Name the missing artifact or observation.
|
||||
- **Implementation-ready:** exact expected behavior and test are established; move the proposed code change to a separate review/implementation task.
|
||||
|
||||
## Test and Artifact Plan
|
||||
|
||||
### Tests
|
||||
|
||||
- Small synthetic fixtures for FLEX entry bounds, fixed-record divisibility, glob counts, and USECODE class/event bounds.
|
||||
- Retail-data comparison reports executed locally against both variants; reports contain hashes and summaries, not retail bytes.
|
||||
- Movement input/animation matrix with repeatable saves or a deterministic input harness.
|
||||
- Target selection tests at standard and larger host viewport dimensions, with the logical retail selection area held constant when its contract is proven.
|
||||
- Separate manual-crosshair/projectile destination tests.
|
||||
- Fresh-start, map-transition, and save/load smoke checks for Remorse and Regret.
|
||||
|
||||
No Ultima8-specific test files were located in the initial filename search. Before choosing a test path, inspect current ScummVM test conventions and use the narrowest supported harness. If asset-dependent integration tests cannot be upstreamed, keep their runner and results local and commit asset-free synthetic tests.
|
||||
|
||||
### Artifacts
|
||||
|
||||
- This document's discrepancy ledger, updated with evidence and test links.
|
||||
- A local run record with ScummVM revision/build config and retail-data hashes.
|
||||
- A local structural report for each archive and game variant.
|
||||
- Asset-free synthetic regression fixtures and tests, if supported by the ScummVM test conventions.
|
||||
- A short gate decision recording `Passed`, `Passed with isolated items`, or `Blocked`, with outstanding IDs.
|
||||
|
||||
Do not commit generated retail extracts, proprietary archive members, savegames, or binary screenshots. Where visual behavior matters, prefer a written coordinate/selection assertion and keep any capture local.
|
||||
|
||||
## Exit Criteria
|
||||
|
||||
Phase 0 is **passed** only when all of the following hold:
|
||||
|
||||
- The exact ScummVM and retail-data inputs are recorded and both games pass the agreed baseline smoke path.
|
||||
- Every Phase 0 ledger row has an evidence label, test/disposition, and variant scope.
|
||||
- Gun-running turn behavior has explicit cases for start-run, sustained run, small/large weapon state, tap/hold/release, and 8/16-direction modes, or is clearly isolated where a retail variant cannot be tested.
|
||||
- Auto-target tests show whether display resizing changes eligible targets. Any proposed fixed logical viewport is backed by a retail-derived rectangle and is isolated to the correct player selection path.
|
||||
- Manual projectile crosshair and target-reticle behavior have separate expected results.
|
||||
- The USECODE formula disagreement is resolved per supported archive, or custom USECODE changes remain blocked and the current retail behavior is not modified on guesswork.
|
||||
- Fixed-map and glob validators report malformed synthetic inputs before unsafe runtime parsing; retail reports identify all ignored remainders, invalid indices, and unresolved references.
|
||||
- No unsupported data files were added, and the baseline comparison shows no unintended changes to retail startup, map loading, targeting, or save/load.
|
||||
|
||||
If only the USECODE discrepancy remains open, Phase 0 may be **passed with an explicit block** for custom USECODE work, but the report must not claim mod-script compatibility. If movement/target behavior lacks a retail-derived expected result, those rows remain open and must not be presented as confirmed parity.
|
||||
|
||||
## Source and Evidence References
|
||||
|
||||
- [Parent feasibility study](../scummvm-crusader-enhancement-feasibility.md)
|
||||
- [ScummVM Crusader reference inventory](../scummvm-crusader-reference.md)
|
||||
- [Movement tap-turn analysis](../scummvm-crusader-movement-tap-turn.md)
|
||||
- [USECODE format specification](../usecode-format-specification.md)
|
||||
- [USECODE round-trip and parser work](../usecode-roundtrip-ir.md)
|
||||
- [Raw rendering and viewport evidence](../raw-0007-rendering.md)
|
||||
- [Remorse gameplay/input evidence](../ne-segment1.md)
|
||||
- [Regret-specific evidence index](../raw-porting-progress.md)
|
||||
- [Local EUSECODE extractor](../../tools/extract_eusecode_flx.py)
|
||||
|
||||
ScummVM source paths reviewed for this plan:
|
||||
|
||||
- `engines/ultima/ultima8/world/actors/cru_avatar_mover_process.cpp`
|
||||
- `engines/ultima/ultima8/world/target_reticle_process.cpp`
|
||||
- `engines/ultima/ultima8/world/crosshair_process.cpp`
|
||||
- `engines/ultima/ultima8/world/current_map.cpp`
|
||||
- `engines/ultima/ultima8/gumps/game_map_gump.cpp`
|
||||
- `engines/ultima/ultima8/world/map.cpp`
|
||||
- `engines/ultima/ultima8/world/map_glob.cpp`
|
||||
- `engines/ultima/ultima8/usecode/usecode_flex.cpp`
|
||||
- `engines/ultima/ultima8/usecode/usecode.cpp`
|
||||
37
docs/scummvm/run-scummvm.ps1
Normal file
37
docs/scummvm/run-scummvm.ps1
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
[CmdletBinding()]
|
||||
param (
|
||||
[ValidateSet('Debug', 'Release')]
|
||||
[string]$Configuration = 'Debug',
|
||||
[string[]]$ScummVMArgs = @()
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$sourceRoot = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..\..\..\scummvm'))
|
||||
$buildDirectory = Join-Path $sourceRoot 'build-msvc'
|
||||
$executable = Join-Path $buildDirectory "$($Configuration)x64\scummvm.exe"
|
||||
|
||||
if (-not (Test-Path -LiteralPath $executable -PathType Leaf)) {
|
||||
throw "'$executable' was not found. Run build-scummvm.ps1 -Configuration $Configuration first."
|
||||
}
|
||||
|
||||
$previousPath = $env:PATH
|
||||
try {
|
||||
$vcpkgBin = Join-Path $buildDirectory 'vcpkg_installed\x64-windows'
|
||||
if ($Configuration -eq 'Debug') {
|
||||
$vcpkgBin = Join-Path $vcpkgBin 'debug\bin'
|
||||
} else {
|
||||
$vcpkgBin = Join-Path $vcpkgBin 'bin'
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath $vcpkgBin -PathType Container)) {
|
||||
throw "The vcpkg $Configuration DLL directory was not found at '$vcpkgBin'."
|
||||
}
|
||||
$env:PATH = "$vcpkgBin;$previousPath"
|
||||
|
||||
& $executable @ScummVMArgs
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "ScummVM exited with code $LASTEXITCODE."
|
||||
}
|
||||
} finally {
|
||||
$env:PATH = $previousPath
|
||||
}
|
||||
39
docs/scummvm/smooth-camera-analysis.md
Normal file
39
docs/scummvm/smooth-camera-analysis.md
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# Crusader Smooth Camera Analysis
|
||||
|
||||
**Status:** Implementation applied; build and regression checks pending
|
||||
**Scope:** ScummVM's Ultima VIII engine camera behavior for No Remorse and No Regret
|
||||
|
||||
## Existing Behavior
|
||||
|
||||
- The existing `Camera moves with Silencer` option is `camera_on_player`. It is listed for Remorse, Regret, and the Regret demo, and defaults to enabled. Its purpose is to choose player tracking instead of map-defined camera snap positions.
|
||||
- In `SnapProcess::run()`, the option bypasses snap-egg selection and uses the controlled actor's center. If the active camera process is not already tracking the actor by object ID, the code replaces it with a point camera at that center.
|
||||
- The Z action is separately bound as `Center screen on Silencer`. Its handler creates a point camera at the actor's center; it does not change the camera's persistent target to the actor.
|
||||
- Therefore, the follow option is not simply a continuously repeated Z key. On initial game/map setup, the camera can track the actor as an item. If Z or another operation changes it to a point camera, the enabled follow option re-centers it from `SnapProcess` on subsequent ticks. The visible effect can resemble repeated recentering in that fallback path, but the camera process and update paths differ.
|
||||
- `CameraProcess::GetLerped()` interpolates between the previous and next camera endpoints using the renderer's frame interpolation factor. With no timed scroll active, those endpoints are refreshed on process ticks. Timed camera scrolling uses a linear, frame-count-based interpolation. Neither path currently provides a distinct multi-frame easing option.
|
||||
|
||||
## Recommended Option
|
||||
|
||||
Add an independent smooth-camera game option, defaulting off so existing behavior remains unchanged. Keep `camera_on_player` as the target-policy choice: follow the player, or use the map's snap eggs. The new option should control how the camera moves toward whichever target that policy selects.
|
||||
|
||||
When smoothing is enabled, retain a stable camera process and ease its position toward the current target over multiple updates. In player-follow mode, the target moves with the actor; in snap mode, the target changes when a new snap egg is selected. Avoid replacing the camera process every tick, since that restarts the transition and can prevent convergence.
|
||||
|
||||
Keep cutscene/stasis camera control and explicit scripted camera commands authoritative. Preserve current behavior for map changes, teleports, and save/load unless their transition policy is deliberately specified. Camera easing must continue updating the map fast area along the actual camera path; it must not change actor coordinates or collision behavior.
|
||||
|
||||
## Regression Checks
|
||||
|
||||
- With smoothing off, both Remorse and Regret retain the current camera behavior.
|
||||
- With smoothing on and player-follow off, entering a different snap-egg region moves the camera monotonically to the new anchor, then settles exactly on it.
|
||||
- With smoothing on and player-follow on, actor movement produces continuous camera motion without restarting the camera process each tick.
|
||||
- Compare the same movement at different frame rates and verify similar elapsed-time motion and exact convergence.
|
||||
- Verify Z still performs its documented recenter action, and that the option's fallback from a point camera does not cause jitter or a never-ending transition.
|
||||
- Check cutscenes/stasis, scripted `moveTo` and `scrollTo`, map changes, teleports, and save/load so smoothing does not override intentional camera control.
|
||||
- Confirm fast-area updates remain valid during a multi-frame transition and do not introduce missed or prematurely activated world objects.
|
||||
|
||||
## Source References
|
||||
|
||||
- [`SnapProcess`](../../../scummvm/engines/ultima/ultima8/world/snap_process.cpp)
|
||||
- [`CameraProcess`](../../../scummvm/engines/ultima/ultima8/world/camera_process.cpp)
|
||||
- [`GameMapGump`](../../../scummvm/engines/ultima/ultima8/gumps/game_map_gump.cpp)
|
||||
- [Ultima game options](../../../scummvm/engines/ultima/metaengine.cpp)
|
||||
- [Crusader key binding](../../../scummvm/engines/ultima/ultima8/metaengine.cpp)
|
||||
- [Crusader option registration](../../../scummvm/engines/ultima/detection_tables.h)
|
||||
95
docs/scummvm/visual-studio-build.md
Normal file
95
docs/scummvm/visual-studio-build.md
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
# ScummVM Visual Studio Build
|
||||
|
||||
These steps create an isolated MSVC solution for building the Ultima engine, including the Crusader camera changes. Generated project files, vcpkg packages, and binaries stay under the ignored `scummvm/build-msvc/` directory.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Visual Studio 2022 with the Desktop development with C++ workload, an MSVC x64 toolset, and a Windows SDK.
|
||||
- ScummVM's Visual Studio-bundled vcpkg. Run `vcpkg integrate install` once from that vcpkg distribution so MSBuild imports its C++ targets.
|
||||
- PowerShell with the ScummVM source root as the working directory.
|
||||
|
||||
The ScummVM wiki's Visual Studio page was behind an anti-bot challenge during verification. The commands below follow this checkout's `dists/msvc/readme.txt` and `devtools/create_project` generator.
|
||||
|
||||
## Build The Project Generator
|
||||
|
||||
From the ScummVM source root:
|
||||
|
||||
```powershell
|
||||
MSBuild.exe .\devtools\create_project\msvc\create_project.vcxproj /m /p:Configuration=Release /p:Platform=Win32 /verbosity:minimal
|
||||
```
|
||||
|
||||
The post-build event copies `create_project.exe` to `dists/msvc/`.
|
||||
|
||||
## Generate An Ultima Solution
|
||||
|
||||
Create `build-msvc/`, then run the generator from that directory:
|
||||
|
||||
```powershell
|
||||
Set-Location .\build-msvc
|
||||
..\dists\msvc\create_project.exe .. --msvc --vcpkg --disable-all-engines --enable-engine=ultima --enable-engine=ultima8
|
||||
```
|
||||
|
||||
The engine selection keeps builds focused while compiling the shared application, Ultima metaengine, and Ultima VIII/Crusader subengine.
|
||||
|
||||
## Helper Scripts
|
||||
|
||||
From this directory, build either configuration and launch it for testing:
|
||||
|
||||
```powershell
|
||||
.\build-scummvm.ps1 -Configuration Debug
|
||||
.\run-scummvm.ps1 -Configuration Debug -ScummVMArgs @('--version')
|
||||
.\build-scummvm.ps1 -Configuration Release
|
||||
.\run-scummvm.ps1 -Configuration Release -ScummVMArgs @('--version')
|
||||
```
|
||||
|
||||
The build script creates the solution and build-local vcpkg files when needed. Use `-RegenerateProject` to rebuild the project generator and regenerate the solution. The launcher temporarily adds the matching vcpkg DLL directory to `PATH` for either configuration.
|
||||
|
||||
## Isolate The vcpkg Manifest
|
||||
|
||||
This checkout's root `vcpkg.json` does not declare a registry baseline. The installed vcpkg requires one, so keep the workaround local to `build-msvc/` rather than editing the source manifest.
|
||||
|
||||
Copy the root `vcpkg.json` into `build-msvc/` and change its package name to `scummvm-local-build`. Copy the `embeddedsha` value from the Visual Studio vcpkg root's `vcpkg-bundle.json` into this `build-msvc/vcpkg-configuration.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"default-registry": {
|
||||
"kind": "builtin",
|
||||
"baseline": "<embeddedsha from vcpkg-bundle.json>"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Add `build-msvc/Directory.Build.props` so MSBuild uses this local manifest and install tree:
|
||||
|
||||
```xml
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<VcpkgManifestRoot>$(MSBuildThisFileDirectory)</VcpkgManifestRoot>
|
||||
<VcpkgInstalledDir>$(MSBuildThisFileDirectory)vcpkg_installed</VcpkgInstalledDir>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
```
|
||||
|
||||
If the files already exist, update the copied dependency list when the root manifest changes, and refresh the baseline when the Visual Studio vcpkg bundle changes. Keep these three build-local files when regenerating the solution; the project generator does not create them.
|
||||
|
||||
## Build And Smoke-Test
|
||||
|
||||
From the ScummVM source root:
|
||||
|
||||
```powershell
|
||||
MSBuild.exe .\build-msvc\scummvm.sln /m /p:Configuration=Debug /p:Platform=x64 /verbosity:minimal
|
||||
MSBuild.exe .\build-msvc\scummvm.sln /m /p:Configuration=Release /p:Platform=x64 /verbosity:minimal
|
||||
$env:PATH = (Resolve-Path .\build-msvc\vcpkg_installed\x64-windows\debug\bin).Path + ";" + $env:PATH
|
||||
.\build-msvc\Debugx64\scummvm.exe --version
|
||||
$env:PATH = (Resolve-Path .\build-msvc\vcpkg_installed\x64-windows\bin).Path + ";" + $env:PATH
|
||||
.\build-msvc\Releasex64\scummvm.exe --version
|
||||
```
|
||||
|
||||
The Debug and Release binaries are written to `build-msvc/Debugx64/` and `build-msvc/Releasex64/`. The first build restores dependencies into `build-msvc/vcpkg_installed/`. Add the matching vcpkg `bin` directory to `PATH` when launching either configuration.
|
||||
|
||||
## Verified Here
|
||||
|
||||
- Built `create_project.exe` with Visual Studio MSBuild 17.14 and the installed v143 toolset.
|
||||
- Generated the Ultima-only solution with MSVC 17 and vcpkg manifest mode.
|
||||
- Debug and Release x64 builds passed after enabling vcpkg MSBuild integration and supplying the isolated manifest baseline.
|
||||
- Both executables passed `--version` with the matching vcpkg `bin` directory on `PATH`.
|
||||
|
|
@ -53,6 +53,27 @@ The nearby fixed-data loader path now closes this pretty tightly.
|
|||
|
||||
That means the printed line is specifically about an alternate fixed-map archive, not a config file, not a save file, and not a usecode package.
|
||||
|
||||
## Normal Archive And Current GOG Install
|
||||
|
||||
The base and patch paths use the same filename under different DOS roots.
|
||||
|
||||
In the live Remorse image:
|
||||
|
||||
- `g_pCDLetter` points to the string `d:`
|
||||
- `g_fixedDatFilenamePtr` points to `fixed.dat`
|
||||
- `FixedDat_LoadData()` calls `Filespec_GetFullPath("d:", "static", "fixed.dat", 0)`
|
||||
- the normal archive is therefore `D:\STATIC\FIXED.DAT`
|
||||
- the optional patch check is the literal relative path `static\fixed.dat`
|
||||
|
||||
The current GOG DOSBox configuration makes those paths distinct. Its `autoexec` mounts `F:\Apps\Crusader No Remorse` as DOS `C:`, mounts `GAME.GOG` as ISO drive `D:`, switches to `C:`, and launches `CRUSADER.EXE`. For this launch:
|
||||
|
||||
- base archive: `D:\STATIC\FIXED.DAT` inside `GAME.GOG`
|
||||
- optional patch: `C:\STATIC\FIXED.DAT` in the installed game directory
|
||||
|
||||
Both files are present in the current install. The ISO contains a 3,734,592-byte `STATIC\FIXED.DAT`; the local `STATIC\FIXED.DAT` is 3,735,392 bytes. Their different sizes establish that the local file is not a byte-for-byte copy of the ISO archive. The local file makes the optional patch path exist, so this launch takes the patch-file branch.
|
||||
|
||||
The `D:` archive is the original map data shipped on the game disc. GOG ships the game with the later published floppy patch already applied in the local `C:\STATIC\FIXED.DAT`, including its map fixes. The GOG install therefore contains both versions: the original archive remains in `GAME.GOG`, while the patched copy is present from installation and selected through the executable's optional patch path. The files' different sizes are consistent with that history.
|
||||
|
||||
## What It Does At Runtime
|
||||
|
||||
The strongest currently recovered consumer is the fixed-map load path in the same item-cache family.
|
||||
|
|
@ -77,6 +98,14 @@ Current safest interpretation:
|
|||
|
||||
Current evidence does **not** show a merge path.
|
||||
|
||||
### Map Entry Present Only In The Patch
|
||||
|
||||
`ItemCache_LoadMapFromActiveFixedDat()` selects the patch handle before reading the requested map entry. It does not first require that the map exist in the base archive. Therefore a valid patch entry at the requested map index can supply a map absent from the base archive, provided the base archive file itself is present. Once the patch handle is selected, missing entries are not read from the base archive.
|
||||
|
||||
### Patch File Present, Base Archive Missing
|
||||
|
||||
The base archive is opened first, before `ItemCache_InitAndLoadFixedDat()` checks for the relative patch file. `FixedDat_LoadData()` passes the resolved `D:\STATIC\FIXED.DAT` path to the fixed archive loader in read mode. That loader checks the file and routes a missing read-mode file into an assertion/error path, including an `INT3`, rather than treating the patch as a replacement for the missing base. The patch-only case is therefore not a supported fallback. This conclusion is from the live code path, not a runtime test with the ISO archive removed.
|
||||
|
||||
What is directly recovered:
|
||||
|
||||
- the game keeps two archive handles: base `DAT_1478_1060` and optional patch `DAT_1478_1064`
|
||||
|
|
@ -120,6 +149,14 @@ It is also **not** currently evidenced as a merge-style overlay:
|
|||
|
||||
So the safest current wording is `replacement-preferred alternate FIXED.DAT source`, not `per-entry patch merge`.
|
||||
|
||||
## GLOB.FLX
|
||||
|
||||
Globs use a separate normal asset loader, not the fixed-map patch handle.
|
||||
|
||||
`ItemGlob_LoadData()` at `1098:0000` builds a path with `Filespec_GetFullPath(0, "static", g_globFlxFilenamePtr, 0)` and loads it through the Flex loader in read mode. `ItemGlob_Init()` initializes the glob cache through `ItemGlob_AllocAndInit()`. This path does not pass the explicit `D:` root used for base `FIXED.DAT`, and the startup code has no second glob handle or optional glob-patch existence check.
|
||||
|
||||
The current DOSBox launch starts from `C:` and the install has `C:\STATIC\GLOB.FLX`; the ISO also contains `D:\STATIC\GLOB.FLX`. Their sizes are 264,974 and 264,884 bytes respectively, so the local and ISO copies differ in length. The glob loader uses the normal/default Filespec path rather than the fixed archive's explicit `D:` path. In this setup the local `C:\STATIC\GLOB.FLX` is the expected source; there is no recovered merge or sidecar-patch mechanism for globs. Modifying that resolved local file is replacement at the normal asset path, not an additive overlay.
|
||||
|
||||
## Practical Meaning
|
||||
|
||||
When retail No Remorse prints `Using map patch file.` at startup, it means:
|
||||
|
|
@ -132,6 +169,9 @@ In plain terms: the executable is telling you it found a replacement/patch copy
|
|||
|
||||
## Evidence Summary
|
||||
|
||||
- `1220:0070 Fastflex_1220_0070` checks the base file in read mode and enters an assertion/`INT3` path if it is absent
|
||||
- `1098:0000 ItemGlob_LoadData` loads the ordinary `GLOB.FLX` through the default `static` Filespec path; no glob patch handle was recovered
|
||||
- the current GOG DOSBox config mounts the install as `C:` and `GAME.GOG` as ISO `D:`; both `FIXED.DAT` and `GLOB.FLX` exist on each drive with different file sizes
|
||||
- `1048:039b Init_Everything` checks `File_Exists("static\\fixed.dat")` and prints `1478:09cc` only on success
|
||||
- `10a8:163a ItemCache_InitAndLoadFixedDat` loads base `fixed.dat` plus optional `static\\fixed.dat`
|
||||
- `10b8:0616 FixedDat_LoadData` resolves the standard `fixed.dat` path from `g_fixedDatFilenamePtr`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue