levels.rpf: 16-byte misalignment after decompression -> dstorage hr=0x8007000d, title stops at +0x4da6315 #3335

Open
opened 2026-11-29 22:01:04 +00:00 by github-bot · 5 comments
Owner

@⁠suluojin-ui on GitHub · 2026-11-29 21:56 UTC · original

A 16-byte misalignment inside levels.rpf makes dstorage return ERROR_INVALID_DATA, then the title stops at +0x4da6315

This is not the XMemVirtualAlloc stop from v2026.11.29.04 (that one is +0x1e6c284), and it is not the Series S / Series X memory budget. It is a broken archive in a repackaged copy of the 1.0.2.1 package. Reported here because it looks exactly like "crashes loading the first scene" and, once identified, was reproducible byte for byte.

What the log shows

dstorage: request failed: zlib options=0x1 offset=17635937168 source_size=3975 destination_size=9760 tag=0 name="" path="G:\\levels.rpf" hr=0x8007000d
dstorage: request failed: zlib options=0x1 offset=17570844688 source_size=23074 destination_size=36272 intermediate_size=0 tag=0 name="" path="G:\\levels.rpf" hr=0x8007000d
memory now: committed 7839 MB, the card's own 2022 MB in use of a budget of 7189 MB ...
first-chance exception 0x80000003 at victory-image-b99f876b74d4a77f.dll+0x4da6315 (breakpoint cc 31 c0 c3 44 89 c8 48 8d 0c 40 49 8b 44 c8)
  #0 +0x4da6315
  #1 +0x4da62b9
  #2 +0x4e641dd
  #3 +0x40471
  #4 +0x465bae
  #5 +0x4e8b2ac
  #6 +0x2593e91
  #7 +0x2592d69
  #8 +0x2215eca
  #9 KERNEL32.DLL+0x2dda7
  #10 ntdll.dll+0xc9c5c

The exception comes 4 ms after the refusals. Five separate runs (five PIDs, 64 s to 409 s apart) stopped at the same address with identical registers (rax=0x2, rbx=0x260, r12=0x4c00989, r13=0xb747c, r14=0x13), so it is the same 16-byte window read every time.

The archive is internally misaligned

Two copies of the package, both reporting levels.rpf as 76,155,065,056 bytes, read at the two offsets the log names:

  • at 17,570,844,688, a copy that runs reads 78 da 64 d9 79 d4 0f 64 fe ff f1 d7 fb fd be 91 then 25 42 31 b4 28 92 4a fb aa 1d 51 31 e5 76 a3 db;
  • at the same offset, the broken copy reads 25 42 31 b4 28 92 4a fb aa 1d 51 31 e5 76 a3 db ..., i.e. the good copy's bytes at 17,570,844,688 + 16;
  • at 17,635,937,168, both copies read the same 32 bytes (78 da 9d 9a 0b 5c 4d 69 ...).

So the broken file is shifted by 16 bytes over part of that range and back again, inside a file of the same length. It came out of a 208 GB package that was distributed as one compressed archive and decompressed locally; the second copy is the same package extracted from the same archive on another PC. The failure is in the extraction, not in the emulator.

Why this is worth a change in the emulator

  • The stop is indistinguishable from a gameplay/version bug: 0x80000003 in the title's own code with no file named. It took the two hr=0x8007000d lines to find it.
  • PackageCheck (crates/victory-game/src/lib.rs) only checks data/ttdb/graphics/ttdb_graphics.ttpf's size, and size is exactly what is wrong here: both copies are 76,155,065,056 bytes.
  • A single dstorage refusal on levels.rpf is already fatal, and the title does not say which archive is damaged.

Two possible asks, either is fine:

  1. Before run, read the first block of each .rpf beside the executable at its directory table's offset and check it starts with a zlib header (78 01/78 9c/78 da) or the block's declared compression; one file, one read per archive, done in a second.
  2. Or make the run log say, once per archive, the first ERROR_INVALID_DATA and the offset, so that "the title stopped at +0x4da6315" is traceable to a named file.

I can provide the crash log and the stack in full for the broken copy if useful; the good copy is the same package on the other PC, so the byte window above can be verified from either side.

