Skip to content

CodeOnARaft/odin-rres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RRES File Manager - Odin Implementation

A command-line tool for managing RRES (Resource) files, written in the Odin programming language.

What is RRES?

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.

Features

  • 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

Usage

Commands

# 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

Examples

# 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 1001

Resource Types

Resource types are 4-character identifiers that categorize the content:

  • IMAG - Images (PNG, JPG, etc.)
  • WAVE - Audio files
  • TEXT - Text files
  • DATA - Generic binary data
  • Custom types can be defined as needed

File Structure

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

Building

Requires the Odin compiler. Build with:

odin build . -out:rres

API Functions

The rres package provides these functions:

  • create_blank_rres_file(filename) - Create empty RRES file
  • add_resource_to_file(filename, data, type, id) - Add resource
  • remove_resource_from_file(filename, id) - Remove resource
  • list_resources(filename) - Get all resource info
  • get_resource_data(filename, id) - Extract resource data
  • has_resource_id(filename, id) - Check if ID exists
  • get_resource_count(filename) - Count total resources

Error Handling

The library provides comprehensive error handling for:

  • File not found
  • Invalid file format
  • Read/write errors
  • Resource not found
  • Data corruption (CRC32 mismatch)

AI

Code created with AI

About

RRES file manager implementation in Odin programming language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages