Skip to content

About

Pure-Rust Windows toolkit to unpack/repack PUBG Mobile PAK archives (v11-v14) and decompile obfuscated Lua 5.3 bytecode in-process. Single yargi.exe - no Python, Java or JVM.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

YARGI ENGINE

PAK extractor / repacker and native Lua 5.3 decompiler for Tencent / PUBG Mobile-style archives — written entirely in Rust, shipped as a single yargi.exe.

Release Downloads Platform Rust License

YARGI ENGINE unpacks, verifies and repacks PAK v11–v14 archives and decompiles the game's obfuscated Lua 5.3 bytecode in-process — no JVM, no Java, no Python and no sidecar binaries. The reverse-engineered bytecode restore runs natively in Rust and feeds a vendored, patched unluac crate.

yargi.exe --version
YARGI ENGINE 1.0.0

Why YARGI ENGINE?

  • One file, zero setup. Copy yargi.exe, run it. No Python, pip, Java, JVM, DLLs or VC++ redistributable.
  • Native decompiler. The PUBG Mobile bytecode transform was reverse-engineered and reimplemented in Rust; decompilation happens inside the process.
  • All CPU cores. Extraction and decompilation are parallelised with rayon.
  • PAK v11 → v14. Index/footer parsing, extraction, verification, manifest and slot-safe repacking, including unaligned encrypted slots.
  • Honest progress. Live bars show done/total, files per second and ETA while the work is running.
  • Hardened. Bounds-checked parsing, per-file isolation, 8 MiB worker stacks and post-write verification — a bad file cannot take down the batch.

Python vs Rust

The previous tool was a Python wrapper around external bytecode/decompiler scripts plus a Java unluac jar. This is the same feature set, reimplemented in Rust and shipped as one binary.

Old Python pipeline YARGI ENGINE (Rust)
Run python main.py + 4 helper scripts + Java yargi.exe — one file
Setup Python, pip packages, Java runtime none
PAK versions v11 / v12 v11 – v14
Lua decompile external Python front-end + unluac.jar (JVM) embedded native Rust engine
Decompile speed single core, external process per file all CPU cores, in-process
Error handling assert / traceback aborts the run per-file isolation + report
Verification partial hash verification after every repack
Worker sizing fixed automatic: all cores (CPU) / SSD-aware (I/O)
Long paths limited \\?\ handling
Distribution folder of scripts + jar single ~23 MB exe

Measured performance

Reference numbers below were measured on the project's test machine. They are representative, not a guarantee — hardware and antivirus settings change I/O throughput.

Workload Result
Full corpus decompile (27,562 real Lua chunks) ~6.8 min on 12 threads — vs ~2 h 20 m for the old Python + Java pipeline (≈20×)
Real PAK Lua extraction (24,906 files, 172.5 MiB) 8.7 s → ~2,710 files/s
Small-file write ceiling (system, no exclusions) ~339 files/s
Decompile throughput (6 logical cores, release) ~32 chunks/s
Startup instant (single native binary)

Tip — big speed win: Windows Defender real-time scanning is the bottleneck for dumps of many small files. Excluding your output folder (Add-MpPreference -ExclusionPath "<folder>", administrator PowerShell) measured 3.3× faster raw small-file writes and ~8× faster real extraction. Only exclude folders you trust.


Quick start

  1. Download yargi.exe from Releases.
  2. Put it in a folder and double-click it (or run it from a terminal).
  3. Put .pak files into 1-PAK_Extractor\PAKS\, or drag & drop a .pak file onto yargi.exe.

Interactive menu:

1. Unpack PAK
2. Repack with manifest
3. Selective extraction (pattern)
4. View manifest
5. Lua decompile
6. PAK info + verify
7. Help
8. Exit

Folder layout (created automatically):

YARGI\
├── yargi.exe
├── 1-PAK_Extractor\
│   ├── PAKS\              <- .pak archives go here
│   ├── unpacked\<pak>\    <- extracted files + manifest.json + edited\
│   ├── repacked_obb\      <- repacked .pak
│   └── extracted\         <- selective extraction output
└── 3-Decompiled_Lua_Files\  <- decompiled Lua source

