Skip to content

Commit

Permalink
Merge pull request #90 from redraskal/fix/y9s1
Browse files Browse the repository at this point in the history
fix: Y9S1 match feedback
  • Loading branch information
redraskal authored Mar 21, 2024
2 parents fa772e3 + 64fc958 commit 85da0b5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
3 changes: 2 additions & 1 deletion dissect/defuse.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package dissect

import (
"github.com/rs/zerolog/log"
"strings"

"github.com/rs/zerolog/log"
)

func readDefuserTimer(r *Reader) error {
Expand Down
30 changes: 22 additions & 8 deletions dissect/feedback.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,24 @@ var activity2 = []byte{0x00, 0x00, 0x00, 0x22, 0xe3, 0x09, 0x00, 0x79}
var killIndicator = []byte{0x22, 0xd9, 0x13, 0x3c, 0xba}

func readMatchFeedback(r *Reader) error {
bombIndicator, err := r.Bytes(1)
if err != nil {
return err
}
_ = bytes.Equal(bombIndicator, []byte{0x01}) // TODO, figure out meaning
err = r.Seek(activity2)
if err != nil {
return err
if r.Header.CodeVersion < Y9S1 {
if err := r.Skip(1); err != nil {
return err
}
if err := r.Seek(activity2); err != nil {
return err
}
} else {
if err := r.Skip(9); err != nil {
return err
}
valid, err := r.Int()
if err != nil || valid != 4 {
return err
}
if err := r.Skip(24); err != nil {
return err
}
}
size, err := r.Int()
if err != nil {
Expand Down Expand Up @@ -137,6 +147,10 @@ func readMatchFeedback(r *Reader) error {
log.Debug().Interface("match_update", u).Send()
return nil
}
// TODO: Y9S1 may have removed or modified other match feedback options
if r.Header.CodeVersion >= Y9S1 {
return nil
}
b, err := r.Bytes(size)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions dissect/site.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package dissect

import (
"github.com/rs/zerolog/log"
"strings"

"github.com/rs/zerolog/log"
)

func readSpawn(r *Reader) error {
log.Debug().Msg("site found")
location, err := r.String()
if err != nil {
return err
Expand Down

0 comments on commit 85da0b5

Please sign in to comment.