summaryrefslogtreecommitdiff
path: root/view/sharedcache/core/SharedCacheView.h
diff options
context:
space:
mode:
Diffstat (limited to 'view/sharedcache/core/SharedCacheView.h')
-rw-r--r--view/sharedcache/core/SharedCacheView.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/view/sharedcache/core/SharedCacheView.h b/view/sharedcache/core/SharedCacheView.h
index 0ae43368..8d4332cb 100644
--- a/view/sharedcache/core/SharedCacheView.h
+++ b/view/sharedcache/core/SharedCacheView.h
@@ -7,12 +7,20 @@
#include <binaryninjaapi.h>
+static const char* VIEW_METADATA_KEY = "shared_cache_view";
class SharedCacheView : public BinaryNinja::BinaryView
{
bool m_parseOnly;
BinaryNinja::Ref<BinaryNinja::Logger> m_logger;
+ // Restored primary file name from metadata, or the file name on first open.
+ std::string m_primaryFileName;
+
+ // Restored associated file names from metadata, this is all the associated cache entries.
+ // NOTE: Currently this is just used to alert the user to supposed missing files.
+ std::set<std::string> m_secondaryFileNames;
+
public:
SharedCacheView(const std::string& typeName, BinaryView* data, bool parseOnly = false);
@@ -22,6 +30,19 @@ public:
// Initialized the shared cache controller for this view. This is what allows us to load images and regions.
bool InitController();
+
+ void SetPrimaryFileName(std::string primaryFileName);
+
+ // Logs the secondary file name to `m_secondaryFileNames`, see the note on the field about usage.
+ void LogSecondaryFileName(std::string associatedFileName);
+
+ // Get the path to the primary file.
+ std::optional<std::string> GetPrimaryFilePath();
+
+ // Get the metadata for saving the state of the shared cache.
+ BinaryNinja::Ref<BinaryNinja::Metadata> GetMetadata() const;
+
+ void LoadMetadata(const BinaryNinja::Metadata& metadata);
};