dev86 - SN duty macro phase reset fix

This commit is contained in:
tildearrow 2022-04-24 18:12:18 -05:00
parent f99ba810fe
commit bd68ef5cc3
6 changed files with 30 additions and 10 deletions

View file

@ -43,8 +43,8 @@
#define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock();
#define BUSY_END isBusy.unlock(); softLocked=false;
#define DIV_VERSION "dev85"
#define DIV_ENGINE_VERSION 85
#define DIV_VERSION "dev86"
#define DIV_ENGINE_VERSION 86
// for imports
#define DIV_VERSION_MOD 0xff01

View file

@ -163,6 +163,7 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
ds.ignoreDACModeOutsideIntendedChannel=false;
ds.e1e2AlsoTakePriority=true;
ds.fbPortaPause=true;
ds.snDutyReset=true;
// 1.1 compat flags
if (ds.version>24) {
@ -997,6 +998,9 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
if (ds.version<85) {
ds.fbPortaPause=true;
}
if (ds.version<86) {
ds.snDutyReset=true;
}
ds.isDMF=false;
reader.readS(); // reserved
@ -1351,7 +1355,12 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
} else {
reader.readC();
}
for (int i=0; i<21; i++) {
if (ds.version>=86) {
ds.snDutyReset=reader.readC();
} else {
reader.readC();
}
for (int i=0; i<20; i++) {
reader.readC();
}
}
@ -2293,7 +2302,8 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) {
w->writeC(song.e1e2AlsoTakePriority);
w->writeC(song.newSegaPCM);
w->writeC(song.fbPortaPause);
for (int i=0; i<21; i++) {
w->writeC(song.snDutyReset);
for (int i=0; i<20; i++) {
w->writeC(0);
}

View file

@ -86,11 +86,13 @@ void DivPlatformSMS::tick(bool sysTick) {
}
if (i==3) {
if (chan[i].std.duty.had) {
snNoiseMode=chan[i].std.duty.val;
if (chan[i].std.duty.val<2) {
chan[3].freqChanged=false;
if (chan[i].std.duty.val!=snNoiseMode || parent->song.snDutyReset) {
snNoiseMode=chan[i].std.duty.val;
if (chan[i].std.duty.val<2) {
chan[3].freqChanged=false;
}
updateSNMode=true;
}
updateSNMode=true;
}
if (chan[i].std.phaseReset.had) {
if (chan[i].std.phaseReset.val==1) {

View file

@ -325,6 +325,7 @@ struct DivSong {
bool e1e2AlsoTakePriority;
bool newSegaPCM;
bool fbPortaPause;
bool snDutyReset;
DivOrders orders;
std::vector<DivInstrument*> ins;
@ -429,7 +430,8 @@ struct DivSong {
ignoreDACModeOutsideIntendedChannel(false),
e1e2AlsoTakePriority(false),
newSegaPCM(true),
fbPortaPause(false) {
fbPortaPause(false),
snDutyReset(false) {
for (int i=0; i<32; i++) {
system[i]=DIV_SYSTEM_NULL;
systemVol[i]=64;