Crate gvrtex

Source
Expand description

gvrtex is a Rust library for interfacing with the GVR texture format used in GameCube/Wii games, for example Sonic Riders.

It’s essentially the same as a regular TPL texture file (the official texture file format for GameCube/Wii), but with GVR headers instead. The image data in the file remains the same as it is for TPL files, so that the game console can read it.

§Examples

Here’s a few examples on how to encode and decode GVR texture files.

Encoding an image into a GVR file:

use gvrtex::error::TextureEncodeError;
use gvrtex::formats::DataFormat;
use gvrtex::TextureEncoder;

let mut encoder = TextureEncoder::new_gcix(DataFormat::Dxt1)?;
let encoded_file = encoder.encode(img_path)?;

Decoding a GVR file:

use gvrtex::error::TextureDecodeError;
use gvrtex::TextureDecoder;

// Reads the contents of the file in gvr_path, but doesn't decode it yet.
let mut decoder = TextureDecoder::new(gvr_path)?;

// Decode file, saving the result in the decoder
decoder.decode()?;

// Save the decoded image to the given path. The image format is derived from the file
// extension in the path.
decoder.save(save_path)?;

§Hints

Easiest place to start off is to look at TextureEncoder for encoding GVR textures and TextureDecoder for decoding GVR textures.

Modules§

error
Contains all the possible custom error types from encoding and decoding textures.
formats
Contains all the possible formats a GVR texture can be.

Structs§

TextureDecoder
Provides all the functionality needed to decode a GVR texture file.
TextureEncoder
Provides all the functionality needed to encode a GVR texture file.