1141 Commits

Author SHA1 Message Date
sp00nz 37b61d5891 Release v0.18.0 -- "Wrong Grain"
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v0.18.0
2026-11-20 12:28:05 -08:00
sp00nz 4182ea2d9f CONTRIBUTORS: credit the v0.18.0 batch
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 12:21:46 -08:00
sp00nz 5e4c67f32d docs: add RECOMP_PHYS_RAM_ALIAS to the environment-variables page
#286 added the switch without a row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 12:20:27 -08:00
sp00nz 1ce3d64b43 Revert "Merge pull request #315" -- idiv16 fails its own native test on Windows
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 12:13:52 -08:00
sp00nz 392039b729 kernel: utility-drive cluster flag 3 clamps to 64 KB
Follow-up to #321: init-flags value 3 shifted to 128 KB, which the
utility drive never uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 12:02:09 -08:00
sp00nz 9fa094bd2c Merge pull request #321 from danfreitas97: kernel: the utility drive reports the cluster size the XBE asked for
# Conflicts:
#	src/kernel/kernel_file.c
2026-11-20 12:01:47 -08:00
sp00nz 8fcd750952 Merge pull request #320 from Tzeentchnet: kernel: add opt-in widescreen and 480p EEPROM flags 2026-11-20 12:01:30 -08:00
sp00nz 7e75525867 Merge pull request #313 from dplewis: test: Six regressions stop being Windows-only 2026-11-20 12:01:28 -08:00
sp00nz c43df95dce Merge pull request #317 from dplewis: kernel: fold case on every host, not only case-sensitive ones 2026-11-20 12:01:27 -08:00
sp00nz 05898b5e14 Merge pull request #316 from dplewis: posix: FILE_NON_DIRECTORY_FILE refuses a directory 2026-11-20 12:01:26 -08:00
sp00nz f2a658144c Merge pull request #343 from rtaranu: nv2a_pb_exec: draw 2D quads sent with RHW 0 2026-11-20 12:01:25 -08:00
sp00nz 7e98f9871f Merge pull request #332 from rtaranu: nv2a_pb_exec: a colour clear marks its surface as drawn
# Conflicts:
#	tests/nv2a_ffp_backend/CMakeLists.txt
2026-11-20 12:01:23 -08:00
sp00nz 1989a49986 Merge pull request #319 from Tzeentchnet: tests: add a reusable NV2A backend contract fixture 2026-11-20 12:01:05 -08:00
sp00nz 3eb5746253 Merge pull request #331 from rtaranu: kernel: 64 KB-align kernel-chosen NtAllocateVirtualMemory addresses
# Conflicts:
#	tests/memory_regressions/test_main.c
2026-11-20 12:01:03 -08:00
sp00nz 8410bb578a Merge pull request #337 from rtaranu: kernel: reused contiguous pages come back writable, with the protection asked for 2026-11-20 12:00:44 -08:00
sp00nz f8a3d497ca Merge pull request #268 from maxiumpro: kernel: split large free heap blocks 2026-11-20 12:00:42 -08:00
sp00nz 08973c65b5 Merge pull request #330 from rtaranu: heap: a merged-away slot keeps its address 2026-11-20 12:00:40 -08:00
sp00nz c7f998807f Merge pull request #336 from NoRain211: perf(recomp): reuse decoded instructions across discovery passes 2026-11-20 11:59:58 -08:00
sp00nz d09473b9dd Merge pull request #275 from NoRain211: fix(recomp): resync direct jumps that land past inline tables 2026-11-20 11:59:56 -08:00
sp00nz abb3cee6ef Merge pull request #335 from NoRain211: feat(recomp): let a project pin the x87 transcendentals 2026-11-20 11:59:55 -08:00
sp00nz 9b0ff1ae31 Merge pull request #329 from MattSG: lifter: xmm integer bitwise ops, movq on xmm and x87 stack-pointer ops lift instead of vanishing 2026-11-20 11:59:54 -08:00
sp00nz 5fb362c60f Merge pull request #315 from Tzeentchnet: Lift 8-bit and 16-bit DIV/IDIV correctly 2026-11-20 11:59:53 -08:00
sp00nz 383326b46e Merge pull request #314 from Tzeentchnet: Fix carry liveness for FCMOVcc 2026-11-20 11:59:51 -08:00
sp00nz 017a0cb47e Merge pull request #338 from rtaranu: disasm: measure a jump table indexed from slot 1 2026-11-20 11:59:50 -08:00
sp00nz 7719940d2f Merge pull request #339 from rtaranu: disasm: seed entries can mark an address "not_function" 2026-11-20 11:59:48 -08:00
sp00nz 7193a8eca1 Merge pull request #333 from rtaranu: disasm: observed seeds are part of the cache key 2026-11-20 11:59:46 -08:00
sp00nz 551ab5ddd2 Merge pull request #328 from MattSG: rtti: word reads stay inside file-backed bytes; executable sections count as code 2026-11-20 11:59:44 -08:00
sp00nz 5d2de97f7f Merge pull request #327 from MattSG: func_id: SSE chain stubs are not capped at 120 bytes 2026-11-20 11:59:41 -08:00
sp00nz 7d24f02c85 Merge pull request #326 from MattSG: func_id: RenderWare ID strings match any RWnnActive branch 2026-11-20 11:59:37 -08:00
sp00nz 1b61fba939 Merge pull request #325 from MattSG: func_id: the immediate scan reads the last instruction of .text 2026-11-20 11:59:33 -08:00
sp00nz 371a6ef082 Merge pull request #324 from MattSG: func_id: a CRT signature replaced by a longer one frees its name 2026-11-20 11:59:25 -08:00
sp00nz 7f56548197 Merge pull request #323 from MattSG: abi_analysis: --output accepts a bare file name 2026-11-20 11:59:18 -08:00
sp00nz a7f76c3f43 Merge pull request #322 from MattSG: xiso: unpack skips disc names that would leave the output directory 2026-11-20 11:59:14 -08:00
sp00nz d5f2e03f15 Merge pull request #286 from vyanhursky: apu: name heap pages by their RAM mirror alias, so no window page shares the number 2026-11-20 11:49:18 -08:00
sp00nz 111ee47911 Merge pull request #341 from rtaranu: apu: pace the voice processor one frame at a time
# Conflicts:
#	docs/runtime/environment-variables.md
2026-11-20 11:49:16 -08:00
sp00nz 96e76ff3ec Merge pull request #342 from rtaranu: apu: RECOMP_APU_SSL_ADVANCE passes a stream voice through an empty list
# Conflicts:
#	tests/apu_vp/test_main.c
2026-11-20 11:48:57 -08:00
sp00nz e75305bca4 Merge pull request #340 from rtaranu: apu: idle-voice traps take turns instead of starting at the list head
# Conflicts:
#	tests/apu_vp/test_main.c
2026-11-20 11:48:09 -08:00
sp00nz e8cb4b3445 Merge pull request #334 from rtaranu: apu: voice_set_mask writes its field atomically 2026-11-20 11:47:10 -08:00
Vlad Yanhursky 9f70b08465 fix(ohci): fold a heap page's mirror alias back to the heap address
A heap page below 64 MB is now named by its alias in the first RAM mirror
(va + the RAM size). bus_resolve passed that alias through as a guest
address, and guest_ok admits RAM only below the mapped size (64 MB on a
retail map), so every DMA to such a buffer was skipped. XAPI's pad report
buffer is a heap block named through MmGetPhysicalAddress: on Splinter Cell
the pad was dead from the first menu.

