1313 0x000F5 00:05 P2 SelectionEvent - 00 22 ac 00 02 f4 00 00 | 00 0c a1 89 00 10 00 00 00 21 0b 01 00 01 5c 01 00 0c 22 0b
1414 01 08 34 07 00 23 80 00 01 1f 0d 41 18 00 8a c0 80 00 05 ff 00 08 21 ac 00 02 11 01 02
1515
16- The first line is the full path to the file followed by an indented list
17- of the last 2 events to be parsed with their associated bytes.
16+ The first line is the full path to the file, followed by an
17+ indented list of the last 3 events that were parsed before an
18+ Error was thrown.
1819
19- The 3rd line for the event the parser failed on is in the following format:
20+ The last line shows the last event that was parsed without
21+ throwing an Error, and the bytes that follow it. The pipe
22+ character delimits where the parser ended the event.
2023
21- cursor event_type - event_bytes | following bytes
22- and the next bytes after that
23-
24- With a pipe character delimiting where the parser ended the event.
25-
26- The general workflow is something like this:
27-
28- 1) Run the debugger over a set of replays
29- 2) Figure out where the failed event boundry should have been
30- 3) Alter the reader code to make it happen
31- 4) Repeat
24+ Often an Error is thrown because our code consumes the wrong
25+ number of bytes for the immediately previous Event.
3226
3327 In the example above:
3428
4236
4337 00 22 ac 00 02 f4 00 00 00
4438
39+
40+ The general workflow is something like this:
41+
42+ 1) Run the debugger over a set of replays
43+ 2) Figure out where the failed event boundry should have been
44+ 3) Alter the reader code to make it happen
45+ 4) Repeat
46+
47+
4548 To figure out how to alter the reader code you'll probably need to compile
4649 lists of failed events with these correct bytes and look for patterns that
4750 would help you read them the right way.
@@ -102,6 +105,7 @@ def get_name(obj):
102105 except ReadError as e :
103106 print filename
104107 if len (e .game_events ):
108+ print " Location Time P# EventType Bytes"
105109 for event in e .game_events [- 3 :- 1 ]:
106110 print " ....... {:0>2}:{:0>2} P{} {: <19} - {}" .format (event .second / 60 , event .second % 60 , event .pid , get_name (event ), format_bytes (event .bytes ))
107111 last_event = e .game_events [- 1 ]
@@ -110,6 +114,7 @@ def get_name(obj):
110114 line2 = e .buffer .read_range (line1_end ,line1_end + BYTES_WIDTH )
111115 print " 0x{:0>5X} {:0>2}:{:0>2} P{} {: <19} - {} | {}" .format (e .location , last_event .second / 60 , last_event .second % 60 , last_event .pid , get_name (last_event ), format_bytes (last_event .bytes ), format_bytes (line1 ))
112116 print " " * 41 + format_bytes (line2 )
117+ print e
113118 else :
114119 print " 0x{:0>5X} {: <19} - {}" .format (0 , "None" , format_bytes (e .buffer .read_range (0 ,BYTES_WIDTH + 1 )))
115- print
120+ print
0 commit comments