diff options
Diffstat (limited to 'messages/messages.go')
| -rw-r--r-- | messages/messages.go | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/messages/messages.go b/messages/messages.go index 4d94728..478b7c7 100644 --- a/messages/messages.go +++ b/messages/messages.go | |||
| @@ -14,7 +14,7 @@ func ParseMessage(file *os.File) (statusCode int) { | |||
| 14 | messageType := reader.TryReadInt8() | 14 | messageType := reader.TryReadInt8() |
| 15 | messageTick := reader.TryReadInt32() | 15 | messageTick := reader.TryReadInt32() |
| 16 | messageSlot := reader.TryReadInt8() | 16 | messageSlot := reader.TryReadInt8() |
| 17 | fmt.Println(messageType, messageTick, messageSlot) | 17 | //fmt.Println(messageType, messageTick, messageSlot) |
| 18 | switch messageType { | 18 | switch messageType { |
| 19 | case 0x01: // SignOn | 19 | case 0x01: // SignOn |
| 20 | var packet Packet | 20 | var packet Packet |
| @@ -22,7 +22,8 @@ func ParseMessage(file *os.File) (statusCode int) { | |||
| 22 | packet.InSequence = int32(reader.TryReadInt32()) | 22 | packet.InSequence = int32(reader.TryReadInt32()) |
| 23 | packet.OutSequence = int32(reader.TryReadInt32()) | 23 | packet.OutSequence = int32(reader.TryReadInt32()) |
| 24 | packet.Size = int32(reader.TryReadInt32()) | 24 | packet.Size = int32(reader.TryReadInt32()) |
| 25 | reader.SkipBytes(int(packet.Size)) | 25 | reader.SkipBytes(int(packet.Size)) // TODO: NET/SVC Message Parsing |
| 26 | fmt.Printf("[%d] (%d) SignOn: %v\n", messageTick, messageSlot, packet) | ||
| 26 | return 1 | 27 | return 1 |
| 27 | case 0x02: // Packet | 28 | case 0x02: // Packet |
| 28 | var packet Packet | 29 | var packet Packet |
| @@ -30,7 +31,8 @@ func ParseMessage(file *os.File) (statusCode int) { | |||
| 30 | packet.InSequence = int32(reader.TryReadInt32()) | 31 | packet.InSequence = int32(reader.TryReadInt32()) |
| 31 | packet.OutSequence = int32(reader.TryReadInt32()) | 32 | packet.OutSequence = int32(reader.TryReadInt32()) |
| 32 | packet.Size = int32(reader.TryReadInt32()) | 33 | packet.Size = int32(reader.TryReadInt32()) |
| 33 | reader.SkipBytes(int(packet.Size)) | 34 | reader.SkipBytes(int(packet.Size)) // TODO: NET/SVC Message Parsing |
| 35 | fmt.Printf("[%d] Packet: %v\n", messageTick, packet) | ||
| 34 | return 2 | 36 | return 2 |
| 35 | case 0x03: // SyncTick | 37 | case 0x03: // SyncTick |
| 36 | return 3 | 38 | return 3 |
| @@ -38,30 +40,33 @@ func ParseMessage(file *os.File) (statusCode int) { | |||
| 38 | var consolecmd ConsoleCmd | 40 | var consolecmd ConsoleCmd |
| 39 | consolecmd.Size = int32(reader.TryReadInt32()) | 41 | consolecmd.Size = int32(reader.TryReadInt32()) |
| 40 | consolecmd.Data = string(utils.ReadByteFromFile(file, consolecmd.Size)) | 42 | consolecmd.Data = string(utils.ReadByteFromFile(file, consolecmd.Size)) |
| 43 | fmt.Printf("[%d] ConsoleCmd: %s\n", messageTick, consolecmd.Data) | ||
| 41 | return 4 | 44 | return 4 |
| 42 | case 0x05: // UserCmd | 45 | case 0x05: // UserCmd |
| 43 | var usercmd UserCmd | 46 | var usercmd UserCmd |
| 44 | usercmd.Cmd = int32(reader.TryReadInt32()) | 47 | usercmd.Cmd = int32(reader.TryReadInt32()) |
| 45 | usercmd.Size = int32(reader.TryReadInt32()) | 48 | usercmd.Size = int32(reader.TryReadInt32()) |
| 46 | usercmd.Data = classes.ParseUserCmdInfo(file, int(usercmd.Size)) | 49 | usercmd.Data = classes.ParseUserCmdInfo(file, int(usercmd.Size)) |
| 50 | fmt.Printf("[%d] UserCmd: %v\n", messageTick, usercmd.Data) | ||
| 47 | return 5 | 51 | return 5 |
| 48 | case 0x06: // DataTables | 52 | case 0x06: // DataTables |
| 49 | var datatables DataTables | 53 | var datatables DataTables |
| 50 | datatables.Size = int32(reader.TryReadInt32()) | 54 | datatables.Size = int32(reader.TryReadInt32()) |
| 51 | reader.SkipBytes(int(datatables.Size)) | 55 | reader.SkipBytes(int(datatables.Size)) // TODO: DataTables Data |
| 52 | return 6 | 56 | return 6 |
| 53 | case 0x07: // Stop | 57 | case 0x07: // Stop |
| 58 | fmt.Printf("[%d] Stop\n", messageTick) | ||
| 54 | return 7 | 59 | return 7 |
| 55 | case 0x08: // CustomData | 60 | case 0x08: // CustomData |
| 56 | var customdata CustomData | 61 | var customdata CustomData |
| 57 | customdata.Unknown = int32(reader.TryReadInt32()) | 62 | customdata.Unknown = int32(reader.TryReadInt32()) |
| 58 | customdata.Size = int32(reader.TryReadInt32()) | 63 | customdata.Size = int32(reader.TryReadInt32()) |
| 59 | reader.SkipBytes(int(customdata.Size)) | 64 | reader.SkipBytes(int(customdata.Size)) // TODO: CustomData Data |
| 60 | return 8 | 65 | return 8 |
| 61 | case 0x09: // StringTables | 66 | case 0x09: // StringTables |
| 62 | var stringtables StringTables | 67 | var stringtables StringTables |
| 63 | stringtables.Size = int32(reader.TryReadInt32()) | 68 | stringtables.Size = int32(reader.TryReadInt32()) |
| 64 | reader.SkipBytes(int(stringtables.Size)) | 69 | reader.SkipBytes(int(stringtables.Size)) // TODO: StringTables Data |
| 65 | return 9 | 70 | return 9 |
| 66 | default: | 71 | default: |
| 67 | return 0 | 72 | return 0 |