bus_resolve now folds the alias back to the heap address, as mcpx_apu_phys
does, decoding from the address alone, so the OHCI and the APU agree on what
an alias means. With the fold, Splinter Cell's pad also keeps working in
levels, where without the alias the report buffer fell below the contiguous
allocator's high-water mark and went to the window.

Found and tested by rtaranu on Splinter Cell (Windows, retail 64 MB map).

Co-authored-by: rtaranu <23201034+rtaranu@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 08:00:11 -07:00
Vlad Yanhursky 80d40d9e5e fix(apu): name heap pages by their RAM mirror alias, not the window's numbers
MmGetPhysicalAddress returned the identity for heap addresses, and the
contiguous window hands out the same numbers below 64 MB, so one physical
number could mean two different pages. The RAM-name record lets the APU tell
them apart until a named heap page and a live window buffer hold the same
number at once: then one of them always reads the other's bytes.

Def Jam: Fight for NY hit it when a translation's string table (21 KB larger)
moved a named heap block over the window buffer of the music stream. The
stream read RAM for those pages: about 1,300 one-slice gaps a minute in the
opening scene, heard as crackling. Padding the English table by the same
amount does the same, so any change in heap layout can.

A heap page below 64 MB is now named va + the RAM size, its alias in the
first RAM mirror, which is also where the console's memory controller wraps
such an address. The window keeps the low numbers to itself, the APU
resolves the alias to RAM directly, and the NV2A executor and the OHCI, which
find it above the window's high-water mark, read it as a guest address in
the mirror. With no first mirror, or RECOMP_PHYS_RAM_ALIAS=0, the old
identity and record remain.

