diff options
Diffstat (limited to 'messages/messages.go')
| -rw-r--r-- | messages/messages.go | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/messages/messages.go b/messages/messages.go index 478b7c7..b40684b 100644 --- a/messages/messages.go +++ b/messages/messages.go | |||
| @@ -4,9 +4,10 @@ import ( | |||
| 4 | "fmt" | 4 | "fmt" |
| 5 | "os" | 5 | "os" |
| 6 | 6 | ||
| 7 | "github.com/bisaxa/bitreader" | 7 | "github.com/pektezol/bitreader" |
| 8 | "github.com/bisaxa/demoparser/classes" | 8 | "github.com/pektezol/demoparser/classes" |
| 9 | "github.com/bisaxa/demoparser/utils" | 9 | "github.com/pektezol/demoparser/classes/netsvc" |
| 10 | "github.com/pektezol/demoparser/utils" | ||
| 10 | ) | 11 | ) |
| 11 | 12 | ||
| 12 | func ParseMessage(file *os.File) (statusCode int) { | 13 | func ParseMessage(file *os.File) (statusCode int) { |
| @@ -22,7 +23,10 @@ func ParseMessage(file *os.File) (statusCode int) { | |||
| 22 | packet.InSequence = int32(reader.TryReadInt32()) | 23 | packet.InSequence = int32(reader.TryReadInt32()) |
| 23 | packet.OutSequence = int32(reader.TryReadInt32()) | 24 | packet.OutSequence = int32(reader.TryReadInt32()) |
| 24 | packet.Size = int32(reader.TryReadInt32()) | 25 | packet.Size = int32(reader.TryReadInt32()) |
| 25 | reader.SkipBytes(int(packet.Size)) // TODO: NET/SVC Message Parsing | 26 | data := utils.ReadByteFromFile(file, packet.Size) |
| 27 | //fmt.Println(data) | ||
| 28 | netsvc.ParseNetSvcMessage(data) | ||
| 29 | //reader.SkipBytes(int(packet.Size)) // TODO: NET/SVC Message Parsing | ||
| 26 | fmt.Printf("[%d] (%d) SignOn: %v\n", messageTick, messageSlot, packet) | 30 | fmt.Printf("[%d] (%d) SignOn: %v\n", messageTick, messageSlot, packet) |
| 27 | return 1 | 31 | return 1 |
| 28 | case 0x02: // Packet | 32 | case 0x02: // Packet |
| @@ -32,7 +36,7 @@ func ParseMessage(file *os.File) (statusCode int) { | |||
| 32 | packet.OutSequence = int32(reader.TryReadInt32()) | 36 | packet.OutSequence = int32(reader.TryReadInt32()) |
| 33 | packet.Size = int32(reader.TryReadInt32()) | 37 | packet.Size = int32(reader.TryReadInt32()) |
| 34 | reader.SkipBytes(int(packet.Size)) // TODO: NET/SVC Message Parsing | 38 | reader.SkipBytes(int(packet.Size)) // TODO: NET/SVC Message Parsing |
| 35 | fmt.Printf("[%d] Packet: %v\n", messageTick, packet) | 39 | //fmt.Printf("[%d] Packet: %v\n", messageTick, packet) |
| 36 | return 2 | 40 | return 2 |
| 37 | case 0x03: // SyncTick | 41 | case 0x03: // SyncTick |
| 38 | return 3 | 42 | return 3 |
| @@ -40,14 +44,14 @@ func ParseMessage(file *os.File) (statusCode int) { | |||
| 40 | var consolecmd ConsoleCmd | 44 | var consolecmd ConsoleCmd |
| 41 | consolecmd.Size = int32(reader.TryReadInt32()) | 45 | consolecmd.Size = int32(reader.TryReadInt32()) |
| 42 | consolecmd.Data = string(utils.ReadByteFromFile(file, consolecmd.Size)) | 46 | consolecmd.Data = string(utils.ReadByteFromFile(file, consolecmd.Size)) |
| 43 | fmt.Printf("[%d] ConsoleCmd: %s\n", messageTick, consolecmd.Data) | 47 | //fmt.Printf("[%d] ConsoleCmd: %s\n", messageTick, consolecmd.Data) |
| 44 | return 4 | 48 | return 4 |
| 45 | case 0x05: // UserCmd | 49 | case 0x05: // UserCmd |
| 46 | var usercmd UserCmd | 50 | var usercmd UserCmd |
| 47 | usercmd.Cmd = int32(reader.TryReadInt32()) | 51 | usercmd.Cmd = int32(reader.TryReadInt32()) |
| 48 | usercmd.Size = int32(reader.TryReadInt32()) | 52 | usercmd.Size = int32(reader.TryReadInt32()) |
| 49 | usercmd.Data = classes.ParseUserCmdInfo(file, int(usercmd.Size)) | 53 | usercmd.Data = classes.ParseUserCmdInfo(file, int(usercmd.Size)) |
| 50 | fmt.Printf("[%d] UserCmd: %v\n", messageTick, usercmd.Data) | 54 | //fmt.Printf("[%d] UserCmd: %v\n", messageTick, usercmd.Data) |
| 51 | return 5 | 55 | return 5 |
| 52 | case 0x06: // DataTables | 56 | case 0x06: // DataTables |
| 53 | var datatables DataTables | 57 | var datatables DataTables |