mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-20 07:27:19 -05:00
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")
|
||||
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
10
main.go
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user