7 Commits
Author SHA1 Message Date
4547d5742e Room movies: start on any field, no fade left over the room; movie textures (#1)
* WIP: movie picture drawn over the frame (drawOver), ONI_MOVIE_TRACE mean

Room 2:1's entry movie (LINKS05.PSS) decodes as black: a standalone FFmpeg
check of the disc file shows its first 300+ pictures are black (Y 16) in the
file itself, so the port is not at fault for that stretch. Paused mid-investigation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Room movies: start on any field, no fade left over the room; movie textures

- startDisplay is native: the game spun on sceGsSyncV for an even field, but
  natively sceGsSyncV's parity only moves with the frames it ends itself, and
  during a movie vblankHandler ends them. A movie starting on the odd parity
  never showed (stage 5 room 0's LINKS01 held on five buffered pictures).
- The movie's picture and fade are drawn only on vblankHandler's frames: the
  fade level stays black after a movie and had covered the room afterwards.
- A background movie whose IMAGE goes elsewhere than the frame (stage 5
  room 19's 256x256 water caustics into block 0x1a40) is a texture upload,
  not a patch of the room's picture (it covered the top-left corner).
- Traces: ONI_FADE_TRACE (fade.c's Fade_w and the game mode), ONI_VU1_TRACE=3
  (every drawn batch), the image destination in ONI_BGMV_TRACE.

Stage 2 room 1 is a door-less movie room (LINKS05, 18 s of black at its
start in the file); reached by warp, out of story order, it stays black
after the movie (its script has no fade-in). All 82 warp rooms run clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Thomas Martin <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-23 22:55:10 +01:00
Thomas MartinandClaude Opus 5.5 1951de4fad Models on their own thread; the frame's draws in one order
Busy fights (room 1's gate) cost ~11 ms of VIF1 / VU1 / GIF work a
frame and the window dropped to 57 fps with sound underruns. In real
time the chains are now copied when sent and run in order on a worker
thread while the game goes on; the texture registry is locked. All
frame draws (the packets', and the game thread's: room depth and
picture, the 2D, the movie fade) go through one ordered list handed to
the renderer at the frame's end, so the event's cinema bars stay over
the characters. The crowd fight holds 60 fps with no underrun; the
headless runner stays single-threaded (deterministic).

SCISSOR is followed per draw (fixing a mis-encoded default and a
fall-through from the MIPTBP registers found along the way).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 18:57:19 +01:00
Thomas MartinandClaude Opus 5.5 fb799ce628 Room depth and shadows: the cut's Z buffer, the shadow volumes
Bgz_disp's Z buffer (PSMZ24, both fields) becomes the next frame's first
draw, a depth-only pass (BozoEngine's Material::depthFromTexture,
TheBozos/BozoEngine#128), so the pre-rendered scenery hides the
characters behind it. Bg_disp now draws the room's picture into the
frame instead of a backdrop under it, as the GS has it.

The shadow program's off-screen buffer (FRAME page 0xd2) is a renderer
auxiliary image sharing the frame's depth: the volumes count in its
colour, the grading sprites run on it, and the last pass reads it back
to darken the frame. Untextured colours are direct bytes; blends on the
CT24 frame leave its alpha. 60 fps, no audio underrun. README and notes
updated, screenshots.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 17:37:51 +01:00
Thomas MartinandClaude Opus 5.5 9d50005510 Draw the models natively: VU1 programs translated, VIF1 chains run
The game's 15 VU1 microprograms (the Vu1mc_* images and the shadows'
program) are translated to straight-line C++ by tools/oni_vu1_gen.py
(the VU0 translator's pair model plus VU1's memory, XTOP, XGKICK and
branch instructions; flag-free SSE arithmetic where the MAC flags are
never read). runtime/oni_vu1.cpp walks each chain Md_tag_trans queues,
runs VIF1's commands on a kept VU1 state and turns the GIF packets the
programs kick into the frame's draws. Samanosuke, Kaede and the soldiers
are drawn with their textures at 60 frames a second.

Off-screen targets (the shadow buffer and its read-back pass) are not
drawn yet. The first slow version dropped the room to 37-50 fps and the
sound underran (crackling); ONI_AUDIO_STATS=1 now prints the device's
underruns and the frame rate. README and notes updated, screenshots.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 17:20:54 +01:00
Thomas MartinandClaude Opus 5.5 9f2d12ae1d Models: the VIF1 tag queue completes at once (nothing drawn yet); notes: the next stop is VU0
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 15:57:35 +01:00
Thomas MartinandClaude Opus 5.5 f911e9ee37 Movies play natively: the attract sequence, New Game's intro and letter
- runtime/oni_movie.cpp answers Sony's ezmpeg player (movie.c), modelled
  on TMB_Recomp's.
  - libmpeg is {referenceLayout false, paced, no Nodata}; its picture
    hook keeps the last picture.
  - videoCallback returns 1 (the decoder reads the demuxed stream itself).
  - dispCreate, dispClear and dispDelete do no GS work.
  - loadImage completes at once.
  - vblankHandler is native: tag walk, buffer release, the display-off
    fade countdown readMpeg waits for (the last picture darkened), and
    the game frame end (the main thread sleeps through the movie).
  - switchThread costs 0.1 ms per pass: the threads' spin no longer
    drops the window to 54 fps.
- runtime/oni_port.cpp: a native site in termAll counts DeleteThread's
  success (0 in BozoEngine) as the thread id, which the PS2 kernel
  returns and the loop waits for.
- runtime/oni_render.cpp: the movie's picture is the backdrop while it
  shows.
- runtime/oni_main.cpp adds ONI_THREADS_AT=<frame> (thread states).
- BozoEngine is on onimusha/libsd-volx-sweep (TheBozos/BozoEngine#125):
  VOLX follows the volume sweep, which SNDDRVCD waits on when a movie is
  skipped.

Result: the opening, intro and letter movies play with sound at 60 fps,
START skips them, and New Game reaches the first room. The next stop is
its 3D (Md_tag_trans, VIF1 DMA). README and docs/RECOMP_NOTES.md are
updated with screenshots.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 15:56:07 +01:00
Thomas MartinandClaude Opus 5.5 5d09848257 Boot screens, title and main menu drawn natively
- Backgrounds (runtime/oni_bg.cpp): decodeIPU / divFrameBuff decode the
  disc's ipum streams with FFmpeg's IPU decoder and the IPU's CSC into
  the game's two field buffers. Bg_disp still runs; the frame publishes
  the picture as its backdrop. scripts/build_ffmpeg.sh builds a static
  FFmpeg with only ipu and mpeg2video.
- Textures (runtime/oni_tex.cpp): sceGsSetDefLoadImage /
  sceGsExecLoadImage are answered by keeping each upload as given
  (block, format, texels; offset palettes at their own block). A TEX0
  decodes to RGBA from its texels and CSM1 palette.
- 2D (runtime/oni_sprite.cpp): native Ot_draw walks the ordering table,
  native Pit_trans the queued sprites (the fades). Each primitive becomes
  a screen-space frame draw with the GS blend, alpha test and point
  sampling.
- Frame (runtime/oni_render.cpp): sceGsSwapDBuffDc publishes the
  backdrop and the 2D. sceSifSetDChain is a no-op. --capture-dir and
  --capture-frame are added to the runner.
- tools/oni_dwarf.py: the game's DWARF 1 as C (types, signatures,
  globals).
- BozoEngine moves to onimusha/irx-sysclib-volx (TheBozos/BozoEngine#124):
  sysclib memmove/strrchr for SNDDRVCD, and libsd VOLX following the
  envelope.

Result: the Capcom logo and violence notice fade in and out, then the
title, then START opens NEW GAME / LOAD GAME / OPTION. The pad moves the
selection, at 60 frames/s. README and docs/RECOMP_NOTES.md are updated
with screenshots.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 15:34:34 +01:00