Skip to content

Detour testing framework - #92

Open
finnhartshorn wants to merge 7 commits into
mainfrom
feature/detour-testing-framework
Open

Detour testing framework#92
finnhartshorn wants to merge 7 commits into
mainfrom
feature/detour-testing-framework

Conversation

@finnhartshorn

Copy link
Copy Markdown
Member

Description

Proposed Changes

Checklist

  • Docs
  • Manually tested
  • Unit tests (where possible)

@finnhartshorn
finnhartshorn force-pushed the feature/detour-testing-framework branch from e8ce74f to 4ec1799 Compare August 18, 2026 14:57
…al tip

Files touched by neither feature/egui-overlay-plumbing nor
feature/save-logging, copied verbatim from the original 36-commit
feature/detour-testing-framework tip (e8ce74f) onto main. Covers the
detour validation framework, openzt-instance-manager, and detour test
tooling. Shared files (Cargo.lock, openzt/Cargo.toml,
openzt-dll/Cargo.toml, openzt.bat, openzt/src/lib.rs,
openzt-detour/src/generated.rs) are handled separately.
openzt/src/lib.rs, openzt.bat, openzt/Cargo.toml, openzt-dll/Cargo.toml,
and openzt-detour/src/generated.rs are also touched by
feature/egui-overlay-plumbing and/or feature/save-logging. Since this
branch must not depend on those branches, each file's detour-testing
content was hand-extracted:

- lib.rs: detour_validation module + OPENZT_VALIDATE_DETOURS env var
  init, plus two unrelated fixes (load_lang_dlls signature, collapsible_if
  cleanup). Excludes save_logging/cursors/ui modules.
- openzt.bat: --no-pause global flag infrastructure and validate-detours
  command. Excludes egui's test-egui-tiny-skia addition.
- openzt/Cargo.toml, openzt-dll/Cargo.toml: detour-validation feature
  and inventory dependency only. Excludes egui deps/features and
  unrelated toml/nt-time version bumps.
- generated.rs: every entry gets detour-testing's validate_detour
  annotation. For the ~49 entries whose pointer type egui or
  save-logging retyped, the type is reverted to main's original so this
  branch carries only the annotation, not their retyping work. 11
  entries (new SAVE hooks, including a whole new ztshowscriptstate
  module) that save-logging added from scratch are dropped entirely
  since they aren't detour-testing's content.
Both files are new/changed only by feature/detour-testing-framework's
own commits (untouched by egui-overlay-plumbing or save-logging), but
their content documents/depends on the egui overlay work that isn't
part of this branch's scope: AGENTS.md documented the egui-overlay
feature and its build commands, and root Cargo.toml listed
egui-tiny-skia as a workspace member even though that crate directory
only exists on feature/egui-overlay-plumbing.
Wholesale-copying ztworldmgr.rs from the original detour-testing-framework
tip reintroduces the pre-existing bug where avoid_edges - 1 stays
unsigned, making radius < 0 always false and tripping clippy's
deny-by-default absurd_extreme_comparisons lint. Cast to i32 before
subtracting, same fix already applied on main.
@finnhartshorn
finnhartshorn force-pushed the feature/detour-testing-framework branch from 4ec1799 to 76db7d9 Compare August 18, 2026 22:50
…riginal tip

The wholesale-copy step earlier this session sourced its "48 exclusive
files" from the original 36-commit detour-testing-framework tip
(e8ce74f), cross-checked only against feature/egui-overlay-plumbing and
feature/save-logging. That missed that main had independently moved
past the same stale tip via four already-merged extraction PRs
(struct-foundation #94, tank/habitat #95, string-registry #96,
ZTResearch #97) - none of which the cross-check accounted for. The
result silently reverted their fixes wherever a file only they (not
egui/save-logging) had touched: a real logic bug reintroduced in
ZTAnimal::get_footprint's rotation branch, a ZTHabitat struct-layout
regression (water_level/is_filled fields dropped), a deliberately
broken proptest assertion in reimplementation_tests, and openzt-detour
disabling the already-merged structs module.

Fix: ztworldmgr.rs, bfentitytype.rs, ztmapview.rs, zthabitatmgr.rs,
ztresearch.rs, bfconfigfile.rs, and reimplementation_tests/mod.rs are
reverted to main's content wholesale (byte-identical, verified via
empty diff) - detour-testing-framework has no legitimate independent
claim on entity-type/world-mgr/research logic. openzt-detour/src/lib.rs
re-enables `pub mod structs;`.

generated.rs is rebuilt from main's content instead of the stale tip:
every entry keeps main's current type and gets the validate_detour
annotation where the tip has one, except the ~46 entries (bfregistry,
bfmgr, uielement, bflog, ztapp, bfresource*, ztui_general, bfuimgr,
ztscenerytype, ztmapview::PLACE_ENTITY_ON_MAP_1, ztui_gameopts,
bfversioninfo, bfapp::LOAD_LANG_DLLS) that detour-testing's own
genuinely-owned files (roofs.rs, bfregistry.rs, resource_manager/hooks.rs,
experimental.rs, version.rs, capture_ztlog.rs, command_console.rs,
lib.rs) actually call with a retyped pointer signature - confirmed by
compiling and fixing exactly what broke, rather than assuming. Also
added ztui::EXIT_APP, a new entry detour_validation.rs itself needs
that never existed on main.

Verified ./openzt.bat check/clippy clean under both default features
and default+detour-validation (temporarily, reverted after).
Another artifact of the stale original tip: init() called
zoo_experimental::init_detours() on main, but the wholesale copy
carried a commented-out version that silently disabled every
experimental detour, including the pre-existing DISPLAY_MESSAGE_0 hook
main already had active - not something detour-testing ever intended
to ship disabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant