Skip to content

Instantly share code, notes, and snippets.

@dsjoerg
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsjoerg/c75ae52ce8099b430ee5 to your computer and use it in GitHub Desktop.
Save dsjoerg/c75ae52ce8099b430ee5 to your computer and use it in GitHub Desktop.
demonstrating "Bad gameloop values in replays from loaded/saved games"
bash-3.2$ wget -q https://dl.dropboxusercontent.com/u/556553/put_things_here/s2protocol_issue.SC2Replay
bash-3.2$ python ./show_tracker_gameloops.py s2protocol_issue.SC2Replay
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 18, 160, 160, 226, 258, 290, 290, 290, 292, 320, 320, 435, 480, 480, 498, 498, 498, 498, 563, 640, 640, 707, 707, 707, 723, 738, 793, 800, 800, 834, 866, 960, 960, 978, 1120, 1120, 1123, 1123, 1123, 1123, 1124, 1138, 1138, 1138, 1176, 1193, 1218, 1265, 1280, 1280, 1376, 1395, 1395, 1395, 1396, 1396, 1396, 1440, 1440, 1458, 1537, 1537, 1537, 1559, 1600, 1600, 1694, 1698, 1716, 1740, 1756, 1760, 1760, 1862, 1920, 1920, 1938, 1958, 2017, 2028, 2028, 2028, 2080, 2080, 2098, 2134, 2134, 2134, 2178, 2178, 2230, 2230, 2230, 2240, 2240, 2259, 2400, 2400, 2418, 2440, 2450, 2450, 2450, 2458, 2560, 2560, 2578, 2658, 2671, 2720, 2720, 2734, 2756, 2756, 2783, 2784, 2848, 2858, 2880, 2880, 2880, 2887, 2898, 2942, 2961, 3040, 3040, 4294967296, 4294967296, 4294967296, 4294967296, 4294970416, 4294970434, 4294970434, 4294970463, 4294970463, 4294970463, 4294970463, 4294970464, 4294970464, 4294970464, 4294970464, 4294970468, 4294970496, 4294970496, 4294970517, 4294970546, 4294970572, 4294970649, 4294970656, 4294970656, 4294970657, 4294970657, 4294970657, 4294970674, 4294970674, 4294970706, 4294970706, 4294970706, 4294970816, 4294970816, 4294970891, 4294970914, 4294970914, 4294970944, 4294970946, 4294970946, 4294970946, 4294970976, 4294970976, 4294970997, 4294970998, 4294971026, 4294971027, 4294971052, 4294971062, 4294971083, 4294971083, 4294971083]
[0, 0, 1, 18, 20, 39, 53, 63, 105, 113, 137, 266, 302, 398, 461, 714, 724, 728, 731, 734, 738, 742, 758, 779, 795, 809, 825, 826, 872, 873, 893, 894, 901, 902, 903, 904, 904, 909, 910, 911, 912, 913, 914, 915, 917, 918, 919, 932, 935, 942, 946, 1014, 1019, 1024, 1028, 1128, 1194, 1205, 1221, 1233, 1246, 1253, 1261, 1263, 1267, 1271, 1272, 1274, 1275, 1276, 1280, 1287, 1290, 1293, 1297, 1300, 1304, 1307, 1383, 1393, 1396, 1403, 1408, 1415, 1420, 1522, 1566, 1593, 1613, 1619, 1623, 1626, 1630, 1634, 1637, 1641, 1645, 1649, 1652, 1655, 1660, 1663, 1666, 1669, 1672, 1676, 1679, 1694, 1705, 1709, 1713, 1760, 1761, 1764, 1777, 1789, 1793, 1799, 1809, 1810, 1811, 1812, 1813, 1814, 1816, 1825, 1833, 1844, 1851, 1853, 1855, 1857, 1867, 1881, 1888, 1890, 1892, 1894, 1902, 1920, 1928, 1930, 1932, 1934, 1936, 1960, 1965, 1968, 1969, 2028, 2054, 2065, 2076, 2083, 2098, 2102, 2110, 2111, 2116, 2118, 2122, 2125, 2130, 2132, 2136, 2139, 2143, 2146, 2149, 2152, 2157, 2172, 2173, 2176, 2181, 2185, 2199, 2213, 2224, 2249, 2253, 2274, 2285, 2312, 2316, 2325, 2386, 2395, 2398, 2402, 2405, 2410, 2412, 2434, 2452, 2462, 2477, 2503, 2545, 2554, 2571, 2577, 2583, 2588, 2614, 2618, 2637, 2683, 2752, 2760, 2762, 2770, 2771, 2773, 2795, 2799, 2801, 2829, 2841, 2847, 2850, 2864, 2867, 2870, 2875, 2878, 2881, 2885, 2888, 2891, 2895, 2898, 2904, 2907, 2911, 2914, 2934, 2952, 2957, 2960, 2961, 2982, 2990, 2993, 3049, 3069, 3074, 3077, 3090, 3160, 3176, 3182, 3206, 3211, 3212, 3219, 3236, 3244, 3245, 3259, 3268, 3273, 3326, 3331, 3341, 3343, 3344, 3345, 3346, 3347, 3349, 3353, 3356, 3364, 3375, 3378, 3421, 3432, 3505, 3508, 3511, 3514, 3518, 3539, 3545, 3554, 3557, 3561, 3564, 3569, 3572, 3589, 3592, 3596, 3600, 3610, 3628, 3649, 3650, 3651, 3660, 3663, 3664, 3665, 3669, 3672, 3675, 3679, 3683, 3686, 3691, 3694, 3697, 3701, 3704, 3707, 3712, 3715, 3718, 3723, 3726, 3752, 3775, 3777, 3787]
#!/usr/bin/env python
from mpyq import mpyq
import protocol15405
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('replay_file', help='.SC2Replay file to load')
args = parser.parse_args()
archive = mpyq.MPQArchive(args.replay_file)
contents = archive.header['user_data_header']['content']
header = protocol15405.decode_replay_header(contents)
baseBuild = header['m_version']['m_baseBuild']
protocol = __import__('protocol%s' % (baseBuild,))
contents = archive.read_file('replay.tracker.events')
te_gameloops = [te['_gameloop'] for te in protocol.decode_replay_tracker_events(contents)]
print te_gameloops
contents = archive.read_file('replay.game.events')
e_gameloops = [te['_gameloop'] for te in protocol.decode_replay_game_events(contents)]
print e_gameloops
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment