PckTool is structured as a layered architecture designed for maintainability, testability, and clear separation of concerns.
SoundsUnpack/
├── src/
│ └── PckTool.Abstractions/ # Interfaces & contracts (zero dependencies)
├── PckTool.Core/ # Core library (Wwise format implementations)
├── PckTool/ # CLI application
└── tests/
└── PckTool.Core.Tests/ # Unit tests
Purpose: Define contracts and interfaces with zero external dependencies.
Key Interfaces:
IPckFile- Core PCK file operations (load, save, query, modify)IPckFileFactory- Factory for creating/loading PCK filesISoundBank- Wwise soundbank operationsISoundBankBuilder- Fluent builder for creating soundbanks from scratchIMediaCollection- Embedded media collectionIStreamingFileCollection- Streaming file collectionIHircItem- HIRC hierarchy items
Patterns:
Result<T>/Result- Error handling without exceptionsWemReplacementResult- Result type for WEM replacement operations
Purpose: Implement Wwise file format parsing, modification, and serialization.
Key Components:
PckFile- Main PCK file class (implementsIPckFile)PckFileFactory- Factory implementation (implementsIPckFileFactory)SoundBankLut- Sound bank lookup tableStreamingFileLut- Streaming file lookup tableStringMap- Language name mapping
SoundBank- BNK file parsing and serialization (implementsISoundBank)SoundBankBuilder- Fluent builder (implementsISoundBankBuilder)MediaCollection- Embedded WEM audioHircCollection- HIRC items collection
BkhdChunk- Bank headerDidxChunk- Data indexDataChunk- Audio dataHircChunk- Hierarchy data- And more...
Purpose: Command-line interface for end users.
Commands:
dump- Extract sound banks and WEM filesreplace- Replace a sound bankreplace-wem- Replace a WEM filelist- List sound banksbrowse- Interactive browsersounds- List sounds in a specific bankfind- Search for WEM IDs or cue namesinfo- Show configuration info
Batch Commands:
batch create- Create a new batch project filebatch run- Execute a batch projectbatch info- Show batch project informationbatch add-action- Add an action to a batch projectbatch rm-action- Remove an action from a batch projectbatch validate- Validate a batch project configurationbatch schema- Generate JSON schema for batch projects
Services:
ServiceProvider- Lightweight service locator for testability
// Create empty PCK file
var pck = ServiceProvider.PckFileFactory.Create();
// Load existing PCK file
var pck = ServiceProvider.PckFileFactory.Load("path/to/sounds.pck");var soundBank = ServiceProvider.CreateSoundBankBuilder()
.WithId(0x12345678)
.WithVersion(0x71)
.WithLanguage(0)
.AddMedia(sourceId, wemData)
.Build();var result = pckFile.ReplaceWem(sourceId, newData);
if (result.WasReplaced)
Console.WriteLine($"Replaced in {result.EmbeddedBanksModified} bank(s)");User Input → CLI → Core → File System
↓
Abstractions (contracts)
- CLI receives user commands
- CLI uses factories from ServiceProvider
- Core implements the abstractions
- Core reads/writes Wwise format files
AKPK Header
├── Languages (StringMap)
├── Sound Banks (SoundBankLut)
│ └── Bank entries → BNK data
└── Streaming Files (StreamingFileLut)
└── WEM entries → Audio data
BNK File
├── BKHD (Bank Header)
├── DIDX (Data Index)
├── DATA (Audio Data)
├── HIRC (Hierarchy)
├── STID (String IDs)
└── Other chunks...
Tests are located in tests/PckTool.Core.Tests/ and cover:
- Serialization round-trips
- Equality comparisons
- WEM replacement functionality
- HIRC item parsing