fix: Provider information in information view always showing info from current provider
This commit is contained in:
parent
d5c8021b41
commit
58441634d6
@ -33,6 +33,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
Region m_analysisRegion = { 0, 0 };
|
Region m_analysisRegion = { 0, 0 };
|
||||||
Region m_analyzedRegion = { 0, 0 };
|
Region m_analyzedRegion = { 0, 0 };
|
||||||
|
prv::Provider *m_analyzedProvider = nullptr;
|
||||||
|
|
||||||
std::string m_dataDescription;
|
std::string m_dataDescription;
|
||||||
std::string m_dataMimeType;
|
std::string m_dataMimeType;
|
||||||
|
@ -41,8 +41,11 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
EventProviderDeleted::subscribe(this, [this](const auto*) {
|
EventProviderDeleted::subscribe(this, [this](const auto *provider) {
|
||||||
m_dataValid = false;
|
if (provider == m_analyzedProvider) {
|
||||||
|
m_dataValid = false;
|
||||||
|
m_analyzedProvider = nullptr;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ContentRegistry::FileHandler::add({ ".mgc" }, [](const auto &path) {
|
ContentRegistry::FileHandler::add({ ".mgc" }, [](const auto &path) {
|
||||||
@ -69,6 +72,8 @@ namespace hex::plugin::builtin {
|
|||||||
m_analyzerTask = TaskManager::createTask("hex.builtin.view.information.analyzing", 0, [this](auto &task) {
|
m_analyzerTask = TaskManager::createTask("hex.builtin.view.information.analyzing", 0, [this](auto &task) {
|
||||||
auto provider = ImHexApi::Provider::get();
|
auto provider = ImHexApi::Provider::get();
|
||||||
|
|
||||||
|
m_analyzedProvider = provider;
|
||||||
|
|
||||||
if ((m_analyzedRegion.getStartAddress() >= m_analyzedRegion.getEndAddress()) || (m_analyzedRegion.getEndAddress() > provider->getActualSize())) {
|
if ((m_analyzedRegion.getStartAddress() >= m_analyzedRegion.getEndAddress()) || (m_analyzedRegion.getEndAddress() > provider->getActualSize())) {
|
||||||
m_analyzedRegion = { provider->getBaseAddress(), provider->getActualSize() };
|
m_analyzedRegion = { provider->getBaseAddress(), provider->getActualSize() };
|
||||||
}
|
}
|
||||||
@ -170,7 +175,7 @@ namespace hex::plugin::builtin {
|
|||||||
ImGui::NewLine();
|
ImGui::NewLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_analyzerTask.isRunning() && m_dataValid) {
|
if (!m_analyzerTask.isRunning() && m_dataValid && m_analyzedProvider != nullptr) {
|
||||||
|
|
||||||
// Provider information
|
// Provider information
|
||||||
ImGuiExt::Header("hex.builtin.view.information.provider_information"_lang, true);
|
ImGuiExt::Header("hex.builtin.view.information.provider_information"_lang, true);
|
||||||
@ -181,7 +186,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
|
|
||||||
for (auto &[name, value] : provider->getDataDescription()) {
|
for (auto &[name, value] : m_analyzedProvider->getDataDescription()) {
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGuiExt::TextFormatted("{}", name);
|
ImGuiExt::TextFormatted("{}", name);
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user