GithubHelp home page GithubHelp logo

absurdlysuspicious / sg-sprite Goto Github PK

View Code? Open in Web Editor NEW
16.0 2.0 1.0 65 KB

Sprite/character (.lay files) decoder for MAGES engine (Steins;Gate 0, Chaos;Child, Steins;Gate Steam Edition, etc)

License: Apache License 2.0

Rust 98.98% Shell 1.02%
visual-novel games binary-format unpacker decoder

sg-sprite's Introduction

sg-sprite

Sprite layout parser for MAGES engine.

This app restores original (full and uncropped) sprites from .png and .lay files found in chara.mpk archives. Note that this parser doesn't work with mpk files directly, you need to unpack sprites beforehand. There's a good tool for this: https://github.com/rdavisau/sg-unpack

Compatible games are listed in the compatibility list below. This list will be updated as soon as I or someone else test (and fix if needed and possible) the parser for other titles. If you find out that it works (or doesn't work) with non-listed games built on mages engine, feel free to submit PR or issue.

You also can read format description here. It's based solely on reverse-engineering of s;g0 sprites and thus is rough and incomplete, but it should give approximate vision of the file structure.

FAQ

    • Q: My archive has .cpk extension. How do I unpack it?
    • A: Use arc_unpacker project: arc_unpacker --dec=cri/cpk --no-recurse chara.cpk (it can extract mpk files too: --dec=mages/mpk)
    • Q: After unpacking chara archive I see .gxt files instead of .png
    • A: GXT is a PS Vita texture format. Convert them into png before using sg-sprite with this tool: Scarlet Project.
      Converted PNGs will have (Image 0) suffix but starting from 0.2.3 sg-sprite will pick them up too, so you should't need to rename them to match .lay files names.
      Resulting sprites may have glitchy background in this case, and I suspect this is a gxt-to-png conversion issue (you can confirm it if you look into one of converted/source PNGs). Let me know if there is any better maintained converter so I can replace the link.
    • Q: I see some transparent PNGs with _oX suffix in output folder. What's this?
    • A: These are overlays. They are intended to be drawn on top of the sprite, you can do this yourself in your favorite photo editor (e.g. GIMP). They should be compatible with most of the sprites in file. Also, they have same size as original sprite, so you don't need to do any manual positioning.

Compatibility list

These titles are known to work, but others might work too (see top of readme)

  • Steins;Gate 0
  • Steins;Gate Steam Edition
  • Steins;Gate Linear Bounded Phenogram
  • Steins;Gate My Darling's Embrace
  • Chaos;Child
  • Yahari Game Demo Ore no Seishun Love-Kome wa Machigatteiru. Zoku

Install

Builds for Windows and Linux are available at Github releases

There's also AUR package available for Arch Linux.

Note that this app has no gui. You should run it from terminal (or cmd.exe on windows). Run sg-spirte --help for details on usage.

Usage example:

  • cd to directory with unpacked sprites
  • create output directory (e.g. out)
  • run sg-sprite -d out *.lay

Build

Install cargo (https://www.rust-lang.org/tools/install)

Run this command in the project directory: cargo build --release

Resulting binary will be in target/release directory

sg-sprite's People

Contributors

absurdlysuspicious avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sg-sprite's Issues

Error "draw: decode[E] image: The system cannot find the file specified. (os error 2)" even when file name is explicitly set

Capture
I'm encountering this error when trying to unpack a folder full of .lay sprites from this game. The same thing happens when I explicitly say the file name as well. I'm not even going to pretend I understand how to unpack .lay files but a .gxt file close to the same name was in the original .mpk dump so I thought that it needed to be referenced or something. The same error happens with and without the .gxt. All of the lay files have the same 25 00 00 00 file signature when I open them with a hex editor so I think it is in the actual .lay format. Any help would be appreciated.

overlay image only functionality

I'm not sure how to best word this so I'll do it by example - instead of a sprite set of Daru with the nosebleed images superimposed, can you output just the nosebleed image sequence separately? I don't know how you feel about this, but for me it'll be useful to have a way to output an overlay from your script even if I have to position it myself.

Glitchy Kagari Sprite

There is a minor glitch with a subset of Kagari from SG0:
AKG_ASB_t64_d5_0.png
AKG_ASB_t64_d5_1.png
AKG_ASB_t64_d5_2.png

I wonder if this is a special case of some kind?

Here's what it looks like:

AKG_ASB_t64_d5_0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.