[PR #717] [MERGED] OLD-7482: restore old upstream PR 7482 - instance_lists, world_interior_names, world_lights_paths: read the block number from 20 bits #755

Closed
opened 2026-11-26 20:18:56 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/717
Author: @aslan2142
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142

Base: main ← Head: resource-pointer-width


📝 Commits (2)

  • 9898dee instance_lists, world_interior_names: read the block number from 20 bits, as world_index and psin_data do
  • 0cbc402 world_lights_paths: read pool references through world_index.split_pointer

📊 Changes

10 files changed (+59 additions, -14 deletions)

View changed files

📝 docs/world.md (+6 -1)
📝 docs/world_lights_paths.md (+2 -2)
📝 tests/test_instance_lists.py (+9 -0)
📝 tests/test_world_index.py (+8 -0)
📝 tests/test_world_interior_names.py (+8 -0)
📝 tests/test_world_lights_paths.py (+10 -1)
📝 tools/instance_lists.py (+2 -2)
📝 tools/world_index.py (+7 -1)
📝 tools/world_interior_names.py (+2 -3)
📝 tools/world_lights_paths.py (+5 -4)

📄 Description

Claimed in the coordination issue as: OLD-7482 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7131947083

Restoration of my original pull request, old upstream PR 7482 in ItsNotRexed/Leonida, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at 51f3160923; the two commits cherry-picked without conflicts and are unchanged.

What and why

  • A resource pool pointer keeps its 1-based block number in the low 20 bits and the byte offset from bit 20 (docs/psin.md, docs/ped_catalogues.md, tools/psin_data.py).
  • instance_lists and world_interior_names masked only 12 bits, as docs/world.md said. A block number of 4,096 or more would be read as the wrong block.
  • world_lights_paths (Meta.ref) also read 12 bits. It refused any pointer with bits 12-19 set as a pool reference, so a pointer to block 4,096 or above fell through to the system-pointer path.
  • New world_index.split_pointer is now the one decoder for all three tools and for world_index itself, which already read 20 bits inline.
  • docs/world.md and docs/world_lights_paths.md now give the 20-bit form.
  • On the game's current resources, bits 12-19 are always zero, so the tools' reported counts don't change. The fix matters for a resource with 4,096 blocks or more.
  • One synthetic test per tool covers a block number above 4,095, and split_pointer has its own test.
  • Draft #315 (old-pr/10049) touches tools/instance_lists.py, tests/test_instance_lists.py and docs/world.md too; git merge-tree finds no conflict with it.

Tested

Linux, Python 3.14, CPU only, synthetic inputs only (no game files).

  • main with only this PR's tests added: the 4 new tests fail (3 FAIL, 1 ERROR).
  • This branch, standalone with python -I:
    • tests/test_instance_lists.py: 17 tests OK.
    • tests/test_world_index.py: 47 tests OK (5 skipped, as on main).
    • tests/test_world_interior_names.py: 28 tests OK.
    • tests/test_world_lights_paths.py: 32 tests OK (1 skipped, as on main).
  • python -m compileall -q tools tests, git diff --check and python -I scripts/check_no_game_data.py on the 10 changed files: clean.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

AI-assisted (Claude Code, Claude Opus 5.5).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/717 **Author:** [@aslan2142](https://github.com/aslan2142) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `resource-pointer-width` --- ### 📝 Commits (2) - [`9898dee`](https://github.com/ubiquitarianism/leonida/commit/9898deecbb8c6b3202e59c5ae95eb720a350ac22) instance_lists, world_interior_names: read the block number from 20 bits, as world_index and psin_data do - [`0cbc402`](https://github.com/ubiquitarianism/leonida/commit/0cbc40239bffe3a873ec938047558322f7d67d22) world_lights_paths: read pool references through world_index.split_pointer ### 📊 Changes **10 files changed** (+59 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `docs/world.md` (+6 -1) 📝 `docs/world_lights_paths.md` (+2 -2) 📝 `tests/test_instance_lists.py` (+9 -0) 📝 `tests/test_world_index.py` (+8 -0) 📝 `tests/test_world_interior_names.py` (+8 -0) 📝 `tests/test_world_lights_paths.py` (+10 -1) 📝 `tools/instance_lists.py` (+2 -2) 📝 `tools/world_index.py` (+7 -1) 📝 `tools/world_interior_names.py` (+2 -3) 📝 `tools/world_lights_paths.py` (+5 -4) </details> ### 📄 Description Claimed in the coordination issue as: OLD-7482 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7131947083 Restoration of my original pull request, old upstream PR 7482 in `ItsNotRexed/Leonida`, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at 51f31609236a952badeb9c9aba9efc2a6e4dc2ff; the two commits cherry-picked without conflicts and are unchanged. ### What and why - A resource pool pointer keeps its 1-based block number in the low 20 bits and the byte offset from bit 20 (`docs/psin.md`, `docs/ped_catalogues.md`, `tools/psin_data.py`). - `instance_lists` and `world_interior_names` masked only 12 bits, as `docs/world.md` said. A block number of 4,096 or more would be read as the wrong block. - `world_lights_paths` (`Meta.ref`) also read 12 bits. It refused any pointer with bits 12-19 set as a pool reference, so a pointer to block 4,096 or above fell through to the system-pointer path. - New `world_index.split_pointer` is now the one decoder for all three tools and for `world_index` itself, which already read 20 bits inline. - `docs/world.md` and `docs/world_lights_paths.md` now give the 20-bit form. - On the game's current resources, bits 12-19 are always zero, so the tools' reported counts don't change. The fix matters for a resource with 4,096 blocks or more. - One synthetic test per tool covers a block number above 4,095, and `split_pointer` has its own test. - Draft #315 (`old-pr/10049`) touches `tools/instance_lists.py`, `tests/test_instance_lists.py` and `docs/world.md` too; `git merge-tree` finds no conflict with it. ### Tested Linux, Python 3.14, CPU only, synthetic inputs only (no game files). - `main` with only this PR's tests added: the 4 new tests fail (3 FAIL, 1 ERROR). - This branch, standalone with `python -I`: - `tests/test_instance_lists.py`: 17 tests OK. - `tests/test_world_index.py`: 47 tests OK (5 skipped, as on `main`). - `tests/test_world_interior_names.py`: 28 tests OK. - `tests/test_world_lights_paths.py`: 32 tests OK (1 skipped, as on `main`). - `python -m compileall -q tools tests`, `git diff --check` and `python -I scripts/check_no_game_data.py` on the 10 changed files: clean. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) AI-assisted (Claude Code, Claude Opus 5.5). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:56 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#755
No description provided.