ticfile
A library for reading and writing TIC-80 .tic cartridge files.
See https://github.com/nesbox/TIC-80/wiki/.tic-File-Format for the file format description.
Installation
pip install ticfile
Usage
from ticfile import TICFile, ChunkType
duck_jam = TICFile.open("duckjam.tic")
code_chunks = [chunk for chunk in duck_jam.chunks if chunk.type == ChunkType.CODE]
code_lines = code_chunks[0].data.decode("ascii").split("\n")
print(code_lines[0])
API
The ticfile module provides the following definitions:
TICFile
Represents a complete .tic file.
Class methods
TICFile(chunks)- construct aTICFilefrom a list ofChunkobjectsTICFile.open(filename)- open aTICFilefrom the given filenameTICFile.from_file(f)- open aTICFilefrom the given file handle
Instance methods / attributes
chunks- the list ofChunkobjects making up this filesave(filename)- write this file to the given filename
ChunkType
An enum defining the available chunk types:
ChunkType.TILES = 1
ChunkType.SPRITES = 2
ChunkType.MAP = 4
ChunkType.CODE = 5
ChunkType.FLAGS = 6
ChunkType.SAMPLES = 9
ChunkType.WAVEFORM = 10
ChunkType.PALETTE = 12
ChunkType.MUSIC = 14
ChunkType.PATTERNS = 15
ChunkType.DEFAULT = 17
ChunkType.SCREEN = 18
ChunkType.BINARY = 19
ChunkType.COVER_DEP = 3
ChunkType.PATTERNS_DEP = 13
ChunkType.CODE_ZIP = 16
Chunk
Represents an individual chunk within a .tic file.
Class methods
Chunk(chunk_type, bank, data)- construct aChunkobject **chunk_type- one of the enum values defined inChunkType**bank- the bank number (0..7) for this chunk **data- the binary data of this chunk, excluding the header, as abytesobject
Instance methods / attributes
type- the type of this chunk, given as one of the enum values defined inChunkTypebank- the bank number (0..7) for this chunkdata- the binary data of this chunk, excluding the header, as abytesobjectwrite(f)- write this chunk to the given file handle
Release files for ticfile 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ticfile-0.1.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ticfile-0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.8 kB
Release files / ticfile-0.1.tar.gz
| Download URL | ticfile-0.1.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e2a6a52ccfb10187f852c6c508c215d92ed5e718eb823751ea2b995abd9ca75
|
|
BLAKE2b-256 checksum How to use checksums |
9053b1d585bdb1991d9770e67c886c1ab22c4f5dc0bd6b45fa49b8f127b6b6bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Release files / ticfile-0.1-py3-none-any.whl
| Download URL | ticfile-0.1-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ab24577250711bbf272a3fbf426e8e8d6167e67772cd60ea0a6dfedd101c34a
|
|
BLAKE2b-256 checksum How to use checksums |
30fed23ab6cfef2a580ce4de7bf0a7e639f00e3ed61cd9980e1b03e66ba3b7c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|