Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 64 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,85 @@ name: Build and Publish to PyPI
on:
push:
tags:
# Publish on any tag starting with a `v`, e.g., v0.1.0
- v*

jobs:
run:
runs-on: ubuntu-latest
build-wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

environment:
name: pypi

permissions:
id-token: write
contents: read


strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
enable-cache: true
command: build
args: --release --out dist
# manylinux auto-selects the correct manylinux image on Linux
manylinux: auto

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: dist

build-sdist:
name: Build source distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install Python
run: uv python install
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist

- name: Install the project
run: uv sync --locked --all-extras --dev
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist

# Probably should run tests here
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [build-wheels, build-sdist]

- name: Build
run: uv build
environment:
name: pypi

permissions:
id-token: write
contents: read

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist

- name: Download sdist
uses: actions/download-artifact@v4
with:
name: sdist
path: dist

- name: Publish
run: uv publish
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@ marimo/_static/
marimo/_lsp/
__marimo__/

# Rust / Cargo
target/
Cargo.lock

# Maturin build artifacts
*.pyd
*.pyi.bak
*.pdb

# Custom
config.json
*output*/
Expand All @@ -215,4 +224,4 @@ test_saves/
entries_generator/
test_json.json
extracted/
**/*.code-workspace
**/*.code-workspace
18 changes: 18 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "_mio_decomp"
version = "0.3.2"
edition = "2021"

[lib]
name = "mio_decomp"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.28.2", features = ["extension-module"] }
bitflags = "2"
lz4_flex = "0.11"
zstd = "0.13"
rayon = "1"
serde_json = "1"
memmap2 = "0.9"
jwalk = "0.8"
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@ mio-decomp config set game_dir "<Path to your MIO install>" # Defaults to "C:\Pr
mio-decomp decompile gin1.gin ./path/to/another/gin.gin -o output # Decompile .gins
mio-decomp parse ./path/to/save.save -o save.json # Convert save file to JSON
```

NOTE: Decompilation of assets.gin takes a really long time! It probably isn't stuck, but can take over 20 minutes, depending on your machine. Also, they don't have a filepath in their binary like all the other extracted .gin files, so if you decompile to structure then they will end up in "ship/decomp_assets".
26 changes: 26 additions & 0 deletions mio_decomp/_mio_decomp.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from os import PathLike
from pathlib import Path

_AnyPath = str | PathLike[str] | Path

class GinDecompiler:
def __init__(self, silent: bool = True) -> None: ...
def check_if_gin_file(self, file_path: _AnyPath) -> bool: ...
def decompile_file(
self,
file_path: _AnyPath,
output_dir: _AnyPath,
file_count_offset: int = 0,
include_number_prefix: bool = True,
) -> list[str]: ...
def decompile_multi(
self,
input_paths: list[_AnyPath],
output_dir: _AnyPath,
include_number_prefix: bool = True,
) -> list[str]: ...
def decompile_to_structure(
self,
input_paths: list[_AnyPath],
output_dir: _AnyPath,
) -> None: ...
Binary file added mio_decomp/mio_decomp.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion mio_decomp/src/commands/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import typer
from rich import print

from mio_decomp.src.libraries.decompiler.decompiler import GinDecompiler
from ..._mio_decomp import GinDecompiler

app = typer.Typer()

Expand Down
9 changes: 6 additions & 3 deletions mio_decomp/src/commands/decompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
from rich import print

from mio_decomp.src.config import config
from mio_decomp.src.libraries.decompiler.decompiler import GinDecompiler

# from mio_decomp.src.libraries.decompiler.decompiler import GinDecompiler
from ..._mio_decomp import GinDecompiler

app = typer.Typer()

Expand Down Expand Up @@ -89,9 +91,10 @@ def decompile(
decompiler: GinDecompiler = GinDecompiler(silent=not debug)
if structure:
decompiler.decompile_to_structure(
input_paths=final_input_paths, output_dir=output_dir
input_paths=final_input_paths, # ty:ignore[invalid-argument-type]
output_dir=output_dir,
)
else:
decompiler.decompile_multi(input_paths=final_input_paths, output_dir=output_dir)
decompiler.decompile_multi(input_paths=final_input_paths, output_dir=output_dir) # ty:ignore[invalid-argument-type]

print("Done!")
Loading