diff options
| author | imShangLi <imshangli@users.noreply.github.com> | 2026-12-02 12:19:23 +0800 |
|---|---|---|
| committer | imShangLi <imshangli@users.noreply.github.com> | 2026-12-02 12:19:23 +0800 |
| commit | 76ba820fb836259a8badd17aedc1cee3d6153ca6 (patch) | |
| tree | b6230833716b12b0c4eca28a3666a9b5f079d54e /docs/lua-modding.md | |
| parent | 8422def759cda12c89f918438eeb8d53dd5972a6 (diff) | |
D3D12-LUA-MEMORY-SCAN-BOUNDS: a scan covers a bounded range and its options are checked
The range of leonida.memory.scan was checked against the process, not against
the work it causes: a mod could ask for the whole user range (128 TiB) and the
scan's time was refunded to the call budget, so nothing stopped it. The one
thread that runs every mod then sat in the scan for hours, and the other mods,
the menu callbacks and the reload path waited for it.
- one scan covers at most 256 MiB (the whole image, when it is bigger)
- start, size and max are whole numbers: a negative one or another kind of
value is refused with the reason, not taken for something else
- without a size, the range reaches the end of the image (it ended 100 bytes
short when it started below the image)
Diffstat (limited to 'docs/lua-modding.md')
| -rw-r--r-- | docs/lua-modding.md | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/lua-modding.md b/docs/lua-modding.md index 6dbfc92bb..713b0213d 100644 --- a/docs/lua-modding.md +++ b/docs/lua-modding.md | |||
| @@ -137,6 +137,11 @@ range are refused. Patterns are hex bytes with `??` (or `?`) for any byte, space | |||
| 137 | most `max` (default 100, ceiling 10,000) addresses in order. A scan of the 114 MB image reads it once in 1 MiB steps | 137 | most `max` (default 100, ceiling 10,000) addresses in order. A scan of the 114 MB image reads it once in 1 MiB steps |
| 138 | on the Lua thread, and the time it takes does not count against the mod's time budget. | 138 | on the Lua thread, and the time it takes does not count against the mod's time budget. |
| 139 | 139 | ||
| 140 | `start`, `size` and `max` are whole numbers; anything else (a negative number, a string) is refused with the reason, | ||
| 141 | not taken for something else. Without a `size`, the range reaches the end of the image. One scan covers at most | ||
| 142 | 256 MiB (the whole image, when it is bigger): a mod may not make the runtime read the whole address space, which | ||
| 143 | would keep the mods' thread busy for hours. | ||
| 144 | |||
| 140 | What it does not do: it does not know what the title keeps where. There is no table of the title's data here (the | 145 | What it does not do: it does not know what the title keeps where. There is no table of the title's data here (the |
| 141 | title's own script natives were not found, `docs/mod-menu.md`); a mod author finds addresses with `scan` and their | 146 | title's own script natives were not found, `docs/mod-menu.md`); a mod author finds addresses with `scan` and their |
| 142 | own tools and takes the risk that a write corrupts the title. A write is checked to land on a page that can be | 147 | own tools and takes the risk that a write corrupts the title. A write is checked to land on a page that can be |