tweak windows crash

This commit is contained in:
2026-01-11 17:14:01 -05:00
parent d2bc5696bb
commit 6fd1d57306
5 changed files with 9 additions and 19 deletions

View File

@@ -35,7 +35,7 @@ namespace anm2ed::imgui
if (isDirty) if (isDirty)
{ {
document.lastAutosaveTime += ImGui::GetIO().DeltaTime; 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);
} }
} }

View File

@@ -52,11 +52,6 @@ namespace anm2ed::imgui::wizard
ImGui::Checkbox(localize.get(BASIC_ENABLED), &temporary.fileIsAutosave); ImGui::Checkbox(localize.get(BASIC_ENABLED), &temporary.fileIsAutosave);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_AUTOSAVE_ENABLED)); 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)); ImGui::SeparatorText(localize.get(LABEL_SNAPSHOTS));
input_int_range(localize.get(LABEL_STACK_SIZE), temporary.fileSnapshotStackSize, 0, 100); input_int_range(localize.get(LABEL_STACK_SIZE), temporary.fileSnapshotStackSize, 0, 100);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_STACK_SIZE)); ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_STACK_SIZE));

View File

@@ -46,9 +46,7 @@ namespace anm2ed
#ifdef _WIN32 #ifdef _WIN32
void windows_wer_localdumps_configure() void windows_wer_localdumps_configure()
{ {
// Only configure crash dumps for debug builds. #ifndef DEBUG
// (Writing per-user registry keys is still intrusive; avoid in release builds.)
#if !defined(_DEBUG)
return; return;
#endif #endif
@@ -82,15 +80,16 @@ namespace anm2ed
auto subkey = std::wstring(L"Software\\Microsoft\\Windows Error Reporting\\LocalDumps\\") + exeName; auto subkey = std::wstring(L"Software\\Microsoft\\Windows Error Reporting\\LocalDumps\\") + exeName;
HKEY key{}; HKEY key{};
auto status = RegCreateKeyExW(HKEY_CURRENT_USER, subkey.c_str(), 0, nullptr, 0, KEY_SET_VALUE, nullptr, &key, auto status =
nullptr); RegCreateKeyExW(HKEY_CURRENT_USER, subkey.c_str(), 0, nullptr, 0, KEY_SET_VALUE, nullptr, &key, nullptr);
if (status != ERROR_SUCCESS) if (status != ERROR_SUCCESS)
{ {
logger.warning(std::format("Failed to create/open WER LocalDumps key (status {}).", (int)status)); logger.warning(std::format("Failed to create/open WER LocalDumps key (status {}).", (int)status));
return; return;
} }
auto closeKey = [&]() { auto closeKey = [&]()
{
if (key) RegCloseKey(key); if (key) RegCloseKey(key);
key = nullptr; key = nullptr;
}; };
@@ -109,12 +108,10 @@ namespace anm2ed
} }
status = RegSetValueExW(key, L"DumpType", 0, REG_DWORD, (const BYTE*)&dumpType, sizeof(dumpType)); status = RegSetValueExW(key, L"DumpType", 0, REG_DWORD, (const BYTE*)&dumpType, sizeof(dumpType));
if (status != ERROR_SUCCESS) if (status != ERROR_SUCCESS) logger.warning(std::format("Failed to set WER DumpType (status {}).", (int)status));
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)); status = RegSetValueExW(key, L"DumpCount", 0, REG_DWORD, (const BYTE*)&dumpCount, sizeof(dumpCount));
if (status != ERROR_SUCCESS) if (status != ERROR_SUCCESS) logger.warning(std::format("Failed to set WER DumpCount (status {}).", (int)status));
logger.warning(std::format("Failed to set WER DumpCount (status {}).", (int)status));
closeKey(); closeKey();
logger.info(std::format("WER LocalDumps enabled (Debug) -> {}", path::to_utf8(dumpDir))); logger.info(std::format("WER LocalDumps enabled (Debug) -> {}", path::to_utf8(dumpDir)));

View File

@@ -452,7 +452,6 @@ namespace anm2ed
X(TOOLTIP_ANIMATION_LENGTH, "Set the animation's length.", "Ajusta la duracion de la animacion.", "Установить продолжительность анимации.", "设置动画时长.", "애니메이션의 길이를 설정합니다.") \ 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_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_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, "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_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.", "Изменить цвет фона.", "更改背景颜色.", "배경색을 변경합니다.") \ X(TOOLTIP_BACKGROUND_COLOR, "Change the background color.", "Cambia el color del fondo.", "Изменить цвет фона.", "更改背景颜色.", "배경색을 변경합니다.") \

View File

@@ -58,7 +58,6 @@ namespace anm2ed
X(LANGUAGE, language, STRING_UNDEFINED, INT, ENGLISH) \ X(LANGUAGE, language, STRING_UNDEFINED, INT, ENGLISH) \
\ \
X(FILE_IS_AUTOSAVE, fileIsAutosave, STRING_UNDEFINED, BOOL, true) \ 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_IS_WARN_OVERWRITE, fileIsWarnOverwrite, STRING_UNDEFINED, BOOL, true) \
X(FILE_SNAPSHOT_STACK_SIZE, fileSnapshotStackSize, STRING_UNDEFINED, INT, 50) \ X(FILE_SNAPSHOT_STACK_SIZE, fileSnapshotStackSize, STRING_UNDEFINED, INT, 50) \
\ \