mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-16 01:49:58 -04:00
The review of the NX2NAVI_COPY_RETIRE count found a double count. A record counts as live while copy_find(handle) succeeds and made_at (nsubmits at copy_add) and the size both match. A copy that AddControlMemory released and the game recorded again with the same size before the next submission can get the same host block back, so the old record matched the new copy too: one live copy had two records, and the old one, fingerprinted over the bytes before the rewrite, counted it under "control memory changed". That breaks the count's stated lower bound. retire_pass now keeps a map from handle to record index (retire_at, the sweep thread's own) and drops the existing record of a handle before it appends the new copy's: a newer copy with that handle means the older one was retired. retire_drop takes a record out of the counts and the map and moves the last record into its place, for both that case and the visits' removal of copies that are no longer live. Nothing is added to copy_prefix. At the default copy_retire = 0 the sweep never runs. Not reproduced before the change in a game run. tests/copy_sweep_check.py queues a copy again with the same handle, made_at and size over changed control bytes: it must keep one record and leave the changed count. Against the previous nvn_api_cmd.c it fails with 7 records and copy 2 still counted as changed. The check passes, and the compile check of nvn_api_cmd.c (also with -Wall -Wextra) adds no warnings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
83 KiB
83 KiB