Fix mpq wav decompression and profiler (#423)
* Fix for mpq wav decompression * Fix for profiler
This commit is contained in:
parent
2332bd7b58
commit
f119d1197c
|
@ -191,11 +191,8 @@ func decompressMulti(data []byte, expectedLength uint32) []byte {
|
||||||
panic("bzip2 decompression not supported")
|
panic("bzip2 decompression not supported")
|
||||||
case 0x80: // IMA ADPCM Stereo
|
case 0x80: // IMA ADPCM Stereo
|
||||||
return d2compression.WavDecompress(data[1:], 2)
|
return d2compression.WavDecompress(data[1:], 2)
|
||||||
//return MpqWavCompression.Decompress(sinput, 2);
|
|
||||||
//panic("ima adpcm sterio decompression not supported")
|
|
||||||
case 0x40: // IMA ADPCM Mono
|
case 0x40: // IMA ADPCM Mono
|
||||||
//return MpqWavCompression.Decompress(sinput, 1)
|
return d2compression.WavDecompress(data[1:], 1)
|
||||||
panic("mpq wav decompression not supported")
|
|
||||||
case 0x12:
|
case 0x12:
|
||||||
panic("lzma decompression not supported")
|
panic("lzma decompression not supported")
|
||||||
// Combos
|
// Combos
|
||||||
|
|
10
main.go
10
main.go
|
@ -83,7 +83,10 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(*profileOption) > 0 {
|
if len(*profileOption) > 0 {
|
||||||
enableProfiler(*profileOption)
|
profiler := enableProfiler(*profileOption)
|
||||||
|
if profiler != nil {
|
||||||
|
defer profiler.Stop()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if *region == 0 {
|
if *region == 0 {
|
||||||
|
@ -457,7 +460,7 @@ func loadStrings() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func enableProfiler(profileOption string) {
|
func enableProfiler(profileOption string) interface{ Stop() } {
|
||||||
var options []func(*profile.Profile)
|
var options []func(*profile.Profile)
|
||||||
switch strings.ToLower(strings.Trim(profileOption, " ")) {
|
switch strings.ToLower(strings.Trim(profileOption, " ")) {
|
||||||
case "cpu":
|
case "cpu":
|
||||||
|
@ -485,6 +488,7 @@ func enableProfiler(profileOption string) {
|
||||||
options = append(options, profile.ProfilePath("./pprof/"))
|
options = append(options, profile.ProfilePath("./pprof/"))
|
||||||
|
|
||||||
if len(options) > 1 {
|
if len(options) > 1 {
|
||||||
defer profile.Start(options...).Stop()
|
return profile.Start(options...)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue