- Use CRLF (preferred windows visual studio)
- This repository is a C++20/CMake project for parsing and exporting
.ysmfiles. - There are two supported runtime paths:
- Native CLI tool: batch-processes
.ysmfiles from an input directory to an output directory. - WebAssembly build: compiles the same parser core for browser or Node.js use via Emscripten.
- Native CLI tool: batch-processes
- Main project code lives in
YSMParser/. - Browser UI assets live in
web/. - Third-party dependencies are vendored under
external/.
- Native CLI entry:
YSMParser/main.cpp - Parser abstraction and factory:
YSMParser/parsers/YSMParser.hppYSMParser/parsers/YSMParser.cpp
- Version-specific parsers:
YSMParser/parsers/YSMParserV1.cppYSMParser/parsers/YSMParserV2.cppYSMParser/parsers/v3/YSMParserV3.cpp
- V3 header/path mapping helpers:
YSMParser/parsers/v3/YSGPHeaderParser.hppYSMParser/parsers/v3/PlayerTextureCollector.hpp
- Web UI:
web/index.htmlweb/app.js
YSMParserFactory::Create()reads the input file and selects a parser implementation by header/version.- V1 parser:
- Uses AES-CBC + zlib.
- Exports resources directly from an in-memory map.
- V2 parser:
- Similar to V1, filename is base64-encoded, but derives the real AES key using MD5 + Java-style PRNG before decrypting payloads.
- V3 parser is the main complexity center:
- Parses YSGP header metadata.
- Verifies file integrity with CityHash.
- Decrypts with custom XChaCha20-based logic plus MT19937 XOR.
- Decompresses with zstd.
- Deserializes models, animations, textures, sounds, language files, controllers, and metadata JSON.
- Exports files using header-derived hashed path mappings when available.
- CLI app name in code:
YSM File Decryptor. - Important arguments:
-i, --input: input directory, required.-o, --output: output directory, required.-v, --verbose: detailed per-file logging.-j, --threads: parallel file processing,0means auto.
- The CLI scans recursively for
.ysmfiles only. - Each input file is exported into its own subdirectory under the output root, usually named after the input stem.
- In non-verbose mode, stdout is intentionally silenced during parsing and a progress renderer is shown instead.
- Verbose mode forces single-threaded execution to keep logs ordered.
- If output-directory name collisions are detected between files, the tool also forces single-threaded execution.
- Top-level CMake supports
YSM_TARGET_WASM=ON. YSM_WASM_ENVmay benodeorweb.- Relevant presets in
CMakePresets.json:wasm-releasewasm-web-release
web/index.htmlis a standalone browser UI for selecting.ysmfiles, running the wasm parser, and downloading a ZIP.web/app.js:- Loads
YSMParser.jsand the wasm module. - Writes selected files into the Emscripten FS under
/input. - Calls the CLI entry via
callMain(["-i", "/input", "-o", "/output"]). - Collects
/outputand packs the result with JSZip.
- Loads
- If working on the web flow, keep native CLI behavior and wasm behavior aligned because the web build reuses the same parser entry path.
- Top-level build files:
CMakeLists.txtCMakePresets.json
- Native presets exist for Windows x86/x64 plus Linux/macOS release builds.
- The project vendors and builds dependencies directly through CMake subdirectories.
version.txtis read by CMake and injected asYSM_PARSER_VERSION.- For wasm builds, the executable suffix becomes
.jsand additional Emscripten link options are applied.
external/zstdexternal/zlibexternal/cityhashexternal/xchacha20external/AESexternal/md5external/cpp-base64external/fpngexternal/json/json.hpp
README.mdis currently minimal and does not explain the real architecture; rely on source first.- V3 contains most of the domain logic and is the first place to inspect for format/export bugs.
YSGPHeaderParseris important because it converts hashed resource identifiers into output paths and also buildsysm.json/player metadata structure.- Path handling already tries to be UTF-8 safe via
PathUtilsandPlatformCompat; preserve that behavior when touching file IO. - Some V3 code still contains debug-style
printf,std::cout,__debugbreak, and exploratory parsing code. Be careful not to break wasm or release builds when cleaning this area up. - There is no obvious dedicated automated test suite in the main project. Validation currently appears to depend on building and running against real sample files.
- For parser bugs, inspect in this order:
YSMParser/parsers/YSMParser.cpp- The relevant version parser implementation.
YSMParser/parsers/v3/YSGPHeaderParser.hppif exported file names/paths look wrong.
- For CLI/output behavior issues, start with
YSMParser/main.cpp. - For browser issues, inspect both the wasm preset configuration and
web/app.js. - Prefer small, version-specific changes over broad parser-wide refactors unless the file format behavior is clearly shared.
- If changing export layout, verify both:
- Native CLI output directory structure.
- Browser ZIP contents generated from
/output.