From 4e520938c972aa1fe916a0337cb65f20e1e2ae14 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 7 Oct 2021 22:51:16 +0200 Subject: [PATCH] sys: Fixed Project load/save and Save as command --- source/helpers/project_file_handler.cpp | 4 ++-- source/providers/file_provider.cpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/helpers/project_file_handler.cpp b/source/helpers/project_file_handler.cpp index 224e40b9a..d8f68c17f 100644 --- a/source/helpers/project_file_handler.cpp +++ b/source/helpers/project_file_handler.cpp @@ -53,6 +53,8 @@ namespace hex { ProjectFile::s_currProjectFilePath = filePath; + EventManager::post(); + return true; } @@ -85,8 +87,6 @@ namespace hex { ProjectFile::s_hasUnsavedChanged = false; ProjectFile::s_currProjectFilePath = filePath; - EventManager::post(); - return true; } diff --git a/source/providers/file_provider.cpp b/source/providers/file_provider.cpp index c222b8c78..42b848796 100644 --- a/source/providers/file_provider.cpp +++ b/source/providers/file_provider.cpp @@ -91,10 +91,11 @@ namespace hex::prv { File file(path, File::Mode::Create); if (file.isValid()) { - std::vector buffer(std::min(0xFF'FFFF, file.getSize()), 0x00); + auto provider = ImHexApi::Provider::get(); + + std::vector buffer(std::min(0xFF'FFFF, provider->getActualSize()), 0x00); size_t bufferSize = buffer.size(); - auto provider = ImHexApi::Provider::get(); for (u64 offset = 0; offset < provider->getActualSize(); offset += bufferSize) { if (bufferSize > provider->getActualSize() - offset) bufferSize = provider->getActualSize() - offset;