Project Structure
ZZAR is organized into several core modules:Core Architecture
Audio Processing Pipeline
ZZAR processes Zenless Zone Zero audio files through this pipeline:-
Extraction (
pck_extractor.py,pck_indexer.py)- Read
.pckarchive files - Extract
.bnkSoundBank files - Index WEM audio files inside BNK archives
- Read
-
Conversion (
audio_converter.py,wwise_wrapper.py)- Convert between MP3, WAV, and WEM formats
- Use Wwise for game-compatible WEM encoding
- Use FFmpeg/vgmstream for decoding
-
Modification (
bnk_handler.py,mod_package_manager.py)- Replace WEM files in BNK archives
- Rebuild BNK with modified audio
- Package changes into
.zzarmod files
-
Packing (
pck_packer.py)- Rebuild
.pckarchives with modified BNK files - Install mods to game directory
- Rebuild
GUI Architecture
ZZAR uses PyQt5 with QML for the interface:- Python Backend - Core logic and game file manipulation
- QML Frontend - Declarative UI components
- Bridge Classes (
gui/backend/) - Connect Python to QML using Qt signals/slots
Coding Standards
Python Code Style
Follow these conventions when writing Python code:- PEP 8 - Use standard Python style guidelines
- 4 spaces for indentation (no tabs)
- Snake case for functions and variables (
extract_wem_file) - Pascal case for classes (
ModPackageManager) - Docstrings for all public functions and classes
QML Code Style
- 2 spaces for indentation
- Camel case for properties (
audioFile) - Pascal case for component names (
AudioBrowserView) - Comments for complex UI logic
File Organization
- Keep related functionality together in modules
- Use
Pathfrompathlibinstead of string paths - Handle platform differences (Windows/Linux) explicitly
Testing
Manual Testing
Before submitting changes, test these workflows:-
Audio Browser
- Browse game audio files
- Preview WEM playback
- Search and filter functionality
-
Mod Creation
- Replace audio files
- Export as
.zzarpackage - Verify mod structure
-
Mod Installation
- Install
.zzarmods - Enable/disable mods
- Handle conflicts between mods
- Install
-
Audio Conversion
- Convert MP3 → WEM
- Convert WAV → WEM
- Convert WEM → WAV
Platform Testing
Test on both platforms when possible:- Windows - Native Wwise, no Wine needed
- Linux - Wwise via Wine, GStreamer audio
Contributing Workflow
Create a Branch
Create a feature branch for your changes:Use descriptive branch names:
feature/add-audio-previewfix/bnk-extraction-crashdocs/update-readme
Commit Your Changes
Write clear, descriptive commit messages:Good commit messages:
- “Fix BNK extraction crash on corrupted files”
- “Add Spanish translation support”
- “Update PyInstaller spec for Linux dependencies”
- “fix bug”
- “update”
- “asdf”
Translation Support
ZZAR supports multiple languages through Qt’s translation system.Adding Translations
- Extract translatable strings:
-
Edit
.tsfiles insrc/gui/translations/:zzar_en.ts- English (source)zzar_es.ts- Spanish- Add new language files as needed
- Use Qt Linguist or edit XML directly to provide translations
- Test translations by changing system language
Making Code Translatable
Useself.tr() in Python classes:
qsTr() in QML:
Utility Scripts
Speaker Clustering (scripts/speaker_cluster.py)
Identify voice characters in ZZZ audio using MFCC clustering:
- Extracts voice clips from game files
- Computes audio features (MFCC, F0, spectral stats)
- Clusters speakers using hierarchical clustering
- Outputs speaker groups for tagging
Translation Fixer (scripts/fix_translations.py)
Maintain translation files:
- Runs
lupdateon QML files - Extracts
self.tr()calls from Python - Injects entries into
.tsfiles - Removes obsolete translations
Resources
Getting Help
If you need help:- Check existing GitHub Issues
- Ask in the project’s discussion forum
- Reach out to maintainers