From 3397941b609cef77086c3225121396e74ce444c2 Mon Sep 17 00:00:00 2001 From: ekeeke Date: Mon, 19 Feb 2024 20:27:54 +0100 Subject: [PATCH] [Core/CD] fixed regression in SUB-CPU synchronization with CDC DMA introduced by https://github.com/ekeeke/Genesis-Plus-GX/commit/da8e4e547affcbd295d2e3028735b3283ec2c462 (fixes freezes in Ultraverse Prime and probably other games) --- core/cd_hw/cdc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/cd_hw/cdc.c b/core/cd_hw/cdc.c index 4936233..fb30e53 100644 --- a/core/cd_hw/cdc.c +++ b/core/cd_hw/cdc.c @@ -444,8 +444,11 @@ void cdc_dma_update(unsigned int cycles) /* SUB-CPU idle on register $04 polling ? */ if (s68k.stopped & (1<<0x04)) { - /* sync SUB-CPU with CDC DMA */ - s68k.cycles = cdc.cycles[0]; + /* sync SUB-CPU with CDC DMA (only if not already ahead) */ + if (s68k.cycles < cdc.cycles[0]) + { + s68k.cycles = cdc.cycles[0]; + } /* restart SUB-CPU */ s68k.stopped = 0;