Skip to content
/ gonx Public

NX file format package for parsing and extracting game data

License

Notifications You must be signed in to change notification settings

Hucaru/gonx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gonx

Parse NX files and extract data from a the tree.

Usage

package main

import "github.com/Hucaru/gonx"

func main() {
    nodes, textLookup, bitmaps, audio, err := gonx.Parse(fname)

    if err != nil {
        panic(err)
    }

    found := gonx.FindNode("element/childEment/grandchildElement", nodes, textLookup, func(node *gonx.Node) {
        // if image
        img, x, y, err := node.GetBitmap(bitmaps)

        // if audio
        sound, err := node.GetAudio(audio)

        // node.Type - 1 = int64, 2 = float64
        data = node.Data
    })

    if !found {
        panic(fmt.Errorf("Not a valid node"))
    }
}

Benchmarks

To run the benchmark tests type go test -run=XXX -bench=.

i5-3570k @ 3.40GHz

goos: windows
goarch: amd64
pkg: github.com/Hucaru/gonx
BenchmarkParse-4              20          86080150 ns/op
BenchmarkExtract-4            30          33965990 ns/op
PASS
ok      github.com/Hucaru/gonx  4.463s

i5 @ 2.40GHz

goos: darwin
goarch: amd64
pkg: github.com/Hucaru/gonx
BenchmarkParse-4   	      10	 113918050 ns/op
PASS
ok  	github.com/Hucaru/gonx	2.040s

About

NX file format package for parsing and extracting game data

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages