This commit is contained in:
Jan Racek
2026-03-27 18:31:54 +01:00
parent 480323f5b9
commit 4ff7ecdd57
6 changed files with 155 additions and 5 deletions

View File

@@ -231,6 +231,7 @@ void psxsplash::SceneManager::InitializeScene(uint8_t* splashpackData, LoadingSc
L.RegisterGameObject(object);
}
m_controls.forceAnalogMode();
m_controls.Init();
Renderer::GetInstance().SetCamera(m_currentCamera);
@@ -815,6 +816,17 @@ void psxsplash::SceneManager::shrinkBuffer() {
m_uiSystem.relocate(delta);
// Re-key Lua registry entries for game objects. RegisterGameObject stored
// lightuserdata keys using the OLD buffer addresses. After relocation, the
// game object pointers changed but the registry keys are stale. Without
// this, Entity.Find/FindByIndex return nil (wrong key), and in release
// builds (-Os) the optimizer can turn this into a hard crash.
if (!m_gameObjects.empty()) {
L.RelocateGameObjects(
reinterpret_cast<GameObject**>(m_gameObjects.data()),
m_gameObjects.size(), delta);
}
FileLoader::Get().FreeFile(oldBase);
m_currentSceneData = newBase;
}