Skip to content

MorenoLand/GScript.GoByte

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GScript.GoByte

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.

Features

  • Decompiles raw .gs2bc files 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.

CLI

Decompile next to the input file:

go run . path/to/weapon.gs2bc

Write to a specific output path:

go run . -o out.gs2 path/to/weapon.gs2bc

Pipe or paste hex:

cat bytecode.hex | go run .

WASM Example

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.

Development

Run checks:

go test -count=1 ./...
go build .

Build WASM directly:

GOOS=js GOARCH=wasm go build -o examples/web/gbyte.wasm .

License

Apache License 2.0. See LICENSE.

About

Minimal GS2 bytecode decompiler in Go with CLI and WASM/browser example. Parses .gs2bc sections, decodes VM opcodes, and reconstructs readable GS2 for calls, arrays, loops, dispatch chains, object methods, and GUI constructor blocks. Includes an example web tester.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages