From 1f6f7f961e656e61650e602ad217de1c345287ce Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 6 Oct 2025 12:31:56 -0500 Subject: [PATCH 1/3] dev234 - extra config paranoia featuring config start/end markers to ensure the config is complete. necessary due to a problem which results in Furnace not writing the entire config in time on Android sometimes. best to fall back to the previous config than a total sudden reset... issue #1825 --- src/engine/config.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++- src/engine/engine.h | 4 ++-- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/engine/config.cpp b/src/engine/config.cpp index fe817ed2c..af4322685 100644 --- a/src/engine/config.cpp +++ b/src/engine/config.cpp @@ -58,6 +58,9 @@ bool DivConfig::save(const char* path, bool redundancy) { reportError(fmt::sprintf("could not write config file! %s",strerror(errno))); return false; } + if (redundancy) { + fputs("!DIV_CONFIG_START!\n",f); + } for (auto& i: conf) { String toWrite=fmt::sprintf("%s=%s\n",i.first,i.second); if (fwrite(toWrite.c_str(),1,toWrite.size(),f)!=toWrite.size()) { @@ -69,6 +72,9 @@ bool DivConfig::save(const char* path, bool redundancy) { return false; } } + if (redundancy) { + fputs("~DIV_CONFIG_END~\n",f); + } fclose(f); logD("config file written successfully."); return true; @@ -124,8 +130,12 @@ bool DivConfig::loadFromFile(const char* path, bool createOnFail, bool redundanc if (redundancy) { unsigned char* readBuf=new unsigned char[CHECK_BUF_SIZE]; size_t readBufLen=0; + bool weRescued=false; for (int i=0; i0) { snprintf(line,4095,"%s.%d",path,i); } else { @@ -143,15 +153,27 @@ bool DivConfig::loadFromFile(const char* path, bool createOnFail, bool redundanc // check whether there's something while (!feof(f)) { + bool willBreak=false; readBufLen=fread(readBuf,1,CHECK_BUF_SIZE,f); if (ferror(f)) { logV("fread(): %s",strerror(errno)); break; } + if (startCheck) { + if (readBufLen>=19) { + if (memcmp(readBuf,"!DIV_CONFIG_START!\n",19)==0) { + hasStartMarker=true; + logV("start marker found"); + } + } + startCheck=false; + } + for (size_t j=0; j=18) { + memcpy(endMarker,&readBuf[readBufLen-18],18); + } else if (readBufLen>0) { + // shift buffer left + for (size_t j=0, k=readBufLen; j Date: Mon, 6 Oct 2025 13:20:36 -0500 Subject: [PATCH 2/3] I AM USING THIS VARIABLE --- extern/imgui_software_renderer/imgui_sw.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extern/imgui_software_renderer/imgui_sw.cpp b/extern/imgui_software_renderer/imgui_sw.cpp index a7471e49a..040580503 100644 --- a/extern/imgui_software_renderer/imgui_sw.cpp +++ b/extern/imgui_software_renderer/imgui_sw.cpp @@ -678,6 +678,9 @@ void ImGui_ImplSW_Shutdown() { void ImGui_ImplSW_NewFrame() { ImGui_ImplSW_Data* bd = ImGui_ImplSW_GetBackendData(); + // look I am USING THIS VARIABLE + // don't go around saying I don't use it + if (bd==NULL) abort(); IM_ASSERT(bd != nullptr); } From b55ff55943f86d298a18420aae962c570c4136fa Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 6 Oct 2025 15:49:11 -0500 Subject: [PATCH 3/3] disable -gcodeview a bug in GCC prevents it from being used. I will be reporting this soon. --- CMakeLists.txt | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8eaf3dc1e..5ddba5cb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1138,15 +1138,7 @@ if (USE_BACKWARD) list(APPEND USED_SOURCES src/backtrace.cpp) if (WIN32) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - include(CheckCXXCompilerFlag) - check_cxx_compiler_flag(-gcodeview GCC_CODEVIEW) - if (GCC_CODEVIEW OR FORCE_CODEVIEW) - set(CMAKE_EXE_LINKER_FLAGS "-Wl,--pdb= ") - add_compile_options(-gcodeview) - message(STATUS "Enabling -gcodeview flag for backward-cpp.") - else() - message(WARNING "Could not enable -gcodeview! backward-cpp will not work.") - endif() + message(WARNING "Could not enable -gcodeview! backward-cpp will not work.") list(APPEND DEPENDENCIES_LIBRARIES dbghelp psapi) endif() endif()