From 0cd6359c4abc90b458a2b90daadccdb6aee8e2c4 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 25 Nov 2026 21:24:27 +0400 Subject: fix(ai): expose the native research catalog scan status Handler(56) returned a constant zero and was described as an automatic research permission flag. It actually normalizes the cached candidate scan byte. Read ResearchCandidateSet.status without refreshing the catalog and report queries by clan and result instead of counting them as stubs. GOG ai.dll SHA-256 c19cd6cd31cd2896f8c4ba0f0e700dd3408aec8182daaf4863d98a7d233a2abc: Handler(56), RVA 0xe430, reads AI+0x431. Native calls to this getter and the chooser at 0x10f90 confirm that finishing the last candidate preserves the old scan flag until the next refresh. Empty/processed sets, missing pending candidates, stale flags, and noncanonical nonzero bytes were exercised. A live stock Single.01 query also returned zero from the same cached byte. The shipped scream.scr condition suppresses the laboratory request for a nonzero result. An ignored resource test executes that original condition and request for cached bytes 0, 1 and 255; an ordinary Rust test covers the cached-state semantics and missing catalog. This isolated branch check does not establish that an entire mission has exhausted all research naturally. Validated fmt, workspace check/tests, the licensed scenario-branch test and the release build. All 29 stock missions pass --sim-report 900 without new script stops; stock mission 28 also runs in the window with ongoing research and the native zero result. None of these stock runs reached a nonzero scan flag. Handler(58) upgrades and Handler(65) candidate power remain explicit stubs, and full timed AI/mission parity remains open. --- crates/fparkan-runtime/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'crates/fparkan-runtime/src/lib.rs') diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs index 730c52ab..317fc539 100644 --- a/crates/fparkan-runtime/src/lib.rs +++ b/crates/fparkan-runtime/src/lib.rs @@ -2923,6 +2923,8 @@ pub struct SimulationReport { pub clan_ai_clock_ticks: Vec<(usize, u64, u64)>, /// Calls to stubbed research policy or status, grouped by clan and handler. pub clan_research_status_stubs: Vec<(usize, u8, u64)>, + /// Cached catalog scan queries, grouped by clan and normalized result. + pub clan_research_scan_queries: Vec<(usize, u32, u64)>, pub clan_research_catalogs: Vec<(usize, usize, u32, u64)>, pub laboratory: LaboratoryReport, /// Counts of pending script problems by clan and problem kind. @@ -2999,6 +3001,7 @@ pub fn simulate_mission_report( clan_ai_event_stops: Vec::new(), clan_ai_clock_ticks: Vec::new(), clan_research_status_stubs: Vec::new(), + clan_research_scan_queries: Vec::new(), clan_research_catalogs: Vec::new(), laboratory: Default::default(), clan_problem_dispatch_stubs: Default::default(), @@ -3102,6 +3105,9 @@ pub fn simulate_mission_report( report .clan_research_status_stubs .extend(loaded.clan_ai_events.research_status_stubs()); + report + .clan_research_scan_queries + .extend(loaded.clan_ai_events.research_scan_queries()); report .clan_ai_clock_ticks .extend(loaded.clan_ai_events.clock_ticks()); -- cgit v1.2.3