From 6fd1d5730633757378e937c7395f5e72f9871476 Mon Sep 17 00:00:00 2001 From: shweet Date: Sun, 11 Jan 2026 17:14:01 -0500 Subject: [PATCH] tweak windows crash --- src/imgui/documents.cpp | 2 +- src/imgui/wizard/configure.cpp | 5 ----- src/loader.cpp | 19 ++++++++----------- src/resource/strings.h | 1 - src/settings.h | 1 - 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/imgui/documents.cpp b/src/imgui/documents.cpp index 529513c..414bdb5 100644 --- a/src/imgui/documents.cpp +++ b/src/imgui/documents.cpp @@ -35,7 +35,7 @@ namespace anm2ed::imgui if (isDirty) { document.lastAutosaveTime += ImGui::GetIO().DeltaTime; - if (document.lastAutosaveTime > settings.fileAutosaveTime * time::SECOND_M) manager.autosave(document); + if (document.lastAutosaveTime > time::SECOND_M) manager.autosave(document); } } diff --git a/src/imgui/wizard/configure.cpp b/src/imgui/wizard/configure.cpp index e40df47..305fbcf 100644 --- a/src/imgui/wizard/configure.cpp +++ b/src/imgui/wizard/configure.cpp @@ -52,11 +52,6 @@ namespace anm2ed::imgui::wizard ImGui::Checkbox(localize.get(BASIC_ENABLED), &temporary.fileIsAutosave); ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_AUTOSAVE_ENABLED)); - ImGui::BeginDisabled(!temporary.fileIsAutosave); - input_int_range(localize.get(LABEL_TIME_MINUTES), temporary.fileAutosaveTime, 0, 10); - ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_AUTOSAVE_INTERVAL)); - ImGui::EndDisabled(); - ImGui::SeparatorText(localize.get(LABEL_SNAPSHOTS)); input_int_range(localize.get(LABEL_STACK_SIZE), temporary.fileSnapshotStackSize, 0, 100); ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_STACK_SIZE)); diff --git a/src/loader.cpp b/src/loader.cpp index 984c253..f422c32 100644 --- a/src/loader.cpp +++ b/src/loader.cpp @@ -46,9 +46,7 @@ namespace anm2ed #ifdef _WIN32 void windows_wer_localdumps_configure() { - // Only configure crash dumps for debug builds. - // (Writing per-user registry keys is still intrusive; avoid in release builds.) - #if !defined(_DEBUG) + #ifndef DEBUG return; #endif @@ -82,21 +80,22 @@ namespace anm2ed auto subkey = std::wstring(L"Software\\Microsoft\\Windows Error Reporting\\LocalDumps\\") + exeName; HKEY key{}; - auto status = RegCreateKeyExW(HKEY_CURRENT_USER, subkey.c_str(), 0, nullptr, 0, KEY_SET_VALUE, nullptr, &key, - nullptr); + auto status = + RegCreateKeyExW(HKEY_CURRENT_USER, subkey.c_str(), 0, nullptr, 0, KEY_SET_VALUE, nullptr, &key, nullptr); if (status != ERROR_SUCCESS) { logger.warning(std::format("Failed to create/open WER LocalDumps key (status {}).", (int)status)); return; } - auto closeKey = [&]() { + auto closeKey = [&]() + { if (key) RegCloseKey(key); key = nullptr; }; auto dumpDirW = dumpDir.wstring(); - const DWORD dumpType = 2; // full dump + const DWORD dumpType = 2; // full dump const DWORD dumpCount = 10; status = RegSetValueExW(key, L"DumpFolder", 0, REG_EXPAND_SZ, (const BYTE*)dumpDirW.c_str(), @@ -109,12 +108,10 @@ namespace anm2ed } status = RegSetValueExW(key, L"DumpType", 0, REG_DWORD, (const BYTE*)&dumpType, sizeof(dumpType)); - if (status != ERROR_SUCCESS) - logger.warning(std::format("Failed to set WER DumpType (status {}).", (int)status)); + if (status != ERROR_SUCCESS) logger.warning(std::format("Failed to set WER DumpType (status {}).", (int)status)); status = RegSetValueExW(key, L"DumpCount", 0, REG_DWORD, (const BYTE*)&dumpCount, sizeof(dumpCount)); - if (status != ERROR_SUCCESS) - logger.warning(std::format("Failed to set WER DumpCount (status {}).", (int)status)); + if (status != ERROR_SUCCESS) logger.warning(std::format("Failed to set WER DumpCount (status {}).", (int)status)); closeKey(); logger.info(std::format("WER LocalDumps enabled (Debug) -> {}", path::to_utf8(dumpDir))); diff --git a/src/resource/strings.h b/src/resource/strings.h index 6cf7fdb..b476237 100644 --- a/src/resource/strings.h +++ b/src/resource/strings.h @@ -452,7 +452,6 @@ namespace anm2ed X(TOOLTIP_ANIMATION_LENGTH, "Set the animation's length.", "Ajusta la duracion de la animacion.", "Установить продолжительность анимации.", "设置动画时长.", "애니메이션의 길이를 설정합니다.") \ X(TOOLTIP_AUTHOR, "Set the author of the document.", "Ajusta el autor del documento.", "Установить автора документа.", "设置文件的制作者.", "파일의 작성자를 설정합니다.") \ X(TOOLTIP_AUTOSAVE_ENABLED, "Enables autosaving of documents.\n(Does not overwrite files; makes copies to restore later.)", "Activa el autoguardado de documentos.\n(No sobreescribe archivos; solo hace copias para restaurar mas tarde.)", "Включает автосохранение документов.\n(Не заменяет файлы; создает копии для последующего восстановления.)", "开启自动保存文件.\n(并不会覆盖原本的文件, 反而会创造出可重新恢复的新文件)", "파일 자동저장을 활성화합니다.\n(파일을 덮어쓰지 않습니다; 나중에 복원할 복사본을 만듭니다.)") \ - X(TOOLTIP_AUTOSAVE_INTERVAL, "If changed, will autosave documents using this interval.", "Si es cambiado, se autoguardara documentos usando este intervalo.", "Если изменено, будет автосохранять документы используя этот промежуток.", "如果更改了, 那么会使自动保存使用这个时间区间.", "이 간격으로 파일을 자동저장합니다.") \ X(TOOLTIP_AXES, "Toggle the axes' visibility.", "Alterna la visibilidad de los ejes.", "Переключить видимость осей.", "切换坐标轴是否可见.", "가로/세로 축을 표시하거나 숨깁니다.") \ X(TOOLTIP_AXES_COLOR, "Set the color of the axes.", "Ajusta el color de los ejes.", "Установить цвет осей.", "设置坐标轴的颜色.", "가로/세로 축의 색상을 설정합니다.") \ X(TOOLTIP_BACKGROUND_COLOR, "Change the background color.", "Cambia el color del fondo.", "Изменить цвет фона.", "更改背景颜色.", "배경색을 변경합니다.") \ diff --git a/src/settings.h b/src/settings.h index 43e0f24..50de9b0 100644 --- a/src/settings.h +++ b/src/settings.h @@ -58,7 +58,6 @@ namespace anm2ed X(LANGUAGE, language, STRING_UNDEFINED, INT, ENGLISH) \ \ X(FILE_IS_AUTOSAVE, fileIsAutosave, STRING_UNDEFINED, BOOL, true) \ - X(FILE_AUTOSAVE_TIME, fileAutosaveTime, STRING_UNDEFINED, INT, 1) \ X(FILE_IS_WARN_OVERWRITE, fileIsWarnOverwrite, STRING_UNDEFINED, BOOL, true) \ X(FILE_SNAPSHOT_STACK_SIZE, fileSnapshotStackSize, STRING_UNDEFINED, INT, 50) \ \