public static void Handle_SYMB(TBinary _toshi, Chunk _chunk, BinaryReader _reader) { List <TSymbol> _chunkSymbols = new List <TSymbol>(); Int32 _symbolCount = _reader.ReadInt32(), _symbolOffset = ((int)_reader.BaseStream.Position + (_symbolCount * 12)); for (int i = 0; i < _symbolCount; i++) { _chunkSymbols.Add(new TSymbol(_reader, ref _symbolOffset)); _toshi.Files[i].Symbol = _chunkSymbols[i]; } }
public static void Handle_HDRX(TBinary _toshi, Chunk _chunk, BinaryReader _reader) { _reader.BaseStream.Seek(4, SeekOrigin.Current); for (int i = 0, _i = _reader.ReadInt32(); i < _i; i++) { _toshi.Files.Add(new TFile(_reader, (Int32)_toshi.Chunks["SECT"].Base)); if (i > 0) { _toshi.Files[i].Offset += _toshi.Files[i - 1].Offset + _toshi.Files[i - 1].Length; } } }
public static void Handle_ttex(TBinary _toshi, TFile _file, BinaryReader _reader, string _path) { // TODO: Figure out more of the header _reader.BaseStream.Seek(48, SeekOrigin.Begin); string _ttexName = _reader.ReadStringNT(); while (_reader.PeekByte() == 0x00) { _reader.BaseStream.Seek(1, SeekOrigin.Current); } _reader.BaseStream.Seek(24, SeekOrigin.Current); File.WriteAllBytes(_path + "\\" + _ttexName, _reader.ReadBytes((int)(_file.Length - _reader.BaseStream.Position))); }
static void Main(string[] args) { // Collection of files to read List <string> _toshiFiles = new List <string>() { //@"D:\Steam\steamapps\common\de Blob\Data\Font\Blob.font.trb", //@"D:\Steam\steamapps\common\de Blob\Data\credits.trb", //@"D:\Steam\steamapps\common\de Blob\Data\Entities\ProjectileData.trb" //@"D:\Steam\steamapps\common\de Blob\Data\Matlibs\bkg_rev3.trb" @"D:\Steam\steamapps\common\de Blob\Data\LEVELS\PRODUCTION\Singleplayer\Abyss\RegionAssets.trb" }; // Loop through files and parse for (int i = 0; i < _toshiFiles.Count; i++) { TBinary _toshiBinary = new TBinary(_toshiFiles[i]); for (int j = 0; j < ChunkHandler.Order.Length; j++) { Chunk _chunkGet = _toshiBinary.Chunks[ChunkHandler.Order[j]]; if (_chunkGet != null) { MethodInfo _chunkHandler = Assembly.GetExecutingAssembly().GetType("trb_explorer.ChunkHandler").GetMethod("Handle_" + _chunkGet.Name); if (_chunkHandler != null) { _toshiBinary.Reader.BaseStream.Seek(_chunkGet.Base, SeekOrigin.Begin); _chunkHandler.Invoke(null, new object[] { _toshiBinary, _chunkGet, _toshiBinary.Reader }); } else { Console.WriteLine("Could not handle: {0}", _chunkGet.Name); } } } _toshiBinary.DumpFiles(@"D:\Steam\steamapps\common\de Blob\Data\Dump"); } }
public static void Handle_Unknown(TBinary _toshi, TFile _file, BinaryReader _reader, string _path) { File.WriteAllBytes(_path + "\\" + _toshi.Name + "_asset" + _file.Symbol.Index + "." + _file.Symbol.Name, _reader.ReadBytes(_file.Length)); }