From e08b851c79ae9a7fc0a2066e49110dc7fb426bce Mon Sep 17 00:00:00 2001 From: Peter Fors Date: Mon, 28 Apr 2025 22:19:43 +0200 Subject: reverted rewrite of ppu, optimized what functions should be forced inline, gained ~2.5% performance --- addmapper.py | 67 ------------------------------------------------------------ 1 file changed, 67 deletions(-) delete mode 100755 addmapper.py (limited to 'addmapper.py') diff --git a/addmapper.py b/addmapper.py deleted file mode 100755 index 8848e87..0000000 --- a/addmapper.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python3 -import sys - -def generate_mapper_files(mapper_id, submapper_id=0): - # Format: submapper (1 hex digit) + mapper_id (3 hex digits, zero-padded) - full_id = f"{submapper_id:01x}{int(mapper_id):03x}" - filename = f"mapper_{full_id}" - - # Generate C file content - c_content = f""" - -static void {filename}_init(struct nes_state *state) {{ -}} - -static uint8_t {filename}_prg_read(struct nes_state *state, uint32_t addr) {{ -}} - -static void {filename}_prg_write(struct nes_state *state, uint32_t addr, uint8_t value) {{ -}} - -static uint8_t {filename}_chr_read(struct nes_state *state, uint32_t addr) {{ -}} - -static void {filename}_chr_write(struct nes_state *state, uint32_t addr, uint8_t value) {{ -}} - -static uint8_t {filename}_ciram_read(struct nes_state *state, uint32_t addr) {{ -}} - -static void {filename}_ciram_write(struct nes_state *state, uint32_t addr, uint8_t value) {{ -}} - -static void {filename}_tick(struct nes_state *state) {{ -}} -""" - - # Generate H file content - h_content = f""" - -struct {filename} {{ -}}; -""" - - # Generate table entry - table_entry = f""" {{ 0x{int(mapper_id):x}, {filename}_prg_read, {filename}_prg_write, {filename}_chr_read, {filename}_chr_write, {filename}_ciram_read, {filename}_ciram_write, {filename}_tick, {filename}_init }},""" - - # Write files - with open(f"{filename}.c", "w") as f: - f.write(c_content) - - with open(f"{filename}.h", "w") as f: - f.write(h_content) - - print(f"Generated files: {filename}.c, {filename}.h") - print("\nTable entry (copy-paste this into your mapper table):") - print(table_entry) - -if __name__ == "__main__": - if len(sys.argv) < 2: - print("Usage: python newmapper.py [submapper_id=0]") - print("Example: python newmapper.py 123 0 # Creates mapper_0123.*") - sys.exit(1) - - mapper_id = sys.argv[1] - submapper_id = int(sys.argv[2]) if len(sys.argv) > 2 else 0 - generate_mapper_files(mapper_id, submapper_id) - -- cgit v1.2.3