tests/apu_phys checks the alias contract, including a window page under a
named heap page, and runs the record's checks again with the switch off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 07:56:47 -07:00
rtaranu b1b3d6b0f5 nv2a: an infinite fog distance follows the hardware
With fog on, W fog on a pre-transformed vertex whose RHW is 0 gives an
infinite distance. Linear fog turned that into factor 0, so every 2D
quad came out as the flat fog colour (MechAssault's movies and menus).
The hardware gives no fog in LINEAR and EXP and full fog in the other
modes (xemu vsh.c).

tests/nv2a_rhw0_quad leaves fog on with D3D's final combiner and checks
the quad in LINEAR and EXP (unfogged) and EXP2 (fully fogged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 21:27:51 -05:00
rtaranu b43e8dbf69 nv2a: draw vertices whose program w is +inf
A pre-transformed vertex sent with RHW 0 (2D quads, Bink movies) comes
out of the runtime's program with oPos.w = 1/0 = +inf. The clip test saw
a non-finite distance and dropped the triangle without counting it, so
MechAssault's movies and menus drew nothing on the software renderer.
Treat +inf like 0 and draw it with w = 1. xemu instead clamps w into
[2^-64, 2^64]; for a quad whose corners share one w the result is the
same.

tests/nv2a_rhw0_quad draws a quad whose program w is +inf through the
executor's own rasteriser and checks its centre pixel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 21:27:19 -05:00
rtaranu 6f4cb70df4 kernel: keep the heap block table in address order when a slot is reused
heap_insert_free reuses an empty slot for the piece left behind a carved
block. The empty slots after it kept addresses from inside the carved block,
which can be below the new piece's, and heap_block_at binary-searches the
table by address. Lookups then found the free remainder instead of the live
block: DOAX's replayed intro movie had its sound ring at the front of such a
block, the second half resolved to a free block that was never named, and
the APU read those pages from the window rather than the RAM the title
wrote (stale audio every lap, a loud hiss). Raise those slots to the new
piece's address.

tests/memory_regressions case 2c carves the front of a merged run and
looks up the carved block's second half.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 20:02:54 -05:00
rtaranu d991982c8c kernel: reused contiguous pages come back writable, with the protection asked for
MmAllocateContiguousMemoryEx ignored its Protect argument, and neither
allocation path reset a page's protection. A title that marks its own
block read-only with MmSetAddressProtect, frees it and allocates again
gets the same pages back still read-only, and the allocator's zeroing
faults on them. MechAssault crashed this way after destroying a building.

The allocator now makes the pages writable before zeroing them, the
pinned-range path zeroes before applying the protection, and both
MmAllocateContiguousMemory paths apply what the caller asked for (Xbox
protection flags as MmSetAddressProtect maps them; the cache bits are
dropped there already).

tests/memory_regressions case 9: protect, free, allocate again, through
the allocator and through a pinned physical range. Without the fix the
test process faults in the zeroing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 19:37:07 -05:00
rtaranu 4d2c1093f2 apu: RECOMP_APU_SSL_ADVANCE passes a stream voice through an empty list
xemu keeps a stream voice whose next segment list is empty on that list
for good, repeating its done notification every frame, and replays a
finished list the title has not refilled yet. DirectSound (XDK 5849)
refills the list that just finished and expects the voice to go on
through an empty one: starved for a moment, it puts the next packet in
the other list. Under xemu's rule that packet waited behind the empty
list, played after later segments or again, and DirectSound's lists stayed
out of step with the voice for the rest of the stream.

Burnout 3's attract-mode trailer starves its stream voice in about half
of all runs (the next movie packet comes late once), and from then on
dropped 15-40 ms at every packet to the end of the movie. With the switch
the voice misses a few frames once and carries on: four trailer runs,
two with a starved moment, one 5 ms dip each.

Opt-in, as one title shows it so far. tests/apu_vp covers both rules;
with the switch's code taken out, the four checks of the new rule fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 19:18:54 -05:00
rtaranu f2c43ea013 apu: report a stretch of over 20 ms without a voice-processor frame
No frame means no idle-voice trap, so a title that stops a voice and waits
for it to be retired (DirectSound's StopEx, then GetStatus) waits it all:
in a 13-minute Burnout 3 session one stop took 102 ms (a visible hitch)
where 5000 others took under 3.1 ms. The line says what the frame thread
did meanwhile -- passes with the front end trapped, the sequencer held, the
device queue full, and time asleep in throttle -- with the start on the
host's QueryPerformanceCounter in ms, to match other host-timed logs. At
most 50 lines; silent through a headless race.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 19:16:43 -05:00
rtaranu b0fcb2d37b apu: pace the voice processor one frame at a time (RECOMP_APU_PACE_FRAMES)
The frame thread paced per 256-sample EP period: the eight 32-sample
frames ran back to back and the thread slept out the rest, where the
hardware runs one every 0.67 ms. A title that stops a voice and spins until
the voice walk retires it (DirectSound's StopEx, then GetStatus) waited for
the next bunch, up to 7 ms each; Burnout 3's crash mode stops ~900 sounds
in 5 minutes.

DMFBMX2/xboxrecomp#21 spread the frames over the period. Here that alone
changes nothing: the device queue sits at its low mark, where pace_step
allows a 42 ms render-ahead, so the frames still bunch. Instead each frame
is due an eighth of a span after the last, and the queue, read where a
period starts, sets the span: 3/4 of a period at or below low, 9/8 above
mid-band, at once below half of low, none at high. The stall fallback is
shared with pace_step (pace_watch_stall). =0 keeps period pacing.

Tests (apu_monitor): next-frame wait 6.0 -> 1.0 ms max with a smooth and a
512-sample-buffer device, queue in band, no underruns, rate kept; a 1 s
device stall drops periods and recovers. Burnout 3 headless race: stops
over 1 ms 46 -> 33, mean 3.2 -> 1.2 ms, max 6.5 -> 1.7 ms; no dropouts in
the race or in four intro-trailer recordings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 19:16:42 -05:00
rtaranu 9a4ef85ad1 apu: idle-voice traps take turns instead of starting at the list head
The voice-list walk raises one idle-voice trap per frame, and always on
the first idle voice it meets. A voice the title leaves listed after its
notice then takes every trap, and the idle voices behind it are never
reported. DirectSound frees a multi-voice stream only on its last voice's
notice and ignores the others: MechAssault spun for ever stopping its menu
music (voice 0xF2 trapped about 2,700 times a second, 0xF4 never).

The walk now notes the idle voices it passes and, after it, traps on the
first one after the voice trapped last time, wrapping round to the first.
Still one trap at a time. The voice trapped last is kept in the VP state
(vp.idle_trap_last, cleared by mcpx_apu_vp_reset).

tests/apu_vp idle_traps_take_turns: two idle voices listed, the ISR
resuming between frames; the traps must alternate. Without the fix the
second voice never comes up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 19:16:34 -05:00
rtaranu 486b800589 disasm: seed entries can mark an address "not_function"
Some false function starts pass every check: a "call" decoded from data
whose target lands mid-instruction in a real function and cuts it in two,
or a coincidental address match. No heuristic rules them out without
losing real functions elsewhere. A seed file entry
{"start": "0x...", "not_function": true} now keeps the address from ever
being proposed as a start (FunctionDetector._add_candidate), and the marks
are an option in the cache key, the way observed seeds are (adds nothing
to the key when there are none).

Splinter Cell (one entry) and Dead or Alive Xtreme Beach Volleyball (four)
use it for false starts found after a regen.

tools/disasm/test_not_function_seeds.py: a marked call target is not a
function, the seed file loader splits the entries, and the cache misses
when the marks change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 19:13:50 -05:00
rtaranu f820d2f3d1 disasm: measure a jump table indexed from slot 1
MSVC's memcpy/memmove dispatch their lead bytes through
`jmp [eax*4 + LeadUpVec - 4]` with eax 1..3, so slot 0 at the
displacement is padding or the previous jmp's tail, not a pointer.
resync_jump_tables measured nothing there and dropped the table, so the
function ended at its own dispatch: every arm after the table became an
indirect call no function covered. MechAssault's memmove (0x001D0580)
ended at 0x001D05E4 instead of 0x001D08BD, the boot stack was corrupted by
the first unaligned copy, and the tail was split into false starts. The
lifter already reads such a table one slot on; measure it there too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 19:12:11 -05:00