fix issue when V_SYNC is cleared (#1357)

* fix issue when V_SYNC is cleared

* fix switch from interlaced to progressive
This commit is contained in:
Logan McNaughton authored and GitHub committed 2026-11-06 12:35:21 +00:00
1 parent cebfadef36
commit 56dd24c699
1 file changed
+16 -8
+16 -8
View File
@@ -44,7 +44,9 @@ fn reset_pace_deadline(device: &mut device::Device) {
}
fn set_vertical_interrupt(device: &mut device::Device) {
if device::events::get_event(device, device::events::EVENT_TYPE_VI).is_none() {
if device.vi.regs[VI_V_SYNC_REG] != 0
&& device::events::get_event(device, device::events::EVENT_TYPE_VI).is_none()
{
device::events::create_event(device, device::events::EVENT_TYPE_VI, device.vi.delay)
}
}
@@ -168,16 +170,22 @@ pub fn vertical_interrupt_event(device: &mut device::Device) {
retroachievements::do_frame();
/* toggle vi field if in interlaced mode */
device.vi.field ^= (device.vi.regs[VI_STATUS_REG] >> 6) & 0x1;
/* toggle vi field if in interlaced mode, the field is always 0 in progressive mode */
if device.vi.regs[VI_STATUS_REG] & 0x40 != 0 {
device.vi.field ^= 1;
} else {
device.vi.field = 0;
}
device::mi::set_rcp_interrupt(device, device::mi::MI_INTR_VI);
device::events::create_event_at(
device,
device::events::EVENT_TYPE_VI,
device.cpu.next_event_count + device.vi.delay,
);
if device.vi.delay != 0 {
device::events::create_event_at(
device,
device::events::EVENT_TYPE_VI,
device.cpu.next_event_count + device.vi.delay,
);
}
let v_intr = (device.vi.regs[VI_V_INTR_REG] & 0x3FF) as i64;
let v_start = ((device.vi.regs[VI_V_START_REG] >> 16) & 0x3FF) as i64;