diff options
| author | BiSaXa <1669855+BiSaXa@users.noreply.github.com> | 2022-08-27 18:53:13 +0300 |
|---|---|---|
| committer | BiSaXa <1669855+BiSaXa@users.noreply.github.com> | 2022-08-27 18:53:13 +0300 |
| commit | 0a3082bd167b2caa1d4a54b62d72e8be13ff43b0 (patch) | |
| tree | a5d1c167da7015ccef4d9c3c5677e01f664850ba /classes/userCmdInfo.go | |
| parent | support for multiple demos in a folder as an argument (diff) | |
| download | sdp.go-0a3082bd167b2caa1d4a54b62d72e8be13ff43b0.tar.gz sdp.go-0a3082bd167b2caa1d4a54b62d72e8be13ff43b0.tar.bz2 sdp.go-0a3082bd167b2caa1d4a54b62d72e8be13ff43b0.zip | |
some stuff before i realized i need my own bitreader library
Diffstat (limited to 'classes/userCmdInfo.go')
| -rw-r--r-- | classes/userCmdInfo.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/classes/userCmdInfo.go b/classes/userCmdInfo.go index ae27e9a..3705c8d 100644 --- a/classes/userCmdInfo.go +++ b/classes/userCmdInfo.go | |||
| @@ -1,7 +1,10 @@ | |||
| 1 | package classes | 1 | package classes |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | ||
| 4 | "parser/utils" | 5 | "parser/utils" |
| 6 | |||
| 7 | "github.com/potterxu/bitreader" | ||
| 5 | ) | 8 | ) |
| 6 | 9 | ||
| 7 | type UserCmdInfo struct { | 10 | type UserCmdInfo struct { |
| @@ -23,7 +26,15 @@ type UserCmdInfo struct { | |||
| 23 | 26 | ||
| 24 | func UserCmdInfoInit(byteArr []byte, size int) (output UserCmdInfo) { | 27 | func UserCmdInfoInit(byteArr []byte, size int) (output UserCmdInfo) { |
| 25 | var class UserCmdInfo | 28 | var class UserCmdInfo |
| 26 | if size-1 >= 4 { | 29 | fmt.Println("Size: ", size) |
| 30 | reader := bitreader.BitReader(byteArr) | ||
| 31 | flag, err := reader.ReadBit() | ||
| 32 | utils.CheckError(err) | ||
| 33 | fmt.Println(flag) | ||
| 34 | flag2, err := reader.ReadBit() | ||
| 35 | utils.CheckError(err) | ||
| 36 | fmt.Println(flag2) | ||
| 37 | /*if size-1 >= 4 { | ||
| 27 | class.CommandNumber = int32(utils.IntFromBytes(byteArr[:4])) | 38 | class.CommandNumber = int32(utils.IntFromBytes(byteArr[:4])) |
| 28 | } | 39 | } |
| 29 | if size-1 >= 8 { | 40 | if size-1 >= 8 { |
| @@ -52,6 +63,6 @@ func UserCmdInfoInit(byteArr []byte, size int) (output UserCmdInfo) { | |||
| 52 | } | 63 | } |
| 53 | if size-1 >= 40 { | 64 | if size-1 >= 40 { |
| 54 | class.Impulse = byteArr[36] | 65 | class.Impulse = byteArr[36] |
| 55 | } | 66 | }*/ |
| 56 | return class | 67 | return class |
| 57 | } | 68 | } |