Fix mpq wav decompression and profiler (#423)

* Fix for mpq wav decompression

* Fix for profiler
This commit is contained in:
Intyre 2020-06-23 20:49:46 +02:00 committed by GitHub
parent 2332bd7b58
commit f119d1197c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -191,11 +191,8 @@ func decompressMulti(data []byte, expectedLength uint32) []byte {
panic("bzip2 decompression not supported")
case 0x80: // IMA ADPCM Stereo
return d2compression.WavDecompress(data[1:], 2)
//return MpqWavCompression.Decompress(sinput, 2);
//panic("ima adpcm sterio decompression not supported")
case 0x40: // IMA ADPCM Mono
//return MpqWavCompression.Decompress(sinput, 1)
panic("mpq wav decompression not supported")
return d2compression.WavDecompress(data[1:], 1)
case 0x12:
panic("lzma decompression not supported")
// Combos

10
main.go
View File

@ -83,7 +83,10 @@ func main() {
}
if len(*profileOption) > 0 {
enableProfiler(*profileOption)
profiler := enableProfiler(*profileOption)
if profiler != nil {
defer profiler.Stop()
}
}
if *region == 0 {
@ -457,7 +460,7 @@ func loadStrings() error {
return nil
}
func enableProfiler(profileOption string) {
func enableProfiler(profileOption string) interface{ Stop() } {
var options []func(*profile.Profile)
switch strings.ToLower(strings.Trim(profileOption, " ")) {
case "cpu":
@ -485,6 +488,7 @@ func enableProfiler(profileOption string) {
options = append(options, profile.ProfilePath("./pprof/"))
if len(options) > 1 {
defer profile.Start(options...).Stop()
return profile.Start(options...)
}
return nil
}