A tool for BFS (Bugbear File System) archives

Related tags

Command-line bfstool
Overview

bfstool

bfstool is a tool for BFS (Bugbear File System) archive creation, extraction and more. BFS archives are present in most games developed by BugBear.

For a complete list of known official BFS archives please see bfs_file_dat.md.

Support of unofficial archives is present on a best-effort basis and is not guaranteed to work.

File format compatibility list

Game Extracting Archiving Notes
Rally Trophy N/A N/A Files are not packed
Tough Trucks N/A N/A Files are not packed
FlatOut
Glimmerati N/A N/A Files are packed in standard ZIP files
FlatOut 2
FlatOut: Ultimate Carnage
FlatOut: Head On
Sega Rally Revo
Ridge Racer Unbounded Partial BFS files are encrypted. See below for decrypting. Cannot be encrypted back currently
Wreckfest ? ? BFS files are encrypted

Examples

List files in FlatOut europe.bfs:

$ bfstool list --format v1 europe.bfs
Listing archive: europe.bfs
Physical size: 4531
Headers size: 4058
File count: 1
| Method | Size | Compressed |  Offset  | File Name                 |
|--------|------|------------|----------|---------------------------|
|   zlib | 1103 |        471 | 00000fdc | data/language/version.ini |

Extract all files from FlatOut 2 fo2b.bfs to directory fo2b

$ bfstool extract fo2b.bfs fo2b --format v2
Extracted 14 files.

Extract all tga files from FlatOut common1.bfs to directory common1

$ bfstool extract -f v1 common1.bfs common1 "**/*.tga" -v
"data/menu/bg/longjump.tga" 1228844 bytes
"data/menu/bg-mainmenu.tga" 1281282 -> 2359340 bytes
"data/menu/bg/bowling.tga" 1228844 bytes
...
"data/menu/bg/class_a_finish.tga" 1228844 bytes
Extracted 111 files.

Identify an unknown file (Only works with files listed in bfs_file_dat.md)

$ bfstool identify unknown.bfs
Identifying archive: unknown.bfs
File name: FLATOUT.BFS
Game: FlatOut
Platform: PlayStation 2
Format: v1
Source:
- Redump (USA)
- Non-Redump (Beta) (2005.03.23)
CRC32: CBB29ACA
MD5: 8b7c307a1ad5483b0bee958687d6d94e
SHA1: c02f2111a97d9b24f6be2db433d25eee97bb890a
$ bfstool id ZMenuFO2BFS.bfs
Identifying archive: ZMenuFO2BFS.bfs
File not found in the BFS file database.
Perhaps it's a modded file or not yet supported by bfstool.

If the file is present in bfs_file_dat.md, you don't need to specify the format for list, extract and dump subcommands

$ bfstool list europe.bfs
Identifying archive: europe.bfs
Listing archive: europe.bfs
Physical size: 4531
Headers size: 4058
File count: 1
| Method | Size | Compressed |  Offset  | File Name                 |
|--------|------|------------|----------|---------------------------|
|   zlib | 1103 |        471 | 00000fdc | data/language/version.ini |

Filtering

Pattern matching glob syntax is described here

To use a filter pass it as --filter-file <FILTER_FILE> to the archive subcommand. There are a couple preconfigured filters to use with --filter <FILTER>.

Example:

# Compress all files
+ **
# Do not compress any files in data/menu/bg/
- data/menu/bg/*
# Compress data/menu/bg/town2.tga and data/menu/bg/town3.tga
+ data/menu/bg/town2.tga
+ data/menu/bg/town3.tga

This would result in:

  • data/cars/car_1/skin1.dds being compressed, because it matches + **
  • data/menu/bg/town1.tga not being compressed, because it matches - data/menu/bg/*
  • data/menu/bg/town2.tga being compressed, because it matches + data/menu/bg/town2.tga
You might also like...
First project in rust which will be to make an accounts system & Leaderboard/Score system

rust-backend this is my first project in rust which will be to make a backend for compsci project it will include: Accounts, Player Achievements (if I

👁️ A tool to execute a certain command when a target file is modified.

Ojo Ojo is a simple utility that allows you to execute a specific command each time a certain file is being saved. Usage Let's say you are sick the fo

🦀️atos for linux by rust - A partial replacement for Apple's atos tool for converting addresses within a binary file to symbols.

atosl-rs 🦀️ atos for linux by rust - A partial replacement for Apple's atos tool for converting addresses within a binary file to symbols. tested on

Command line tool to convert env variables beginning with user to a htpasswd file

envhtp This command line tool converts environment variables whose keys start with "user_" into htpasswd compatible username/password pairs. The goal

A command line tool for easily generating multiple versions of a configuration file from a single template

MultiConf A command line tool for easily generating multiple versions of a configuration file from a single template. Why? I'm a big fan of the i3 win

Minimal recursive "truncate file/directory names to meet requirements" tool

trunc_filenames ssokolow@monolith ~ % trunc_filenames --help trunc_filenames 0.1.0 Rename files and directories to fit length limits. WARNING: Will n

rpsc is a *nix command line tool to quickly search for file systems items matching varied criterions like permissions, extended attributes and much more.

rpsc rpsc is a *nix command line tool to quickly search for file systems items matching varied criterions like permissions, extended attributes and mu

Rsre it's tool to rename file/directory

, Rust renamer Rsre it's tool to rename file/directory Zero dependencies 👀 Requirements Rust Nightly Install With Cargo # Install nightly rust rustup

Sniffer - a tool to quickly inspect csv and flat-file files for basic information
Sniffer - a tool to quickly inspect csv and flat-file files for basic information

sniffer sniffer is a tool to quickly inspect csv and flat-file files for basic information. Need to see how many rows are in a csv file? Want to see t

Comments
  • Added: Support for deduplicating files inside created archives & File Sorting

    Added: Support for deduplicating files inside created archives & File Sorting

    Changes

    • Added: Support for de-duplicating files in v1/v1a/v2/v2a archives.

      • Implementation uses combination of xxHash64, along with file length check to determine if to dedupe.
        • I was worried about possible collisions for a 32-bit hash function [short hash], so didn't reuse CRC32 result.
        • xxHash is stupidly fast, so I think it's a-ok.
      • Files are not de-duped when filter determines one file should be compressed and other shouldn't.
      • Tested with other copy-filter(s), seems to work okay.
      • For v1, I tested with vanilla files. For v2 I tested with mods & vanilla files.
    • Added: Compression profile for FO2 Mod Loader Reloaded Add-in, since I added support for compressed menu cars; which saves a lot of space.

    • Added: Sorting by file name for v2(a), to put groups of related files close to each other within the BFS.

    Todo

    • [ ] Add support for dedupe for V3 archives.
    • [ ] Code review. This is my first time writing Rust code.
    opened by Sewer56 0
  • Sega Rally Revo doesn't work with bfstool files on real hardware

    Sega Rally Revo doesn't work with bfstool files on real hardware

    In this test case, using the "Sega Rally Revo" DATA.BFS file.

    MD5: eb3a74cc08a9b16efe7d84183da09b06

    Steps:

    1. Extract the files from "DATA.BFS" using "extract" subcommand to a folder.
    2. Recreate "DATA.BFS" using subcommand "archive" pointing to the folder in question:

    bfstool.exe archive --format v2 --filter srr data.bfs data

    The newly created DATA.BFS will have a smaller filesize, in this specific case, 125 MB (131,173,513 bytes) compared to the 130 MB (136,341,174 bytes) from the original.

    Using UMDGen, insert newly created file into Sega Rally Revo ISO file, replacing the original one. Optionally, LBA can be adjusted, but the game in question does not have LBA protection.

    Upon testing the new ISO file, in emulator or hardware, the game won't boot.

    bug 
    opened by MDashK 5
Owner
Katie
18f (she/her). Spaghetti code specialist.
Katie
A tool for determining file types, an alternative to file

file-rs a tool for determining file types, an alternative to file whats done determining file extension determining file type determining file's mime

null 3 Nov 27, 2022
Modern file system navigation tool on Unix

monat -- Modern file system Navigator 简体中文 Introduction monat is a Unix shell auxiliary command focusing on the navigation of the file system, especia

Pavinberg 8 May 10, 2022
A CLI tool for CIs and build scripts, making file system based caching easy and correct (locking, eviction, etc.)

FS Dir Cache A CLI tool for CIs and build scripts, making file system based caching easy and correct (locking, eviction, etc.) When working on build s

Dawid Ciężarkiewicz 5 Aug 29, 2023
Single File Assets is a file storage format for images

SFA (Rust) Single File Assets is a file storage format for images. The packed images are not guaranteed to be of same format because the format while

null 1 Jan 23, 2022
SAORI for UKAGAKA. Convert a image file to resized png file.

Resized Png GitHub repository これは何? デスクトップマスコット、「伺か」で使用できるSAORIの一種です。 機能としては、指定した画像ファイルを拡大または縮小し、pngとして出力します。 「伺か」「SAORI」等の用語については詳しく説明いたしませんのでご了承下さい。

月波 清火 2 Jan 3, 2023
FileSorterX is an automatic file sorting application that sorts your files into folders based on their file extension

FileSorterX is an automatic file sorting application that sorts your files into folders based on their file extension. With FileSorterX, you can easily keep your files organized and find what you need quickly.

Xanthus 22 Apr 4, 2023
My own image file format created for fun! Install the "hif_opener.exe" to open hif files. clone the repo and compile to make your own hif file

Why am i creating this? I wanted to create my own image format since I was 12 years old using Windows 7, tryna modify GTA San Andreas. That day, when

hiftie 3 Dec 17, 2023
An easy file system based on eazy-fs of rcore.

fs-rs An easy mixed index file system based on eazy-fs of rcore. Usage if you don't have rust environment, you can download rust by: curl https://sh.r

Clstilmldy 9 Dec 21, 2022
An efficient pictures manager based on custom tags and file system organization.

PicturesManager An efficient pictures manager based on custom tags and file system organization. Developed with Tauri (web app) with a Rust backend an

Clément Grennerat 2 Dec 21, 2022
A file watcher system written in Rust.

fws-rs fws-rs is an application written in rust that acts as a configurable file watcher, capable of detecting real-time changes and running custom co

ChirujanoCodding 18 Mar 23, 2023