#!/usr/bin/env python3 """Extract canary tid=6 events around the XAudio spawn window (idx 106750-107800) and tid=14/15 first events. Looking for the resume mechanism.""" import json import os PATH = "/home/fabi/RE - Project Sylpheed/xenia-canary/build-cross/bin/Windows/Debug/canary-jitter-1.jsonl" tid6_events = [] # idx 106700 to 107800 tid14_first = [] tid15_first = [] tid14_count = 0 tid15_count = 0 seen_tid6_high = False with open(PATH, "rb") as f: for line in f: try: obj = json.loads(line) except Exception: continue tid = obj.get("tid") idx = obj.get("tid_event_idx", obj.get("idx")) if tid == 6 and idx is not None and 106700 <= idx <= 108200: tid6_events.append(obj) if idx > 108000: seen_tid6_high = True elif tid == 14 and tid14_count < 120: tid14_first.append(obj) tid14_count += 1 elif tid == 15 and tid15_count < 120: tid15_first.append(obj) tid15_count += 1 if seen_tid6_high and tid14_count >= 120 and tid15_count >= 120: break OUT = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(OUT, "tid6_window.json"), "w") as f: json.dump(tid6_events, f, indent=2) with open(os.path.join(OUT, "tid14_first.json"), "w") as f: json.dump(tid14_first, f, indent=2) with open(os.path.join(OUT, "tid15_first.json"), "w") as f: json.dump(tid15_first, f, indent=2) print(f"tid6 window: {len(tid6_events)}") print(f"tid14 first: {len(tid14_first)}") print(f"tid15 first: {len(tid15_first)}")