$ show UlyssesWu/FreeMote
FreeMote is a Windows-oriented .NET Framework 4.8 toolchain for reverse-engineering, decompiling, converting, rendering, and rebuilding E-mote (EMT) PSB game asset packages. It is primarily an application suite rather than a data/research project: five CLI tools (EmtConvert, PsbDecompile, PsBuild, EmtMake, FontBuilder-related commands) plus a WPF viewer provide user-facing workflows, while the core libraries FreeMote, FreeMote.Psb, and FreeMote.PsBuild implement binary parsing, encryption, plugin dispatch, compilation/decompilation, and platform conversion. The architecture is modular: FreeMote handles low-level container and crypto primitives, FreeMote.Psb provides the PSB object model and plugin interfaces, FreeMote.PsBuild handles JSON/PSB conversion and E-mote project generation, and FreeMote.Plugins supplies compressors, image/audio codecs, and shell handlers through MEF composition. The primary data flow is file-in/file-out: encrypted or shell-wrapped PSB containers are opened through FreeMount plugin composition, decrypted or unpacked into an in-memory PSB object graph, decompiled to JSON plus extracted resources, then optionally recompiled, re-encrypted, and packed back into shells. The reverse pipeline also supports building PSB from JSON, generating bitmap fonts, porting between Kirikiri/Windows/common/console specifications, converting motion PSB into MMO editor projects, and extracting textures/audio from archives. The code embodies deep reverse-engineering knowledge: PSB versions 1-4, trie-compressed name tables, XorShift128/MT19937 cipher handling, MDF/LZ4/Zlib shells, ASTC/BC7/DXT/TLG pixel formats, and console-specific texture swizzling. Although the repo contains research-grade format analysis, its dominant character is an application toolkit for game modding. It is actively maintained with CI packaging, tests, and a plugin ecosystem, but carries medium technical drift: legacy .NET Framework and System.Drawing dependencies, Direct3D9 interop in the viewer, reliance on external executables for some audio/image encoders, hard-coded platform heuristics, and a large monolithic Psb.cs with TODO debt. The most reusable assets are self-contained texture utilities and the generic plugin/composition pattern, not the tightly coupled PSB-specific pipeline components.
The LLM identified 3 files worth highlighting for reuse:
A self-contained rectangle bin-packing implementation with Area and MaxOneAxis heuristics, padding support, and cell splitting. It has minimal internal coupling and can be extracted into any C# project needing texture-atlas generation or rectangle packing.
A standalone ASTC texture decompressor ported from UtinyRipper, covering block endpoint decoding, weight interpolation, and color unquantization. It is an isolated codec module usable in any toolchain that needs to decode ASTC textures without external native libraries.
Self-contained tiling, un-tiling, swizzling, and layout-conversion routines for PS4, PS3, PSP, PSV, and Wii texture formats. The functions are independent of the rest of FreeMote and can be reused directly in game-asset extraction or conversion pipelines for console-specific GPU texture layouts.