BonusAnalyzer: Shift non-PCI VGA formatting to formatter code

This commit is contained in:
RichardG867
2022-08-07 15:03:17 -03:00
parent 07e04362df
commit 8f39e3a079
2 changed files with 4 additions and 3 deletions

View File

@@ -466,8 +466,9 @@ def analyze_files(formatter, scan_base, file_analyzers, scan_dir_path, scan_file
# Add names to option ROMs.
previous_vendor = previous_device = None
for x in range(len(oroms)):
if type(oroms[x]) == str: # generic ROM
continue
if type(oroms[x][0]) == str: # generic ROM
# Format string.
oroms[x] = '[{0}] {1}'.format(*oroms[x]).replace('\n', '\n' + (' ' * (len(oroms[x][0]) + 3)))
elif len(oroms[x]) == 2: # PCI ROM
# Get vendor and device IDs and names.
vendor_id, device_id = oroms[x]

View File

@@ -1286,7 +1286,7 @@ class BonusAnalyzer(Analyzer):
# Strip lines that are too short or have a single repeated character.
stripped = (x.strip() for x in vga_marker.replace('\r', '').split('\n'))
vga_marker = '\n'.join(x for x in stripped if len(x) > 3 and x != (x[0] * len(x))).strip('\n')
self.oroms.append('[VGA] ' + vga_marker.replace('\n', '\n '))
self.oroms.append(('VGA', vga_marker))
# This analyzer should never return True.
return False