Repository navigation
restofworld_model_join: handle straddling page-map slots, sort loose hex dirs numerically, and harden index.json load - #7750
Open
narekshaghoyandev wants to merge 1 commit into
Conversation
…hex dirs numerically, and harden index.json load
This was referenced Nov 23, 2026
|
Tested
AI-assisted. |
Contributor
|
Tested 3e4d11c on Windows 11 (26200.9974), Python 3.12.0: pass.
One wording nit only: a non-zero slot beyond the 16-byte header, when those bytes happen to be present, is reported as "in page-map header". Both the old and new tests match that string, so I would not change it now. Synthetic fixtures only; no game data. AI-assisted. |
Contributor
|
Tested 3e4d11c on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass. Ran the test files this PR adds or changes, from a clean checkout of the PR head: AI-assisted (Claude Code). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes three edge-case bugs in
tools/restofworld_model_join.py(with zero overlap against #6514, #4021, and #5550):datResourceMapslot array straddling a 64 KiB system page boundary (_parse_page_map_header,ModelSystemPages.accept,join_streams):join_streamspreviously stopped fetching system chunks once the 16-byte page-map header fit (p8_off + 16) and immediately called fullparse_page_map(sys_probe)before appending the remaining declaredsystem_pages, causing valid multi-page resources whose8 * (sp + gp)runtime slot array straddles into the next system page to fail prematurely withpage-map slot array extends past system segment. Similarly,ModelSystemPages.acceptdropped a short (< 64-byte) final system page when the page-map slot array crossed out of page 0. Now_parse_page_map_headervalidates the 16-byte header and any slot bytes already present in page 0 so remaining declared system pages are fetched first, and fullparse_page_map(sys_bytes)validates the complete slot array across all system pages.scan_dir): Whenindex.jsonis absent,scan_dirsorted directory entries lexicographically (sorted(os.listdir(path))) and checked case-sensitive.bin/.bk2endings, which reversed mixed-width (100010.binvs1000010.bin) or mixed-case (0000000a0010.binvs0000000B0010.BIN) hex filenames and skipped uppercase extensions. Loose directories are now ordered numerically by their hex offset prefix (preserving exact behavior for equal-width lowercase names) and match.bin/.bk2case-insensitively.index.jsonBOM and deep nesting (_carve_rows): Readsindex.jsonasutf-8-sigso a UTF-8 BOM does not fail JSON parsing, and turnsRecursionErrorfrom deeply nested JSON into a cleanValueErrorinstead of an unhandled traceback.Verification
python3 -I tests/test_restofworld_model_join.py -v: 12/12 pass (all 3 new tests fail/error againstmain).python3 -I scripts/check_no_game_data.py tools/restofworld_model_join.py tests/test_restofworld_model_join.py: clean.python3 -m compileall -q tools/restofworld_model_join.py tests/test_restofworld_model_join.py: clean.Claim: #7694 (comment)
AI-assisted: yes (Gemini)