From 9fd957d950e52d8eaf3e7f160a4d64f48b036f8b Mon Sep 17 00:00:00 2001 From: Erik Abair Date: Fri, 8 Jul 2022 16:44:18 -0700 Subject: [PATCH] nv2a: Add hack for NV_PVIDEO_SIZE_IN sentinel --- hw/xbox/nv2a/pgraph.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/xbox/nv2a/pgraph.c b/hw/xbox/nv2a/pgraph.c index 1e2d27e3aa..5dad4247e6 100644 --- a/hw/xbox/nv2a/pgraph.c +++ b/hw/xbox/nv2a/pgraph.c @@ -5068,7 +5068,17 @@ static void pgraph_render_display_pvideo_overlay(NV2AState *d) { PGRAPHState *pg = &d->pgraph; - bool enabled = d->pvideo.regs[NV_PVIDEO_BUFFER] & NV_PVIDEO_BUFFER_0_USE; + // FIXME: This check against PVIDEO_SIZE_IN does not match HW behavior. + // Many games seem to pass this value when initializing or tearing down + // PVIDEO. On its own, this generally does not result in the overlay being + // hidden, however there are certain games (e.g., Ultimate Beach Soccer) + // that use an unknown mechanism to hide the overlay without explicitly + // stopping it. + // Since the value seems to be set to 0xFFFFFFFF only in cases where the + // content is not valid, it is probably good enough to treat it as an + // implicit stop. + bool enabled = (d->pvideo.regs[NV_PVIDEO_BUFFER] & NV_PVIDEO_BUFFER_0_USE) + && d->pvideo.regs[NV_PVIDEO_SIZE_IN] != 0xFFFFFFFF; glUniform1ui(d->pgraph.disp_rndr.pvideo_enable_loc, enabled); if (!enabled) { return;