summaryrefslogtreecommitdiff
path: root/view
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2024-08-29 19:08:59 -0400
committerMason Reed <mason@vector35.com>2024-08-29 19:10:30 -0400
commitc19bd82b7dfe4dd695048dda81707de4da651313 (patch)
tree4625c3b3f016d065f2e3443ae4a8c48d2080dd91 /view
parentc558b0c44bc80edaaf016e899c391f39dddebeef (diff)
Update load setting properties from rust plugin
Diffstat (limited to 'view')
-rw-r--r--view/bintxt/src/ihex.rs21
1 files changed, 20 insertions, 1 deletions
diff --git a/view/bintxt/src/ihex.rs b/view/bintxt/src/ihex.rs
index 5b210ff4..bb694941 100644
--- a/view/bintxt/src/ihex.rs
+++ b/view/bintxt/src/ihex.rs
@@ -3,7 +3,8 @@ use binaryninja::custombinaryview::*;
use binaryninja::rc::Ref;
use binaryninja::segment::SegmentBuilder;
use ihex::Record;
-
+use binaryninja::platform::Platform;
+use binaryninja::settings::Settings;
use crate::segment_after_address;
use crate::segment_from_address;
use crate::sort_and_merge_segments;
@@ -150,6 +151,15 @@ impl BinaryViewTypeBase for IHexViewConstructor {
fn is_deprecated(&self) -> bool {
false
}
+
+ fn load_settings_for_data(&self, data: &BinaryView) -> Option<Ref<Settings>> {
+ self.default_load_settings_for_data(&data).map(|s| {
+ s.update_bool_property("loader.platform", "readOnly", false);
+ s.update_bool_property("loader.imageBase", "readOnly", false);
+ s.update_bool_property("loader.segments", "readOnly", false);
+ s
+ })
+ }
}
pub struct IHexView {
@@ -206,6 +216,15 @@ unsafe impl CustomBinaryView for IHexView {
.contains_code(true),
);
}
+
+ // TODO: Because we detached from the raw view this setting will never be set.
+ let _ = self.core.load_settings(self.type_name()).map(|s| {
+ let platform_name = s.get_string("loader.platform", Some(&self.core), None);
+ if let Some(platform) = Platform::by_name(platform_name) {
+ self.set_default_platform(&platform);
+ }
+ });
+
Ok(())
}
}