dev87 - C64 changes

issue #335
This commit is contained in:
tildearrow 2022-04-25 17:55:48 -05:00
parent 8ba2787160
commit 2a952b1a66
7 changed files with 57 additions and 14 deletions

View file

@ -501,9 +501,9 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
} else {
ins->std.dutyMacro.val[j]=reader.readI();
}
if ((ds.system[0]==DIV_SYSTEM_C64_8580 || ds.system[0]==DIV_SYSTEM_C64_6581) && ins->std.dutyMacro.val[j]>24) {
/*if ((ds.system[0]==DIV_SYSTEM_C64_8580 || ds.system[0]==DIV_SYSTEM_C64_6581) && ins->std.dutyMacro.val[j]>24) {
ins->std.dutyMacro.val[j]=24;
}
}*/
}
if (ins->std.dutyMacro.len>0) {
ins->std.dutyMacro.open=true;
@ -556,6 +556,16 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
ins->c64.bp=reader.readC();
ins->c64.lp=reader.readC();
ins->c64.ch3off=reader.readC();
// weird storage
if (ins->c64.volIsCutoff) {
for (int j=0; j<ins->std.volMacro.len; j++) {
ins->std.volMacro.val[j]-=18;
}
}
for (int j=0; j<ins->std.dutyMacro.len; j++) {
ins->std.dutyMacro.val[j]-=12;
}
}
if (ds.system[0]==DIV_SYSTEM_GB && ds.version>0x11) {
@ -2609,7 +2619,13 @@ SafeWriter* DivEngine::saveDMF(unsigned char version) {
} else { // STD
if (sys!=DIV_SYSTEM_GB) {
w->writeC(i->std.volMacro.len);
w->write(i->std.volMacro.val,4*i->std.volMacro.len);
if ((sys==DIV_SYSTEM_C64_6581 || sys==DIV_SYSTEM_C64_8580) && i->c64.volIsCutoff) {
for (int j=0; j<i->std.volMacro.len; j++) {
w->writeI(i->std.volMacro.val[j]+18);
}
} else {
w->write(i->std.volMacro.val,4*i->std.volMacro.len);
}
if (i->std.volMacro.len>0) {
w->writeC(i->std.volMacro.loop);
}
@ -2629,7 +2645,13 @@ SafeWriter* DivEngine::saveDMF(unsigned char version) {
w->writeC(i->std.arpMacro.mode);
w->writeC(i->std.dutyMacro.len);
w->write(i->std.dutyMacro.val,4*i->std.dutyMacro.len);
if (sys==DIV_SYSTEM_C64_6581 || sys==DIV_SYSTEM_C64_8580) {
for (int j=0; j<i->std.dutyMacro.len; j++) {
w->writeI(i->std.dutyMacro.val[j]+12);
}
} else {
w->write(i->std.dutyMacro.val,4*i->std.dutyMacro.len);
}
if (i->std.dutyMacro.len>0) {
w->writeC(i->std.dutyMacro.loop);
}