stream_dvdnav: reset a stale selected button on menu changes

A menu change keeps the VM's selected-button register unless the link
command carried a button number or the new button set forces one via
fosl_btnn. Select the first button in that case.
This commit is contained in:
Kacper Michajłow committed 2026-08-26 01:47:41 +02:00
1 parent abbbffe0dd
commit dd18d1eabc
1 file changed
+15
+15
View File
@@ -609,6 +609,21 @@ static int process_event(stream_t *s, int event, void *buf, int len)
priv->pci = *pnavpci;
priv->pci_valid = true;
MP_TRACE(s, "start pts = %"PRIu32"\n", pnavpci->pci_gi.vobu_s_ptm);
// Reset selection to first button if the current selection is out of
// range. libdvdnav holds stale button selections when the menu changes,
// which makes the new page unusable.
if (in_menu_domain(dvdnav) && pnavpci->hli.hl_gi.hli_ss &&
pnavpci->hli.hl_gi.btn_ns > 0)
{
int32_t btn = 0;
dvdnav_get_current_highlight(dvdnav, &btn);
if (btn <= 0 || btn > pnavpci->hli.hl_gi.btn_ns) {
MP_VERBOSE(s, "stale button %d for a %d-button menu, "
"selecting button 1\n", btn,
pnavpci->hli.hl_gi.btn_ns);
dvdnav_button_select(dvdnav, pnavpci, 1);
}
}
// Each NAV packet can change the highlighted button or the
// available button set; keep our mirrored state in sync.
update_highlight(priv);