Skip to content

Commit

Permalink
VR (Single pass): Further stability improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Oct 21, 2024
1 parent d967aa7 commit 8b0d835
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/mods/VR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ class VR : public Mod {
void unhide_crosshair() {
m_last_crosshair_hide = std::chrono::steady_clock::now();
}

void notify_camera_destroyed(RECamera* camera) {
for (auto& existing_camera : m_multipass_cameras) {
if (existing_camera == camera) {
existing_camera = nullptr;
}
}
}

void set_multipass_camera(RECamera* camera, uint32_t index) {
if (index >= 2) {
Expand Down
8 changes: 8 additions & 0 deletions src/mods/vr/CameraDuplicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ void CameraDuplicator::on_pre_application_entry(void* entry, const char* name, s
}

for (auto camera : cameras_to_remove) {
VR::get()->notify_camera_destroyed((RECamera*)camera);

m_new_cameras.erase((RECamera*)camera);
m_old_cameras.erase((RECamera*)camera);
m_seen_cameras.erase((RECamera*)camera);
Expand Down Expand Up @@ -326,6 +328,12 @@ void CameraDuplicator::clone_camera() {

m_called_activate = true;
m_identified_new_cameras = true;

// Destroy our existing property jobs so we don't work with stale data
m_getter_setters.clear();
m_property_jobs.clear();
m_property_jobs_index = 0;

/*m_identified_new_cameras = false;
m_waiting_for_identify = true;
Expand Down

0 comments on commit 8b0d835

Please sign in to comment.