From 030724a9aea346e4a9843d5842fb28c6d6c4cf1a Mon Sep 17 00:00:00 2001 From: Peter Fors Date: Thu, 9 Oct 2025 22:07:52 +0200 Subject: Rearrangement and refactoring and optimizations and more accuracy --- mapper_scan.py | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100755 mapper_scan.py (limited to 'mapper_scan.py') diff --git a/mapper_scan.py b/mapper_scan.py deleted file mode 100755 index 5b6e96a..0000000 --- a/mapper_scan.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python3 -import glob -import re - -def scan_mappers(): - mappers = [] - - # Find all mapper_*.c files - for filename in sorted(glob.glob("mapper_*.c")): - # Extract mapper ID from filename - match = re.match(r'mapper_(\d+)_([0-9a-fA-F])\.c', filename) - if match: - mapper_id = int(match.group(1)) - submapper_id = int(match.group(2), 16) - full_id = (mapper_id << 4) | submapper_id - else: - # Legacy format: mapper_xxx.c without submapper - match = re.match(r'mapper_(\d+)\.c', filename) - if match: - mapper_id = int(match.group(1)) - full_id = (mapper_id << 4) | 0 - else: - continue - - init_fn = f"mapper_{mapper_id:03d}_{submapper_id:x}_init" if 'submapper_id' in locals() else f"mapper_{mapper_id:03d}_init" - mappers.append((full_id, init_fn)) - - return mappers - -def generate_table(mappers): - print("static struct mapper_entry mapper_table[] = {") - for full_id, init_fn in mappers: - print(f"\t{{ 0x{full_id:04x}, {init_fn} }},") - print("};") - -if __name__ == "__main__": - mappers = scan_mappers() - generate_table(mappers) -- cgit v1.2.3