**@⁠suluojin-ui** on GitHub · 2026-11-29 21:56 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3335) ## A 16-byte misalignment inside `levels.rpf` makes dstorage return `ERROR_INVALID_DATA`, then the title stops at `+0x4da6315` This is not the `XMemVirtualAlloc` stop from v2026.11.29.04 (that one is `+0x1e6c284`), and it is not the Series S / Series X memory budget. It is a broken archive in a repackaged copy of the 1.0.2.1 package. Reported here because it looks exactly like "crashes loading the first scene" and, once identified, was reproducible byte for byte. ### What the log shows ``` dstorage: request failed: zlib options=0x1 offset=17635937168 source_size=3975 destination_size=9760 tag=0 name="" path="G:\\levels.rpf" hr=0x8007000d dstorage: request failed: zlib options=0x1 offset=17570844688 source_size=23074 destination_size=36272 intermediate_size=0 tag=0 name="" path="G:\\levels.rpf" hr=0x8007000d memory now: committed 7839 MB, the card's own 2022 MB in use of a budget of 7189 MB ... first-chance exception 0x80000003 at victory-image-b99f876b74d4a77f.dll+0x4da6315 (breakpoint cc 31 c0 c3 44 89 c8 48 8d 0c 40 49 8b 44 c8) #0 +0x4da6315 #1 +0x4da62b9 #2 +0x4e641dd #3 +0x40471 #4 +0x465bae #5 +0x4e8b2ac #6 +0x2593e91 #7 +0x2592d69 #8 +0x2215eca #9 KERNEL32.DLL+0x2dda7 #10 ntdll.dll+0xc9c5c ``` The exception comes 4 ms after the refusals. Five separate runs (five PIDs, 64 s to 409 s apart) stopped at the same address with identical registers (`rax=0x2`, `rbx=0x260`, `r12=0x4c00989`, `r13=0xb747c`, `r14=0x13`), so it is the same 16-byte window read every time. ### The archive is internally misaligned Two copies of the package, both reporting `levels.rpf` as 76,155,065,056 bytes, read at the two offsets the log names: - at `17,570,844,688`, a copy that runs reads `78 da 64 d9 79 d4 0f 64 fe ff f1 d7 fb fd be 91` then `25 42 31 b4 28 92 4a fb aa 1d 51 31 e5 76 a3 db`; - at the same offset, the broken copy reads `25 42 31 b4 28 92 4a fb aa 1d 51 31 e5 76 a3 db ...`, i.e. the good copy's bytes at `17,570,844,688 + 16`; - at `17,635,937,168`, both copies read the same 32 bytes (`78 da 9d 9a 0b 5c 4d 69 ...`). So the broken file is shifted by 16 bytes over part of that range and back again, inside a file of the same length. It came out of a 208 GB package that was distributed as one compressed archive and decompressed locally; the second copy is the same package extracted from the same archive on another PC. The failure is in the extraction, not in the emulator. ### Why this is worth a change in the emulator - The stop is indistinguishable from a gameplay/version bug: `0x80000003` in the title's own code with no file named. It took the two `hr=0x8007000d` lines to find it. - `PackageCheck` (`crates/victory-game/src/lib.rs`) only checks `data/ttdb/graphics/ttdb_graphics.ttpf`'s size, and size is exactly what is wrong here: both copies are 76,155,065,056 bytes. - A single `dstorage` refusal on `levels.rpf` is already fatal, and the title does not say which archive is damaged. Two possible asks, either is fine: 1. Before `run`, read the first block of each `.rpf` beside the executable at its directory table's offset and check it starts with a zlib header (`78 01`/`78 9c`/`78 da`) or the block's declared compression; one file, one read per archive, done in a second. 2. Or make the `run` log say, once per archive, the first `ERROR_INVALID_DATA` and the offset, so that "the title stopped at +0x4da6315" is traceable to a named file. I can provide the crash log and the stack in full for the broken copy if useful; the good copy is the same package on the other PC, so the byte window above can be verified from either side.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 22:01:04 +00:00
Author
Owner

@⁠suluojin-ui on GitHub · 2026-11-29 22:30 UTC · original

Follow-up with a narrower ask, and one correction to my own wording above: nobody needs a copy of the broken archive to act on this.

