gfxd-rs
A safe Rust wrapper for glankk's C library
libgfxd, the defacto N64 display list
disassembler library.
This crate uses the gfxd-sys crate,
which exposes Raw FFI bindings for libgfxd, meaning this crate requires a
C compiler.
Example usage
use ;
// F3DEX data
static INPUT: = ;
static OUTPUT: &str = "\
{
gsDPPipeSync(),
gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, 0, 0, 0, 1, COMBINED, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED),
gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2),
gsSPClearGeometryMode(G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR),
gsSPSetGeometryMode(G_CULL_BACK | G_FOG),
gsDPSetPrimColor(0, 0, 0xFF, 0xFF, 0xFF, 0xFF),
gsSPVertex(0x000002E0, 12, 0),
gsSP2Triangles(0, 1, 2, 0, 1, 3, 2, 0),
gsSP2Triangles(4, 5, 6, 0, 5, 7, 6, 0),
gsSP1Quadrangle(5, 8, 9, 7, 0),
gsSP1Quadrangle(10, 1, 0, 11, 0),
gsSPEndDisplayList(),
}
";
// Customize the generated output.
let mut customizer = new;
// Override the default macro handler to make the output prettier.
let mut macro_fn = ;
customizer.macro_fn;
// Print an opening and closing brace around the disassembled data.
let mut before = ;
let mut after = ;
customizer.before_after_execution_callback;
// Select F3DEX as the target microcode and pass a data buffer, executing
// until either the end of input or encountering an invalid command.
let out = new.disassemble;
// Check the disassembly is formatted as we expect.
assert_eq!;
Minimum Supported Rust Version (MSRV)
The current version of gfxd-rs requires Rust 1.48.0 or greater.
The current policy is that this may be changed in minor version updates.
Cargo features
This crate does not depend on Rust's std crates. It does depend on Rust's
core and alloc crates.
Currently none of the available features are enabled by default.
std: Turns onstd(or turn offno_std, depending on how you prefer it). Even when this crate does not depend on Rust'sstd, the internal library it is wrapping (libgfxd) does depend on the C standard library, including IO functions like theprintffamily and allocation functions like themallocfamily.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Versioning and changelog
This library follows Semantic Versioning. We try to always keep backwards compatibility, so no breaking changes should happen until a major release (i.e. jumping from 1.X.X to 2.0.0).
To see what changed on each release visit either the CHANGELOG.md file or check the releases page on Github. You can also use this link to check the latest release.