Minimal GS2 bytecode decompiler written in Go.
GoByte reads GScript .gs2bc bytecode, parses the function table, string
table, and instruction stream, then emits readable GS2-like source. It is
intentionally small: one decompiler core, a CLI entrypoint, and a WASM
entrypoint for browser use.
- Decompiles raw
.gs2bcfiles or whitespace-separated hex input. - Recovers named functions and common parameter prologues.
- Handles the known GS2 VM opcode set used by the current fixtures.
- Reconstructs calls, object methods, arrays, foreach/counting loops, dispatch chains, and GUI constructor blocks.
- Builds as a native CLI or as WebAssembly.
Decompile next to the input file:
go run . path/to/weapon.gs2bcWrite to a specific output path:
go run . -o out.gs2 path/to/weapon.gs2bcPipe or paste hex:
cat bytecode.hex | go run .Build the browser example:
GOOS=js GOARCH=wasm go build -o examples/web/gbyte.wasm .
wasm_exec="$(find "$(go env GOROOT)" -path "*/wasm_exec.js" -type f | head -n 1)"
cp "$wasm_exec" examples/web/The web example exposes the decompiler through Go's WASM runtime and lets you
load a .gs2bc file or paste hex input. It expects gbyte.wasm and
wasm_exec.js beside examples/web/index.html.
Run checks:
go test -count=1 ./...
go build .Build WASM directly:
GOOS=js GOARCH=wasm go build -o examples/web/gbyte.wasm .Apache License 2.0. See LICENSE.