From d6441892013cbc48c06e9bf7b96c3ac3ff06a135 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 20 May 2023 15:19:45 -0500 Subject: [PATCH] C64: prevent multiple write to filter reg issue #1114 --- src/engine/platform/c64.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/engine/platform/c64.cpp b/src/engine/platform/c64.cpp index 139b1525b..977e39511 100644 --- a/src/engine/platform/c64.cpp +++ b/src/engine/platform/c64.cpp @@ -105,6 +105,7 @@ void DivPlatformC64::updateFilter() { } void DivPlatformC64::tick(bool sysTick) { + bool willUpdateFilter=false; for (int i=0; i<3; i++) { chan[i].std.next(); if (chan[i].std.vol.had) { @@ -117,10 +118,10 @@ void DivPlatformC64::tick(bool sysTick) { if (filtCut>2047) filtCut=2047; if (filtCut<0) filtCut=0; } - updateFilter(); + willUpdateFilter=true; } else { vol=MIN(15,chan[i].std.vol.val); - updateFilter(); + willUpdateFilter=true; } } if (NEW_ARP_STRAT) { @@ -156,11 +157,11 @@ void DivPlatformC64::tick(bool sysTick) { } if (chan[i].std.ex1.had) { filtControl=chan[i].std.ex1.val&15; - updateFilter(); + willUpdateFilter=true; } if (chan[i].std.ex2.had) { filtRes=chan[i].std.ex2.val&15; - updateFilter(); + willUpdateFilter=true; } if (chan[i].std.ex3.had) { chan[i].sync=chan[i].std.ex3.val&1; @@ -207,6 +208,7 @@ void DivPlatformC64::tick(bool sysTick) { chan[i].freqChanged=false; } } + if (willUpdateFilter) updateFilter(); } int DivPlatformC64::dispatch(DivCommand c) {