Utility for loading assets from tf2 data files
  • Rust 96.5%
  • Nix 3.5%
Find a file
2025-06-02 20:42:02 +02:00
.forgejo/workflows workflow updates 2025-06-02 20:33:49 +02:00
examples example/docs 2024-08-30 22:54:48 +02:00
src readme update 2025-06-02 20:42:02 +02:00
.envrc initial version 2023-12-20 17:01:29 +01:00
.gitignore initial version 2023-12-20 17:01:29 +01:00
Cargo.lock update dependencies 2025-03-04 21:51:04 +01:00
Cargo.toml update repo url 2025-06-02 20:31:47 +02:00
flake.lock flake update 2025-06-02 20:33:41 +02:00
flake.nix flake update 2025-06-02 20:33:41 +02:00
README.md readme update 2025-06-02 20:42:02 +02:00

tf-asset-loader

Utility for loading assets from tf2 data files.

Supports loading assets like models and textures from the tf2 data directory. The tf2 data directory should be automatically detected when installed to steam, or you can use the TF_DIR environment variable to overwrite the data directory.

Supports loading both plain file data, data embedded in vpk files and data embedded in bsp maps.

Usage

use tf_asset_loader::{Loader, LoaderError};

fn main() -> Result<(), LoaderError> {
    let loader = Loader::new()?;
    if let Some(model) = loader.load("models/props_gameplay/resupply_locker.mdl")? {
        println!("resupply_locker.mdl is {} bytes large", model.len());
    }
    Ok(())
}

Additional sources

You can customize the sources the loader looks for files by using Loader::add_source. This supports folders on the filesystem, vpk archives or Pack files from bsp files