https://github.com/icza/mpq
Decoder/parser of Blizzard's MPQ archive file format
https://github.com/icza/mpq
blizzard decoder mpq-archives parse
Last synced: about 1 year ago
JSON representation
Decoder/parser of Blizzard's MPQ archive file format
- Host: GitHub
- URL: https://github.com/icza/mpq
- Owner: icza
- License: apache-2.0
- Created: 2016-07-25T11:17:40.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-03-30T13:28:46.000Z (about 3 years ago)
- Last Synced: 2025-03-24T10:45:46.366Z (about 1 year ago)
- Topics: blizzard, decoder, mpq-archives, parse
- Language: Go
- Homepage:
- Size: 767 KB
- Stars: 34
- Watchers: 4
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# mpq

[](https://pkg.go.dev/github.com/icza/mpq)
[](https://goreportcard.com/report/github.com/icza/mpq)
[](https://codecov.io/gh/icza/mpq)
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
- The_MoPaQ_Archive_Format: http://wiki.devklog.net/index.php?title=The_MoPaQ_Archive_Format
- MPQ on wikipedia: http://en.wikipedia.org/wiki/MPQ
- Zezula MPQ description: http://www.zezula.net/mpq.html
- Stormlib: https://github.com/ladislav-zezula/StormLib
- Libmpq project: https://github.com/ge0rg/libmpq (old: https://libmpq.org/)
- MPQ parser of the Scelight project: https://github.com/icza/scelight/tree/master/src-app-libs/hu/belicza/andras/mpq
## Example projects using this
- https://github.com/icza/s2prot
## License
Open-sourced under the [Apache License 2.0](https://github.com/icza/mpq/blob/master/LICENSE).