allow saving patterns in old format
This commit is contained in:
parent
c3ccd74a15
commit
4947d02c68
|
@ -591,7 +591,7 @@ class DivEngine {
|
|||
SafeWriter* saveDMF(unsigned char version);
|
||||
// save as .fur.
|
||||
// if notPrimary is true then the song will not be altered
|
||||
SafeWriter* saveFur(bool notPrimary=false);
|
||||
SafeWriter* saveFur(bool notPrimary=false, bool newPatternFormat=true);
|
||||
// build a ROM file (TODO).
|
||||
// specify system to build ROM for.
|
||||
std::vector<DivROMExportOutput> buildROM(DivROMExportOptions sys);
|
||||
|
|
|
@ -5077,9 +5077,7 @@ DivDataErrors DivEngine::readAssetDirData(SafeReader& reader, std::vector<DivAss
|
|||
return DIV_DATA_SUCCESS;
|
||||
}
|
||||
|
||||
#define NEW_PATTERN_FORMAT
|
||||
|
||||
SafeWriter* DivEngine::saveFur(bool notPrimary) {
|
||||
SafeWriter* DivEngine::saveFur(bool notPrimary, bool newPatternFormat) {
|
||||
saveLock.lock();
|
||||
std::vector<int> subSongPtr;
|
||||
std::vector<int> sysFlagsPtr;
|
||||
|
@ -5514,7 +5512,7 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) {
|
|||
DivPattern* pat=song.subsong[i.subsong]->pat[i.chan].getPattern(i.pat,false);
|
||||
patPtr.push_back(w->tell());
|
||||
|
||||
#ifdef NEW_PATTERN_FORMAT
|
||||
if (newPatternFormat) {
|
||||
w->write("PATN",4);
|
||||
blockStartSeek=w->tell();
|
||||
w->writeI(0);
|
||||
|
@ -5613,7 +5611,7 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) {
|
|||
|
||||
// stop
|
||||
w->writeC(0xff);
|
||||
#else
|
||||
} else {
|
||||
w->write("PATR",4);
|
||||
blockStartSeek=w->tell();
|
||||
w->writeI(0);
|
||||
|
@ -5639,7 +5637,7 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) {
|
|||
}
|
||||
|
||||
w->writeString(pat->name,false);
|
||||
#endif
|
||||
}
|
||||
|
||||
blockEndSeek=w->tell();
|
||||
w->seek(blockStartSeek,SEEK_SET);
|
||||
|
|
|
@ -1975,7 +1975,7 @@ int FurnaceGUI::save(String path, int dmfVersion) {
|
|||
if (dmfVersion<24) dmfVersion=24;
|
||||
w=e->saveDMF(dmfVersion);
|
||||
} else {
|
||||
w=e->saveFur();
|
||||
w=e->saveFur(false,settings.newPatternFormat);
|
||||
}
|
||||
if (w==NULL) {
|
||||
lastError=e->getLastError();
|
||||
|
@ -5674,7 +5674,7 @@ bool FurnaceGUI::loop() {
|
|||
}
|
||||
}
|
||||
logD("saving backup...");
|
||||
SafeWriter* w=e->saveFur(true);
|
||||
SafeWriter* w=e->saveFur(true,true);
|
||||
logV("writing file...");
|
||||
|
||||
if (w!=NULL) {
|
||||
|
|
|
@ -1425,6 +1425,7 @@ class FurnaceGUI {
|
|||
int iCannotWait;
|
||||
int orderButtonPos;
|
||||
int compress;
|
||||
int newPatternFormat;
|
||||
unsigned int maxUndoSteps;
|
||||
String mainFontPath;
|
||||
String patFontPath;
|
||||
|
@ -1571,6 +1572,7 @@ class FurnaceGUI {
|
|||
iCannotWait(0),
|
||||
orderButtonPos(2),
|
||||
compress(1),
|
||||
newPatternFormat(1),
|
||||
maxUndoSteps(100),
|
||||
mainFontPath(""),
|
||||
patFontPath(""),
|
||||
|
|
|
@ -662,6 +662,13 @@ void FurnaceGUI::drawSettings() {
|
|||
ImGui::SetTooltip("use zlib to compress saved songs.");
|
||||
}
|
||||
|
||||
bool newPatternFormatB=settings.newPatternFormat;
|
||||
if (ImGui::Checkbox("Use new pattern format when saving",&newPatternFormatB)) {
|
||||
settings.newPatternFormat=newPatternFormatB;
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("use a packed format which saves space when saving songs.\ndisable if you need compatibility with older Furnace and/or tools\nwhich do not support this format.");
|
||||
}
|
||||
|
||||
bool cursorFollowsOrderB=settings.cursorFollowsOrder;
|
||||
if (ImGui::Checkbox("Cursor follows current order when moving it",&cursorFollowsOrderB)) {
|
||||
|
@ -2683,6 +2690,7 @@ void FurnaceGUI::syncSettings() {
|
|||
settings.iCannotWait=e->getConfInt("iCannotWait",0);
|
||||
settings.orderButtonPos=e->getConfInt("orderButtonPos",2);
|
||||
settings.compress=e->getConfInt("compress",1);
|
||||
settings.newPatternFormat=e->getConfInt("newPatternFormat",1);
|
||||
|
||||
clampSetting(settings.mainFontSize,2,96);
|
||||
clampSetting(settings.patFontSize,2,96);
|
||||
|
@ -2804,6 +2812,7 @@ void FurnaceGUI::syncSettings() {
|
|||
clampSetting(settings.iCannotWait,0,1);
|
||||
clampSetting(settings.orderButtonPos,0,2);
|
||||
clampSetting(settings.compress,0,1);
|
||||
clampSetting(settings.newPatternFormat,0,1);
|
||||
|
||||
if (settings.exportLoops<0.0) settings.exportLoops=0.0;
|
||||
if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
|
||||
|
@ -3020,6 +3029,7 @@ void FurnaceGUI::commitSettings() {
|
|||
e->setConf("iCannotWait",settings.iCannotWait);
|
||||
e->setConf("orderButtonPos",settings.orderButtonPos);
|
||||
e->setConf("compress",settings.compress);
|
||||
e->setConf("newPatternFormat",settings.newPatternFormat);
|
||||
|
||||
// colors
|
||||
for (int i=0; i<GUI_COLOR_MAX; i++) {
|
||||
|
|
Loading…
Reference in a new issue