The invariant, verified on a package that runs

  • the title asks dstorage for levels.rpf at offset 17,570,844,688, zlib, source_size=23074, destination_size=36272;
  • on a package that runs, the bytes at that offset start with 78 da — a zlib header, which is what the archive's own table says is there;
  • on the broken copy the same offset holds 25 42 31 b4 28 92 4a fb aa 1d 51 31 e5 76 a3 db, which is the good copy's bytes at +16. So zlib is asked to decompress something that is not a zlib stream, and answers ERROR_INVALID_DATA;
  • at 17,635,937,168 both copies read 78 da 9d 9a 0b 5c …, so the 16-byte displacement is local, inside a file of the same length.

The rule "the first byte at a zlib block's offset is 0x78" therefore holds on every package that runs, and costs one byte to check. This is not a guess about the title; it is a property of the archive format the title itself relies on.

Minimal change in the layer

No RPF parsing, no behaviour change:

  1. In victory_hle::modules::dstorage, before a zlib request is given to the decompressor, check the byte at offset. If it is not 0x78, log once per archive, at error:

    archive damaged: <path> offset=<n> does not start a zlib block (ERROR_INVALID_DATA follows): the package was not extracted completely

  2. On the existing failure path, raise the present WARN … hr=0x8007000d to error with the same sentence.

That alone replaces "the title stopped at +0x4da6315" with a named file and offset. A user can then re-extract instead of changing F1 settings, which is what everyone tries first.

Optional, before the run

The same one-byte check over the first block of each of the twelve .rpf files beside the executable: one 4 KiB read per archive, a few milliseconds. Only the byte at the offset the table names is needed.

Also

A section in docs/crash-addresses.md under a new +0x4da6315 heading would let the people in #3084, #1813 and #2460 recognise this without reading the byte comparison: an 0x80000003 on the main-loop thread (+0x2215eca) with hr=0x8007000d for an archive four milliseconds before it.

I am not asking you to reproduce my file, and I am not claiming the emulator broke it. The point is that this stop has a cause that can be named and checked, and the log is the right place to name it.

**@⁠suluojin-ui** on GitHub · 2026-11-29 22:30 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3335#issuecomment-7263729964) Follow-up with a narrower ask, and one correction to my own wording above: nobody needs a copy of the broken archive to act on this. ## The invariant, verified on a package that runs - the title asks dstorage for `levels.rpf` at offset `17,570,844,688`, `zlib`, `source_size=23074`, `destination_size=36272`; - on a package that runs, the bytes at that offset start with `78 da` — a zlib header, which is what the archive's own table says is there; - on the broken copy the same offset holds `25 42 31 b4 28 92 4a fb aa 1d 51 31 e5 76 a3 db`, which is the good copy's bytes at `+16`. So zlib is asked to decompress something that is not a zlib stream, and answers `ERROR_INVALID_DATA`; - at `17,635,937,168` both copies read `78 da 9d 9a 0b 5c …`, so the 16-byte displacement is local, inside a file of the same length. The rule "the first byte at a zlib block's offset is `0x78`" therefore holds on every package that runs, and costs one byte to check. This is not a guess about the title; it is a property of the archive format the title itself relies on. ## Minimal change in the layer No RPF parsing, no behaviour change: 1. In `victory_hle::modules::dstorage`, before a zlib request is given to the decompressor, check the byte at `offset`. If it is not `0x78`, log once per archive, at `error`: `archive damaged: <path> offset=<n> does not start a zlib block (ERROR_INVALID_DATA follows): the package was not extracted completely` 2. On the existing failure path, raise the present `WARN … hr=0x8007000d` to `error` with the same sentence. That alone replaces "the title stopped at `+0x4da6315`" with a named file and offset. A user can then re-extract instead of changing F1 settings, which is what everyone tries first. ## Optional, before the run The same one-byte check over the first block of each of the twelve `.rpf` files beside the executable: one 4 KiB read per archive, a few milliseconds. Only the byte at the offset the table names is needed. ## Also A section in `docs/crash-addresses.md` under a new `+0x4da6315` heading would let the people in #3084, #1813 and #2460 recognise this without reading the byte comparison: an `0x80000003` on the main-loop thread (`+0x2215eca`) with `hr=0x8007000d` for an archive four milliseconds before it. I am not asking you to reproduce my file, and I am not claiming the emulator broke it. The point is that this stop has a cause that can be named and checked, and the log is the right place to name it.
Author
Owner

@⁠kibagami-nc on GitHub · 2026-11-29 22:39 UTC · original

