Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux fixes #41

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 26 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -448,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
Expand Down Expand Up @@ -842,7 +845,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);
}
Expand Down Expand Up @@ -1033,6 +1036,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));
Expand All @@ -1045,17 +1051,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
Expand Down