|
@@ -69,7 +69,12 @@ class BaseBinary:
|
|
|
def mmap(self):
|
|
|
mm = mmap.mmap(self._file.fileno(), 0, access=mmap.ACCESS_READ)
|
|
|
yield mm
|
|
|
- mm.close()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
def read(self, address, size) -> bytes:
|
|
|
|
|
@@ -211,6 +216,18 @@ class ByteSigEntry(LocationEntry, tag="bytesig", kw_only=True):
|
|
|
allow_multiple: bool = False
|
|
|
|
|
|
def process(self, bin: PlatformBinary) -> ResultValues:
|
|
|
+ if self.symbol or self.bytescan:
|
|
|
+ address = self.calculate_phys_address(bin)
|
|
|
+ data = bin.read(address, self.contents.length)
|
|
|
+ if not self.contents.expr.match(data):
|
|
|
+ actual_disp = f"[{data.hex(' ')}]"
|
|
|
+ raise AssertionError(
|
|
|
+ f"Assertion failed: {self.contents.display_str} != {actual_disp}"
|
|
|
+ )
|
|
|
+ return {
|
|
|
+ KEY_AS_IS: self.contents.gameconf_str,
|
|
|
+ }
|
|
|
+
|
|
|
with bin.mmap() as memory:
|
|
|
matches = self.contents.expr.finditer(memory)
|
|
|
match = next(matches, False)
|