From b763b8da0eacdb2399813cf7e0f957b35456dbb6 Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Sat, 30 Aug 2025 23:23:33 -0500 Subject: [PATCH] add README --- README.rst | 41 +++++++++++++++++++++++++++++++++++++++++ aseprite.py | 2 -- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 README.rst diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..088af31 --- /dev/null +++ b/README.rst @@ -0,0 +1,41 @@ +=============== +saturn-aseprite +=============== + +This is a humble conversion utility from ``.aseprite`` files to Sega Saturn VDP2 +palette/character/pattern name table formats. + +Python >= 3.7 is required. + +Usage/example: + +.. code:: + + python aseprite.py rustboro.aseprite + +In the case of ``rustboro.aseprite`` (an Aseprite file with two tilesets and two +layers), the following files will be generated (also printed on stderr): + +.. code:: + + palette.bin + character_pattern__tileset_0.bin + character_pattern__tileset_1.bin + pattern_name_table__layer_0.bin + pattern_name_table__layer_1.bin + +The ``palette.bin`` and ``character_pattern__tileset_*.bin`` files can be +directly copied to VDP2 CRAM and VRAM +respectively. ``pattern_name_table__layer_*.bin`` need to be trivially modified +to point to the correct character addresses, as in: + +.. code:: c + + extern uint32_t size; + extern uint32_t * buf; + for (uint32_t i = 0; i < size / 4; i++) { + uint32_t data = buf[i]; + uint32_t character_number = (data & 0x7fff) * 8 + character_offset; + uint32_t flags = data & 0xf0000000; + vdp2.vram.u32[(vram_offset / 4) + i] = flags | character_number; + } diff --git a/aseprite.py b/aseprite.py index 432a3bc..9fdae94 100644 --- a/aseprite.py +++ b/aseprite.py @@ -587,8 +587,6 @@ def pack_pattern_name_table_2x2(filename, cel_chunk): y_flip = (tile_data & cel_chunk.data.bitmask_for_y_flip.value) != 0 pattern = (int(y_flip) << 31) | (int(x_flip) << 30) | tile_id - if x_flip or y_flip: - print("HERE", x_flip, y_flip, hex(pattern)) f.write(pack_index(pattern))