diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-09-23 17:46:12 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-09-23 17:46:12 +0300 |
| commit | 7745f2dcaa2c409c19c6e79bf1eaa2bc41444be0 (patch) | |
| tree | 0c57a12442ec0b8e90089eddf44af78a01e8882a /pkg/classes | |
| parent | feat: TONS of user message parsing (#10) (diff) | |
| download | sdp.go-7745f2dcaa2c409c19c6e79bf1eaa2bc41444be0.tar.gz sdp.go-7745f2dcaa2c409c19c6e79bf1eaa2bc41444be0.tar.bz2 sdp.go-7745f2dcaa2c409c19c6e79bf1eaa2bc41444be0.zip | |
lp parser: only get portal count and cm ticks
Diffstat (limited to 'pkg/classes')
| -rw-r--r-- | pkg/classes/consoleCmd.go | 4 | ||||
| -rw-r--r-- | pkg/classes/customData.go | 4 | ||||
| -rw-r--r-- | pkg/classes/dataTables.go | 13 | ||||
| -rw-r--r-- | pkg/classes/packet.go | 9 | ||||
| -rw-r--r-- | pkg/classes/sarData.go | 49 | ||||
| -rw-r--r-- | pkg/classes/signOn.go | 9 | ||||
| -rw-r--r-- | pkg/classes/stop.go | 2 | ||||
| -rw-r--r-- | pkg/classes/stringTables.go | 14 | ||||
| -rw-r--r-- | pkg/classes/userCmd.go | 9 |
9 files changed, 14 insertions, 99 deletions
diff --git a/pkg/classes/consoleCmd.go b/pkg/classes/consoleCmd.go index 75a56eb..fa9bbd0 100644 --- a/pkg/classes/consoleCmd.go +++ b/pkg/classes/consoleCmd.go | |||
| @@ -1,10 +1,7 @@ | |||
| 1 | package classes | 1 | package classes |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "strings" | ||
| 5 | |||
| 6 | "github.com/pektezol/bitreader" | 4 | "github.com/pektezol/bitreader" |
| 7 | "github.com/pektezol/demoparser/pkg/writer" | ||
| 8 | ) | 5 | ) |
| 9 | 6 | ||
| 10 | type ConsoleCmd struct { | 7 | type ConsoleCmd struct { |
| @@ -15,5 +12,4 @@ type ConsoleCmd struct { | |||
| 15 | func (consoleCmd *ConsoleCmd) ParseConsoleCmd(reader *bitreader.Reader) { | 12 | func (consoleCmd *ConsoleCmd) ParseConsoleCmd(reader *bitreader.Reader) { |
| 16 | consoleCmd.Size = reader.TryReadSInt32() | 13 | consoleCmd.Size = reader.TryReadSInt32() |
| 17 | consoleCmd.Data = reader.TryReadStringLength(uint64(consoleCmd.Size)) | 14 | consoleCmd.Data = reader.TryReadStringLength(uint64(consoleCmd.Size)) |
| 18 | writer.AppendLine("\t%s", strings.TrimSpace(consoleCmd.Data)) | ||
| 19 | } | 15 | } |
diff --git a/pkg/classes/customData.go b/pkg/classes/customData.go index 2dadde4..59cb121 100644 --- a/pkg/classes/customData.go +++ b/pkg/classes/customData.go | |||
| @@ -2,7 +2,6 @@ package classes | |||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "github.com/pektezol/bitreader" | 4 | "github.com/pektezol/bitreader" |
| 5 | "github.com/pektezol/demoparser/pkg/writer" | ||
| 6 | ) | 5 | ) |
| 7 | 6 | ||
| 8 | type CustomData struct { | 7 | type CustomData struct { |
| @@ -16,13 +15,10 @@ func (customData *CustomData) ParseCustomData(reader *bitreader.Reader, tickNumb | |||
| 16 | customData.Size = reader.TryReadSInt32() | 15 | customData.Size = reader.TryReadSInt32() |
| 17 | if customData.Type != 0 || customData.Size == 8 { | 16 | if customData.Type != 0 || customData.Size == 8 { |
| 18 | // Not SAR data | 17 | // Not SAR data |
| 19 | writer.AppendLine("[%d] %s (%d):", tickNumber, "CUSTOMDATA", packetType) | ||
| 20 | customData.Data = string(reader.TryReadBytesToSlice(uint64(customData.Size))) | 18 | customData.Data = string(reader.TryReadBytesToSlice(uint64(customData.Size))) |
| 21 | writer.AppendLine("\t%s", customData.Data) | ||
| 22 | return | 19 | return |
| 23 | } | 20 | } |
| 24 | // SAR data | 21 | // SAR data |
| 25 | writer.AppendLine("[%d] %s (%d):", tickNumber, "SARDATA", packetType) | ||
| 26 | sarData := SarData{} | 22 | sarData := SarData{} |
| 27 | data := reader.TryReadBytesToSlice(uint64(customData.Size)) | 23 | data := reader.TryReadBytesToSlice(uint64(customData.Size)) |
| 28 | sarReader := bitreader.NewReaderFromBytes(data, true) | 24 | sarReader := bitreader.NewReaderFromBytes(data, true) |
diff --git a/pkg/classes/dataTables.go b/pkg/classes/dataTables.go index 27ab9e4..c17e5f6 100644 --- a/pkg/classes/dataTables.go +++ b/pkg/classes/dataTables.go | |||
| @@ -4,7 +4,6 @@ import ( | |||
| 4 | "fmt" | 4 | "fmt" |
| 5 | 5 | ||
| 6 | "github.com/pektezol/bitreader" | 6 | "github.com/pektezol/bitreader" |
| 7 | "github.com/pektezol/demoparser/pkg/writer" | ||
| 8 | ) | 7 | ) |
| 9 | 8 | ||
| 10 | type DataTables struct { | 9 | type DataTables struct { |
| @@ -46,14 +45,10 @@ func (dataTables *DataTables) ParseDataTables(reader *bitreader.Reader) { | |||
| 46 | count++ | 45 | count++ |
| 47 | dataTables.SendTable = append(dataTables.SendTable, ParseSendTable(dataTableReader)) | 46 | dataTables.SendTable = append(dataTables.SendTable, ParseSendTable(dataTableReader)) |
| 48 | } | 47 | } |
| 49 | writer.AppendLine("\t%d Send Tables:", count) | ||
| 50 | writer.AppendOutputFromTemp() | ||
| 51 | numOfClasses := dataTableReader.TryReadBits(16) | 48 | numOfClasses := dataTableReader.TryReadBits(16) |
| 52 | for count = 0; count < int(numOfClasses); count++ { | 49 | for count = 0; count < int(numOfClasses); count++ { |
| 53 | dataTables.ServerClassInfo = append(dataTables.ServerClassInfo, ParseServerClassInfo(dataTableReader, count, int(numOfClasses))) | 50 | dataTables.ServerClassInfo = append(dataTables.ServerClassInfo, ParseServerClassInfo(dataTableReader, count, int(numOfClasses))) |
| 54 | } | 51 | } |
| 55 | writer.AppendLine("\t%d Classes:", count) | ||
| 56 | writer.AppendOutputFromTemp() | ||
| 57 | } | 52 | } |
| 58 | 53 | ||
| 59 | func ParseSendTable(reader *bitreader.Reader) SendTable { | 54 | func ParseSendTable(reader *bitreader.Reader) SendTable { |
| @@ -65,7 +60,6 @@ func ParseSendTable(reader *bitreader.Reader) SendTable { | |||
| 65 | if sendTable.NumOfProps < 0 { | 60 | if sendTable.NumOfProps < 0 { |
| 66 | return sendTable | 61 | return sendTable |
| 67 | } | 62 | } |
| 68 | writer.TempAppendLine("\t\t%s (%d Props):", sendTable.NetTableName, sendTable.NumOfProps) | ||
| 69 | for count := 0; count < int(sendTable.NumOfProps); count++ { | 63 | for count := 0; count < int(sendTable.NumOfProps); count++ { |
| 70 | propType := int8(reader.TryReadBits(5)) | 64 | propType := int8(reader.TryReadBits(5)) |
| 71 | if propType >= int8(7) { | 65 | if propType >= int8(7) { |
| @@ -77,26 +71,20 @@ func ParseSendTable(reader *bitreader.Reader) SendTable { | |||
| 77 | SendPropFlags: uint32(reader.TryReadBits(19)), | 71 | SendPropFlags: uint32(reader.TryReadBits(19)), |
| 78 | Priority: reader.TryReadUInt8(), | 72 | Priority: reader.TryReadUInt8(), |
| 79 | } | 73 | } |
| 80 | writer.TempAppend("\t\t\t%s\t", prop.SendPropType) | ||
| 81 | if propType == int8(ESendPropTypeDataTable) || checkBit(prop.SendPropFlags, 6) { | 74 | if propType == int8(ESendPropTypeDataTable) || checkBit(prop.SendPropFlags, 6) { |
| 82 | prop.ExcludeDtName = reader.TryReadString() | 75 | prop.ExcludeDtName = reader.TryReadString() |
| 83 | writer.TempAppend(":\t%s\t", prop.ExcludeDtName) | ||
| 84 | } else { | 76 | } else { |
| 85 | switch propType { | 77 | switch propType { |
| 86 | case int8(ESendPropTypeString), int8(ESendPropTypeInt), int8(ESendPropTypeFloat), int8(ESendPropTypeVector3), int8(ESendPropTypeVector2): | 78 | case int8(ESendPropTypeString), int8(ESendPropTypeInt), int8(ESendPropTypeFloat), int8(ESendPropTypeVector3), int8(ESendPropTypeVector2): |
| 87 | prop.LowValue = reader.TryReadFloat32() | 79 | prop.LowValue = reader.TryReadFloat32() |
| 88 | prop.HighValue = reader.TryReadFloat32() | 80 | prop.HighValue = reader.TryReadFloat32() |
| 89 | prop.NumBits = int32(reader.TryReadBits(7)) | 81 | prop.NumBits = int32(reader.TryReadBits(7)) |
| 90 | writer.TempAppend("Low: %f\tHigh: %f\t%d bits\t", prop.LowValue, prop.HighValue, prop.NumBits) | ||
| 91 | case int8(ESendPropTypeArray): | 82 | case int8(ESendPropTypeArray): |
| 92 | prop.NumElements = int32(reader.TryReadBits(10)) | 83 | prop.NumElements = int32(reader.TryReadBits(10)) |
| 93 | writer.TempAppend("Elements: %d\t", prop.NumElements) | ||
| 94 | default: | 84 | default: |
| 95 | writer.TempAppend("Unknown Prop Type: %v\t", propType) | ||
| 96 | return sendTable | 85 | return sendTable |
| 97 | } | 86 | } |
| 98 | } | 87 | } |
| 99 | writer.TempAppend("Flags: %v\tPriority: %d\n", prop.GetFlags(), prop.Priority) | ||
| 100 | sendTable.Props = append(sendTable.Props, prop) | 88 | sendTable.Props = append(sendTable.Props, prop) |
| 101 | } | 89 | } |
| 102 | return sendTable | 90 | return sendTable |
| @@ -108,7 +96,6 @@ func ParseServerClassInfo(reader *bitreader.Reader, count int, numOfClasses int) | |||
| 108 | ClassName: reader.TryReadString(), | 96 | ClassName: reader.TryReadString(), |
| 109 | DataTableName: reader.TryReadString(), | 97 | DataTableName: reader.TryReadString(), |
| 110 | } | 98 | } |
| 111 | writer.TempAppendLine("\t\t\t[%d] %s (%s)", serverClassInfo.ClassId, serverClassInfo.ClassName, serverClassInfo.DataTableName) | ||
| 112 | return serverClassInfo | 99 | return serverClassInfo |
| 113 | } | 100 | } |
| 114 | 101 | ||
diff --git a/pkg/classes/packet.go b/pkg/classes/packet.go index 0bba102..c608244 100644 --- a/pkg/classes/packet.go +++ b/pkg/classes/packet.go | |||
| @@ -5,7 +5,6 @@ import ( | |||
| 5 | 5 | ||
| 6 | "github.com/pektezol/bitreader" | 6 | "github.com/pektezol/bitreader" |
| 7 | "github.com/pektezol/demoparser/pkg/messages" | 7 | "github.com/pektezol/demoparser/pkg/messages" |
| 8 | "github.com/pektezol/demoparser/pkg/writer" | ||
| 9 | ) | 8 | ) |
| 10 | 9 | ||
| 11 | const MSSC int = 2 | 10 | const MSSC int = 2 |
| @@ -55,14 +54,6 @@ func (packet *Packet) ParseCmdInfo(reader *bitreader.Reader) { | |||
| 55 | ViewAngles2: []float32{reader.TryReadFloat32(), reader.TryReadFloat32(), reader.TryReadFloat32()}, | 54 | ViewAngles2: []float32{reader.TryReadFloat32(), reader.TryReadFloat32(), reader.TryReadFloat32()}, |
| 56 | LocalViewAngles2: []float32{reader.TryReadFloat32(), reader.TryReadFloat32(), reader.TryReadFloat32()}, | 55 | LocalViewAngles2: []float32{reader.TryReadFloat32(), reader.TryReadFloat32(), reader.TryReadFloat32()}, |
| 57 | }) | 56 | }) |
| 58 | writer.AppendLine("\tFlags: %s", CmdInfoFlags(packet.PacketInfo[len(packet.PacketInfo)-1].Flags).String()) | ||
| 59 | writer.AppendLine("\tView Origin: %v", packet.PacketInfo[len(packet.PacketInfo)-1].ViewOrigin) | ||
| 60 | writer.AppendLine("\tView Angles: %v", packet.PacketInfo[len(packet.PacketInfo)-1].ViewAngles) | ||
| 61 | writer.AppendLine("\tLocal View Angles: %v", packet.PacketInfo[len(packet.PacketInfo)-1].LocalViewAngles) | ||
| 62 | writer.AppendLine("\tView Origin 2: %v", packet.PacketInfo[len(packet.PacketInfo)-1].ViewOrigin2) | ||
| 63 | writer.AppendLine("\tView Angles 2: %v", packet.PacketInfo[len(packet.PacketInfo)-1].ViewAngles2) | ||
| 64 | writer.AppendLine("\tLocal View Angles 2: %v", packet.PacketInfo[len(packet.PacketInfo)-1].LocalViewAngles2) | ||
| 65 | writer.AppendLine("") | ||
| 66 | } | 57 | } |
| 67 | 58 | ||
| 68 | type CmdInfoFlags int | 59 | type CmdInfoFlags int |
diff --git a/pkg/classes/sarData.go b/pkg/classes/sarData.go index 27e8a64..9c61304 100644 --- a/pkg/classes/sarData.go +++ b/pkg/classes/sarData.go | |||
| @@ -5,7 +5,6 @@ import ( | |||
| 5 | "fmt" | 5 | "fmt" |
| 6 | 6 | ||
| 7 | "github.com/pektezol/bitreader" | 7 | "github.com/pektezol/bitreader" |
| 8 | "github.com/pektezol/demoparser/pkg/writer" | ||
| 9 | ) | 8 | ) |
| 10 | 9 | ||
| 11 | type SarDataType uint8 | 10 | type SarDataType uint8 |
| @@ -164,7 +163,6 @@ func (sarData *SarData) ParseSarData(reader *bitreader.Reader) (err error) { | |||
| 164 | len = 9 | 163 | len = 9 |
| 165 | } | 164 | } |
| 166 | dataReader := bitreader.NewReaderFromBytes(reader.TryReadBytesToSlice(len-1), true) | 165 | dataReader := bitreader.NewReaderFromBytes(reader.TryReadBytesToSlice(len-1), true) |
| 167 | writer.AppendLine("\tMessage: %s (%d):", sarData.Type.String(), sarData.Type) | ||
| 168 | switch sarData.Type { | 166 | switch sarData.Type { |
| 169 | case ESarDataTimescaleCheat: | 167 | case ESarDataTimescaleCheat: |
| 170 | sarData.Data, err = parseTimescaleCheatData(dataReader, len) | 168 | sarData.Data, err = parseTimescaleCheatData(dataReader, len) |
| @@ -175,7 +173,6 @@ func (sarData *SarData) ParseSarData(reader *bitreader.Reader) (err error) { | |||
| 175 | sarData.Data = parseInitialCVarData(dataReader) | 173 | sarData.Data = parseInitialCVarData(dataReader) |
| 176 | case ESarDataEntityInputSlot: | 174 | case ESarDataEntityInputSlot: |
| 177 | sarData.Slot = int(dataReader.TryReadBytes(1)) | 175 | sarData.Slot = int(dataReader.TryReadBytes(1)) |
| 178 | writer.AppendLine("\t\tSlot: %d", sarData.Slot) | ||
| 179 | case ESarDataEntityInput: | 176 | case ESarDataEntityInput: |
| 180 | sarData.Data = parseEntityInputData(dataReader) | 177 | sarData.Data = parseEntityInputData(dataReader) |
| 181 | case ESarDataChecksum: | 178 | case ESarDataChecksum: |
| @@ -201,7 +198,7 @@ func (sarData *SarData) ParseSarData(reader *bitreader.Reader) (err error) { | |||
| 201 | if err != nil { | 198 | if err != nil { |
| 202 | sarData.Data = nil | 199 | sarData.Data = nil |
| 203 | } | 200 | } |
| 204 | writer.AppendLine("\t\tSlot: %d", sarData.Slot) | 201 | |
| 205 | case ESarDataPause: | 202 | case ESarDataPause: |
| 206 | sarData.Data, err = parsePauseData(dataReader, len) | 203 | sarData.Data, err = parsePauseData(dataReader, len) |
| 207 | if err != nil { | 204 | if err != nil { |
| @@ -246,7 +243,7 @@ func parseTimescaleCheatData(reader *bitreader.Reader, length uint64) (SarDataTi | |||
| 246 | sarDataTimescaleCheat := SarDataTimescaleCheat{ | 243 | sarDataTimescaleCheat := SarDataTimescaleCheat{ |
| 247 | Timescale: reader.TryReadFloat32(), | 244 | Timescale: reader.TryReadFloat32(), |
| 248 | } | 245 | } |
| 249 | writer.AppendLine("\t\tTimescale: %f", sarDataTimescaleCheat.Timescale) | 246 | |
| 250 | return sarDataTimescaleCheat, nil | 247 | return sarDataTimescaleCheat, nil |
| 251 | } | 248 | } |
| 252 | 249 | ||
| @@ -255,7 +252,7 @@ func parseInitialCVarData(reader *bitreader.Reader) SarDataInitialCVar { | |||
| 255 | CVar: reader.TryReadString(), | 252 | CVar: reader.TryReadString(), |
| 256 | Val: reader.TryReadString(), | 253 | Val: reader.TryReadString(), |
| 257 | } | 254 | } |
| 258 | writer.AppendLine("\t\tCvar: \"%s\" = \"%s\"", sarDataInitialCvar.CVar, sarDataInitialCvar.Val) | 255 | |
| 259 | return sarDataInitialCvar | 256 | return sarDataInitialCvar |
| 260 | } | 257 | } |
| 261 | 258 | ||
| @@ -266,10 +263,7 @@ func parseEntityInputData(reader *bitreader.Reader) SarDataEntityInput { | |||
| 266 | InputName: reader.TryReadString(), | 263 | InputName: reader.TryReadString(), |
| 267 | Parameter: reader.TryReadString(), | 264 | Parameter: reader.TryReadString(), |
| 268 | } | 265 | } |
| 269 | writer.AppendLine("\t\tTarget: %s", sarDataEntityInput.TargetName) | 266 | |
| 270 | writer.AppendLine("\t\tClass: %s", sarDataEntityInput.ClassName) | ||
| 271 | writer.AppendLine("\t\tInput: %s", sarDataEntityInput.InputName) | ||
| 272 | writer.AppendLine("\t\tParameter: %s", sarDataEntityInput.Parameter) | ||
| 273 | return sarDataEntityInput | 267 | return sarDataEntityInput |
| 274 | } | 268 | } |
| 275 | 269 | ||
| @@ -281,8 +275,7 @@ func parseChecksumData(reader *bitreader.Reader, length uint64) (SarDataChecksum | |||
| 281 | DemoSum: reader.TryReadUInt32(), | 275 | DemoSum: reader.TryReadUInt32(), |
| 282 | SarSum: reader.TryReadUInt32(), | 276 | SarSum: reader.TryReadUInt32(), |
| 283 | } | 277 | } |
| 284 | writer.AppendLine("\t\tDemo Checksum: %d", sarDataChecksum.DemoSum) | 278 | |
| 285 | writer.AppendLine("\t\tSAR Checksum: %d", sarDataChecksum.SarSum) | ||
| 286 | return sarDataChecksum, nil | 279 | return sarDataChecksum, nil |
| 287 | } | 280 | } |
| 288 | 281 | ||
| @@ -294,8 +287,7 @@ func parseChecksumV2Data(reader *bitreader.Reader, length uint64) (SarDataChecks | |||
| 294 | SarSum: reader.TryReadUInt32(), | 287 | SarSum: reader.TryReadUInt32(), |
| 295 | Signature: [64]byte(reader.TryReadBytesToSlice(60)), | 288 | Signature: [64]byte(reader.TryReadBytesToSlice(60)), |
| 296 | } | 289 | } |
| 297 | writer.AppendLine("\t\tSAR Checksum: %d", sarDataChecksumV2.SarSum) | 290 | |
| 298 | writer.AppendLine("\t\tSignature: %v", sarDataChecksumV2.Signature) | ||
| 299 | return sarDataChecksumV2, nil | 291 | return sarDataChecksumV2, nil |
| 300 | } | 292 | } |
| 301 | 293 | ||
| @@ -312,10 +304,7 @@ func parsePortalPlacementData(reader *bitreader.Reader, length uint64) (SarDataP | |||
| 312 | Y: reader.TryReadFloat32(), | 304 | Y: reader.TryReadFloat32(), |
| 313 | Z: reader.TryReadFloat32(), | 305 | Z: reader.TryReadFloat32(), |
| 314 | } | 306 | } |
| 315 | writer.AppendLine("\t\tOrange: %t", orange) | 307 | |
| 316 | writer.AppendLine("\t\tX: %f", sarDataPortalPlacement.X) | ||
| 317 | writer.AppendLine("\t\tY: %f", sarDataPortalPlacement.Y) | ||
| 318 | writer.AppendLine("\t\tZ: %f", sarDataPortalPlacement.Z) | ||
| 319 | return sarDataPortalPlacement, slot, nil | 308 | return sarDataPortalPlacement, slot, nil |
| 320 | } | 309 | } |
| 321 | 310 | ||
| @@ -333,7 +322,7 @@ func parsePauseData(reader *bitreader.Reader, length uint64) (SarDataPause, erro | |||
| 333 | sarDataPause := SarDataPause{ | 322 | sarDataPause := SarDataPause{ |
| 334 | PauseTicks: reader.TryReadUInt32(), | 323 | PauseTicks: reader.TryReadUInt32(), |
| 335 | } | 324 | } |
| 336 | writer.AppendLine("\t\tPause Ticks: %d", sarDataPause.PauseTicks) | 325 | |
| 337 | return sarDataPause, nil | 326 | return sarDataPause, nil |
| 338 | } | 327 | } |
| 339 | 328 | ||
| @@ -345,8 +334,7 @@ func parseWaitRunData(reader *bitreader.Reader, length uint64) (SarDataWaitRun, | |||
| 345 | Ticks: int(reader.TryReadUInt32()), | 334 | Ticks: int(reader.TryReadUInt32()), |
| 346 | Cmd: reader.TryReadString(), | 335 | Cmd: reader.TryReadString(), |
| 347 | } | 336 | } |
| 348 | writer.AppendLine("\t\tTicks: %d", sarDataWaitRun.Ticks) | 337 | |
| 349 | writer.AppendLine("\t\tCmd: \"%s\"", sarDataWaitRun.Cmd) | ||
| 350 | return sarDataWaitRun, nil | 338 | return sarDataWaitRun, nil |
| 351 | } | 339 | } |
| 352 | 340 | ||
| @@ -358,8 +346,7 @@ func parseHWaitRunData(reader *bitreader.Reader, length uint64) (SarDataHWaitRun | |||
| 358 | Ticks: int(reader.TryReadUInt32()), | 346 | Ticks: int(reader.TryReadUInt32()), |
| 359 | Cmd: reader.TryReadString(), | 347 | Cmd: reader.TryReadString(), |
| 360 | } | 348 | } |
| 361 | writer.AppendLine("\t\tTicks: %d", sarDataHWaitRun.Ticks) | 349 | |
| 362 | writer.AppendLine("\t\tCmd: \"%s\"", sarDataHWaitRun.Cmd) | ||
| 363 | return sarDataHWaitRun, nil | 350 | return sarDataHWaitRun, nil |
| 364 | } | 351 | } |
| 365 | 352 | ||
| @@ -372,14 +359,12 @@ func parseSpeedrunTimeData(reader *bitreader.Reader, length uint64) (SarDataSpee | |||
| 372 | for splitCount := 0; splitCount < int(numberOfSplits); splitCount++ { | 359 | for splitCount := 0; splitCount < int(numberOfSplits); splitCount++ { |
| 373 | splits[splitCount].Name = reader.TryReadString() | 360 | splits[splitCount].Name = reader.TryReadString() |
| 374 | splits[splitCount].NSegs = reader.TryReadUInt32() | 361 | splits[splitCount].NSegs = reader.TryReadUInt32() |
| 375 | writer.AppendLine("\t\t[%d] Split Name: \"%s\"", splitCount, splits[splitCount].Name) | 362 | |
| 376 | writer.AppendLine("\t\t[%d] Number of Segments: %d", splitCount, splits[splitCount].NSegs) | ||
| 377 | splits[splitCount].Segs = make([]SarDataSpeedrunTimeSegs, splits[splitCount].NSegs) | 363 | splits[splitCount].Segs = make([]SarDataSpeedrunTimeSegs, splits[splitCount].NSegs) |
| 378 | for segCount := 0; segCount < int(splits[splitCount].NSegs); segCount++ { | 364 | for segCount := 0; segCount < int(splits[splitCount].NSegs); segCount++ { |
| 379 | splits[splitCount].Segs[segCount].Name = reader.TryReadString() | 365 | splits[splitCount].Segs[segCount].Name = reader.TryReadString() |
| 380 | splits[splitCount].Segs[segCount].Ticks = reader.TryReadUInt32() | 366 | splits[splitCount].Segs[segCount].Ticks = reader.TryReadUInt32() |
| 381 | writer.AppendLine("\t\t\t[%d] Segment Name: \"%s\"", segCount, splits[splitCount].Segs[segCount].Name) | 367 | |
| 382 | writer.AppendLine("\t\t\t[%d] Segment Ticks: %d", segCount, splits[splitCount].Segs[segCount].Ticks) | ||
| 383 | } | 368 | } |
| 384 | } | 369 | } |
| 385 | return SarDataSpeedrunTime{ | 370 | return SarDataSpeedrunTime{ |
| @@ -401,12 +386,7 @@ func parseTimestampData(reader *bitreader.Reader, length uint64) (SarDataTimesta | |||
| 401 | Minute: timestamp[5], | 386 | Minute: timestamp[5], |
| 402 | Second: timestamp[6], | 387 | Second: timestamp[6], |
| 403 | } | 388 | } |
| 404 | writer.AppendLine("\t\tYear: %d", sarDataTimeStamp.Year) | 389 | |
| 405 | writer.AppendLine("\t\tMonth: %d", sarDataTimeStamp.Month) | ||
| 406 | writer.AppendLine("\t\tDay: %d", sarDataTimeStamp.Day) | ||
| 407 | writer.AppendLine("\t\tHour: %d", sarDataTimeStamp.Hour) | ||
| 408 | writer.AppendLine("\t\tMinute: %d", sarDataTimeStamp.Minute) | ||
| 409 | writer.AppendLine("\t\tSecond: %d", sarDataTimeStamp.Second) | ||
| 410 | return sarDataTimeStamp, nil | 390 | return sarDataTimeStamp, nil |
| 411 | } | 391 | } |
| 412 | 392 | ||
| @@ -418,7 +398,6 @@ func parseFileChecksumData(reader *bitreader.Reader, length uint64) (SarDataFile | |||
| 418 | Sum: reader.TryReadUInt32(), | 398 | Sum: reader.TryReadUInt32(), |
| 419 | Path: reader.TryReadString(), | 399 | Path: reader.TryReadString(), |
| 420 | } | 400 | } |
| 421 | writer.AppendLine("\t\tChecksum: %d", sarDataFileChecksum.Sum) | 401 | |
| 422 | writer.AppendLine("\t\tPath: \"%s\"", sarDataFileChecksum.Path) | ||
| 423 | return sarDataFileChecksum, nil | 402 | return sarDataFileChecksum, nil |
| 424 | } | 403 | } |
diff --git a/pkg/classes/signOn.go b/pkg/classes/signOn.go index fad696c..5f004c0 100644 --- a/pkg/classes/signOn.go +++ b/pkg/classes/signOn.go | |||
| @@ -3,7 +3,6 @@ package classes | |||
| 3 | import ( | 3 | import ( |
| 4 | "github.com/pektezol/bitreader" | 4 | "github.com/pektezol/bitreader" |
| 5 | "github.com/pektezol/demoparser/pkg/messages" | 5 | "github.com/pektezol/demoparser/pkg/messages" |
| 6 | "github.com/pektezol/demoparser/pkg/writer" | ||
| 7 | ) | 6 | ) |
| 8 | 7 | ||
| 9 | type SignOn struct { | 8 | type SignOn struct { |
| @@ -41,12 +40,4 @@ func (signOn *SignOn) ParseCmdInfo(reader *bitreader.Reader) { | |||
| 41 | ViewAngles2: []float32{reader.TryReadFloat32(), reader.TryReadFloat32(), reader.TryReadFloat32()}, | 40 | ViewAngles2: []float32{reader.TryReadFloat32(), reader.TryReadFloat32(), reader.TryReadFloat32()}, |
| 42 | LocalViewAngles2: []float32{reader.TryReadFloat32(), reader.TryReadFloat32(), reader.TryReadFloat32()}, | 41 | LocalViewAngles2: []float32{reader.TryReadFloat32(), reader.TryReadFloat32(), reader.TryReadFloat32()}, |
| 43 | }) | 42 | }) |
| 44 | writer.AppendLine("\tFlags: %s", CmdInfoFlags(signOn.PacketInfo[len(signOn.PacketInfo)-1].Flags).String()) | ||
| 45 | writer.AppendLine("\tView Origin: %v", signOn.PacketInfo[len(signOn.PacketInfo)-1].ViewOrigin) | ||
| 46 | writer.AppendLine("\tView Angles: %v", signOn.PacketInfo[len(signOn.PacketInfo)-1].ViewAngles) | ||
| 47 | writer.AppendLine("\tLocal View Angles: %v", signOn.PacketInfo[len(signOn.PacketInfo)-1].LocalViewAngles) | ||
| 48 | writer.AppendLine("\tView Origin 2: %v", signOn.PacketInfo[len(signOn.PacketInfo)-1].ViewOrigin2) | ||
| 49 | writer.AppendLine("\tView Angles 2: %v", signOn.PacketInfo[len(signOn.PacketInfo)-1].ViewAngles2) | ||
| 50 | writer.AppendLine("\tLocal View Angles 2: %v", signOn.PacketInfo[len(signOn.PacketInfo)-1].LocalViewAngles2) | ||
| 51 | writer.AppendLine("") | ||
| 52 | } | 43 | } |
diff --git a/pkg/classes/stop.go b/pkg/classes/stop.go index 753be19..96bc1e4 100644 --- a/pkg/classes/stop.go +++ b/pkg/classes/stop.go | |||
| @@ -2,7 +2,6 @@ package classes | |||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "github.com/pektezol/bitreader" | 4 | "github.com/pektezol/bitreader" |
| 5 | "github.com/pektezol/demoparser/pkg/writer" | ||
| 6 | ) | 5 | ) |
| 7 | 6 | ||
| 8 | type Stop struct { | 7 | type Stop struct { |
| @@ -12,6 +11,5 @@ type Stop struct { | |||
| 12 | func (stop *Stop) ParseStop(reader *bitreader.Reader) { | 11 | func (stop *Stop) ParseStop(reader *bitreader.Reader) { |
| 13 | if reader.TryReadBool() { | 12 | if reader.TryReadBool() { |
| 14 | stop.RemainingData = reader.TryReadBitsToSlice(uint64(reader.TryReadRemainingBits())) | 13 | stop.RemainingData = reader.TryReadBitsToSlice(uint64(reader.TryReadRemainingBits())) |
| 15 | writer.AppendLine("\tRemaining Data: %v", stop.RemainingData) | ||
| 16 | } | 14 | } |
| 17 | } | 15 | } |
diff --git a/pkg/classes/stringTables.go b/pkg/classes/stringTables.go index 01939b2..45954be 100644 --- a/pkg/classes/stringTables.go +++ b/pkg/classes/stringTables.go | |||
| @@ -2,7 +2,6 @@ package classes | |||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "github.com/pektezol/bitreader" | 4 | "github.com/pektezol/bitreader" |
| 5 | "github.com/pektezol/demoparser/pkg/writer" | ||
| 6 | ) | 5 | ) |
| 7 | 6 | ||
| 8 | type StringTables struct { | 7 | type StringTables struct { |
| @@ -46,7 +45,6 @@ func (stringTables *StringTables) ParseStringTables(reader *bitreader.Reader) { | |||
| 46 | func (stringTable *StringTable) ParseStream(reader *bitreader.Reader) { | 45 | func (stringTable *StringTable) ParseStream(reader *bitreader.Reader) { |
| 47 | stringTable.Name = reader.TryReadString() | 46 | stringTable.Name = reader.TryReadString() |
| 48 | entryCount := reader.TryReadBits(16) | 47 | entryCount := reader.TryReadBits(16) |
| 49 | writer.AppendLine("\tTable Name: %s", stringTable.Name) | ||
| 50 | stringTable.TableEntries = make([]StringTableEntry, entryCount) | 48 | stringTable.TableEntries = make([]StringTableEntry, entryCount) |
| 51 | 49 | ||
| 52 | for i := 0; i < int(entryCount); i++ { | 50 | for i := 0; i < int(entryCount); i++ { |
| @@ -54,12 +52,6 @@ func (stringTable *StringTable) ParseStream(reader *bitreader.Reader) { | |||
| 54 | entry.Parse(reader) | 52 | entry.Parse(reader) |
| 55 | stringTable.TableEntries[i] = entry | 53 | stringTable.TableEntries[i] = entry |
| 56 | } | 54 | } |
| 57 | if entryCount != 0 { | ||
| 58 | writer.AppendLine("\t\t%d Table Entries:", entryCount) | ||
| 59 | writer.AppendOutputFromTemp() | ||
| 60 | } else { | ||
| 61 | writer.AppendLine("\t\tNo Table Entries") | ||
| 62 | } | ||
| 63 | if reader.TryReadBool() { | 55 | if reader.TryReadBool() { |
| 64 | classCount := reader.TryReadBits(16) | 56 | classCount := reader.TryReadBits(16) |
| 65 | stringTable.Classes = make([]StringTableClass, classCount) | 57 | stringTable.Classes = make([]StringTableClass, classCount) |
| @@ -69,10 +61,6 @@ func (stringTable *StringTable) ParseStream(reader *bitreader.Reader) { | |||
| 69 | class.Parse(reader) | 61 | class.Parse(reader) |
| 70 | stringTable.Classes[i] = class | 62 | stringTable.Classes[i] = class |
| 71 | } | 63 | } |
| 72 | writer.AppendLine("\t\t%d Classes:", classCount) | ||
| 73 | writer.AppendOutputFromTemp() | ||
| 74 | } else { | ||
| 75 | writer.AppendLine("\t\tNo Class Entries") | ||
| 76 | } | 64 | } |
| 77 | } | 65 | } |
| 78 | 66 | ||
| @@ -91,10 +79,8 @@ func (stringTableEntry *StringTableEntry) Parse(reader *bitreader.Reader) { | |||
| 91 | 79 | ||
| 92 | func (stringTableClass *StringTableClass) Parse(reader *bitreader.Reader) { | 80 | func (stringTableClass *StringTableClass) Parse(reader *bitreader.Reader) { |
| 93 | stringTableClass.Name = reader.TryReadString() | 81 | stringTableClass.Name = reader.TryReadString() |
| 94 | writer.TempAppendLine("\t\t\tName: %s", stringTableClass.Name) | ||
| 95 | if reader.TryReadBool() { | 82 | if reader.TryReadBool() { |
| 96 | dataLen := reader.TryReadBits(16) | 83 | dataLen := reader.TryReadBits(16) |
| 97 | stringTableClass.Data = reader.TryReadStringLength(dataLen) | 84 | stringTableClass.Data = reader.TryReadStringLength(dataLen) |
| 98 | writer.TempAppendLine("\t\t\tData: %s", stringTableClass.Data) | ||
| 99 | } | 85 | } |
| 100 | } | 86 | } |
diff --git a/pkg/classes/userCmd.go b/pkg/classes/userCmd.go index 24969f1..a4bf3d4 100644 --- a/pkg/classes/userCmd.go +++ b/pkg/classes/userCmd.go | |||
| @@ -2,7 +2,6 @@ package classes | |||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "github.com/pektezol/bitreader" | 4 | "github.com/pektezol/bitreader" |
| 5 | "github.com/pektezol/demoparser/pkg/writer" | ||
| 6 | ) | 5 | ) |
| 7 | 6 | ||
| 8 | type UserCmd struct { | 7 | type UserCmd struct { |
| @@ -78,14 +77,6 @@ func (userCmd *UserCmd) ParseUserCmdInfo(reader *bitreader.Reader) { | |||
| 78 | if reader.TryReadBool() { | 77 | if reader.TryReadBool() { |
| 79 | userCmd.Data.MouseDy = reader.TryReadUInt16() | 78 | userCmd.Data.MouseDy = reader.TryReadUInt16() |
| 80 | } | 79 | } |
| 81 | writer.AppendLine("\tCommand Number: %v", userCmd.Data.CommandNumber) | ||
| 82 | writer.AppendLine("\tTick Count: %v", userCmd.Data.TickCount) | ||
| 83 | writer.AppendLine("\tView Angles: %v", []float32{userCmd.Data.ViewAnglesX, userCmd.Data.ViewAnglesY, userCmd.Data.ViewAnglesZ}) | ||
| 84 | writer.AppendLine("\tMovement: %v", []float32{userCmd.Data.ForwardMove, userCmd.Data.SideMove, userCmd.Data.UpMove}) | ||
| 85 | writer.AppendLine("\tButtons: %v", Buttons(userCmd.Data.Buttons).GetButtons()) | ||
| 86 | writer.AppendLine("\tImpulse: %v", userCmd.Data.Impulse) | ||
| 87 | writer.AppendLine("\tWeapon, Subtype: %v, %v", userCmd.Data.WeaponSelect, userCmd.Data.WeaponSubType) | ||
| 88 | writer.AppendLine("\tMouse Dx, Mouse Dy: %v, %v", userCmd.Data.MouseDx, userCmd.Data.MouseDy) | ||
| 89 | } | 80 | } |
| 90 | 81 | ||
| 91 | func (button Buttons) GetButtons() []string { | 82 | func (button Buttons) GetButtons() []string { |