better YMU759 support

time base now loaded as rate and timer no longer bugs out

also you can save YMU759 songs as .fur now, even if it is pointless
This commit is contained in:
tildearrow 2022-01-09 17:08:14 -05:00
parent 9b6db75d4f
commit 7568f1a1b9
2 changed files with 34 additions and 47 deletions

View file

@ -506,6 +506,34 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
ds.arpLen=1;
}
if (ds.system[0]==DIV_SYSTEM_YMU759) {
switch (ds.timeBase) {
case 0:
ds.hz=248;
break;
case 1:
ds.hz=200;
break;
case 2:
ds.hz=100;
break;
case 3:
ds.hz=50;
break;
case 4:
ds.hz=25;
break;
case 5:
ds.hz=20;
break;
default:
ds.hz=248;
break;
}
ds.customTempo=true;
ds.timeBase=0;
}
logI("reading pattern matrix (%d)...\n",ds.ordersLen);
for (int i=0; i<getChannelCount(ds.system[0]); i++) {
for (int j=0; j<ds.ordersLen; j++) {
@ -1344,13 +1372,6 @@ SafeWriter* DivEngine::saveFur() {
std::vector<int> patPtr;
size_t ptrSeek;
// fail if this is an YMU759 song
if (song.system[0]==DIV_SYSTEM_YMU759) {
logE("cannot save YMU759 song!\n");
lastError="YMU759 song saving is not supported";
return NULL;
}
SafeWriter* w=new SafeWriter;
w->init();
/// HEADER

View file

@ -643,15 +643,6 @@ void DivEngine::nextRow() {
}
}
if (song.system[0]==DIV_SYSTEM_YMU759) {
if (speedAB) {
ticks=speed2;
nextSpeed=speed1;
} else {
ticks=speed1;
nextSpeed=speed2;
}
} else {
if (speedAB) {
ticks=speed2*(song.timeBase+1);
nextSpeed=speed1;
@ -659,7 +650,6 @@ void DivEngine::nextRow() {
ticks=speed1*(song.timeBase+1);
nextSpeed=speed2;
}
}
speedAB=!speedAB;
// post row details
@ -679,31 +669,7 @@ bool DivEngine::nextTick(bool noAccum) {
if (song.customTempo) {
divider=song.hz;
} else {
if (song.system[0]==DIV_SYSTEM_YMU759) {
switch (song.timeBase) {
case 0:
divider=248;
break;
case 1:
divider=210;
break;
case 2:
divider=100;
break;
case 3:
divider=50;
break;
case 4:
divider=25;
break;
case 5:
divider=20;
break;
default:
divider=248;
break;
}
} else if (song.pal) {
if (song.pal) {
divider=60;
} else {
divider=50;