diff --git a/BizHawk.MultiClient/output/dll/libsneshawk.dll b/BizHawk.MultiClient/output/dll/libsneshawk.dll index efc47b6c34..633fd78b86 100644 Binary files a/BizHawk.MultiClient/output/dll/libsneshawk.dll and b/BizHawk.MultiClient/output/dll/libsneshawk.dll differ diff --git a/libsnes/bsnes/snes/alt/ppu-compatibility/ppu.cpp b/libsnes/bsnes/snes/alt/ppu-compatibility/ppu.cpp index 324ee5bd56..3220ffb8a9 100644 --- a/libsnes/bsnes/snes/alt/ppu-compatibility/ppu.cpp +++ b/libsnes/bsnes/snes/alt/ppu-compatibility/ppu.cpp @@ -28,7 +28,10 @@ void PPU::synchronize_cpu() { void PPU::Enter() { ppu.enter(); } void PPU::enter() { - while(true) { + while(true) { + if(scheduler.sync == Scheduler::SynchronizeMode::CPU) { + synchronize_cpu(); // when in CPU sync mode, always switch back to CPU as soon as possible + } if(scheduler.sync == Scheduler::SynchronizeMode::All) { scheduler.exit(Scheduler::ExitReason::SynchronizeEvent); } diff --git a/libsnes/bsnes/snes/cpu/cpu.cpp b/libsnes/bsnes/snes/cpu/cpu.cpp index 55afe6fa69..577fc64bb4 100644 --- a/libsnes/bsnes/snes/cpu/cpu.cpp +++ b/libsnes/bsnes/snes/cpu/cpu.cpp @@ -55,9 +55,13 @@ void CPU::Enter() { cpu.enter(); } void CPU::enter() { while(true) { - if(scheduler.sync == Scheduler::SynchronizeMode::CPU) { - scheduler.sync = Scheduler::SynchronizeMode::All; - scheduler.exit(Scheduler::ExitReason::SynchronizeEvent); + if(scheduler.sync == Scheduler::SynchronizeMode::CPU) { + // we can only stop if there's enough time for at least one more event + // on both the PPU and the SMP + if (smp.clock < 0 && ppu.clock < 0) { + scheduler.sync = Scheduler::SynchronizeMode::All; + scheduler.exit(Scheduler::ExitReason::SynchronizeEvent); + } } if(status.interrupt_pending) { @@ -86,7 +90,7 @@ void CPU::enter() { void CPU::op_step() { debugger.op_exec(regs.pc.d); - + if (interface->wanttrace) { char tmp[512]; @@ -94,7 +98,7 @@ void CPU::op_step() { tmp[511] = 0; interface->cpuTrace(tmp); } - + (this->*opcode_table[op_readpc()])(); } diff --git a/libsnes/bsnes/snes/smp/smp.cpp b/libsnes/bsnes/snes/smp/smp.cpp index 628c2f9c9e..13db7b9ada 100644 --- a/libsnes/bsnes/snes/smp/smp.cpp +++ b/libsnes/bsnes/snes/smp/smp.cpp @@ -47,8 +47,12 @@ void SMP::Enter() { smp.enter(); } void SMP::enter() { while(true) { // see comment in timing.cpp - if(clock > +(768 * 24 * (int64)24000000)) synchronize_cpu(); + if(clock > +(768 * 24 * (int64)24000000)) + synchronize_cpu(); + if(scheduler.sync == Scheduler::SynchronizeMode::CPU) { + synchronize_cpu(); // when in CPU sync mode, always switch back to CPU as soon as possible + } if(scheduler.sync == Scheduler::SynchronizeMode::All) { scheduler.exit(Scheduler::ExitReason::SynchronizeEvent); }