Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

test(dualsense): allow the dry PCM discards a stalled sender causes

raymondchins9ada9fe07f4b
diff --git a/controllers/dualsense/test-pcm.py b/controllers/dualsense/test-pcm.py
index b49bad1..53b7ffb 100644
--- a/controllers/dualsense/test-pcm.py
+++ b/controllers/dualsense/test-pcm.py
@@ -110,11 +110,16 @@ try:
report = bytes([30, 1, 0, 0]) + (bytes(60) if hardware else bytes([16, 240]) * 30)
epoch = time.monotonic()
seq = 0
+ # Frames this loop sent over 64 ms behind schedule: after a stall here it catches up in
+ # a burst, and the broker's latency bound rightly drops that backlog.
+ late_frames = 0
if not hardware:
sock.sendto(packet(seq, report, secret=bytes(16)), addr)
sock.sendto(packet(seq, report) + b"extra", addr)
for i in range(seconds * 100):
seq += 1
+ if time.monotonic() - (epoch + i * 0.01) > 0.064:
+ late_frames += report[0]
sock.sendto(packet(seq, report), addr)
if not hardware and i % 10 == 0:
# Exercise serialized simultaneous trigger/LED commands offline.
@@ -154,8 +159,8 @@ try:
assert (
state["pcm"]["discardedFrames"] == 0
if hardware
- else state["pcm"]["discardedFrames"] <= sent_frames // 4
- ), state
+ else state["pcm"]["discardedFrames"] <= sent_frames // 4 + late_frames
+ ), (late_frames, state)
if not hardware:
assert state["dropped"] == 2 and state["outputCommands"] > 0, state
print(