Repository navigation
Keep the interior camera list at one address - #213
Merged
Merged
Conversation
SetCameraPos's static active_camera points into the frame's camera list from one frame to the next. Retail's list sat on the stack at the same address every frame; a fresh allocation per call left the pointer dangling, so entering some interiors, such as Carl's house, crashed.
SetCameraPos remembered the camera the player stood in as a pointer into the list it rebuilds every frame. Retail's list sat on the stack at the same address each frame, so the pointer stayed valid; once the list was allocated per call it dangled. The camera is now kept by its place in the list, which lives on the stack again.
SirFancyBacon
added a commit
to SirFancyBacon/Chronicle
that referenced
this pull request
Oct 23, 2026
This was referenced Oct 24, 2026
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.
Summary
Entering some interiors, Carl's house in Norune among them, crashed in
CFrame::GetLWMatrix.SetCameraPoskept the active camera as a pointer into a list that is freed every frame. It now keeps the camera by its place in that list, and the list lives on the stack again.fixes #214
fixes #217
Cause
CFrame::GetLWMatrix←CFrame::GetWorldPosition←SetCameraPos←EditInLoop.SetCameraPos(port/src/edit_in.cpp) rebuilds the interior's camera list every frame from the parts' camera markers, and the file-staticactive_cameraremembers which one the player last stood in, from one frame to the next.active_camerapoints into the stack. That only holds because the list sits at the same address every frame and is refilled beforeactive_camerais read.std::make_uniqueallocation made on each call. The next frame's allocation can land elsewhere, leavingactive_camerapointing at freed memory, andGetWorldPositionthen follows a garbage parent pointer. Whether it crashes depends on the allocator, which is why only some interiors show it.Fix
active_camerais the camera's index in the list,-1for none, instead of a pointer.EditInInitresets it to-1, where it reset the pointer before.std::array<INTERIOR_CAMERA, 8>on the stack again, so there is no allocation each frame. The cap of eight and the early returns from 98580bd are kept.staticarray), the second replaces that with the index. They can be squashed.Testing
GfxValidationones, which need a Vulkan validation layer the SDK lacks.