Files
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

66 lines
2.1 KiB
C++

// Onimusha's native frame: the background, then the 2D, published to BozoEngine's renderer at each frame boundary.
#include "oni_render.h"
#include "oni_vu1.h"
#include <cstdio>
#include <cstdlib>
namespace oni::render
{
namespace
{
bool trace()
{
static const bool on = [] { const char *e = std::getenv("ONI_RENDER_TRACE"); return e && *e == '1'; }();
return on;
}
bool g_open = false;
uint64_t g_frames = 0;
} // namespace
bozo::render::Screen screen()
{
bozo::render::Screen s;
s.width = 640.0f;
s.height = 448.0f;
s.originX = 2048.0f - 320.0f;
s.originY = 2048.0f - 224.0f;
return s;
}
void publish(uint8_t *ram)
{
auto &r = bozo::render::Renderer::instance();
const bozo::render::Screen s = screen();
if (!g_open)
r.beginFrame(s);
r.clearBackdrop();
oni::sprite::submit(ram);
oni::movie::drawOver(); // a movie over the game's frame (a room's script may play one over its room)
oni::vu1::drain(); // the frame's draws (picture, models, effects, 2D) to the renderer in their order
r.publishOverlay(s);
r.endFrame();
oni::vu1::frameStats();
++g_frames;
if (trace())
std::printf("[oni:render] frame %llu\n", (unsigned long long)g_frames);
r.beginFrame(s);
oni::bg::drawDepth(); // the room's Z, under the next frame's models
g_open = true;
}
void install(bozo::port::Registry &registry)
{
auto &r = bozo::render::Renderer::instance();
r.setEnabled(true);
r.setPresentsAlone(true); // the window shows the port's frame: the background, the 2D
r.setClearColour(0);
r.beginFrame(screen()); // open from the start: the game draws (Bg_disp) before its first frame ends
g_open = true;
oni::bg::install(registry);
oni::sprite::install(registry);
oni::movie::install(registry);
oni::model::install(registry);
}
} // namespace oni::render