Here is what I have done so far.
PACK Files - They also contain the RIFX format which seems to be nothing but junk if you ask me...
Code: Select all
public struct Entry
{
public uint Offset;
public uint Size;
public uint Unknown;
}
public struct PackHeader
{
public string Magic; // PACK
public byte[] Unknown; // Len16
public uint numEntires; // Maybe NumberEntries - 1
public byte[] Unknown2; // Len12
public List<Entry> Entries;
}
Code: Select all
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;
using EndianIO;
using System.Text;
namespace SoundExtractor
{
class PackFile
{
public struct Entry
{
public uint Offset;
public uint Size;
public uint Unknown;
}
public struct PackHeader
{
public string Magic; // PACK
public byte[] Unknown; // Len16
public uint numEntires; // Maybe NumberEntries - 1
public byte[] Unknown2; // Len12
public List<Entry> Entries;
}
PackHeader head;
EndianReader toc; // TOC file
BinaryReader br; // PACK file
public void Load(string _toc, string _br, ListView lst)
{
toc = new EndianReader(new FileStream(_toc, FileMode.Open, FileAccess.Read), EndianType.BigEndian);
br = new BinaryReader(new FileStream(_br, FileMode.Open, FileAccess.Read));
head = new PackHeader();
head.Entries = new List<Entry>();
lst.Items.Clear();
head.Magic = toc.ReadAsciiString(4);
if (head.Magic == "PACK")
{
head.Unknown = toc.ReadBytes(16);
head.numEntires = toc.ReadUInt32();
head.Unknown2 = toc.ReadBytes(12);
for (uint i = 0; i < head.numEntires - 1; i++)
{
Entry temp = new Entry();
temp.Offset = toc.ReadUInt32();
temp.Size = toc.ReadUInt32();
temp.Unknown = toc.ReadUInt32();
ListViewItem lvi = new ListViewItem();
lvi.Text = "PACK[" + i + "].raw";
lvi.SubItems.Add(temp.Size.ToString());
lst.Items.Add(lvi);
head.Entries.Add(temp);
}
}
toc.Close();
MessageBox.Show("Done");
}
public void Extract(string FileName, int Index)
{
BinaryWriter bw = new BinaryWriter(new FileStream(FileName, FileMode.Create, FileAccess.Write));
br.BaseStream.Position = head.Entries[Index].Offset;
bw.Write(br.ReadBytes((int)head.Entries[Index].Size));
bw.Close();
MessageBox.Show("Done");
}
}
}
Code: Select all
struct Packpher
{
public string Magic; // PACK
public byte[] Unknown; // Len8
public uint numEntries;
public byte[] Unknown1; // Len16
public List<Entry> Entries;
}
struct Entry
{
public uint FileNameLen;
public uint FileOffset;
public uint FileLength;
public int Unknown; // 0xDEDE
}