Command line

# Info / listing / verification
yargi.exe info   PAKS\game.pak
yargi.exe info   PAKS\game.pak --json
yargi.exe list   PAKS\game.pak --pattern "*Lua*" --long
yargi.exe verify PAKS\game.pak

# Extraction
yargi.exe unpack --all
yargi.exe unpack PAKS\game.pak --pattern "*.lua"
yargi.exe unpack --all --block-split
yargi.exe unpack --all --out D:\dump --jobs 16

# Repacking (patch modified files back into the original slots)
yargi.exe repack 1-PAK_Extractor\unpacked\game --dry-run
yargi.exe repack 1-PAK_Extractor\unpacked\game

# Lua decompilation (embedded engine)
yargi.exe decompile --jobs 0
yargi.exe decompile --input unpacked --output 3-Decompiled_Lua_Files
yargi.exe decompile --fix-failed

# Interactive menu
yargi.exe

Exit codes: 0 success, 1 hard error, 2 finished with some failures.

Option Meaning
--jobs N Worker threads (0 = automatic: all cores / SSD-aware)
--pattern GLOB Only extract PAK paths matching the glob (repeatable)
--block-split Extract compressed files as 64 KiB _block_N parts
--dry-run Show the repack plan, write nothing
--fast / --no-reuse Faster compression / force recompression
--no-verify Skip post-write verification
--strict Treat integrity warnings as errors
--allow-unknown-version Try PAK versions newer than supported

Decompiler pipeline

game .lua chunk
      │  restore: XOR strings, opcode permutation, Lua 5.4-style debug lines
      ▼
restored Lua 5.3 chunk
      │  vendored unluac-rs (patched for SETLIST, loop labels, negative lines)
      ▼
Lua source (strict pass)
      └─ recovery ladder: ignore debug info → permissive diagnostic pseudocode
  • Empty stub modules (a bare RETURN) are emitted as a faithful -- empty module + return body instead of an empty file.
  • Already-restored / plain Lua 5.3 chunks are detected and parsed directly.
  • The reverse-engineered format is documented in rust/docs/lua-bytecode-restore.md and the local patches in rust/vendor/unluac/PATCHES.md.

Build from source

Requirements: Windows 10/11 x64 and a Rust toolchain (1.94+; the vendored unluac crate uses edition 2024). A C toolchain (MSVC build tools or MinGW-w64) is needed only for the bundled zstd C library.

.\build-release.cmd          # builds and copies yargi.exe to the project root

or directly:

cd rust
cargo build --release -p yargi-cli
# -> rust\target\release\yargi.exe

Test and lint:

cd rust
cargo test --workspace      # 135 tests
cargo clippy --workspace --all-targets
cargo fmt --all --check

Project layout

├── build-release.cmd / .ps1    # reproducible release build
├── CHANGELOG.md
├── rust/
│   ├── crates/yargi-core       # PAK container + bytecode restore
│   ├── crates/yargi-lua        # Lua 5.3 parser + native decompiler
│   ├── crates/yargi-decompile  # batch orchestration
│   ├── crates/yargi-cli        # yargi.exe (clap + interactive menu)
│   ├── vendor/unluac           # patched unluac-rs (MIT)
│   └── docs/                   # format / porting notes
├── LICENSE                     # Apache-2.0
└── NOTICE                      # third-party notices (unluac-rs, MIT)

Local-only folders are ignored by git: game PAK files (1-PAK_Extractor/), build output (rust/target/), scratch data (.tmp/) and the compiled yargi.exe.


License & legal

Licensed under the Apache License, Version 2.0 — see LICENSE. Third-party notices (notably the MIT-licensed unluac-rs) are in NOTICE.

This project is not affiliated with Tencent, PUBG Mobile, or any game publisher. Only process files you own or are otherwise authorised to modify. No game assets, PAK archives or license keys are included in this repository.

About

Pure-Rust Windows toolkit to unpack/repack PUBG Mobile PAK archives (v11-v14) and decompile obfuscated Lua 5.3 bytecode in-process. Single yargi.exe - no Python, Java or JVM.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages