Skip to content
/ mpq Public

Decoder/parser of Blizzard's MPQ archive file format

License

Notifications You must be signed in to change notification settings

icza/mpq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mpq

Build Status Go Reference Go Report Card codecov

Package mpq is a decoder/parser of Blizzard's MPQ archive file format.

This is not a full MPQ implementation. It is primarily intended to parse StarCraft II replay files (*.SC2Replay), but that is fully supported.

Usage

Usage is simple. Opening an MPQ archive file:

m, err := mpq.NewFromFile("myreplay.SC2Replay")
if err != nil {
	// Handle error
	return
}
defer m.Close()

Getting a named file from the archive:

// Access a file inside the MPQ archive.
// Usually there is a file called "(listfile)" containing the list of other files:
if data, err := m.FileByName("(listfile)"); err == nil {
	fmt.Println("Files inside archive:")
	fmt.Println(string(data))
} else {
	// handle error
}

If you already have the MPQ data in memory:

mpqdata := []byte{} // MPQ data in memory
m, err := mpq.New(bytes.NewReader(mpqdata)))

Information sources

Example projects using this

License

Open-sourced under the Apache License 2.0.

About

Decoder/parser of Blizzard's MPQ archive file format

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Languages