Fix DualSense native audio initialization and default to accepted 32-frame format

This commit is contained in:
Joey Yakimowich-Payne 2026-09-08 10:15:07 -06:00
commit 46f42a26dc
19 changed files with 304 additions and 176 deletions

View file

@ -7,9 +7,9 @@ import pytest
@pytest.mark.parametrize("ram", [0, 1], ids=["flash", "sram"])
@pytest.mark.parametrize("short_packets", [False, True], ids=["64frames", "32frames"])
@pytest.mark.parametrize("packet_frames", [32, 64], ids=["32frames", "64frames"])
def test_haptics_experiment_native(
tmp_path: Path, ram: int, short_packets: bool
tmp_path: Path, ram: int, packet_frames: int
) -> None:
root = Path(__file__).resolve().parents[1]
compiler = shutil.which("c++") or shutil.which("g++")
@ -27,14 +27,14 @@ def test_haptics_experiment_native(
"-pedantic",
"-DSWITCH_PICO_HAPTICS_EXPERIMENT=1",
f"-DSWITCH_PICO_HAPTICS_EXPERIMENT_RAM={ram}",
f"-DSWITCH_PICO_HD_PACKET_FRAMES={packet_frames}",
*(
[
"-DSWITCH_PICO_CYW43_PACKET_READ=1",
"-DSWITCH_PICO_HCI_CREDIT_BATCH=1",
"-DSWITCH_PICO_SYS_CLOCK_MHZ=300",
"-DSWITCH_PICO_HD_PACKET_FRAMES=32",
]
if short_packets
if packet_frames == 32
else []
),
f"-I{root / 'tests' / 'haptics_experiment_native_stubs'}",
@ -52,7 +52,7 @@ def test_haptics_experiment_native(
)
subprocess.run([str(executable), str(corpus)], check=True, cwd=root)
reports = corpus.read_bytes()
assert len(reports) == 288 * 143
assert len(reports) == (18432 // packet_frames) * 143
# Independent standard-library CRC across real module-generated packets:
# A2 is covered once, CRC itself excluded, and stored little-endian.
for offset in range(0, len(reports), 143):