Skip to content

CommandLine Usage for Tools

Ulysses edited this page Jan 30, 2024 · 26 revisions

For every tool, use -h (--help for FreeMoteViewer) to get help.

PsbDecompile

Convert PSB to description jsons and resources.

PsbDecompile sample.psb

image

Get combined image from pimg files.

PsbDecompile image sample.psb

unlink

Unlink textures from an EMT PSB, get all textures and a PSB without textures inside (aka external texture PSB).

PsbDecompile unlink sample.psb

Usage:  unlink [options] <PSB>

Arguments:
  PSB                           PSB Path

Options:
  -o|--order <ORDER>            Set texture unlink order (ByName/ByOrder/Convention). Default=ByName
                                Allowed values are: Convention, Name, Order

Example:
  PsbDecompile unlink sample.psb

info-psb

Extract files from info.psb.m & body.bin . (FreeMote.Plugins required)

Do NOT try open .bin files with FreeMote. Always use the associated _info.psb.m files.

PsDecompile info-psb xxx_info.psb.m -k {key} -a

Usage:  info-psb [options] <PSB>

Arguments:
  PSB                           Archive Info PSB Paths

Options:
  -?|-h|--help                  Show help information
  -a|--all                      Decompile all contents in body.bin if possible (can be slow)
  -k|--key <KEY>                Set key (Infer file name from path)
  -l|--length <LEN>             Set key length. Default=131
  -b|--body <PATH>              Set body.bin path. If not set, {name}_body.bin is used.
  -1by1|--enumerate             Disable parallel processing (can be very slow)

Example:
  PsbDecompile info-psb -k 1234567890ab sample_info.psb.m
  PsbDecompile info-psb -k 1234567890ab -l 131 -a sample_info.psb.m
  Hint: The body.bin should exist in the same folder and keep both file names correct.

PsBuild

Convert description jsons and resources to PSB.

PsBuild sample.psb.json

link

Link textures into an external texture (EMT) PSB.

PsBuild link sample.psb tex000.png tex001.png

Usage:  link [options] <PSB> <Textures>

Arguments:
  PSB                    PSB Path
  Textures               Texture Paths

Options:
  -o|--order <ORDER>     Set texture link order (Name/Order/Convention). Default=Name
                         Allowed values are: Convention, Name, Order

Example:
  PsBuild link -o Order sample.psb tex000.png tex001.bmp

port

Re-compile an EMT PSB to another platform (e.g. from KRKR to Win). Supported platforms for port: win, krkr, common, ems

PsBuild port -p win sample-krkr.psb

Usage:  port [options] <PSB>

Arguments:
  PSB                    PSB Path

Options:
  -p|--spec <SPEC>       Target PSB platform (krkr/common/win/ems)
                         Allowed values are: none, common, krkr, win, ems, psp, vita, ps4, nx, citra, and, other
  -r|--resolution        Enable resolution support (may scaling images, quality is not guaranteed)

Example:
  PsBuild port -p win sample.psb

info-psb

Pack files to info.psb.m & body.bin . (FreeMote.Plugins required)

PsBuild info-psb xxx_info.psb.m.json

Usage:  info-psb [options] <PSB>

Arguments:
  PSB                    Archive Info PSB .json paths

Options:
  -i|--intersect         Only pack files which existed in info.psb.m
  -p|--packed            Prefer using PSB files rather than json files in source folder
  -k|--key <KEY>         Set key (get file name from input path)
  -l|--length <LEN>      Set key length. Default=131
  -1by1|--enumerate      Disable parallel processing (can be slow but save a lot memory)

Example:
  PsBuild info-psb sample_info.psb.m.json (Key specified in resx.json)
  PsBuild info-psb -k 1234567890ab -l 131 sample_info.psb.m.json (Must keep every filename correct)
  Hint: Always keep file names correct. A file name in source folder must match a name kept in .m.json
  If there are both `a.psb.m` and `a.psb.m.json` in the source folder, `.json` will be used (unless using `--packed`).
  If you don't have enough RAM to keep the whole output, use `-1by1` and wait patiently.

replace

In-place Replace: replace the PSB's textures. Only works for pure PSBs with not compressed textures (RGBA8, RGBA4444). If there is something wrong with rebuilt PSB, this feature would be useful.

PsBuild replace sample.psb sample.json

  • sample.json: generated by PsbDecompile sample.psb, and then replace the images in sample(resource) folder.

FreeMote Viewer

Preview EMT PSB and its motions.

Usage:  [options] <Files>

Arguments:
  Files         File paths

Options:
  -?|--help     Show help
  -w|--width    Set Window width
  -h|--height   Set Window height
  -d|--direct   Just load with EMT driver, don't try parsing with FreeMote first
  -nf|--no-fix  Don't try to apply metadata fix (for partial exported PSBs).
                Can't work together with `-d`
Examples: 
  FreeMoteViewer sample.psb
  FreeMoteViewer -w 1920 -h 1080 -d sample.psb
  FreeMoteViewer -nf sample_head.psb sample_body.psb
Hint:
  You can load multiple partial exported PSB like the `-nf` example. 
  Use correct order: always try to put the Main part at last (body is the Main part comparing to head)!
  If you're picking multiple files from file explorer and drag&drop to Viewer, drag the non-Main part.

EmtConvert

Encrypt/Decrypt a PSB, must specify the key.

pixel

When you extract images from other tools, and images' color looks wrong, use this to convert images to make pixels looks right.

Switch02

For every 4 bytes, switch byte [0] [2].

ROR

Round shift right.

ROL

Round shift left.

RGBA428

Shibuya Scramble!

Extend 4-bit pixel to 8-bit pixel.

RGBA2L8Grayscale

Convert color to L8 style GrayScale.

TLG

PNG <-> TLG image conversion.

Untile

Unswizzle

Tile

Swizzle

Flip

pack

Pack/Unpack PSBs to/from shell such as mdf, lz4 etc. (FreeMote.Plugins required)

Usage:  pack [options] <PSB>

Arguments:
  PSB                 MDF/PSB Paths

Options:
  -s|--shell <SHELL>  Set shell type. No need to specify if unpack

Example:
  EmtConvert pack -s LZ4 sample.psb

Officially supported shell types (in FreeMote.Plugins): MDF,LZ4,PSZ,MFL,MXB

Special shell type: use shell type PSD for pimg <-> PSD: EmtConvert pack -s PSD xxx.pimg; EmtConvert pack -s PSD xxx.pimg.psd

print

Print a motion (EMT or non-EMT) PSB. (for its initial state; this feature has no support; it may looks strange)

For EMT PSB, this will output one single image. For other motion PSB, this will output images for every motion inside.

mpack

Pack/Unpack MT19937 encrypted MDF. (FreeMote.Plugins required)

This is for MT19937 encrypted shells. For normal compressed MDF/MFL/MZS files, use pack -s <ShellType> command.

fix

Apply some fix to PSB.

MetadataBase

Fix [metadata/base/motion] missing issue for partial exported PSBs.

EmtMake

Convert EMT PSB to MMO project file.