Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ArchiveManager

This project allows extracting files from various container formats used in video games. Based on an open framework, it is easy to add support for any container.

Project details

.NET 8 port of the original Snailium ArchiveManager with cross-platform UI (Avalonia) and new container format support from reverse-engineering projects.

Extraction works cross-platform for all containers. Repacking: Currently only implemented for LNK4 containers, works on Windows via xcompress.dll or cross-platform via the xcompress-shim (Wine + the real xcompress.dll).

Project Structure

ArchiveManager/
├── ArchiveManager.Avalonia/       # Cross-platform UI (Avalonia 12.1.0, .NET 8)
├── ArchiveManager/                 # Original WinForms UI ( updated from .NET Framework to net8, with some new additions)
├── Snailium.Lib.Containers/        # Reusable container library (library)
│   └── native/msxca/              # libmsxca C wrapper + bundled libmspack
├── ArchiveManager.sln              # Solution file
└── README.md

Features

  • Cross-platform UI: Avalonia 12.1.0 with split-container preview pane, zoom controls, file type filtering.
  • Image preview: TIMG → PNG conversion (SkiaSharp), plus native PNG and JPEG preview. Zoom from 0.1× to 10×.
  • TImg → PNG batch conversion: Convert selected TIMG textures to PNG with a single button.
  • Replace: Swap a TImg texture inside the container with a PNG (converted back to TImg), then repack.
  • Repack (cross-platform): Rebuild an LNK4 archive using xcompress.dll (Windows) or the xcompress-shim (Wine). Backend-aware — enabled whenever packing is supported.
  • Backend selection: Choose Auto / xcompress / libmsxca / xcompress-shim in Settings. The active backend is shown in the status bar.
  • Decompress activity indication: Decompress tasks show Running task: decompress (Windows, GUI) / Running wine for shim task: decompress (Linux/macOS, console, GUI), platform-aware, and drive the progress bar. A background thread populates the ShimCache folder.
  • Settings: Persisted as settings.json next to the executable. Configurable output directory, decompression backend, shim executable path, and ShimCache folder location.
  • Support for multiple encodings: System.Text.Encoding.CodePages registered at startup for Japanese filename decoding, and the text preview pane has selectable encoding.

Build & Run

The GUI lives in ArchiveManager.Avalonia/ (the consolidated, actively maintained build).

The original GUI (based on WPF/NetFramework) was updated to use WinForms/net8 and some new features but does not have feature parity with the Avalonia GUI, so the Avalonia one is preferred.

dotnet build ArchiveManager.Avalonia
dotnet run --project ArchiveManager.Avalonia

Requirements:

  • .NET 8 SDK.
  • Linux/macOS: Wine is required only when using the xcompress-shim backend (to run xcompress_shim.exe). Extraction via libmsxca needs no Wine.
  • Windows: no external dependency for xcompress.dll; the shim also runs xcompress_shim.exe natively.

See USAGE.md for a step-by-step guide.

Backends

LZXNATIVE (XMemCompress) blobs are decoded/encoded by one of three backends, picked in Settings (or auto-detected):

  • xcompress.dll (XCompress) — Microsoft's native codec. Decompression + compression (repacking). Windows-only (the bundled xcompress.dll must sit next to the executable).
  • xcompress-shim (Shim) — xcompress_shim.exe is a tiny helper that P/Invokes the genuine xcompress.dll; on Linux/macOS it is run through Wine. Provides decompression + compression (repacking) cross-platform. Set its path in Settings (auto-detected next to the app / in an xcompress-shim/ folder otherwise).
  • libmsxca (MsXca) — Cross-platform decompression only (C wrapper around libmspack LZX decoder). No managed LZX port; no dependency on xbdecompress.exe. Cannot repack.

On Windows, Auto prefers xcompress.dll, then libmsxca. Off Windows, Auto prefers the Shim (it can also pack), then libmsxca.

The active backend is shown in the status bar. The Repack button is enabled whenever the backend can pack (xcompress.dll or Shim); it is disabled only in the libmsxca fallback (decompress-only).

Containers Supported

All containers are identified by their header magic (first bytes of the file).

NEKOPACK (V1)

A container with signature NEKOPACK (8 bytes). Also known as Chartreux Inc. Nekopack Engine.

This engine is used by the Lass game ("3days").

  • Format: V1 header (signature + version + resCount), flat file table with per-entry XOR-encrypted filenames and file data keys.
  • Encryption: Table-based XOR cipher (MakeTable(0x9999 + key), 624-entry table). Filenames decrypted with shared stateful table. File data decrypted with per-file key.
  • Encoding: Shift-JIS for Japanese filenames, with UTF-8 → Shift-JIS → Latin1 fallback.
  • Reference: RxNekoPack (ZQF-ReVN/RxNekoPack) for V1 format; NekoPackExtractTool for V2/V3.
  • New addition in this fork.

