A command-line tool for managing RRES (Resource) files, written in the Odin programming language.
RRES is a resource file format designed for packaging multiple resources (images, audio, text, etc.) into a single file. Each resource has a unique ID, type identifier, and associated data. The format includes features like CRC32 checksums for data integrity verification.
This implementation is based on the RRES specification from raysan5/rres, which provides the original C library and format documentation.
- Create blank RRES files
- Add resources to existing RRES files
- Remove resources by ID
- List all resources in a file
- Check if a resource ID exists
- Count total resources in a file
- Built-in CRC32 validation for data integrity
# Create a new blank RRES file
rres create <filename>
# Add a resource to an RRES file
rres add <rres_file> <resource_file> <type> <id>
# Remove a resource by ID
rres remove <filename> <id>
# List all resources in a file
rres list <filename>
# Show help
rres help# Create a new resource file
rres create my_resources.rres
# Add different types of resources
rres add my_resources.rres texture.png IMAG 1001
rres add my_resources.rres music.wav WAVE 2001
rres add my_resources.rres config.txt TEXT 3001
# List all resources
rres list my_resources.rres
# Remove a specific resource
rres remove my_resources.rres 1001Resource types are 4-character identifiers that categorize the content:
IMAG- Images (PNG, JPG, etc.)WAVE- Audio filesTEXT- Text filesDATA- Generic binary data- Custom types can be defined as needed
The RRES format consists of:
- Header: Contains file signature, version, chunk count, and metadata
- Resource Chunks: Each containing resource info (type, ID, size, CRC32) followed by the actual data
Requires the Odin compiler. Build with:
odin build . -out:rresThe rres package provides these functions:
create_blank_rres_file(filename)- Create empty RRES fileadd_resource_to_file(filename, data, type, id)- Add resourceremove_resource_from_file(filename, id)- Remove resourcelist_resources(filename)- Get all resource infoget_resource_data(filename, id)- Extract resource datahas_resource_id(filename, id)- Check if ID existsget_resource_count(filename)- Count total resources
The library provides comprehensive error handling for:
- File not found
- Invalid file format
- Read/write errors
- Resource not found
- Data corruption (CRC32 mismatch)
Code created with AI