mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
feat: Properly save memory provider data
This commit is contained in:
@@ -12,8 +12,11 @@
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
bool MemoryFileProvider::open() {
|
||||
this->m_data.resize(1);
|
||||
this->markDirty();
|
||||
if (this->m_data.empty()) {
|
||||
this->m_data.resize(1);
|
||||
this->markDirty();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -109,4 +112,16 @@ namespace hex::plugin::builtin {
|
||||
return { Region::Invalid(), false };
|
||||
}
|
||||
|
||||
void MemoryFileProvider::loadSettings(const nlohmann::json &settings) {
|
||||
Provider::loadSettings(settings);
|
||||
|
||||
this->m_data = settings["data"].get<std::vector<u8>>();
|
||||
}
|
||||
|
||||
[[nodiscard]] nlohmann::json MemoryFileProvider::storeSettings(nlohmann::json settings) const {
|
||||
settings["data"] = this->m_data;
|
||||
|
||||
return Provider::storeSettings(settings);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user