NPA (V3)

A container with identifier NPA (3 bytes). Used by various Nitro+ games.

  • Encryption: Per-game XOR key table (25 games × 256 bytes statically embedded). File data XORed with derived key stream.
  • Supported games: Includes key tables for 25 games (Chaos;Head, Chaos;Head Noah, etc.).
  • Reference: nipa
  • New addition in this fork.

PFS (PF6/PF8)

Containers with identifiers pf6/pf8 (3 bytes). Used by Artemis Engine games.

  • Format: File table with SHA1-based encryption keys. Subdirectory paths embedded in filenames (\-separated).
  • Reference: Rust pfs-rs implementation.
  • New addition in this fork.

MPK

A container with identifier MPK (3 bytes). Used by MAGES Engine (PC / Steam) games.

  • Format: File entry table with 4 fields (id, offset, size, actual_size) at 16-byte stride, followed by 224-byte name buffer per entry.
  • Reference: Python mpk_tools.py by spaceskynet.

XBC

Standalone XMemCompress LZXNATIVE compressed blob wrapper (magic 0FF512EE).

  • Simply wraps the decompressed blob as a single-file container.
  • Uses libmsxca or xcompress.dll for decompression.
  • This format was present in the codebase, before the decompressors added in, this format was the primary export format.

LNK4

A container with identifier 0x4C4E4B34 (ASCII: LNK4). Used by Xbox 360 game "Code_18". Base research made by Snailium, then further research revealead a lot more Xbox 360 games ("5pb/MAGES Engine-based") using this format.

  • Extraction: LZXNATIVE blobs (magic 0FF512EE) decompressed via libmsxca (cross-platform), xcompress.dll (Windows), or the xcompress-shim (Wine + real xcompress.dll, cross-platform).
  • Repacking: Available cross-platform. On Windows use xcompress.dll (FreeMote.XMemCompress); off Windows (or when the shim backend is selected) use xcompress_shim.exe via Wine. Modify files and write them back to the container.
  • ShimCache: When an LNK4 is opened with the shim backend, a background thread decompresses each member once and persists a JSON file table (<archive>.json) under the ShimCache folder (default ShimCache/ next to the app, configurable in Settings). Subsequent opens resolve extensions/sizes instantly from the cache.
  • TIMG textures: Originally a nameless raw texture format, but this name was coined from crosslnk4's conversion script. This raw format is converted to PNG via SkiaSharp with ARGB→BGR pixel swap. Pixel-identical to crosslnk4 reference images.
  • For further information on the base research see: https://www.snailium.com/my-gaming/lnk4-container-code-18.html
  • Base structure was present, and it was overhauled by other research projects for this format

UNI2 (Union 2)

A container with identifier 0x554e4932 (ASCII: UNI2). Xbox 360 game "俺の嫁 ~あなただけの花嫁~" (Ore no yome ~Anata dake no hanayome~).

For further information, see: http://www.snailium.com/my-gaming/uni2-file-structure.html

CPK (CPack / CRI-Pack)

A container with identifier 0x43504b20 (ASCII: CPK), used by CRI Middleware (CRI FileMajik).

  • CriPakContainer: Primary implementation based on CriPakTools-fixed. Supports TOC, ITOC (index tables), ETOC (extended metadata), and GTOC. ITOC files are listed as id.bin with proper alignment-based offset calculation.
  • SnailCpkContainer (retained): Original Snailium implementation, kept for reference.
  • Encryption: UTF table blocks may be XOR-encrypted (0x655f/0x4115 key); decryption handled automatically.

AFS

Originally by Sega. A container with identifier 0x441465300 (ASCII: AFS). Xbox 360 game "Cross Channel".

For further information, see: https://www.snailium.com/my-gaming/afs-container-from-cross-channel.html

MAAB / CWAB

Packages of images to form animated images. Xbox 360 game "俺の嫁 ~あなただけの花嫁~". (Ore no yome ~Anata dake no hanayome~) (Missing documentation)

Pak

Container without identifier. Xbox 360 game "Time Leap". Starts with a file count followed by file offset table.

AXCS

(Missing documentation)

Note

  • OpenCode's Zen models were used during the modernization, upgrade and testing process.

Credits

This tool uses several other projects for reading formats other than the original ~8 formats that were already supported by the original project:

  • LNK4 improvements taken from asmodean's exlnk4 extractor and crosslnk4 by Timo654.
  • libmsxca (the XBC decompression library), based on libmspack.
  • pfs-rs by sakarie9 - for reading and extracting PFS archives
  • nipa by Wilhansen - for reading and extracting NPA archives
  • NekoPackExtract by xmoezzz, RxNekoPack (NekoPackTools) by ZQF-ReVN - For reading and extracting Nekopack archives.

About

Modern port of Snailium's ArchiveManager

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages