Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from binaryninja import Architecture, BinaryView
from binaryninjaui import UIAction, UIActionHandler, Menu
from binaryninjaui import UIAction, UIActionHandler, Menu, UIContext
from PySide6.QtWidgets import (
QApplication,
QWidget,
Expand Down Expand Up @@ -226,6 +226,13 @@ def check_bad_patterns(
class AssemblerWidget(QWidget):
def __init__(self, parent=None):
super(AssemblerWidget, self).__init__(parent)

# To get a binaryview we can use the UIContext of the currently opened file/db
view = UIContext.activeContext().getCurrentView()
# Get the actual BinaryView from the UI view
self.bv = view.getData() if view else None
# Now we can access the architecture
self._current_arch = self.bv.arch if self.bv else None
self.assembler = Assembler()
self.initUI()

Expand All @@ -238,6 +245,8 @@ def initUI(self) -> None:
self.arch_combo = QComboBox()
for arch in list(Architecture):
self.arch_combo.addItem(arch.name)
if self._current_arch:
self.arch_combo.setCurrentText(self._current_arch.name)
arch_layout.addWidget(arch_label)
arch_layout.addWidget(self.arch_combo)
layout.addLayout(arch_layout)
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
"type": [
"helper"
],
"version": "1.0.1"
"version": "1.0.2"
}