From 71042da8614e3f4cffef7822e677596f9e69adad Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Tue, 17 Dec 2024 21:17:45 -0500 Subject: [PATCH] Fix Crash On NVIDIA + Improve Splash Oscillation --- dependencies/glfw/src | 2 +- launcher/src/client/ui.cpp | 2 +- libreborn/src/util/glfw.cpp | 2 ++ mods/src/misc/tinting.cpp | 2 +- mods/src/title-screen/splashes.cpp | 7 +++++-- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/dependencies/glfw/src b/dependencies/glfw/src index b35641f4a3..21fea01161 160000 --- a/dependencies/glfw/src +++ b/dependencies/glfw/src @@ -1 +1 @@ -Subproject commit b35641f4a3c62aa86a0b3c983d163bc0fe36026d +Subproject commit 21fea01161e0d6b70c0c5c1f52dc8e7a7df14a50 diff --git a/launcher/src/client/ui.cpp b/launcher/src/client/ui.cpp index 5f37f0790b..d575fa5bb0 100644 --- a/launcher/src/client/ui.cpp +++ b/launcher/src/client/ui.cpp @@ -118,7 +118,7 @@ void ConfigurationUI::draw_main() const { int gui_scale_int = int(state.gui_scale); // Fractional GUI Scales Are Messy std::string scale_format = "%ix"; if (gui_scale_int <= AUTO_GUI_SCALE) { - scale_format = "Auto"; + scale_format = "Automatic"; } if (ImGui::SliderInt(labels[2], &gui_scale_int, 0, 8, scale_format.c_str())) { state.gui_scale = float(gui_scale_int); diff --git a/libreborn/src/util/glfw.cpp b/libreborn/src/util/glfw.cpp index 1c2eb8b20e..1d6f40c4ed 100644 --- a/libreborn/src/util/glfw.cpp +++ b/libreborn/src/util/glfw.cpp @@ -40,6 +40,8 @@ GLFWwindow *create_glfw_window(const char *title, const int width, const int hei void cleanup_glfw(GLFWwindow *window) { // Ignore GLFW Errors During Termination glfwSetErrorCallback(nullptr); + // Workaround Segmentation Fault On NVIDIA + glfwPollEvents(); // Terminate GLFW glfwDestroyWindow(window); glfwTerminate(); diff --git a/mods/src/misc/tinting.cpp b/mods/src/misc/tinting.cpp index b3fa99c48f..ee43f69cc9 100644 --- a/mods/src/misc/tinting.cpp +++ b/mods/src/misc/tinting.cpp @@ -62,7 +62,7 @@ static int32_t TallGrass_getColor_injection(TallGrass_getColor_t original, TallG // Grass Side Tinting CUSTOM_VTABLE(grass_side, Tile) { vtable->shouldRenderFace = [](Tile *self, LevelSource *level_source, const int x, const int y, const int z, const int face) { - return face != 0 && face != 1 && Tile_vtable::base->shouldRenderFace(self, level_source, x, y, z, face); + return face > 1 && Tile_vtable::base->shouldRenderFace(self, level_source, x, y, z, face); }; vtable->getColor = [](Tile *self, LevelSource *level_source, const int32_t x, const int32_t y, const int32_t z) { return GrassTile_getColor_injection(nullptr, (GrassTile *) self, level_source, x, y, z); diff --git a/mods/src/title-screen/splashes.cpp b/mods/src/title-screen/splashes.cpp index 57722aecdd..e2938adcd8 100644 --- a/mods/src/title-screen/splashes.cpp +++ b/mods/src/title-screen/splashes.cpp @@ -114,8 +114,11 @@ static bool draw_splash(const StartMenuScreen *screen, const float y_factor, con media_glRotatef(SplashLine::angle, 0.0f, 0.0f, 1.0f); // Oscillate const float timeMS = float(Common::getTimeMs() % 1000) / 1000.0f; - const float oscillation = (scale / SplashLine::max_scale) * 0.1f; - scale = scale - Mth::abs(oscillation * Mth::sin(2.0f * float(M_PI) * timeMS)); + const float time = 4.0f * float(M_PI) * timeMS; + float oscillation = 0.1f; + oscillation /= 2.0f; + oscillation = 1.0f + (oscillation * Mth::cos(time)) - oscillation; + scale *= oscillation; // Scale media_glTranslatef(splash_width / 2.0f, 0, 0); media_glScalef(scale, scale, 1);