Make sure important data is synchronized between ImHex and plugins

This commit is contained in:
WerWolv
2021-01-04 00:19:56 +01:00
parent c7c654d310
commit eed7ef1ac3
24 changed files with 148 additions and 113 deletions

View File

@@ -13,13 +13,13 @@ namespace hex {
ViewPatches::ViewPatches() : View("Patches") {
View::subscribeEvent(Events::ProjectFileStore, [this](const void*) {
auto provider = prv::Provider::getCurrentProvider();
auto provider = *SharedData::get().currentProvider;
if (provider != nullptr)
ProjectFile::setPatches(provider->getPatches());
});
View::subscribeEvent(Events::ProjectFileLoad, [this](const void*) {
auto provider = prv::Provider::getCurrentProvider();
auto provider = *SharedData::get().currentProvider;
if (provider != nullptr)
provider->getPatches() = ProjectFile::getPatches();
});
@@ -32,7 +32,7 @@ namespace hex {
void ViewPatches::drawContent() {
if (ImGui::Begin("Patches", &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
auto provider = prv::Provider::getCurrentProvider();
auto provider = *SharedData::get().currentProvider;
if (provider != nullptr && provider->isReadable()) {