bugfixes
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user