feat: Properly save memory provider data
This commit is contained in:
parent
e77f138514
commit
ba9227c1e0
@ -38,8 +38,8 @@ namespace hex::plugin::builtin {
|
||||
|
||||
[[nodiscard]] std::pair<Region, bool> getRegionValidity(u64 address) const override;
|
||||
|
||||
void loadSettings(const nlohmann::json &settings) override { hex::unused(settings); }
|
||||
[[nodiscard]] nlohmann::json storeSettings(nlohmann::json settings) const override { return settings; }
|
||||
void loadSettings(const nlohmann::json &settings) override;
|
||||
[[nodiscard]] nlohmann::json storeSettings(nlohmann::json settings) const override;
|
||||
|
||||
void setReadOnly(bool readOnly) { this->m_readOnly = readOnly; }
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user