# msg-tool
msg-tool is a command-line tool for exporting, importing, packing, and unpacking script files.
## How to Compile
```bash
git clone https://github.com/lifegpc/msg-tool
cargo build --release # Build with all features enabled
cargo build --release --no-default-features --features=circus # Build with only specific features enabled. See supported types below.
```
## Basic Usage
### Extract messages from script files
```bash
msg-tool export <input> [output]
```
Some script files cannot be detected automatically. You can specify the type of script file with the `--script-type` / `-t` option.
```bash
msg-tool export -t <script-type> <input> [output]
```
If the script file is an image file, you can specify the output type of the image file with the `--image-type` / `-i` option.
```bash
msg-tool export -i webp <input> [output]
```
If the script file is an archive file, it will be unpacked and will try to extract messages/images/audio from the unpacked files. If you don't want to extract, please use the `unpack` command.
If the input is a directory, all script files in the directory will be processed. (The `-r` / `--recursive` option is needed if you want to process files in subdirectories.)
### Import data into script files
```bash
msg-tool import <input> <output> <patched>
```
### Pack files into an archive
```bash
msg-tool pack <input> -t <archive-type> [output]
```
### Unpack an archive file
```bash
msg-tool unpack <input> [output]
```
Some archive files cannot be detected automatically. You can specify the type of archive file with the `--script-type` / `-t` option.
### Create a new script file
```bash
msg-tool create -t <script-type> <input> <output>
```
## Supported Output Script Types
- `json` - [GalTransl](https://github.com/GalTransl/GalTransl)'s JSON format
- `m3t` / `m3ta` - A simple text format that supports both original/llm/translated messages.
- `yaml` - Same as `json`, but in YAML format.
- `po`/`pot` - Gettext PO/POT format.
## Supported Image Types
| `png` | `image` (enabled automatically if any image script types are enabled) |
| `jpg` | `image-jpg` |
| `webp` | `image-webp` |
| `jxl` | `image-jxl` |
## Supported Script Types
### Artemis Engine
| `artemis` | `artemis` | Artemis Engine AST file (.ast) | ✔️ | ✔️ | ❌ | ❌ | ❌ | |
| `artemis-asb` | `artemis` | Artemis Engine ASB file (.asb/.iet) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | For `.iet` files, only custom export/import and create features are supported. |
| `artemis-panmimisoft-txt` | `artemis-panmimisoft` | Artemis Engine TXT ([ぱんみみそふと](https://pannomimi.net/panmimisoft)) file (.txt) | ✔️ | ✔️ | ❌ | ❌ | ❌ | |
| `artemis-arc`/`pfs` | `artemis-arc` | Artemis Engine archive file (.pfs) | ✔️ | ✔️ | `pf2` is not supported now |
### Buriko General Interpreter / Ethornell
| `bgi`/`ethornell` | `bgi` | Buriko General Interpreter/Ethornell Script | ✔️ | ✔️ | ❌ | ❌ | ❌ | Some old games' scripts cannot be detected automatically |
| `bgi-bsi`/`ethornell-bsi` | `bgi` | Buriko General Interpreter/Ethornell BSI Script (._bsi) | ❌ | ❌ | ✔️ | ✔️ | ✔️ | |
| `bgi-bp`/`ethornell-bp` | `bgi` | Buriko General Interpreter/Ethornell BP Script (._bp) | ✔️ | ✔️ | ❌ | ❌ | ❌ | |
| `bgi-dsc`/`ethornell-dsc` | `bgi-arc` | Buriko General Interpreter/Ethornell compressed file in archive | ❌ | ❌ | ✔️ | ✔️ | ✔️ | |
| `bgi-arc-v1`/`ethornell-arc-v1` | `bgi-arc` | Buriko General Interpreter/Ethornell Archive File Version 1 (.arc) | ✔️ | ✔️ | |
| `bgi-arc`/`bgi-arc-v2`/`ethornell-arc`/`ethornell-arc-v2` | `bgi-arc` | Buriko General Interpreter/Ethornell Archive File Version 2 (.arc) | ✔️ | ✔️ | |
| `bgi-audio`/`ethornell-audio` | `bgi-audio` | Buriko General Interpreter/Ethornell Audio File (Ogg/Vorbis) | ✔️ | ❌ | ❌ | |
| `bgi-img`/`ethornell-img` | `bgi-img` | Buriko General Interpreter/Ethornell Uncompressed Image File | ✔️ | ✔️ | ❌ | ❌ | ✔️ | Image files in `sysgrp.arc` |
| `bgi-cbg`/`ethornell-cbg` | `bgi-img` | Buriko General Interpreter/Ethornell Compressed Image File | ✔️ | ✔️ | ❌ | ❌ | ✔️ | V2 is not supported when importing/creating image |
### CatSystem2
| `cat-system` | `cat-system` | CatSystem2 Scene Script File (.cst) | ✔️ | ✔️ | ❌ | ❌ | ❌ | |
| `cat-system-cstl` | `cat-system` | CatSystem2 Scene I18N File (.cstl) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | |
| `cat-system-int` | `cat-system-arc` | CatSystem2 Archive File (.int) | ✔️ | ❌ | Encrypted archives are supported too. Use `--cat-system-int-encrypt-password` to specify password |
| `cat-system-hg3` | `cat-system-img` | CatSystem2 HG3 Image File (.hg3) | ✔️ | ❌ | ✔️ | ❌ | ❌ | |
### Circus
| `circus` | `circus` | Circus Script File (.mes) | ✔️ | ✔️ | ❌ | ❌ | ❌ | Some scripts must use `--circus-mes-type` to specify game |
| `circus-crm` | `circus-arc` | Circus Image Archive File (.crm) | ✔️ | ❌ | |
| `circus-dat` | `circus-arc` | Circus Archive File (.dat) | ✔️ | ❌ | |
| `circus-pck` | `circus-arc` | Circus Archive File (.pck/.dat) | ✔️ | ✔️ | |
| `circus-pcm` | `circus-audio` | Circus Audio File (.pcm) | ✔️ | ❌ | ❌ | |
| `circus-crx` | `circus-img` | Circus Image File (.crx) | ✔️ | ✔️ | ❌ | ❌ | ✔️ | |
| `circus-crxd` | `circus-img` | Circus Differential Image File (.crx) | ✔️ | ❌ | ❌ | ❌ | ❌ | |
### Emote
| `emote-psb`/`psb` | `emote-img` | Emote PSB File | ❌ | ❌ | ✔️ | ✔️ | ✔️ | |
| `emote-pimg`/`pimg` | `emote-img` | Emote Multiple Image File (.pimg) | ❌ | ❌ | ✔️ | ❌ | ❌ | |
| `emote-dref`/`dref` | `emote-img` | Emote DPAK-referenced Image File (.dref) | ✔️ | ❌ | ❌ | ❌ | ❌ | |
### Entis GLS engine
| `entis-gls` | `entis-gls` | Entis GLS engine XML Script (.srcxml) | ✔️ | ✔️ | ❌ | ❌ | ❌ | |
### Escu:de
| `escude` | `escude` | Escu:de Script File (.bin) | ✔️ | ✔️ | ❌ | ❌ | ❌ | |
| `escude-list` | `escude` | Escu:de List File (.bin) | ❌ | ❌ | ✔️ | ✔️ | ✔️ | |
| `escude-arc` | `escude-arc` | Escu:de Archive File (.bin) | ✔️ | ✔️ | |
### ExHibit
| `ex-hibit` | `ex-hibit` | ExHibit Script File (.rld) | ✔️ | ✔️ | ✔️ | ✔️ | ❌ | |
### Favorite
| `favorite` | `favorite` | Favorite Hcb Script (.hcb) | ✔️ | ✔️ | ✔️ | ❌ | ❌ | |
### HexenHaus
| `hexen-haus` | `hexen-haus` | HexenHaus Script File (.bin) | ✔️ | ✔️ | ❌ | ❌ | ❌ | |
### Kirikiri
| `kirikiri`/`kr`/`kr-ks`/`kirikiri-ks` | `kirikiri` | Kirikiri Script File (.ks) | ✔️ | ✔️ | ❌ | ❌ | ❌ | |
| `kirikiri-scn`/`kr-scn` | `kirikiri` | Kirikiri Scene File (.scn) | ✔️ | ✔️ | ✔️ | ✔️ | ❌ | |
| `kirikiri-simple-crypt`/`kr-simple-crypt` | `kirikiri` | Kirikiri Simple Crypt Text File | ❌ | ❌ | ✔️ | ❌ | ❌ | |
| `kirikiri-mdf`/`kr-mdf` | `kirikiri` | Kirikiri Zlib-Compressed File | ❌ | ❌ | ✔️ | ❌ | ❌ | |
| `kirikiri-tjs-ns0`/`kr-tjs-ns0` | `kirikiri` | Kirikiri TJS NS0 binary encoded script | ❌ | ❌ | ✔️ | ❌ | ❌ | |
| `kirikiri-tjs2`/`kr-tjs2` | `kirikiri` | Kirikiri compiled TJS2 script | ✔️ | ✔️ | ✔️ | ✔️ | ❌ | |
| `kirikiri-tlg`/`kr-tlg` | `kirikiri-img` | Kirikiri TLG Image File (.tlg) | ✔️ | ✔️ | ❌ | ❌ | ✔️ | tlg6 is not supported when importing/creating image |
### Silky Engine
| `silky` | `silky` | Silky Engine Mes Script File (.mes) | ✔️ | ✔️ | ❌ | ❌ | ❌ | |
| `silky-map` | `silky` | Silky Engine Map File (.map) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | |
### Softpal
| `softpal` | `softpal` | Softpal Script File (.src) | ✔️ | ✔️ | ✔️ | ❌ | ❌ | |
### WillPlus / AdvHD
| `will-plus-ws2`/`adv-hd-ws2` | `will-plus` | WillPlus/AdvHD Script File (.ws2) | ✔️ | ✔️ | ❌ | ❌ | ❌ | |
### Yaneurao Itufuru
| `yaneurao-itufuru`/`itufuru` | `yaneurao-itufuru` | Yaneurao Itufuru Script File | ✔️ | ✔️ | ❌ | ❌ | ❌ | |
| `yaneurao-itufuru-arc`/`itufuru-arc` | `yaneurao-itufuru-arc` | Yaneurao Itufuru Archive File (.scd) | ✔️ | ✔️ | |