sys: Save project backup if ImHex crashes

This commit is contained in:
WerWolv
2021-08-17 13:41:44 +02:00
parent 551da69a4c
commit 4d677f430b
5 changed files with 33 additions and 13 deletions

View File

@@ -198,10 +198,6 @@ namespace hex {
}
});
EventManager::subscribe<EventFileLoaded>(this, [](std::string path) {
EventManager::post<RequestChangeWindowTitle>(std::filesystem::path(path).filename().string());
});
EventManager::subscribe<EventSettingsChanged>(this, [this] {
auto alpha = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.highlight_alpha");
@@ -217,7 +213,6 @@ namespace hex {
EventManager::unsubscribe<EventWindowClosing>(this);
EventManager::unsubscribe<EventPatternChanged>(this);
EventManager::unsubscribe<RequestOpenWindow>(this);
EventManager::unsubscribe<EventFileLoaded>(this);
EventManager::unsubscribe<EventSettingsChanged>(this);
}
@@ -442,8 +437,6 @@ namespace hex {
}
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.save_project"_lang, "", false, provider != nullptr && provider->isWritable())) {
EventManager::post<EventProjectFileStore>();
if (ProjectFile::getProjectFilePath() == "") {
View::openFileBrowser("hex.view.hexeditor.save_project"_lang, DialogMode::Save, { { "Project File", "hexproj" } }, [](auto path) {
if (path.ends_with(".hexproj")) {

View File

@@ -43,6 +43,9 @@ namespace hex {
View::doLater([]{ ImGui::OpenPopup(View::toWindowName("hex.view.settings.name").c_str()); });
this->getWindowOpenState() = true;
}
if (ImGui::MenuItem("Crash")) {
*reinterpret_cast<int*>(8) = 16;
}
ImGui::EndMenu();
}
}