diff options
| -rw-r--r-- | apps/fparkan-game/src/script_coverage.rs | 3 | ||||
| -rw-r--r-- | crates/fparkan-runtime/src/clan_ai_events.rs | 23 | ||||
| -rw-r--r-- | crates/fparkan-runtime/src/lib.rs | 6 | ||||
| -rw-r--r-- | docs/appendices/knowledge-boundaries.md | 2 |
4 files changed, 34 insertions, 0 deletions
diff --git a/apps/fparkan-game/src/script_coverage.rs b/apps/fparkan-game/src/script_coverage.rs index 0b0eea99..fa6c156d 100644 --- a/apps/fparkan-game/src/script_coverage.rs +++ b/apps/fparkan-game/src/script_coverage.rs @@ -21,6 +21,9 @@ pub(super) fn log_script_init(engine: &Engine, mission: &str) { } pub(super) fn log_clan_ai_stops(report: &SimulationReport) { + for &(clan, count) in &report.clan_research_status_stubs { + eprintln!("sim_coverage script_research_status_stubs={count} clan={clan}"); + } for (stop, count) in &report.clan_ai_event_stops { eprintln!( "sim_coverage script_clan_ai_stops={count} clan={} script={} event={} instruction={} reason={}", diff --git a/crates/fparkan-runtime/src/clan_ai_events.rs b/crates/fparkan-runtime/src/clan_ai_events.rs index caca586c..e0ed4906 100644 --- a/crates/fparkan-runtime/src/clan_ai_events.rs +++ b/crates/fparkan-runtime/src/clan_ai_events.rs @@ -7,6 +7,7 @@ use std::collections::BTreeMap; pub(super) struct ClanAiEvents { next_ms: BTreeMap<usize, u32>, stops: BTreeMap<(usize, usize, usize), (MissionEventStop, u64)>, + research_status_stubs: BTreeMap<usize, u64>, } impl LoadedMissionState { @@ -66,6 +67,22 @@ impl LoadedMissionState { class, ))) } + ScriptDispatchSelector::Handler(65) if instruction.references.is_empty() => { + // RVA 0x111d0 returns false while the research catalog is unloaded. + let count = self + .clan_ai_events + .research_status_stubs + .entry(clan) + .or_default(); + *count += 1; + if *count == 1 { + eprintln!( + "sim_coverage script_research_status_stub=1 clan={clan} script={}", + bundle.script_path + ); + } + Ok(Some(0)) + } selector => Err(format!("{selector:?}")), }, ); @@ -113,6 +130,12 @@ impl ClanAiEvents { pub(super) fn stops(&self) -> impl Iterator<Item = (&MissionEventStop, u64)> { self.stops.values().map(|(stop, count)| (stop, *count)) } + + pub(super) fn research_status_stubs(&self) -> impl Iterator<Item = (usize, u64)> + '_ { + self.research_status_stubs + .iter() + .map(|(&clan, &count)| (clan, count)) + } } #[cfg(test)] diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs index 3b857586..ed6b6aa6 100644 --- a/crates/fparkan-runtime/src/lib.rs +++ b/crates/fparkan-runtime/src/lib.rs @@ -2899,6 +2899,8 @@ pub struct SimulationReport { pub mission_event_stops: Vec<MissionEventStop>, /// Uncovered clan AI instructions and the number of invocations they stopped. pub clan_ai_event_stops: Vec<(MissionEventStop, u64)>, + /// Research status calls handled with an unloaded catalog, grouped by clan. + pub clan_research_status_stubs: Vec<(usize, u64)>, /// Total requests for mission information messages. pub mission_messages: u64, /// Clock of the first autonomous shot, in milliseconds. @@ -2933,6 +2935,7 @@ pub fn simulate_mission_report( mission_events: 0, mission_event_stops: Vec::new(), clan_ai_event_stops: Vec::new(), + clan_research_status_stubs: Vec::new(), mission_messages: 0, autodemo_first_shot_ms: None, autodemo_first_destroyed_ms: None, @@ -2984,6 +2987,9 @@ pub fn simulate_mission_report( .stops() .map(|(stop, count)| (stop.clone(), count)), ); + report + .clan_research_status_stubs + .extend(loaded.clan_ai_events.research_status_stubs()); } Ok(report) } diff --git a/docs/appendices/knowledge-boundaries.md b/docs/appendices/knowledge-boundaries.md index 263cc389..bf026f35 100644 --- a/docs/appendices/knowledge-boundaries.md +++ b/docs/appendices/knowledge-boundaries.md @@ -437,6 +437,8 @@ core и `ResearchCandidateSet::refresh_selection`: последний получ `Handler(69)` по RVA `0xf06c` записывает неотрицательный DWORD в поле AI `+0x41c`. Игровой `Init` учитывает эту форму как заглушку до подключения потребителя поля к логике AI. +`script_research_status_stubs` считает вызовы `Handler(65)` без каталога. +Оригинальный getter `ai.dll+0x111d0` возвращает ноль в этом состоянии. `Handler(15)` для `ORDER_ROBOT_SEARCH` генератора пока проходит как `script_init_handler_stub`. GOG Behavior.dll по RVA `0x30110` настраивает поиск строения, а задача по RVA `0x30300` обрабатывает в том числе захват. |
