ndspy.codeCompression: Code Compression

ndspy.codeCompression’s command-line interface allows you to easily compress and decompress files using the compression format used for NDS executable code files. You can access it through python3 -m ndspy.codeCompression or ndspy_codeCompression, or programmatically with ndspy.codeCompression.main().

Usage summary:

$ python3 -m ndspy.codeCompression -h
usage: codeCompression.py [-h] {compress,c,decompress,d} ...

ndspy.codeCompression CLI: Compress or decompress files using the code
compression format.

optional arguments:
  -h, --help            show this help message and exit

commands:
  (run a command with -h for additional help)

  {compress,c,decompress,d}
    compress (c)        compress a file
    decompress (d)      decompress a file

The module provides commands for compression and decompression:

Compress (compress / c)

Usage summary:

$ python3 -m ndspy.codeCompression compress -h
usage: codeCompression.py compress [-h] [--is_arm9] input_file [output_file]

positional arguments:
  input_file   input file to compress
  output_file  what to save the compressed file as

optional arguments:
  -h, --help   show this help message and exit
  --is_arm9    treat the data as a main ARM9 code file (do not use for
               overlays)

This command compresses a file in the code compression format. If no output filename is given, it defaults to the input filename, with a .cmp extension.

The --is_arm9 argument corresponds to the isArm9 argument of the compress() function.

Decompress (decompress / d)

Usage summary:

$ python3 -m ndspy.codeCompression decompress -h
usage: codeCompression.py decompress [-h] input_file [output_file]

positional arguments:
  input_file   input file to decompress
  output_file  what to save the decompressed file as

optional arguments:
  -h, --help   show this help message and exit

This command decompresses a code-compressed file. If no output filename is given, it defaults to the input filename, with a .dec extension.