Repository navigation
Port: leave a map piece's texture set with the map that entered it - #131
Merged
Adubbz merged 1 commit intoOct 20, 2026
Merged
Conversation
Since c0f07fe, LoadModel enters each embedded texture set from block 0. A map piece embeds the set its map already entered into the map's own blocks, so the copy landed in another map's blocks: the Palm Brinks residence pieces put e04's water into the town map's blocks 3-5, which the grounds map never deletes. When the grounds loaded again, the water's texture animation found those copies by name and attached to block 4 with memory from the grounds map's stack. Walking back into Maximilian's House reused that memory, and the next frame crashed in RestoreAnimatedTextures or TexAnime. A plain model now leaves a set alone when every picture in it is already registered under its name, the way retail map models only look their textures up. Sets with pictures nobody has entered are entered as before.
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 a crash in Palm Brinks when you walk out of Maximilian's House and straight back in. Found in playtesting.
Before: since c0f07fe,
model_assets::LoadModelenters each embedded texture set from block 0. Map pieces embed the same set their map already entered into its own blocks. In Palm Brinks Residence the m04 pieces carry e04's water (e04_watertoe04_water7), so loading the grounds (map 1, blocks 24-31) also put a second copy of the water into blocks 3-5. Those belong to the town map (map 0) and never get deleted with the grounds. After going inside and back out, the grounds'#texanimefound those copies by name and attached its animation to block 4, allocated from the grounds map's stack. Walking back in loads map 1 over that stack, block 4 still points into it, and the next frame crashes inRestoreAnimatedTexturesormgCTextureAnime::TexAnimereading float data as list nodes.After: a plain model (no character) skips an embedded set when every picture in it is already registered under its name, so map pieces use their map's textures by name the way the retail MDS pieces do. Sets with pictures that aren't registered yet get entered the same as before. The grounds' water animation also gets registered once now instead of twice.
Tests:
NativeModel.ModelLeavesATextureSetItsMapAlreadyEnteredWithTheMapenters a document at block 24 and then loads a model that embeds the same set. Without the fix it ends up with a second copy in block 0 (2 textures), with it the model uses the block 24 texture.PcOptionsAudio.MissingCustomTrackFallsBackToThePs2Sequence, which fails under -j8 on a temp dir lock and passes on its own.--jump dungeon:1:1anddungeon:0:2,--seed 1, screenshots at frames 3000 and 7800) match master.