sys: Fixed Project load/save and Save as command

This commit is contained in:
WerWolv 2021-10-07 22:51:16 +02:00
parent 7498a72f70
commit 4e520938c9
2 changed files with 5 additions and 4 deletions

View File

@ -53,6 +53,8 @@ namespace hex {
ProjectFile::s_currProjectFilePath = filePath;
EventManager::post<EventProjectFileLoad>();
return true;
}
@ -85,8 +87,6 @@ namespace hex {
ProjectFile::s_hasUnsavedChanged = false;
ProjectFile::s_currProjectFilePath = filePath;
EventManager::post<EventProjectFileLoad>();
return true;
}

View File

@ -91,10 +91,11 @@ namespace hex::prv {
File file(path, File::Mode::Create);
if (file.isValid()) {
std::vector<u8> buffer(std::min<size_t>(0xFF'FFFF, file.getSize()), 0x00);
auto provider = ImHexApi::Provider::get();
std::vector<u8> buffer(std::min<size_t>(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;