diff --git a/CMakeLists.txt b/CMakeLists.txt index 78a68aa83..d405d4726 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -792,7 +792,7 @@ endif() if(ANDROID AND NOT TERMUX) add_library(furnace SHARED ${USED_SOURCES}) elseif(WIN32) - add_executable(furnace WIN32 ${USED_SOURCES}) + add_executable(furnace ${USED_SOURCES}) else() add_executable(furnace ${USED_SOURCES}) endif() diff --git a/extern/imgui_patched/imgui.cpp b/extern/imgui_patched/imgui.cpp index 612a88d2d..19316ae25 100644 --- a/extern/imgui_patched/imgui.cpp +++ b/extern/imgui_patched/imgui.cpp @@ -12457,14 +12457,15 @@ void ImGui::ClearIniSettings() g.SettingsHandlers[handler_n].ClearAllFn(&g, &g.SettingsHandlers[handler_n]); } -void ImGui::LoadIniSettingsFromDisk(const char* ini_filename) +bool ImGui::LoadIniSettingsFromDisk(const char* ini_filename) { size_t file_data_size = 0; char* file_data = (char*)ImFileLoadToMemory(ini_filename, "rb", &file_data_size); if (!file_data) - return; + return false; LoadIniSettingsFromMemory(file_data, (size_t)file_data_size); IM_FREE(file_data); + return true; } // Zero-tolerance, no error reporting, cheap .ini parsing @@ -12538,20 +12539,22 @@ void ImGui::LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size) g.SettingsHandlers[handler_n].ApplyAllFn(&g, &g.SettingsHandlers[handler_n]); } -void ImGui::SaveIniSettingsToDisk(const char* ini_filename) +bool ImGui::SaveIniSettingsToDisk(const char* ini_filename) { ImGuiContext& g = *GImGui; g.SettingsDirtyTimer = 0.0f; if (!ini_filename) - return; + return false; size_t ini_data_size = 0; const char* ini_data = SaveIniSettingsToMemory(&ini_data_size); ImFileHandle f = ImFileOpen(ini_filename, "wt"); if (!f) - return; - ImFileWrite(ini_data, sizeof(char), ini_data_size, f); + return false; + bool areEqual=ImFileWrite(ini_data, sizeof(char), ini_data_size, f)==ini_data_size; + IM_ASSERT_USER_ERROR(areEqual, "ImFileWrite failed to write file!"); ImFileClose(f); + return areEqual; } // Call registered handlers (e.g. SettingsHandlerWindow_WriteAll() + custom handlers) to write their stuff into a text buffer diff --git a/extern/imgui_patched/imgui.h b/extern/imgui_patched/imgui.h index 131784f8f..ac6b77dc3 100644 --- a/extern/imgui_patched/imgui.h +++ b/extern/imgui_patched/imgui.h @@ -950,9 +950,9 @@ namespace ImGui // - The disk functions are automatically called if io.IniFilename != NULL (default is "imgui.ini"). // - Set io.IniFilename to NULL to load/save manually. Read io.WantSaveIniSettings description about handling .ini saving manually. // - Important: default value "imgui.ini" is relative to current working dir! Most apps will want to lock this to an absolute path (e.g. same path as executables). - IMGUI_API void LoadIniSettingsFromDisk(const char* ini_filename); // call after CreateContext() and before the first call to NewFrame(). NewFrame() automatically calls LoadIniSettingsFromDisk(io.IniFilename). + IMGUI_API bool LoadIniSettingsFromDisk(const char* ini_filename); // call after CreateContext() and before the first call to NewFrame(). NewFrame() automatically calls LoadIniSettingsFromDisk(io.IniFilename). IMGUI_API void LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size=0); // call after CreateContext() and before the first call to NewFrame() to provide .ini data from your own data source. - IMGUI_API void SaveIniSettingsToDisk(const char* ini_filename); // this is automatically called (if io.IniFilename is not empty) a few seconds after any modification that should be reflected in the .ini file (and also by DestroyContext). + IMGUI_API bool SaveIniSettingsToDisk(const char* ini_filename); // this is automatically called (if io.IniFilename is not empty) a few seconds after any modification that should be reflected in the .ini file (and also by DestroyContext). IMGUI_API const char* SaveIniSettingsToMemory(size_t* out_ini_size = NULL); // return a zero-terminated string with the .ini data which you can save by your own mean. call when io.WantSaveIniSettings is set, then save data by your own mean and clear io.WantSaveIniSettings. // Debug Utilities