Skip to content

Commit

Permalink
OpenXR: Fix persistent custom bindings not working
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Jan 1, 2024
1 parent 3994e58 commit cc5b781
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/mods/vr/runtimes/OpenXR.cpp
Expand Up @@ -571,10 +571,10 @@ void OpenXR::destroy() {
xrDestroySession(this->session);
}

/*if (this->instance != nullptr) {
if (this->instance != nullptr && this->ever_submitted) {
xrDestroyInstance(this->instance);
this->instance = nullptr;
}*/
}

this->session = nullptr;
this->session_ready = false;
Expand Down Expand Up @@ -1284,9 +1284,11 @@ void OpenXR::display_bindings_editor() {
// replace the slashes with underscores
std::replace(filename.begin(), filename.end(), '/', '_');

if (std::filesystem::exists(filename)) {
const auto persistent_filename = (Framework::get_persistent_dir() / filename).string();

if (std::filesystem::exists(persistent_filename)) {
// Delete the file
std::filesystem::remove(filename);
std::filesystem::remove(persistent_filename);
this->wants_reinitialize = true;
}
}
Expand Down Expand Up @@ -1543,7 +1545,9 @@ void OpenXR::save_bindings() {

// replace the slashes with underscores
std::replace(filename.begin(), filename.end(), '/', '_');
std::ofstream(filename) << j.dump(4);
const auto persistent_filename = (Framework::get_persistent_dir() / filename).string();

std::ofstream(persistent_filename) << j.dump(4);

this->wants_reinitialize = true;
}
Expand Down

0 comments on commit cc5b781

Please sign in to comment.