From 5bc5256b7181838c9b173a598baf5e46bd897709 Mon Sep 17 00:00:00 2001 From: Yoyobuae Date: Thu, 24 Oct 2024 15:15:17 -0500 Subject: [PATCH 1/4] Fixing "SizeOfColorStack" assertion failure void ImGuiStackSizes::CompareWithContextState(ImGuiContext*): Assertion `SizeOfColorStack >= g.ColorStack.Size && "PushStyleColor/PopStyleColor Mismatch!"' failed. --- src/main.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 922b5c9..4479172 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1033,6 +1033,9 @@ int main(int argc, char *argv[]) if (oldDataAverageSamples != dataAverageSamples) frameTiming = new vr::Compositor_FrameTiming[dataAverageSamples]; } + ImGui::PopStyleColor(); // pushRedButtonColour(); + ImGui::PopStyleColor(); + ImGui::PopStyleColor(); ImGui::SameLine(); pushGreenButtonColour(); bool savePressed = ImGui::Button("Save", ImVec2(82, 28)); @@ -1045,17 +1048,27 @@ int main(int argc, char *argv[]) prevAutoStart = autoStart; } } + ImGui::PopStyleColor(); // pushGreenButtonColour(); + ImGui::PopStyleColor(); + ImGui::PopStyleColor(); // Stop creating the settings window ImGui::End(); } #pragma endregion + ImGui::PopStyleColor(); // pushGrayButtonColour(); + ImGui::PopStyleColor(); + ImGui::PopStyleColor(); + + ImGui::PopStyleColor(); // ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.03, 0.03, 0.03, 1)); // Rendering ImGui::Render(); ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); glfwSwapBuffers(glfwWindow); + + ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.03, 0.03, 0.03, 1)); #pragma endregion // Check if OpenVR is quitting so we can quit alongside it From c46fe15da4318574811961d7cc0cfcf920ad1b5f Mon Sep 17 00:00:00 2001 From: Yoyobuae Date: Thu, 24 Oct 2024 15:28:26 -0500 Subject: [PATCH 2/4] Fixing "Cannot have empty ID" assertion failure _deps/imgui-src/imgui.cpp:10455: bool ImGui::ItemAdd(const ImRect&, ImGuiID, const ImRect*, ImGuiItemFlags): Assertion `id != window->ID && "Cannot have an empty ID at the root of a window. If you need an empty label, use ## and read the FAQ about how the ID Stack works!"' failed. --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 4479172..c2e1c3a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -842,7 +842,7 @@ int main(int argc, char *argv[]) { ImGui::PushItemWidth(192); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0)); - if (ImGui::SliderInt("", &newRes, 20, 500, "%d", ImGuiSliderFlags_AlwaysClamp)) + if (ImGui::SliderInt("##", &newRes, 20, 500, "%d", ImGuiSliderFlags_AlwaysClamp)) { vr::VRSettings()->SetFloat(vr::k_pch_SteamVR_Section, vr::k_pch_SteamVR_SupersampleScale_Float, newRes / 100.0f); } From cda52c4a745e80a4e1c4dd6154128f9823a8f716 Mon Sep 17 00:00:00 2001 From: Yoyobuae Date: Thu, 24 Oct 2024 15:28:57 -0500 Subject: [PATCH 3/4] Fixing SEGFAULT on exit --- src/main.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c2e1c3a..ea315f3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -368,12 +368,14 @@ void cleanup(nvmlLib nvmlLibrary) } FreeLibrary(nvmlLibrary); #else - nvmlShutdown_t nvmlShutdownPtr = (nvmlShutdown_t)dlsym(nvmlLibrary, "nvmlShutdown"); - if (nvmlShutdownPtr) - { - nvmlShutdownPtr(); + if (nvmlEnabled) { + nvmlShutdown_t nvmlShutdownPtr = (nvmlShutdown_t)dlsym(nvmlLibrary, "nvmlShutdown"); + if (nvmlShutdownPtr) + { + nvmlShutdownPtr(); + } + dlclose(nvmlLibrary); } - dlclose(nvmlLibrary); #endif // GUI cleanup From 1af117fb2e94d8f9698d03d1ef72aaf996e38511 Mon Sep 17 00:00:00 2001 From: Yoyobuae Date: Thu, 24 Oct 2024 15:41:22 -0500 Subject: [PATCH 4/4] Avoid crashing when icon.png is missing --- src/main.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ea315f3..9b5c77e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -450,10 +450,11 @@ int main(int argc, char *argv[]) // Set window icon GLFWimage icon; unsigned iconWidth, iconHeight; - unsigned test = lodepng_decode32_file(&(icon.pixels), &(iconWidth), &(iconHeight), iconPath); - icon.width = (int)iconWidth; - icon.height = (int)iconHeight; - glfwSetWindowIcon(glfwWindow, 1, &icon); + if (lodepng_decode32_file(&(icon.pixels), &(iconWidth), &(iconHeight), iconPath) == 0) { + icon.width = (int)iconWidth; + icon.height = (int)iconHeight; + glfwSetWindowIcon(glfwWindow, 1, &icon); + } #pragma endregion #pragma region VR init