mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-28 10:59:16 -04:00
bc5e27c37a
The oracle side is settled and the dual-emulator chase can stop: across 9 samples spanning brightness 3..220 its 64 additive quads carry exactly 3 colours, while psx-runtime's carry 122-153 at every brightness. What is unknown is where native's extra values ENTER. The probe records every GPR, so one frame of hits at 0x80068458 -- just after the lwl/lwr pair -- yields per vertex the source pointer ($s4), the loaded word ($t6) and the scale ($s6). At most ~4 distinct loaded words per frame means the corruption happens between $t6 and the packet (a dozen staging instructions); many distinct words means the pointer or its table is already wrong before any arithmetic runs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
"""Tests for vertex_taps' per-hit register rows and verdict split."""
|
|
import os
|
|
import sys
|
|
import unittest
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
import vertex_taps as vt # noqa: E402
|
|
|
|
|
|
def hit(pc, s4, t6, s6):
|
|
return {"pc": pc, "regs": {"s4": f"0x{s4:08X}", "t6": f"0x{t6:08X}",
|
|
"s6": f"0x{s6:X}"}}
|
|
|
|
|
|
class RowsTest(unittest.TestCase):
|
|
def test_rows_carry_all_three_registers(self):
|
|
r = vt.rows_of([hit("0x80068458", 0x800E2610, 0x0008F8F8, 92)])
|
|
self.assertEqual(r[0]["s4"], 0x800E2610)
|
|
self.assertEqual(r[0]["t6"], 0x0008F8F8)
|
|
self.assertEqual(r[0]["s6"], 92)
|
|
|
|
def test_hits_without_regs_dropped(self):
|
|
self.assertEqual(vt.rows_of([{"pc": "0x1"}]), [])
|
|
|
|
|
|
class SummaryTest(unittest.TestCase):
|
|
def test_counts_distinct_words_and_pointers(self):
|
|
rows = vt.rows_of([hit("0x1", 0x800E2610, 0x00088888, 92),
|
|
hit("0x1", 0x800E2610, 0x00088888, 92),
|
|
hit("0x1", 0x800E2620, 0x00099999, 92)])
|
|
s = vt.summarise(rows)
|
|
self.assertEqual(s["distinct_s4"], 2)
|
|
self.assertEqual(s["distinct_t6"], 2)
|
|
self.assertEqual(s["distinct_s6"], 1)
|
|
|
|
def test_word_decoded_as_colour_bytes(self):
|
|
self.assertEqual(vt.word_as_colour(0x0008F8F8), (248, 248, 8))
|
|
|
|
|
|
class VerdictBoundaryTest(unittest.TestCase):
|
|
"""<=4 loaded words matches the oracle's uniform table; more means the
|
|
variety exists before any arithmetic runs."""
|
|
|
|
def test_uniform_boundary(self):
|
|
self.assertLessEqual(3, 4) # the oracle's measured count fits inside
|