Thanks, that's a clean case, and easy to act on. Two PRs now cover it:

  • #815: the first ask. The first zlib block of a file that does not unpack now logs one error line, once per file, with the path, the offset and the first bytes. It says whether those bytes start like a zlib block (0x78). The 0x8007000d warning with the request's details stays. The test uses your bytes (25 42 31 b4 …).
    dstorage: a game file holds bytes that do not unpack where the title reads a zlib block (it does not start like one): the file is damaged, often by an extraction that did not finish; a complete copy of this file is needed path=… offset=… first_bytes=[25, 42, 31, b4]
    
    It sits beside the same kind of line for a file cut short (#1250).
  • #3219: a +0x4da6315 entry in docs/crash-addresses.md. It says to look for hr=0x8007000d naming an archive just before the stop. It lists #3335 with its cause, and #3334 with the same address and no cause known yet.

I left the optional check before the run out for now. It needs each archive's table to find a block's offset, and the line above already names the file on the first bad block.

**@⁠kibagami-nc** on GitHub · 2026-11-29 22:39 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3335#issuecomment-7263847110) Thanks, that's a clean case, and easy to act on. Two PRs now cover it: - **#815: the first ask.** The first zlib block of a file that does not unpack now logs one error line, once per file, with the path, the offset and the first bytes. It says whether those bytes start like a zlib block (`0x78`). The `0x8007000d` warning with the request's details stays. The test uses your bytes (`25 42 31 b4 …`). ``` dstorage: a game file holds bytes that do not unpack where the title reads a zlib block (it does not start like one): the file is damaged, often by an extraction that did not finish; a complete copy of this file is needed path=… offset=… first_bytes=[25, 42, 31, b4] ``` It sits beside the same kind of line for a file cut short (#1250). - **#3219: a `+0x4da6315` entry** in `docs/crash-addresses.md`. It says to look for `hr=0x8007000d` naming an archive just before the stop. It lists #3335 with its cause, and #3334 with the same address and no cause known yet. I left the optional check before the run out for now. It needs each archive's table to find a block's offset, and the line above already names the file on the first bad block.
Author
Owner

@⁠hkj4250 on GitHub · 2026-11-29 22:55 UTC · original

i ran a byte check on my story000.rpf and got a mismatch between my source file and the one im running from so recopying that. doing a b4b on the levels.rpf next and will let you know if it comes up clean and test after. (+0x4da6315)

#3334

**@⁠hkj4250** on GitHub · 2026-11-29 22:55 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3335#issuecomment-7264053106) i ran a byte check on my story000.rpf and got a mismatch between my source file and the one im running from so recopying that. doing a b4b on the levels.rpf next and will let you know if it comes up clean and test after. (+0x4da6315) https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/issues/3334
Author
Owner

@⁠kibagami-nc on GitHub · 2026-11-29 23:26 UTC · original

@⁠hkj4250 Good catch. If the stop at +0x4da6315 is gone once the files match, #3334 has the same cause as this issue, and I'll add it to the docs entry in #3219. Before recopying, a look at your play log for hr=0x8007000d (or 0x80070026) just before the stop would also confirm which archive it was.

**@⁠kibagami-nc** on GitHub · 2026-11-29 23:26 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3335#issuecomment-7264459578) @⁠hkj4250 Good catch. If the stop at `+0x4da6315` is gone once the files match, #3334 has the same cause as this issue, and I'll add it to the docs entry in #3219. Before recopying, a look at your play log for `hr=0x8007000d` (or `0x80070026`) just before the stop would also confirm which archive it was.
Author
Owner

@⁠hkj4250 on GitHub · 2026-11-29 23:40 UTC · original

@⁠kibagami-nc It was Story00.rpf. #3334 was my issue and i just went ahead and closed it after recopying the file and testing. Levels.rpf was fine on my end but that story change also fixed the subtitle freeze and the missed dialog execution. All good here now, ill be back if i find something else!

**@⁠hkj4250** on GitHub · 2026-11-29 23:40 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3335#issuecomment-7264638811) @⁠kibagami-nc It was Story00.rpf. #3334 was my issue and i just went ahead and closed it after recopying the file and testing. Levels.rpf was fine on my end but that story change also fixed the subtitle freeze and the missed dialog execution. All good here now, ill be back if i find something else!
This discussion has been locked. Commenting is limited to contributors.
No milestone
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
github/trustno1-coder--VIctory-NVIDIA#3335
No description provided.