mirror of
https://github.com/tildearrow/furnace.git
synced 2024-12-29 02:51:24 +00:00
compound system flattening, part 2
.dmf saving implemented. only available for the following setups: - YM2612 + SMS = Genesis - YM2612 ext3 + SMS = Genesis ext3 - YM2151 + SegaPCM compat = Arcade - SMS + OPLL = SMS with FM expansion
This commit is contained in:
parent
e4b9a6d1d9
commit
319c559f47
1 changed files with 28 additions and 6 deletions
|
@ -1447,15 +1447,28 @@ SafeWriter* DivEngine::saveDMF(unsigned char version) {
|
|||
lastError="invalid version to save in! this is a bug!";
|
||||
return NULL;
|
||||
}
|
||||
// check whether system is compound
|
||||
bool isFlat=false;
|
||||
if (song.systemLen==2) {
|
||||
if (song.system[0]==DIV_SYSTEM_YM2612 && song.system[1]==DIV_SYSTEM_SMS) {
|
||||
isFlat=true;
|
||||
}
|
||||
if (song.system[0]==DIV_SYSTEM_YM2612_EXT && song.system[1]==DIV_SYSTEM_SMS) {
|
||||
isFlat=true;
|
||||
}
|
||||
if (song.system[0]==DIV_SYSTEM_YM2151 && song.system[1]==DIV_SYSTEM_SEGAPCM_COMPAT) {
|
||||
isFlat=true;
|
||||
}
|
||||
if (song.system[0]==DIV_SYSTEM_SMS && song.system[1]==DIV_SYSTEM_OPLL) {
|
||||
isFlat=true;
|
||||
}
|
||||
}
|
||||
// fail if more than one system
|
||||
// TODO: fix this mess for the flattening in 0.6
|
||||
if (!(song.system[0]==DIV_SYSTEM_SMS && song.system[1]==DIV_SYSTEM_OPLL)) {
|
||||
if (song.systemLen!=1) {
|
||||
if (!isFlat && song.systemLen!=1) {
|
||||
logE("cannot save multiple systems in this format!\n");
|
||||
lastError="multiple systems not possible on .dmf";
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
// fail if this is an YMU759 song
|
||||
if (song.system[0]==DIV_SYSTEM_YMU759) {
|
||||
logE("cannot save YMU759 song!\n");
|
||||
|
@ -1469,7 +1482,7 @@ SafeWriter* DivEngine::saveDMF(unsigned char version) {
|
|||
return NULL;
|
||||
}
|
||||
// fail if the system is Furnace-exclusive
|
||||
if (systemToFile(song.system[0])&0x80) {
|
||||
if (!isFlat && systemToFile(song.system[0])&0x80) {
|
||||
logE("cannot save Furnace-exclusive system song!\n");
|
||||
lastError="this system is not possible on .dmf";
|
||||
return NULL;
|
||||
|
@ -1485,7 +1498,16 @@ SafeWriter* DivEngine::saveDMF(unsigned char version) {
|
|||
// version
|
||||
w->writeC(version);
|
||||
DivSystem sys=DIV_SYSTEM_NULL;
|
||||
if (song.system[0]==DIV_SYSTEM_SMS && song.system[1]==DIV_SYSTEM_OPLL) {
|
||||
if (song.system[0]==DIV_SYSTEM_YM2612 && song.system[1]==DIV_SYSTEM_SMS) {
|
||||
w->writeC(systemToFile(DIV_SYSTEM_GENESIS));
|
||||
sys=DIV_SYSTEM_GENESIS;
|
||||
} else if (song.system[0]==DIV_SYSTEM_YM2612_EXT && song.system[1]==DIV_SYSTEM_SMS) {
|
||||
w->writeC(systemToFile(DIV_SYSTEM_GENESIS_EXT));
|
||||
sys=DIV_SYSTEM_GENESIS_EXT;
|
||||
} else if (song.system[0]==DIV_SYSTEM_YM2151 && song.system[1]==DIV_SYSTEM_SEGAPCM_COMPAT) {
|
||||
w->writeC(systemToFile(DIV_SYSTEM_ARCADE));
|
||||
sys=DIV_SYSTEM_ARCADE;
|
||||
} else if (song.system[0]==DIV_SYSTEM_SMS && song.system[1]==DIV_SYSTEM_OPLL) {
|
||||
w->writeC(systemToFile(DIV_SYSTEM_SMS_OPLL));
|
||||
sys=DIV_SYSTEM_SMS_OPLL;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue