Willy-JL 1 год назад
Родитель
Сommit
c389bb7442
2 измененных файлов с 12 добавлено и 6 удалено
  1. 9 3
      air_arkanoid/engine/scripts/sprite_builder.py
  2. 3 3
      video_game_module_tool/flasher/rp2040.c

+ 9 - 3
air_arkanoid/engine/scripts/sprite_builder.py

@@ -14,6 +14,7 @@ from PIL import Image, ImageOps
 #   uint32 height in px
 #   uint32 height in px
 #   uint8[] pixel data, every row is padded to 8 bits (like XBM)
 #   uint8[] pixel data, every row is padded to 8 bits (like XBM)
 
 
+
 def image2xbm(input_file_path):
 def image2xbm(input_file_path):
     with Image.open(input_file_path) as im:
     with Image.open(input_file_path) as im:
         with io.BytesIO() as output:
         with io.BytesIO() as output:
@@ -22,6 +23,7 @@ def image2xbm(input_file_path):
             bw.save(output, format="XBM")
             bw.save(output, format="XBM")
             return output.getvalue()
             return output.getvalue()
 
 
+
 def xbm2fxbm(data):
 def xbm2fxbm(data):
     # hell as it is, but it works
     # hell as it is, but it works
     f = io.StringIO(data.decode().strip())
     f = io.StringIO(data.decode().strip())
@@ -36,12 +38,13 @@ def xbm2fxbm(data):
     output += image_bin
     output += image_bin
     return output
     return output
 
 
+
 def process_sprites(input_dir, output_dir):
 def process_sprites(input_dir, output_dir):
     for root, dirs, files in os.walk(input_dir):
     for root, dirs, files in os.walk(input_dir):
         for file in files:
         for file in files:
-            if file.startswith('.'):
+            if file.startswith("."):
                 continue
                 continue
-            
+
             try:
             try:
                 input_file_path = os.path.join(root, file)
                 input_file_path = os.path.join(root, file)
                 rel_path = os.path.relpath(input_file_path, input_dir)
                 rel_path = os.path.relpath(input_file_path, input_dir)
@@ -58,6 +61,7 @@ def process_sprites(input_dir, output_dir):
             except Exception as e:
             except Exception as e:
                 print(f"Cannot convert '{rel_path}': {e}")
                 print(f"Cannot convert '{rel_path}': {e}")
 
 
+
 def clear_directory(directory):
 def clear_directory(directory):
     for root, dirs, files in os.walk(directory, topdown=False):
     for root, dirs, files in os.walk(directory, topdown=False):
         for name in files:
         for name in files:
@@ -65,6 +69,7 @@ def clear_directory(directory):
         for name in dirs:
         for name in dirs:
             os.rmdir(os.path.join(root, name))
             os.rmdir(os.path.join(root, name))
 
 
+
 def main():
 def main():
     parser = argparse.ArgumentParser()
     parser = argparse.ArgumentParser()
     parser.add_argument("source", help="Source directory")
     parser.add_argument("source", help="Source directory")
@@ -80,5 +85,6 @@ def main():
 
 
     return 0
     return 0
 
 
+
 if __name__ == "__main__":
 if __name__ == "__main__":
-    main()
+    main()

+ 3 - 3
video_game_module_tool/flasher/rp2040.c

@@ -64,9 +64,9 @@
 #define RP_SSI_XIP_SPI_CTRL0_FORMAT_STD_SPI (0U << 0U)
 #define RP_SSI_XIP_SPI_CTRL0_FORMAT_STD_SPI (0U << 0U)
 #define RP_SSI_XIP_SPI_CTRL0_FORMAT_SPLIT (1U << 0U)
 #define RP_SSI_XIP_SPI_CTRL0_FORMAT_SPLIT (1U << 0U)
 #define RP_SSI_XIP_SPI_CTRL0_FORMAT_FRF (2U << 0U)
 #define RP_SSI_XIP_SPI_CTRL0_FORMAT_FRF (2U << 0U)
-#define RP_SSI_XIP_SPI_CTRL0_ADDRESS_LENGTH(x) (((x)*2U) << 2U)
+#define RP_SSI_XIP_SPI_CTRL0_ADDRESS_LENGTH(x) (((x) * 2U) << 2U)
 #define RP_SSI_XIP_SPI_CTRL0_INSTR_LENGTH_8b (2U << 8U)
 #define RP_SSI_XIP_SPI_CTRL0_INSTR_LENGTH_8b (2U << 8U)
-#define RP_SSI_XIP_SPI_CTRL0_WAIT_CYCLES(x) (((x)*8U) << 11U)
+#define RP_SSI_XIP_SPI_CTRL0_WAIT_CYCLES(x) (((x) * 8U) << 11U)
 #define RP_SSI_XIP_SPI_CTRL0_XIP_CMD_SHIFT 24U
 #define RP_SSI_XIP_SPI_CTRL0_XIP_CMD_SHIFT 24U
 #define RP_SSI_XIP_SPI_CTRL0_XIP_CMD(x) ((x) << RP_SSI_XIP_SPI_CTRL0_XIP_CMD_SHIFT)
 #define RP_SSI_XIP_SPI_CTRL0_XIP_CMD(x) ((x) << RP_SSI_XIP_SPI_CTRL0_XIP_CMD_SHIFT)
 #define RP_SSI_XIP_SPI_CTRL0_TRANS_1C1A (0U << 0U)
 #define RP_SSI_XIP_SPI_CTRL0_TRANS_1C1A (0U << 0U)
@@ -94,7 +94,7 @@
 
 
 // SPI Flash defines
 // SPI Flash defines
 #define SPI_FLASH_OPCODE_MASK 0x00ffU
 #define SPI_FLASH_OPCODE_MASK 0x00ffU
-#define SPI_FLASH_OPCODE(x) ((x)&SPI_FLASH_OPCODE_MASK)
+#define SPI_FLASH_OPCODE(x) ((x) & SPI_FLASH_OPCODE_MASK)
 #define SPI_FLASH_DUMMY_MASK 0x0700U
 #define SPI_FLASH_DUMMY_MASK 0x0700U
 #define SPI_FLASH_DUMMY_SHIFT 8U
 #define SPI_FLASH_DUMMY_SHIFT 8U
 #define SPI_FLASH_DUMMY_LEN(x) (((x) << SPI_FLASH_DUMMY_SHIFT) & SPI_FLASH_DUMMY_MASK)
 #define SPI_FLASH_DUMMY_LEN(x) (((x) << SPI_FLASH_DUMMY_SHIFT) & SPI_FLASH_DUMMY_MASK)