2626from binaryninja .log import log_error
2727from binaryninja import _binaryninjacore as core
2828from binaryninja .architecture import Architecture
29+ from binaryninja .platform import Platform
2930from binaryninja .binaryview import BinaryView
3031from binaryninja .binaryview import BinaryViewType
3132from binaryninja .enums import SegmentFlag
@@ -53,7 +54,7 @@ def is_valid_for_data(data):
5354 def get_load_settings_for_data (cls , data ):
5455 # This method is optional. If provided this is where the Load Settings for a BinaryViewType are specified. Binary Ninja provides
5556 # some default read-only load settings which are:
56- # ["loader.architecture", "loader. platform", "loader.entryPointOffset", "loader.imageBase", "loader.segments", "loader.sections"]
57+ # ["loader.platform", "loader.entryPointOffset", "loader.imageBase", "loader.segments", "loader.sections"]
5758 # The default load settings are provided for consistency and convenience.
5859 # The default load settings are always generated with a read-only indication which is respected by the UI.
5960 # The read-only indication is a property that consists of a JSON name/value pair ("readOnly" : true).
@@ -75,7 +76,7 @@ def get_load_settings_for_data(cls, data):
7576 load_settings = registered_view .get_default_load_settings_for_data (view )
7677
7778 # Specify default load settings that can be overridden (from the UI).
78- overrides = ["loader.architecture" , "loader. platform" , "loader.entryPointOffset" , "loader.imageBase" , "loader.segments" , "loader.sections" ]
79+ overrides = ["loader.platform" , "loader.entryPointOffset" , "loader.imageBase" , "loader.segments" , "loader.sections" ]
7980 for override in overrides :
8081 if load_settings .contains (override ):
8182 load_settings .update_property (override , json .dumps ({'readOnly' : False }))
@@ -127,9 +128,9 @@ def init(self):
127128 # This allows us to generate default load options for the BinaryView. This step is not required but can be useful.
128129 load_settings = self .__class__ .get_load_settings_for_data (self .parent_view )
129130
130- arch = load_settings .get_string ("loader.architecture " , self )
131- self .arch = Architecture [ arch ] # type: ignore
132- self .platform = Architecture [ arch ]. standalone_platform # type: ignore
131+ platform = load_settings .get_string ("loader.platform " , self )
132+ self .platform = Platform [ platform ]
133+ self .arch = self . platform . arch # type: ignore
133134 self .load_address = load_settings .get_integer ("loader.imageBase" , self )
134135 self .add_auto_segment (
135136 self .load_address , len (self .parent_view ), 0 , len (self .parent_view ),
0 commit comments