feat: Allow recents to also display other providers

This commit is contained in:
WerWolv
2022-08-14 10:07:45 +02:00
parent 440ba3823e
commit 85f0e04d0e
14 changed files with 150 additions and 78 deletions

View File

@@ -268,10 +268,13 @@ namespace hex {
});
}
void add(prv::Provider *provider) {
void add(prv::Provider *provider, bool skipLoadInterface) {
if (Task::getRunningTaskCount() > 0)
return;
if (skipLoadInterface)
provider->skipLoadInterface();
s_providers.push_back(provider);
EventManager::post<EventProviderCreated>(provider);
@@ -310,9 +313,9 @@ namespace hex {
delete provider;
}
prv::Provider* createProvider(const std::string &unlocalizedName) {
prv::Provider* createProvider(const std::string &unlocalizedName, bool skipLoadInterface) {
prv::Provider* result = nullptr;
EventManager::post<RequestCreateProvider>(unlocalizedName, &result);
EventManager::post<RequestCreateProvider>(unlocalizedName, skipLoadInterface, &result);
return result;
}

View File

@@ -232,6 +232,9 @@ namespace hex::fs {
case ImHexPath::Yara:
result = appendPath(getDataPaths(), "yara");
break;
case ImHexPath::Recent:
result = appendPath(getConfigPaths(), "recent");
break;
}
if (!listNonExisting) {

View File

@@ -251,6 +251,9 @@ namespace hex::prv {
}
nlohmann::json Provider::storeSettings(nlohmann::json settings) const {
settings["displayName"] = this->getName();
settings["type"] = this->getTypeName();
settings["baseAddress"] = this->m_baseAddress;
settings["currPage"] = this->m_currPage;
@@ -263,7 +266,7 @@ namespace hex::prv {
}
std::pair<Region, bool> Provider::getRegionValidity(u64 address) const {
if (address > this->getActualSize())
if (address < this->getActualSize())
return { Region::Invalid(), false };
bool insideValidRegion = false;