From 6f5343638813ef7c34cdf218cc2046f990042bad Mon Sep 17 00:00:00 2001 From: Lunathir <18320914+lunathir@users.noreply.github.com> Date: Mon, 10 Jul 2023 11:30:41 -0700 Subject: [PATCH 1/8] Update multiplayer.md --- papers/multiplayer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/papers/multiplayer.md b/papers/multiplayer.md index 5f87bdba4..c2978ee84 100644 --- a/papers/multiplayer.md +++ b/papers/multiplayer.md @@ -220,7 +220,7 @@ size | description 1 | status | - 0: denied | - 1: allowed - +``` ## 0x13: message ``` size | description From 7d8a61d6dc1d031b4a8a3c0ca19d804443788a5e Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 10 Jul 2023 14:26:27 -0500 Subject: [PATCH 2/8] don't use IMGUI_USER_CONFIG apparently a specific build of GCC 11.2.0 has a bug which prevents using defines in #include --- CMakeLists.txt | 3 +-- extern/{imgui_conf => imgui_patched}/imconfig_fur.h | 0 extern/imgui_patched/imgui.h | 4 +--- 3 files changed, 2 insertions(+), 5 deletions(-) rename extern/{imgui_conf => imgui_patched}/imconfig_fur.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fb2aa919..caee04a7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -805,7 +805,6 @@ if (BUILD_GUI) list(APPEND USED_SOURCES ${GUI_SOURCES}) list(APPEND DEPENDENCIES_INCLUDE_DIRS extern/imgui_patched - extern/imgui_conf extern/imgui_patched/backends extern/IconFontCppHeaders extern/igfd @@ -877,7 +876,7 @@ else() endif() target_include_directories(furnace SYSTEM PRIVATE ${DEPENDENCIES_INCLUDE_DIRS}) -target_compile_definitions(furnace PRIVATE ${DEPENDENCIES_DEFINES} IMGUI_USER_CONFIG="imconfig_fur.h") +target_compile_definitions(furnace PRIVATE ${DEPENDENCIES_DEFINES}) target_compile_options(furnace PRIVATE ${DEPENDENCIES_COMPILE_OPTIONS}) target_link_libraries(furnace PRIVATE ${DEPENDENCIES_LIBRARIES}) if (PKG_CONFIG_FOUND AND (SYSTEM_FMT OR SYSTEM_LIBSNDFILE OR SYSTEM_ZLIB OR SYSTEM_SDL2 OR SYSTEM_RTMIDI OR WITH_JACK)) diff --git a/extern/imgui_conf/imconfig_fur.h b/extern/imgui_patched/imconfig_fur.h similarity index 100% rename from extern/imgui_conf/imconfig_fur.h rename to extern/imgui_patched/imconfig_fur.h diff --git a/extern/imgui_patched/imgui.h b/extern/imgui_patched/imgui.h index f78011369..8674f9970 100644 --- a/extern/imgui_patched/imgui.h +++ b/extern/imgui_patched/imgui.h @@ -52,9 +52,7 @@ Index of this file: // Configuration file with compile-time options // (edit imconfig.h or '#define IMGUI_USER_CONFIG "myfilename.h" from your build system') -#ifdef IMGUI_USER_CONFIG -#include IMGUI_USER_CONFIG -#endif +#include "imconfig_fur.h" #include "imconfig.h" #ifndef IMGUI_DISABLE From 5619ae36c8e9dafc45d96dd81646ebd2f7bf7d6a Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 10 Jul 2023 14:36:44 -0500 Subject: [PATCH 3/8] GUI: set bigFont on font loading failure issue #1228 --- src/gui/gui.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index dd760e0fc..bd75fce85 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -5978,6 +5978,7 @@ bool FurnaceGUI::loop() { ImGui::GetIO().Fonts->Clear(); mainFont=ImGui::GetIO().Fonts->AddFontDefault(); patFont=mainFont; + bigFont=mainFont; if (rend) rend->destroyFontsTexture(); if (!ImGui::GetIO().Fonts->Build()) { logE("error again while building font atlas!"); From 7524b42564262466cd658dcf1ea146034a93b4e5 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 10 Jul 2023 14:38:26 -0500 Subject: [PATCH 4/8] GUI: again issue #1228 --- src/gui/gui.cpp | 2 ++ src/gui/settings.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index bd75fce85..6eefb6913 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -3839,6 +3839,7 @@ bool FurnaceGUI::loop() { ImGui::GetIO().Fonts->Clear(); mainFont=ImGui::GetIO().Fonts->AddFontDefault(); patFont=mainFont; + bigFont=mainFont; if (rend) rend->destroyFontsTexture(); if (!ImGui::GetIO().Fonts->Build()) { logE("error again while building font atlas!"); @@ -6433,6 +6434,7 @@ bool FurnaceGUI::init() { ImGui::GetIO().Fonts->Clear(); mainFont=ImGui::GetIO().Fonts->AddFontDefault(); patFont=mainFont; + bigFont=mainFont; if (rend) rend->destroyFontsTexture(); if (!ImGui::GetIO().Fonts->Build()) { logE("error again while building font atlas!"); diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 6c70a8914..b0e280e90 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -3201,6 +3201,7 @@ void FurnaceGUI::commitSettings() { ImGui::GetIO().Fonts->Clear(); mainFont=ImGui::GetIO().Fonts->AddFontDefault(); patFont=mainFont; + bigFont=mainFont; if (rend) rend->destroyFontsTexture(); if (!ImGui::GetIO().Fonts->Build()) { logE("error again while building font atlas!"); From f45df351a8398f32e0fd55c863f9ae721b414f6e Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 10 Jul 2023 15:28:09 -0500 Subject: [PATCH 5/8] let's debug GL problem --- extern/imgui_patched/backends/imgui_impl_opengl3.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/extern/imgui_patched/backends/imgui_impl_opengl3.cpp b/extern/imgui_patched/backends/imgui_impl_opengl3.cpp index c9bd8e171..b1015365f 100644 --- a/extern/imgui_patched/backends/imgui_impl_opengl3.cpp +++ b/extern/imgui_patched/backends/imgui_impl_opengl3.cpp @@ -199,16 +199,17 @@ #define IMGUI_IMPL_OPENGL_MAY_HAVE_EXTENSIONS #endif +#include "../../../src/ta-log.h" + // [Debugging] -//#define IMGUI_IMPL_OPENGL_DEBUG +#define IMGUI_IMPL_OPENGL_DEBUG #ifdef IMGUI_IMPL_OPENGL_DEBUG -#include -#define GL_CALL(_CALL) do { _CALL; GLenum gl_err = glGetError(); if (gl_err != 0) fprintf(stderr, "GL error 0x%x returned from '%s'.\n", gl_err, #_CALL); } while (0) // Call with error check +#define GL_CALL(_CALL) do { _CALL; GLenum gl_err = glGetError(); if (gl_err != 0) logE("GL error 0x%x returned from '%s'.\n", gl_err, #_CALL); } while (0) // Call with error check #else #define GL_CALL(_CALL) _CALL // Call without error check #endif -#define GL_CALL_FALSE(_CALL) _CALL; { GLenum gl_err = glGetError(); if (gl_err != 0) return false; } +#define GL_CALL_FALSE(_CALL) _CALL; { GLenum gl_err = glGetError(); if (gl_err != 0) { logW("GL error 0x%x returned from '%s'.\n", gl_err, #_CALL); return false; } } // OpenGL Data struct ImGui_ImplOpenGL3_Data @@ -326,7 +327,7 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version) #endif #ifdef IMGUI_IMPL_OPENGL_DEBUG - printf("GL_MAJOR_VERSION = %d\nGL_MINOR_VERSION = %d\nGL_VENDOR = '%s'\nGL_RENDERER = '%s'\n", major, minor, (const char*)glGetString(GL_VENDOR), (const char*)glGetString(GL_RENDERER)); // [DEBUG] + logD("\nGL_VENDOR = '%s'\nGL_RENDERER = '%s'\n", (const char*)glGetString(GL_VENDOR), (const char*)glGetString(GL_RENDERER)); // [DEBUG] #endif #ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET From 9662653aac4d556ffe073edcf4c9f0b40a954cbd Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 10 Jul 2023 15:44:50 -0500 Subject: [PATCH 6/8] let's fix --- .../imgui_patched/backends/imgui_impl_opengl3.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/extern/imgui_patched/backends/imgui_impl_opengl3.cpp b/extern/imgui_patched/backends/imgui_impl_opengl3.cpp index b1015365f..46c28a815 100644 --- a/extern/imgui_patched/backends/imgui_impl_opengl3.cpp +++ b/extern/imgui_patched/backends/imgui_impl_opengl3.cpp @@ -202,7 +202,7 @@ #include "../../../src/ta-log.h" // [Debugging] -#define IMGUI_IMPL_OPENGL_DEBUG +//#define IMGUI_IMPL_OPENGL_DEBUG #ifdef IMGUI_IMPL_OPENGL_DEBUG #define GL_CALL(_CALL) do { _CALL; GLenum gl_err = glGetError(); if (gl_err != 0) logE("GL error 0x%x returned from '%s'.\n", gl_err, #_CALL); } while (0) // Call with error check #else @@ -678,13 +678,19 @@ bool ImGui_ImplOpenGL3_CreateFontsTexture() // (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling) GLint last_texture; GL_CALL(glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture)); + // clear errors + while (glGetError()!=GL_NO_ERROR) {} + GL_CALL_FALSE(glGenTextures(1, &bd->FontTexture)); GL_CALL_FALSE(glBindTexture(GL_TEXTURE_2D, bd->FontTexture)); - GL_CALL_FALSE(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); - GL_CALL_FALSE(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); + GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); + GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); #ifdef GL_UNPACK_ROW_LENGTH // Not on WebGL/ES - GL_CALL_FALSE(glPixelStorei(GL_UNPACK_ROW_LENGTH, 0)); + GL_CALL(glPixelStorei(GL_UNPACK_ROW_LENGTH, 0)); #endif + + while (glGetError()!=GL_NO_ERROR) {} + GL_CALL_FALSE(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels)); // Store our identifier From b7b4177251929489d35207eb836b251f2ac67d7f Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 10 Jul 2023 15:47:20 -0500 Subject: [PATCH 7/8] why --- extern/imgui_patched/backends/imgui_impl_opengl3.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extern/imgui_patched/backends/imgui_impl_opengl3.cpp b/extern/imgui_patched/backends/imgui_impl_opengl3.cpp index 46c28a815..d5ef359d6 100644 --- a/extern/imgui_patched/backends/imgui_impl_opengl3.cpp +++ b/extern/imgui_patched/backends/imgui_impl_opengl3.cpp @@ -679,7 +679,7 @@ bool ImGui_ImplOpenGL3_CreateFontsTexture() GLint last_texture; GL_CALL(glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture)); // clear errors - while (glGetError()!=GL_NO_ERROR) {} + glGetError(); GL_CALL_FALSE(glGenTextures(1, &bd->FontTexture)); GL_CALL_FALSE(glBindTexture(GL_TEXTURE_2D, bd->FontTexture)); @@ -689,7 +689,7 @@ bool ImGui_ImplOpenGL3_CreateFontsTexture() GL_CALL(glPixelStorei(GL_UNPACK_ROW_LENGTH, 0)); #endif - while (glGetError()!=GL_NO_ERROR) {} + glGetError(); GL_CALL_FALSE(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels)); From d93a3d17a9c226a2b49b01a57909da63c9ee22b3 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 10 Jul 2023 21:48:41 -0500 Subject: [PATCH 8/8] not recommended --- src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 0aa4c9b4f..b5484ea36 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -370,6 +370,13 @@ static void handleTermGUI(int) { // TODO: CoInitializeEx on Windows? // TODO: add crash log int main(int argc, char** argv) { + // uncomment these if you want Furnace to play in the background on Android. + // not recommended. it lags. +#if defined(HAVE_SDL2) && defined(ANDROID) + //SDL_SetHint(SDL_HINT_ANDROID_BLOCK_ON_PAUSE,"0"); + //SDL_SetHint(SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO,"0"); +#endif + // Windows console thing - thanks dj.tuBIG/MaliceX #ifdef _WIN32