diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2022-11-10 22:59:32 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-09-16 21:39:40 +0300 |
| commit | 9f5e8f230d35fffb106088b72e5fdb148905f450 (patch) | |
| tree | 2f22a5357a7bea2ce516b9a5e56e21435414529a /packets/messages/types/SvcSounds.go | |
| parent | upgraded to v1.2.3 (diff) | |
| download | sdp.go-9f5e8f230d35fffb106088b72e5fdb148905f450.tar.gz sdp.go-9f5e8f230d35fffb106088b72e5fdb148905f450.tar.bz2 sdp.go-9f5e8f230d35fffb106088b72e5fdb148905f450.zip | |
added almost all net/svc messages - currently broken
Diffstat (limited to 'packets/messages/types/SvcSounds.go')
| -rw-r--r-- | packets/messages/types/SvcSounds.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/packets/messages/types/SvcSounds.go b/packets/messages/types/SvcSounds.go new file mode 100644 index 0000000..1f76a03 --- /dev/null +++ b/packets/messages/types/SvcSounds.go | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | package types | ||
| 2 | |||
| 3 | import "github.com/pektezol/bitreader" | ||
| 4 | |||
| 5 | type SvcSounds struct { | ||
| 6 | ReliableSound bool | ||
| 7 | Size int8 | ||
| 8 | Data []byte | ||
| 9 | } | ||
| 10 | |||
| 11 | func ParseSvcSounds(reader *bitreader.ReaderType) SvcSounds { | ||
| 12 | reliablesound := reader.TryReadBool() | ||
| 13 | var size int8 | ||
| 14 | var length int16 | ||
| 15 | if reliablesound { | ||
| 16 | size = 1 | ||
| 17 | } else { | ||
| 18 | size = int8(reader.TryReadInt8()) | ||
| 19 | } | ||
| 20 | if reliablesound { | ||
| 21 | length = int16(reader.TryReadInt8()) | ||
| 22 | } else { | ||
| 23 | length = int16(reader.TryReadInt16()) | ||
| 24 | } | ||
| 25 | data := reader.TryReadBytesToSlice(int(length / 8)) | ||
| 26 | return SvcSounds{ | ||
| 27 | ReliableSound: reliablesound, | ||
| 28 | Size: size, | ||
| 29 | Data: data, | ||
| 30 | } | ||
| 31 | } | ||