Skip to content

Fix timed-object collision crash on 1.6 - #5409

Open
Zephkek wants to merge 5 commits into
multitheftauto:release/1.6.0from
Zephkek:fix/1.6-timed-object-col
Open

Zephkek wants to merge 5 commits into
multitheftauto:release/1.6.0from
Zephkek:fix/1.6-timed-object-col

Conversation

@Zephkek

@Zephkek Zephkek commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Crash at gta_sa.exe+0x1E26EE in CPed::ProcessEntityCollision. The player ped model carries an object collision whose data is not loaded, so the function reads a null CColData.

Requested timed-object models get m_wOtherTimeModel = 0, and CBaseModelInfo::SetColModel propagates every owned collision assignment to that model, which is the CJ ped model. The -1 from #4782 did land on 1.6 but was undone by the texture streaming revert in 93e6ae8. This puts it back and backports the explicit paired time model tracking from #4864.

Fixes #5310

Test plan

Resource from #3342: engineRequestModel('timed-object'), replace COL, TXD and DFF, create the object, stop the resource, reconnect. No crash on 1.6 anymore. Same for loading timed-object night models with a map loader and spawning as CJ.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

The texture streaming revert on 1.6 (93e6ae8) restored an older
CModelInfoSA.cpp and brought back m_wOtherTimeModel = 0 for requested
timed-object models, undoing multitheftauto#4782. CBaseModelInfo::SetColModel then
propagates every owned collision assignment to model 0, so the player
ped model ends up with an object collision whose data is unloaded, and
CPed::ProcessEntityCollision reads a null CColData at 0x5E26EE.

Set the pairing back to -1 and backport the explicit paired time model
collision tracking from multitheftauto#4864.
While chasing the clang-format failure I noticed the code I backported
was the same twenty lines written twice, once for the model itself and
once for its day/night partner. It is now two small helpers that apply
or restore a custom collision on one model, and SetColModel and
RestoreColModel just run them for the partner as well. Same behaviour,
about half the code, and the partner logic lives in one place instead
of being copy pasted into two functions.
The texture streaming revert in May put 65 files back into their old
shape, so every PR against release/1.6.0 has been failing the clang
format check since then. This is the output of the exact binary the CI
uses (clang-format 21.1.7 from utils/clang-format.ps1) over those 65
files. Whitespace and line breaks only, the preprocessor and token
stream are unchanged.
The Windows jobs revert the VS2026 switch commit on the fly so the
windows-2022 runner can build. That revert conflicts on
win-create-projects.bat since the PREMAKE_FILE change landed on top of
it, so all three Windows builds have been failing at that step. Replace
the revert with the two edits it was meant to produce.
@Zephkek

Zephkek commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

I just pushed three follow-up commits. First, I cleaned up the time model code by removing some duplicated day/night logic it acts exactly the same but uses half the code now.

I also fixed the clang-format and Windows build failures. Neither were actually caused by this PR, they were just old CI issues (the formatter has been broken since May, and the Windows build script was conflicting with itself). I updated the formatting and tweaked the Windows script so the tests will actually pass now.

clang-format joined instructions inside __asm blocks in CMultiplayerSA.cpp
and the win32 build died with 88 errors. master already wraps every asm
block in clang-format off/on (multitheftauto#4611), the 1.6 files never got that. Put
the 13 asm files back to how they were, wrapped all 422 blocks, ran the
formatter again. Every asm line is byte for byte what it was before.
@Zephkek

Zephkek commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

yay!

@FileEX FileEX added the bugfix Solution to a bug of any kind label Sep 16, 2026
@FileEX

FileEX commented Sep 16, 2026

Copy link
Copy Markdown
Member

Since two checks won't run for the 1.6.0 branch, someone with permission to merge while bypassing the checks will need to merge it, because auto-merge will wait until all checks pass

Zephkek added a commit to Zephkek/mtasa-blue that referenced this pull request Sep 17, 2026
The texture streaming revert in May put 65 files back into their old
shape, so every PR against release/1.6.0 fails the clang-format check.
This is the output of the binary the CI uses (clang-format 21.1.7 from
utils/clang-format.ps1) over those files, with every __asm block wrapped
in clang-format off/on first, the way master does since multitheftauto#4611, because
the formatter otherwise merges asm lines and breaks the win32 build.
Whitespace, line breaks and the guard comments only; every asm line is
byte for byte what it was. Same result as the formatting in multitheftauto#5409.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Solution to a bug of any kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants