A Rust library and programs for interacting with the Shrek SuperSlam game files.
use std::path::Path;
use shrek_superslam::{Console, MasterDat, MasterDir};
use shrek_superslam::classes::AttackMoveType;
use shrek_superslam::files::Bin;
// Read the MASTER.DAT and MASTER.DIR pair
let mut master_dir = MasterDir::from_file(Path::new("MASTER.DIR"), Console::PC).unwrap();
let mut master_dat = MasterDat::from_file(Path::new("MASTER.DAT"), master_dir).unwrap();
// Parse the Shrek character player.db.bin file, and get the last attack
let mut bin = Bin::new(
master_dat.decompressed_file("data\\players\\shrek\\player.db.bin").unwrap(),
Console::PC
).unwrap_or_else(|e| panic!("Failed to read bin file: {:?}", e));
let mut attacks = bin.get_all_objects_of_type::<AttackMoveType>();
let (offset, mut attack) = attacks.pop().unwrap();
// Modify the contents of the attack
attack.damage1 = 100.0;
// Write the new attack back to the .bin file
bin.overwrite_object(offset, &attack).unwrap();
// Write the updated .bin file back to the MASTER.DAT
master_dat.update_file("data\\players\\shrek\\player.db.bin", bin.raw()).unwrap();
// Write the updated MASTER.DAT and MASTER.DIR pair to disk
master_dat.write(Path::new("MASTER.DAT"), Path::new("MASTER.DIR"));
// We have now overwritten the damage of Shrek's last attack!This repository includes multiple programs for reading, interacting with and modifying the game's files.
A program for extracting the game's compressed file - MASTER.DAT, using the associated MASTER.DIR file. Tested and working for PC and Gamecube versions.
./shreksuperslam-extract --dat MASTER.DAT --dir MASTER.DIR --console gcWhere:
--datis the path to the MASTER.DAT--diris the path to the associated MASTER.DIR--consoleis the game version the files are from. Defaults topcif not given:pc: PCgc: Gamecubeps2: PS2xbox: Xbox
A program for taking an extracted pair of files and repacking them into the files to be read by the game. This can be used to facilitate modification of the game's files, for example changing attack values or textures. Tested and working for PC and Gamecube versions.
./shreksuperslam-repackage --data data/ --console gcWhere:
--datais the path to a 'data' directory created byshreksuperslam-extract. Currently, there is a restriction that the path must not contain more than one directories named 'data', and it must be the last.--consoleis the game version the files are from. Defaults topcif not given:pc: PCgc: Gamecubeps2: PS2xbox: Xbox
Prints the name and offset of every serialised object within the game's .bin files.
./shreksuperslam-classes --dat MASTER.DAT --dir MASTER.DIR --console gcWhere:
--datis the path to the MASTER.DAT--diris the path to the associated MASTER.DIR--consoleis the game version the files are from. Defaults topcif not given:pc: PCgc: Gamecubeps2: PS2xbox: Xbox