Skip to content

fix(camera): preserve roll patch addresses - #16

Merged
TrackAndTruckDevs merged 1 commit into
TrackAndTruckDevs:mainfrom
aefly:fix/roll-patches-world-reload
Oct 5, 2026
Merged

TrackAndTruckDevs merged 1 commit into
TrackAndTruckDevs:mainfrom
aefly:fix/roll-patches-world-reload

Conversation

@aefly

@aefly aefly commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes InteriorCameraDataFinder reporting Roll zero store / Roll controller store → NOT FOUND after a world reload when a plugin is using the interior camera roll.

Root cause

GameCameraInterior::OnDeactivate().

On a world reload (e.g. a profile change), GameCameraManager::Uninstall() destroys the cameras with m_cameras.clear() without calling OnDeactivate(), so the NOPs stay in place. The finders then re-scan, find only 90 90 90… and report both sites as NOT FOUND. After that, the next SetInteriorRoll overwrites the patch addresses with 0, so the original code can no longer be restored until the game restarts.

Changes

  • GameCameraManager::Uninstall(): deactivate the active camera before clearing the cameras, so the interior camera restores the patched code. Every camera's OnDeactivate() only clears its pointer (and restores code for the interior camera), so this is safe during the reset.
  • GameCameraInterior::SetRollPatchesApplied(): an applied patch keeps its address, so the NOPs can always be reverted.

Testing

Reproduced on ETS2 1.61 with MotionCab: interior camera with roll active, then a profile change.

Before:

[Core] World reload detected. ...
[GameCameraManagerService] Uninstalling Game Camera Service...
[WARN] 6. [RT] Roll zero store → NOT FOUND [!]
[WARN] 7. [RT] Roll controller store → NOT FOUND [!]

After:

[Core] World reload detected. ...
[GameCameraManagerService] Uninstalling Game Camera Service...
[GameCameraInterior] Deactivating Interior Camera.
6. [RT] Roll zero store → 0x7FF7B1E2EBAD ("eurotrucks2.exe"+8AEBAD)
7. [RT] Roll controller store → 0x7FF7B1E2ED45 ("eurotrucks2.exe"+8AED45)

No errors in framework.log, and the roll still works in-game after the reload :)

When reapplying roll patches, keep existing addresses so NOPs are
not left in place. Deactivate the active camera before clearing
cameras to restore patched game code.
@TrackAndTruckDevs
TrackAndTruckDevs merged commit 68bf4be into TrackAndTruckDevs:main Oct 5, 2026
1 check passed
@TrackAndTruckDevs

Copy link
Copy Markdown
Owner

Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants