Skip to content

Red40-Development/red40_clothing_packer

Repository files navigation

Red40 Clothing Repacker

Red40 Clothing Repacker is a .NET CLI for analyzing GTA V/FiveM clothing resources, merging ped variation collections into a generated resource, and optionally applying those changes back to your working resource set with a reversible backup manifest.

It supports:

  • Scanning resource folders for .ymt and .ymt.xml clothing data
  • Exporting binary .ymt files to XML for inspection
  • Generating a merge plan as JSON
  • Building a new merged resource without touching the originals
  • Applying the plan to your resources with backup metadata
  • Restoring everything from the backup manifest

Like this tool and want to support further development? Checkout our store Red40 Development

New GUI now available

  • Download the release version approriate for your architecture (Windows/Linux x86-64 builds)

  • Launch and follow the steps in the help button

Preview 1

Preview 2

CLI directions

Download and Install

Option 1: Download built binaries

Download the release version approriate for your architecture (Windows/Linux x86-64 builds)

Copy the executable to your clothing folder

Option 2: Clone and run from source

Prerequisites:

  • Git
  • .NET 10 SDK

Clone the repository with the CodeWalker submodule:

git clone --recurse-submodules https://github.com/Red40-Development/red40_clothing_packer.git
cd red40_clothing_packer

Run the CLI directly:

dotnet run --project src/ClothingRepacker.Cli -- --help

Command Summary

If you are running from source, use dotnet run --project src/ClothingRepacker.Cli -- ... instead.

ClothingRepacker.Cli analyze --resources <path> --target-resource <name> --out <plan.json>
  [--max-drawables-per-component <128>] [--max-drawables-per-prop <255>]
ClothingRepacker.Cli analyze --resource <path_to_resource> [--resource <path_to_resource> ...]
  --generated-root <folder> --target-resource <name> --out <plan.json>
  [--max-drawables-per-component <128>] [--max-drawables-per-prop <255>]

ClothingRepacker.Cli build --plan <plan.json> --out <folder>
  [--include-ymt-xml <true|false>] [--include-debug-client <true|false>]
ClothingRepacker.Cli apply --plan <plan.json> --backup-root <folder> [--copy-resources-to-output]
ClothingRepacker.Cli restore --backup-manifest <backup-manifest.json>
ClothingRepacker.Cli validate --plan <plan.json>
ClothingRepacker.Cli validate --resources <path>
ClothingRepacker.Cli validate --resource <path_to_resource> [--resource <path_to_resource> ...] --generated-root <folder>
ClothingRepacker.Cli export-xml --folder <path> [--overwrite]

By default, the CLI checks the latest GitHub release when a command starts and prints a notice if a newer version is available. Add --no-version-check to any command, or set RED40_NO_VERSION_CHECK=1, to skip the check.

How to use

Assume your clothing resources live in the same directory as the executable.

Open a terminal (Powershell/Terminal) and navigate to your folder with all your clothing assets such as [clothing]

Create a merge plan:

ClothingRepacker.Cli analyze \
  --resources . \
  --target-resource zz_merged_clothing_meta \
  --out plan.json

Or pick exact resource folders instead of scanning every child folder under one parent:

ClothingRepacker.Cli analyze \
  --resource ./gang_flags \
  --resource ./gang_outfits \
  --generated-root . \
  --target-resource zz_merged_clothing_meta \
  --out plan.json

When using one or more --resource options, each value must be an actual resource folder. --generated-root controls where apply will copy the generated merged resource and any standalone generated resources.

Validate the generated plan:

ClothingRepacker.Cli validate --plan plan.json

Build the merged resource into a separate output folder (disable the ymt-xml or debug commands as appropriate):

ClothingRepacker.Cli build \
  --plan plan.json \
  --out . \
  --include-ymt-xml true \
  --include-debug-client true

This writes a generated resource like:

  • ./zz_merged_clothing_meta/fxmanifest.lua
  • ./zz_merged_clothing_meta/stream/*.ymt
  • ./zz_merged_clothing_meta/stream/*.ymt.xml
  • ./zz_merged_clothing_meta/data/*.meta
  • ./zz_merged_clothing_meta/client/validate_collections.lua

The two optional build toggles both default to true:

  • --include-ymt-xml false skips writing the preview stream/*.ymt.xml files
  • --include-debug-client false skips generating client/validate_collections.lua and removes its client_script line from fxmanifest.lua

Creature metadata is preserved and remapped when it has a matching source ShopPedApparel creatureMetaData reference. When multiple source shop metadata files share one creature metadata file, the generated shop metadata keeps that relationship and points to one shared generated creature metadata YMT. Creature metadata without a matching shop metadata reference is treated as broken, warned about during analyze, skipped during build, and only moved into the backup during apply.

pedalternatevariations.meta and first_person_alternates.meta files are detected, remapped to generated collection names and drawable indexes, written to the generated resource data folder, and declared in the generated manifest with their FiveM data file types.

Apply the plan to your actual resource set:

ClothingRepacker.Cli apply \
  --plan plan.json \
  --backup-root ./backups

To leave the source resources untouched, apply against a copied output set instead:

ClothingRepacker.Cli apply \
  --plan plan.json \
  --backup-root ./backups \
  --copy-resources-to-output

apply does three important things:

  • Renames stream files according to the plan
  • Copies original source .ymt files into a timestamped backup folder, then removes them from the source resources
  • Creates the generated merged resource under the plan's generated root. For --resources <parent> plans this remains the sibling folder next to your resources root; for repeated --resource plans it is the --generated-root folder.

With --copy-resources-to-output, apply first copies the source resource folders into the plan's generated root and performs the stream renames and source .ymt removals on those copies. Use an output root separate from the original resources.

How to Undo What the Tool Did

Every apply run writes a timestamped backup folder under your chosen --backup-root, including a backup-manifest.json file.

Example:

./backups/2026-06-16T103000Z/backup-manifest.json

To undo an apply, run:

ClothingRepacker.Cli restore \
  --backup-manifest ./backups/2026-06-16T103000Z/backup-manifest.json

restore will:

  • Delete the generated merged resource created by apply
  • Put backed-up source .ymt files back in their original locations
  • Move renamed stream files back to their original names

export will:

  • Export .ymt files to XML
ClothingRepacker.Cli export-xml --folder .

NOTE:

  • Keep the entire timestamped backup directory until you have verified the restore worked
  • Prefer running build first so you can inspect output before modifying your real resources with apply

Credits

This project uses code and file-format handling from CodeWalker. Credit and thanks to the CodeWalker project for making GTA V/FiveM resource inspection and serialization work possible.

About

Repack FiveM ymts to optimize slot utilization

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors

Languages