mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-01 18:42:40 +00:00
import/export config and factory reset
This commit is contained in:
parent
4086cd3fc5
commit
5e213256b6
5 changed files with 353 additions and 290 deletions
|
@ -19,11 +19,13 @@
|
||||||
|
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "../ta-log.h"
|
#include "../ta-log.h"
|
||||||
|
#include "../fileutils.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "winStuff.h"
|
#include "winStuff.h"
|
||||||
#define CONFIG_FILE "\\furnace.cfg"
|
#define CONFIG_FILE "\\furnace.cfg"
|
||||||
#define LOG_FILE "\\furnace.log"
|
#define LOG_FILE "\\furnace.log"
|
||||||
|
#define LAYOUT_INI "\\layout.ini"
|
||||||
#else
|
#else
|
||||||
#ifdef __HAIKU__
|
#ifdef __HAIKU__
|
||||||
#include <support/SupportDefs.h>
|
#include <support/SupportDefs.h>
|
||||||
|
@ -33,6 +35,8 @@
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#define CONFIG_FILE "/furnace.cfg"
|
#define CONFIG_FILE "/furnace.cfg"
|
||||||
|
#define LOG_FILE "/furnace.log"
|
||||||
|
#define LAYOUT_INI "/layout.ini"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IS_MOBILE
|
#ifdef IS_MOBILE
|
||||||
|
@ -172,3 +176,23 @@ bool DivEngine::hasConf(String key) {
|
||||||
DivConfig& DivEngine::getConfObject() {
|
DivConfig& DivEngine::getConfObject() {
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivEngine::factoryReset() {
|
||||||
|
conf.clear();
|
||||||
|
String confPath=configPath+String(CONFIG_FILE);
|
||||||
|
String layoutPath=configPath+String(LAYOUT_INI);
|
||||||
|
|
||||||
|
for (int i=0; i<10; i++) {
|
||||||
|
String path=confPath;
|
||||||
|
if (i>0) path+=fmt::sprintf(".%d",i);
|
||||||
|
deleteFile(path.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0; i<10; i++) {
|
||||||
|
String path=layoutPath;
|
||||||
|
if (i>0) path+=fmt::sprintf(".%d",i);
|
||||||
|
deleteFile(path.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
|
@ -766,6 +766,9 @@ class DivEngine {
|
||||||
// get whether config value exists
|
// get whether config value exists
|
||||||
bool hasConf(String key);
|
bool hasConf(String key);
|
||||||
|
|
||||||
|
// reset all settings
|
||||||
|
void factoryReset();
|
||||||
|
|
||||||
// calculate base frequency/period
|
// calculate base frequency/period
|
||||||
double calcBaseFreq(double clock, double divider, int note, bool period);
|
double calcBaseFreq(double clock, double divider, int note, bool period);
|
||||||
|
|
||||||
|
|
581
src/gui/gui.cpp
581
src/gui/gui.cpp
|
@ -3129,7 +3129,7 @@ int FurnaceGUI::processEvent(SDL_Event* ev) {
|
||||||
if (ev->type==SDL_APP_TERMINATING) {
|
if (ev->type==SDL_APP_TERMINATING) {
|
||||||
// TODO: save last song state here
|
// TODO: save last song state here
|
||||||
} else if (ev->type==SDL_APP_WILLENTERBACKGROUND) {
|
} else if (ev->type==SDL_APP_WILLENTERBACKGROUND) {
|
||||||
commitState();
|
commitState(e->getConfObject());
|
||||||
e->saveConf();
|
e->saveConf();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -4000,7 +4000,7 @@ bool FurnaceGUI::loop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
commitState();
|
commitState(e->getConfObject());
|
||||||
rend->quitGUI();
|
rend->quitGUI();
|
||||||
rend->quit();
|
rend->quit();
|
||||||
ImGui_ImplSDL2_Shutdown();
|
ImGui_ImplSDL2_Shutdown();
|
||||||
|
@ -6016,10 +6016,13 @@ bool FurnaceGUI::loop() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GUI_WARN_RESET_CONFIG:
|
case GUI_WARN_RESET_CONFIG:
|
||||||
|
pushDestColor();
|
||||||
if (ImGui::Button("Yes")) {
|
if (ImGui::Button("Yes")) {
|
||||||
|
e->factoryReset();
|
||||||
quit=true;
|
quit=true;
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
|
popDestColor();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("No")) {
|
if (ImGui::Button("No")) {
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
|
@ -6682,156 +6685,7 @@ bool FurnaceGUI::loop() {
|
||||||
bool FurnaceGUI::init() {
|
bool FurnaceGUI::init() {
|
||||||
logI("initializing GUI.");
|
logI("initializing GUI.");
|
||||||
|
|
||||||
String homeDir=getHomeDir();
|
syncState();
|
||||||
workingDir=e->getConfString("lastDir",homeDir);
|
|
||||||
workingDirSong=e->getConfString("lastDirSong",workingDir);
|
|
||||||
workingDirIns=e->getConfString("lastDirIns",workingDir);
|
|
||||||
workingDirWave=e->getConfString("lastDirWave",workingDir);
|
|
||||||
workingDirSample=e->getConfString("lastDirSample",workingDir);
|
|
||||||
workingDirAudioExport=e->getConfString("lastDirAudioExport",workingDir);
|
|
||||||
workingDirVGMExport=e->getConfString("lastDirVGMExport",workingDir);
|
|
||||||
workingDirZSMExport=e->getConfString("lastDirZSMExport",workingDir);
|
|
||||||
workingDirROMExport=e->getConfString("lastDirROMExport",workingDir);
|
|
||||||
workingDirFont=e->getConfString("lastDirFont",workingDir);
|
|
||||||
workingDirColors=e->getConfString("lastDirColors",workingDir);
|
|
||||||
workingDirKeybinds=e->getConfString("lastDirKeybinds",workingDir);
|
|
||||||
workingDirLayout=e->getConfString("lastDirLayout",workingDir);
|
|
||||||
workingDirConfig=e->getConfString("lastDirConfig",workingDir);
|
|
||||||
workingDirTest=e->getConfString("lastDirTest",workingDir);
|
|
||||||
|
|
||||||
editControlsOpen=e->getConfBool("editControlsOpen",true);
|
|
||||||
ordersOpen=e->getConfBool("ordersOpen",true);
|
|
||||||
insListOpen=e->getConfBool("insListOpen",true);
|
|
||||||
songInfoOpen=e->getConfBool("songInfoOpen",true);
|
|
||||||
patternOpen=e->getConfBool("patternOpen",true);
|
|
||||||
insEditOpen=e->getConfBool("insEditOpen",false);
|
|
||||||
waveListOpen=e->getConfBool("waveListOpen",true);
|
|
||||||
waveEditOpen=e->getConfBool("waveEditOpen",false);
|
|
||||||
sampleListOpen=e->getConfBool("sampleListOpen",true);
|
|
||||||
sampleEditOpen=e->getConfBool("sampleEditOpen",false);
|
|
||||||
settingsOpen=e->getConfBool("settingsOpen",false);
|
|
||||||
mixerOpen=e->getConfBool("mixerOpen",false);
|
|
||||||
oscOpen=e->getConfBool("oscOpen",true);
|
|
||||||
chanOscOpen=e->getConfBool("chanOscOpen",false);
|
|
||||||
xyOscOpen=e->getConfBool("xyOscOpen",false);
|
|
||||||
memoryOpen=e->getConfBool("memoryOpen",false);
|
|
||||||
volMeterOpen=e->getConfBool("volMeterOpen",true);
|
|
||||||
statsOpen=e->getConfBool("statsOpen",false);
|
|
||||||
compatFlagsOpen=e->getConfBool("compatFlagsOpen",false);
|
|
||||||
#ifdef IS_MOBILE
|
|
||||||
pianoOpen=e->getConfBool("pianoOpen",true);
|
|
||||||
#else
|
|
||||||
pianoOpen=e->getConfBool("pianoOpen",false);
|
|
||||||
#endif
|
|
||||||
notesOpen=e->getConfBool("notesOpen",false);
|
|
||||||
channelsOpen=e->getConfBool("channelsOpen",false);
|
|
||||||
patManagerOpen=e->getConfBool("patManagerOpen",false);
|
|
||||||
sysManagerOpen=e->getConfBool("sysManagerOpen",false);
|
|
||||||
clockOpen=e->getConfBool("clockOpen",false);
|
|
||||||
speedOpen=e->getConfBool("speedOpen",true);
|
|
||||||
groovesOpen=e->getConfBool("groovesOpen",false);
|
|
||||||
regViewOpen=e->getConfBool("regViewOpen",false);
|
|
||||||
logOpen=e->getConfBool("logOpen",false);
|
|
||||||
effectListOpen=e->getConfBool("effectListOpen",true);
|
|
||||||
subSongsOpen=e->getConfBool("subSongsOpen",true);
|
|
||||||
findOpen=e->getConfBool("findOpen",false);
|
|
||||||
spoilerOpen=e->getConfBool("spoilerOpen",false);
|
|
||||||
userPresetsOpen=e->getConfBool("userPresetsOpen",false);
|
|
||||||
|
|
||||||
insListDir=e->getConfBool("insListDir",false);
|
|
||||||
waveListDir=e->getConfBool("waveListDir",false);
|
|
||||||
sampleListDir=e->getConfBool("sampleListDir",false);
|
|
||||||
|
|
||||||
tempoView=e->getConfBool("tempoView",true);
|
|
||||||
waveHex=e->getConfBool("waveHex",false);
|
|
||||||
waveSigned=e->getConfBool("waveSigned",false);
|
|
||||||
waveGenVisible=e->getConfBool("waveGenVisible",false);
|
|
||||||
waveEditStyle=e->getConfInt("waveEditStyle",0);
|
|
||||||
int extraChannelButtons=e->getConfInt("extraChannelButtons",0);
|
|
||||||
if (!e->hasConf("patExtraButtons")) {
|
|
||||||
patExtraButtons=(extraChannelButtons==1);
|
|
||||||
} else {
|
|
||||||
patExtraButtons=e->getConfBool("patExtraButtons",false);
|
|
||||||
}
|
|
||||||
if (!e->hasConf("patChannelNames")) {
|
|
||||||
patChannelNames=(extraChannelButtons==2);
|
|
||||||
} else {
|
|
||||||
patChannelNames=e->getConfBool("patChannelNames",false);
|
|
||||||
}
|
|
||||||
patChannelPairs=e->getConfBool("patChannelPairs",true);
|
|
||||||
patChannelHints=e->getConfInt("patChannelHints",0);
|
|
||||||
lockLayout=e->getConfBool("lockLayout",false);
|
|
||||||
#ifdef IS_MOBILE
|
|
||||||
fullScreen=true;
|
|
||||||
#else
|
|
||||||
fullScreen=e->getConfBool("fullScreen",false);
|
|
||||||
#endif
|
|
||||||
mobileUI=e->getConfBool("mobileUI",MOBILE_UI_DEFAULT);
|
|
||||||
edit=e->getConfBool("edit",false);
|
|
||||||
followOrders=e->getConfBool("followOrders",true);
|
|
||||||
followPattern=e->getConfBool("followPattern",true);
|
|
||||||
noteInputPoly=e->getConfBool("noteInputPoly",true);
|
|
||||||
audioExportOptions.loops=e->getConfInt("exportLoops",0);
|
|
||||||
if (audioExportOptions.loops<0) audioExportOptions.loops=0;
|
|
||||||
audioExportOptions.fadeOut=e->getConfDouble("exportFadeOut",0.0);
|
|
||||||
if (audioExportOptions.fadeOut<0.0) audioExportOptions.fadeOut=0.0;
|
|
||||||
orderEditMode=e->getConfInt("orderEditMode",0);
|
|
||||||
if (orderEditMode<0) orderEditMode=0;
|
|
||||||
if (orderEditMode>3) orderEditMode=3;
|
|
||||||
|
|
||||||
oscZoom=e->getConfFloat("oscZoom",0.5f);
|
|
||||||
oscZoomSlider=e->getConfBool("oscZoomSlider",false);
|
|
||||||
oscWindowSize=e->getConfFloat("oscWindowSize",20.0f);
|
|
||||||
|
|
||||||
pianoOctaves=e->getConfInt("pianoOctaves",pianoOctaves);
|
|
||||||
pianoOctavesEdit=e->getConfInt("pianoOctavesEdit",pianoOctavesEdit);
|
|
||||||
pianoOptions=e->getConfBool("pianoOptions",pianoOptions);
|
|
||||||
pianoSharePosition=e->getConfBool("pianoSharePosition",pianoSharePosition);
|
|
||||||
pianoOptionsSet=e->getConfBool("pianoOptionsSet",pianoOptionsSet);
|
|
||||||
pianoReadonly=e->getConfBool("pianoReadonly",false);
|
|
||||||
pianoOffset=e->getConfInt("pianoOffset",pianoOffset);
|
|
||||||
pianoOffsetEdit=e->getConfInt("pianoOffsetEdit",pianoOffsetEdit);
|
|
||||||
pianoView=e->getConfInt("pianoView",pianoView);
|
|
||||||
pianoInputPadMode=e->getConfInt("pianoInputPadMode",pianoInputPadMode);
|
|
||||||
|
|
||||||
chanOscCols=e->getConfInt("chanOscCols",3);
|
|
||||||
chanOscAutoColsType=e->getConfInt("chanOscAutoColsType",0);
|
|
||||||
chanOscColorX=e->getConfInt("chanOscColorX",GUI_OSCREF_CENTER);
|
|
||||||
chanOscColorY=e->getConfInt("chanOscColorY",GUI_OSCREF_CENTER);
|
|
||||||
chanOscTextX=e->getConfFloat("chanOscTextX",0.0f);
|
|
||||||
chanOscTextY=e->getConfFloat("chanOscTextY",0.0f);
|
|
||||||
chanOscAmplify=e->getConfFloat("chanOscAmplify",0.95f);
|
|
||||||
chanOscLineSize=e->getConfFloat("chanOscLineSize",1.0f);
|
|
||||||
chanOscWindowSize=e->getConfFloat("chanOscWindowSize",20.0f);
|
|
||||||
chanOscWaveCorr=e->getConfBool("chanOscWaveCorr",true);
|
|
||||||
chanOscOptions=e->getConfBool("chanOscOptions",false);
|
|
||||||
chanOscNormalize=e->getConfBool("chanOscNormalize",false);
|
|
||||||
chanOscRandomPhase=e->getConfBool("chanOscRandomPhase",false);
|
|
||||||
chanOscTextFormat=e->getConfString("chanOscTextFormat","%c");
|
|
||||||
chanOscColor.x=e->getConfFloat("chanOscColorR",1.0f);
|
|
||||||
chanOscColor.y=e->getConfFloat("chanOscColorG",1.0f);
|
|
||||||
chanOscColor.z=e->getConfFloat("chanOscColorB",1.0f);
|
|
||||||
chanOscColor.w=e->getConfFloat("chanOscColorA",1.0f);
|
|
||||||
chanOscTextColor.x=e->getConfFloat("chanOscTextColorR",1.0f);
|
|
||||||
chanOscTextColor.y=e->getConfFloat("chanOscTextColorG",1.0f);
|
|
||||||
chanOscTextColor.z=e->getConfFloat("chanOscTextColorB",1.0f);
|
|
||||||
chanOscTextColor.w=e->getConfFloat("chanOscTextColorA",0.75f);
|
|
||||||
chanOscUseGrad=e->getConfBool("chanOscUseGrad",false);
|
|
||||||
chanOscGrad.fromString(e->getConfString("chanOscGrad",""));
|
|
||||||
chanOscGrad.render();
|
|
||||||
|
|
||||||
xyOscXChannel=e->getConfInt("xyOscXChannel",0);
|
|
||||||
xyOscXInvert=e->getConfBool("xyOscXInvert",false);
|
|
||||||
xyOscYChannel=e->getConfInt("xyOscYChannel",1);
|
|
||||||
xyOscYInvert=e->getConfBool("xyOscYInvert",false);
|
|
||||||
xyOscZoom=e->getConfFloat("xyOscZoom",1.0f);
|
|
||||||
xyOscSamples=e->getConfInt("xyOscSamples",32768);
|
|
||||||
xyOscDecayTime=e->getConfFloat("xyOscDecayTime",10.0f);
|
|
||||||
xyOscIntensity=e->getConfFloat("xyOscIntensity",2.0f);
|
|
||||||
xyOscThickness=e->getConfFloat("xyOscThickness",2.0f);
|
|
||||||
|
|
||||||
cvHiScore=e->getConfInt("cvHiScore",25000);
|
|
||||||
|
|
||||||
syncSettings();
|
syncSettings();
|
||||||
syncTutorial();
|
syncTutorial();
|
||||||
|
|
||||||
|
@ -6840,13 +6694,6 @@ bool FurnaceGUI::init() {
|
||||||
audioExportOptions.fadeOut=settings.exportFadeOut;
|
audioExportOptions.fadeOut=settings.exportFadeOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<settings.maxRecentFile; i++) {
|
|
||||||
String r=e->getConfString(fmt::sprintf("recentFile%d",i),"");
|
|
||||||
if (!r.empty()) {
|
|
||||||
recentFile.push_back(r);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
initSystemPresets();
|
initSystemPresets();
|
||||||
|
|
||||||
e->setAutoNotePoly(noteInputPoly);
|
e->setAutoNotePoly(noteInputPoly);
|
||||||
|
@ -7251,170 +7098,330 @@ bool FurnaceGUI::init() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FurnaceGUI::commitState() {
|
void FurnaceGUI::syncState() {
|
||||||
|
String homeDir=getHomeDir();
|
||||||
|
workingDir=e->getConfString("lastDir",homeDir);
|
||||||
|
workingDirSong=e->getConfString("lastDirSong",workingDir);
|
||||||
|
workingDirIns=e->getConfString("lastDirIns",workingDir);
|
||||||
|
workingDirWave=e->getConfString("lastDirWave",workingDir);
|
||||||
|
workingDirSample=e->getConfString("lastDirSample",workingDir);
|
||||||
|
workingDirAudioExport=e->getConfString("lastDirAudioExport",workingDir);
|
||||||
|
workingDirVGMExport=e->getConfString("lastDirVGMExport",workingDir);
|
||||||
|
workingDirZSMExport=e->getConfString("lastDirZSMExport",workingDir);
|
||||||
|
workingDirROMExport=e->getConfString("lastDirROMExport",workingDir);
|
||||||
|
workingDirFont=e->getConfString("lastDirFont",workingDir);
|
||||||
|
workingDirColors=e->getConfString("lastDirColors",workingDir);
|
||||||
|
workingDirKeybinds=e->getConfString("lastDirKeybinds",workingDir);
|
||||||
|
workingDirLayout=e->getConfString("lastDirLayout",workingDir);
|
||||||
|
workingDirConfig=e->getConfString("lastDirConfig",workingDir);
|
||||||
|
workingDirTest=e->getConfString("lastDirTest",workingDir);
|
||||||
|
|
||||||
|
editControlsOpen=e->getConfBool("editControlsOpen",true);
|
||||||
|
ordersOpen=e->getConfBool("ordersOpen",true);
|
||||||
|
insListOpen=e->getConfBool("insListOpen",true);
|
||||||
|
songInfoOpen=e->getConfBool("songInfoOpen",true);
|
||||||
|
patternOpen=e->getConfBool("patternOpen",true);
|
||||||
|
insEditOpen=e->getConfBool("insEditOpen",false);
|
||||||
|
waveListOpen=e->getConfBool("waveListOpen",true);
|
||||||
|
waveEditOpen=e->getConfBool("waveEditOpen",false);
|
||||||
|
sampleListOpen=e->getConfBool("sampleListOpen",true);
|
||||||
|
sampleEditOpen=e->getConfBool("sampleEditOpen",false);
|
||||||
|
settingsOpen=e->getConfBool("settingsOpen",false);
|
||||||
|
mixerOpen=e->getConfBool("mixerOpen",false);
|
||||||
|
oscOpen=e->getConfBool("oscOpen",true);
|
||||||
|
chanOscOpen=e->getConfBool("chanOscOpen",false);
|
||||||
|
xyOscOpen=e->getConfBool("xyOscOpen",false);
|
||||||
|
memoryOpen=e->getConfBool("memoryOpen",false);
|
||||||
|
volMeterOpen=e->getConfBool("volMeterOpen",true);
|
||||||
|
statsOpen=e->getConfBool("statsOpen",false);
|
||||||
|
compatFlagsOpen=e->getConfBool("compatFlagsOpen",false);
|
||||||
|
#ifdef IS_MOBILE
|
||||||
|
pianoOpen=e->getConfBool("pianoOpen",true);
|
||||||
|
#else
|
||||||
|
pianoOpen=e->getConfBool("pianoOpen",false);
|
||||||
|
#endif
|
||||||
|
notesOpen=e->getConfBool("notesOpen",false);
|
||||||
|
channelsOpen=e->getConfBool("channelsOpen",false);
|
||||||
|
patManagerOpen=e->getConfBool("patManagerOpen",false);
|
||||||
|
sysManagerOpen=e->getConfBool("sysManagerOpen",false);
|
||||||
|
clockOpen=e->getConfBool("clockOpen",false);
|
||||||
|
speedOpen=e->getConfBool("speedOpen",true);
|
||||||
|
groovesOpen=e->getConfBool("groovesOpen",false);
|
||||||
|
regViewOpen=e->getConfBool("regViewOpen",false);
|
||||||
|
logOpen=e->getConfBool("logOpen",false);
|
||||||
|
effectListOpen=e->getConfBool("effectListOpen",true);
|
||||||
|
subSongsOpen=e->getConfBool("subSongsOpen",true);
|
||||||
|
findOpen=e->getConfBool("findOpen",false);
|
||||||
|
spoilerOpen=e->getConfBool("spoilerOpen",false);
|
||||||
|
userPresetsOpen=e->getConfBool("userPresetsOpen",false);
|
||||||
|
|
||||||
|
insListDir=e->getConfBool("insListDir",false);
|
||||||
|
waveListDir=e->getConfBool("waveListDir",false);
|
||||||
|
sampleListDir=e->getConfBool("sampleListDir",false);
|
||||||
|
|
||||||
|
tempoView=e->getConfBool("tempoView",true);
|
||||||
|
waveHex=e->getConfBool("waveHex",false);
|
||||||
|
waveSigned=e->getConfBool("waveSigned",false);
|
||||||
|
waveGenVisible=e->getConfBool("waveGenVisible",false);
|
||||||
|
waveEditStyle=e->getConfInt("waveEditStyle",0);
|
||||||
|
int extraChannelButtons=e->getConfInt("extraChannelButtons",0);
|
||||||
|
if (!e->hasConf("patExtraButtons")) {
|
||||||
|
patExtraButtons=(extraChannelButtons==1);
|
||||||
|
} else {
|
||||||
|
patExtraButtons=e->getConfBool("patExtraButtons",false);
|
||||||
|
}
|
||||||
|
if (!e->hasConf("patChannelNames")) {
|
||||||
|
patChannelNames=(extraChannelButtons==2);
|
||||||
|
} else {
|
||||||
|
patChannelNames=e->getConfBool("patChannelNames",false);
|
||||||
|
}
|
||||||
|
patChannelPairs=e->getConfBool("patChannelPairs",true);
|
||||||
|
patChannelHints=e->getConfInt("patChannelHints",0);
|
||||||
|
lockLayout=e->getConfBool("lockLayout",false);
|
||||||
|
#ifdef IS_MOBILE
|
||||||
|
fullScreen=true;
|
||||||
|
#else
|
||||||
|
fullScreen=e->getConfBool("fullScreen",false);
|
||||||
|
#endif
|
||||||
|
mobileUI=e->getConfBool("mobileUI",MOBILE_UI_DEFAULT);
|
||||||
|
edit=e->getConfBool("edit",false);
|
||||||
|
followOrders=e->getConfBool("followOrders",true);
|
||||||
|
followPattern=e->getConfBool("followPattern",true);
|
||||||
|
noteInputPoly=e->getConfBool("noteInputPoly",true);
|
||||||
|
audioExportOptions.loops=e->getConfInt("exportLoops",0);
|
||||||
|
if (audioExportOptions.loops<0) audioExportOptions.loops=0;
|
||||||
|
audioExportOptions.fadeOut=e->getConfDouble("exportFadeOut",0.0);
|
||||||
|
if (audioExportOptions.fadeOut<0.0) audioExportOptions.fadeOut=0.0;
|
||||||
|
orderEditMode=e->getConfInt("orderEditMode",0);
|
||||||
|
if (orderEditMode<0) orderEditMode=0;
|
||||||
|
if (orderEditMode>3) orderEditMode=3;
|
||||||
|
|
||||||
|
oscZoom=e->getConfFloat("oscZoom",0.5f);
|
||||||
|
oscZoomSlider=e->getConfBool("oscZoomSlider",false);
|
||||||
|
oscWindowSize=e->getConfFloat("oscWindowSize",20.0f);
|
||||||
|
|
||||||
|
pianoOctaves=e->getConfInt("pianoOctaves",pianoOctaves);
|
||||||
|
pianoOctavesEdit=e->getConfInt("pianoOctavesEdit",pianoOctavesEdit);
|
||||||
|
pianoOptions=e->getConfBool("pianoOptions",pianoOptions);
|
||||||
|
pianoSharePosition=e->getConfBool("pianoSharePosition",pianoSharePosition);
|
||||||
|
pianoOptionsSet=e->getConfBool("pianoOptionsSet",pianoOptionsSet);
|
||||||
|
pianoReadonly=e->getConfBool("pianoReadonly",false);
|
||||||
|
pianoOffset=e->getConfInt("pianoOffset",pianoOffset);
|
||||||
|
pianoOffsetEdit=e->getConfInt("pianoOffsetEdit",pianoOffsetEdit);
|
||||||
|
pianoView=e->getConfInt("pianoView",pianoView);
|
||||||
|
pianoInputPadMode=e->getConfInt("pianoInputPadMode",pianoInputPadMode);
|
||||||
|
|
||||||
|
chanOscCols=e->getConfInt("chanOscCols",3);
|
||||||
|
chanOscAutoColsType=e->getConfInt("chanOscAutoColsType",0);
|
||||||
|
chanOscColorX=e->getConfInt("chanOscColorX",GUI_OSCREF_CENTER);
|
||||||
|
chanOscColorY=e->getConfInt("chanOscColorY",GUI_OSCREF_CENTER);
|
||||||
|
chanOscTextX=e->getConfFloat("chanOscTextX",0.0f);
|
||||||
|
chanOscTextY=e->getConfFloat("chanOscTextY",0.0f);
|
||||||
|
chanOscAmplify=e->getConfFloat("chanOscAmplify",0.95f);
|
||||||
|
chanOscLineSize=e->getConfFloat("chanOscLineSize",1.0f);
|
||||||
|
chanOscWindowSize=e->getConfFloat("chanOscWindowSize",20.0f);
|
||||||
|
chanOscWaveCorr=e->getConfBool("chanOscWaveCorr",true);
|
||||||
|
chanOscOptions=e->getConfBool("chanOscOptions",false);
|
||||||
|
chanOscNormalize=e->getConfBool("chanOscNormalize",false);
|
||||||
|
chanOscRandomPhase=e->getConfBool("chanOscRandomPhase",false);
|
||||||
|
chanOscTextFormat=e->getConfString("chanOscTextFormat","%c");
|
||||||
|
chanOscColor.x=e->getConfFloat("chanOscColorR",1.0f);
|
||||||
|
chanOscColor.y=e->getConfFloat("chanOscColorG",1.0f);
|
||||||
|
chanOscColor.z=e->getConfFloat("chanOscColorB",1.0f);
|
||||||
|
chanOscColor.w=e->getConfFloat("chanOscColorA",1.0f);
|
||||||
|
chanOscTextColor.x=e->getConfFloat("chanOscTextColorR",1.0f);
|
||||||
|
chanOscTextColor.y=e->getConfFloat("chanOscTextColorG",1.0f);
|
||||||
|
chanOscTextColor.z=e->getConfFloat("chanOscTextColorB",1.0f);
|
||||||
|
chanOscTextColor.w=e->getConfFloat("chanOscTextColorA",0.75f);
|
||||||
|
chanOscUseGrad=e->getConfBool("chanOscUseGrad",false);
|
||||||
|
chanOscGrad.fromString(e->getConfString("chanOscGrad",""));
|
||||||
|
chanOscGrad.render();
|
||||||
|
|
||||||
|
xyOscXChannel=e->getConfInt("xyOscXChannel",0);
|
||||||
|
xyOscXInvert=e->getConfBool("xyOscXInvert",false);
|
||||||
|
xyOscYChannel=e->getConfInt("xyOscYChannel",1);
|
||||||
|
xyOscYInvert=e->getConfBool("xyOscYInvert",false);
|
||||||
|
xyOscZoom=e->getConfFloat("xyOscZoom",1.0f);
|
||||||
|
xyOscSamples=e->getConfInt("xyOscSamples",32768);
|
||||||
|
xyOscDecayTime=e->getConfFloat("xyOscDecayTime",10.0f);
|
||||||
|
xyOscIntensity=e->getConfFloat("xyOscIntensity",2.0f);
|
||||||
|
xyOscThickness=e->getConfFloat("xyOscThickness",2.0f);
|
||||||
|
|
||||||
|
cvHiScore=e->getConfInt("cvHiScore",25000);
|
||||||
|
|
||||||
|
recentFile.clear();
|
||||||
|
for (int i=0; i<settings.maxRecentFile; i++) {
|
||||||
|
String r=e->getConfString(fmt::sprintf("recentFile%d",i),"");
|
||||||
|
if (!r.empty()) {
|
||||||
|
recentFile.push_back(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FurnaceGUI::commitState(DivConfig& conf) {
|
||||||
if (!mobileUI) {
|
if (!mobileUI) {
|
||||||
if (!ImGui::SaveIniSettingsToDisk(finalLayoutPath,true)) {
|
if (!ImGui::SaveIniSettingsToDisk(finalLayoutPath,true)) {
|
||||||
reportError(fmt::sprintf("could NOT save layout! %s",strerror(errno)));
|
reportError(fmt::sprintf("could NOT save layout! %s",strerror(errno)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
e->setConf("configVersion",(int)DIV_ENGINE_VERSION);
|
conf.set("configVersion",(int)DIV_ENGINE_VERSION);
|
||||||
|
|
||||||
e->setConf("lastDir",workingDir);
|
conf.set("lastDir",workingDir);
|
||||||
e->setConf("lastDirSong",workingDirSong);
|
conf.set("lastDirSong",workingDirSong);
|
||||||
e->setConf("lastDirIns",workingDirIns);
|
conf.set("lastDirIns",workingDirIns);
|
||||||
e->setConf("lastDirWave",workingDirWave);
|
conf.set("lastDirWave",workingDirWave);
|
||||||
e->setConf("lastDirSample",workingDirSample);
|
conf.set("lastDirSample",workingDirSample);
|
||||||
e->setConf("lastDirAudioExport",workingDirAudioExport);
|
conf.set("lastDirAudioExport",workingDirAudioExport);
|
||||||
e->setConf("lastDirVGMExport",workingDirVGMExport);
|
conf.set("lastDirVGMExport",workingDirVGMExport);
|
||||||
e->setConf("lastDirZSMExport",workingDirZSMExport);
|
conf.set("lastDirZSMExport",workingDirZSMExport);
|
||||||
e->setConf("lastDirROMExport",workingDirROMExport);
|
conf.set("lastDirROMExport",workingDirROMExport);
|
||||||
e->setConf("lastDirFont",workingDirFont);
|
conf.set("lastDirFont",workingDirFont);
|
||||||
e->setConf("lastDirColors",workingDirColors);
|
conf.set("lastDirColors",workingDirColors);
|
||||||
e->setConf("lastDirKeybinds",workingDirKeybinds);
|
conf.set("lastDirKeybinds",workingDirKeybinds);
|
||||||
e->setConf("lastDirLayout",workingDirLayout);
|
conf.set("lastDirLayout",workingDirLayout);
|
||||||
e->setConf("lastDirConfig",workingDirConfig);
|
conf.set("lastDirConfig",workingDirConfig);
|
||||||
e->setConf("lastDirTest",workingDirTest);
|
conf.set("lastDirTest",workingDirTest);
|
||||||
|
|
||||||
// commit last open windows
|
// commit last open windows
|
||||||
e->setConf("editControlsOpen",editControlsOpen);
|
conf.set("editControlsOpen",editControlsOpen);
|
||||||
e->setConf("ordersOpen",ordersOpen);
|
conf.set("ordersOpen",ordersOpen);
|
||||||
e->setConf("insListOpen",insListOpen);
|
conf.set("insListOpen",insListOpen);
|
||||||
e->setConf("songInfoOpen",songInfoOpen);
|
conf.set("songInfoOpen",songInfoOpen);
|
||||||
e->setConf("patternOpen",patternOpen);
|
conf.set("patternOpen",patternOpen);
|
||||||
e->setConf("insEditOpen",insEditOpen);
|
conf.set("insEditOpen",insEditOpen);
|
||||||
e->setConf("waveListOpen",waveListOpen);
|
conf.set("waveListOpen",waveListOpen);
|
||||||
e->setConf("waveEditOpen",waveEditOpen);
|
conf.set("waveEditOpen",waveEditOpen);
|
||||||
e->setConf("sampleListOpen",sampleListOpen);
|
conf.set("sampleListOpen",sampleListOpen);
|
||||||
e->setConf("sampleEditOpen",sampleEditOpen);
|
conf.set("sampleEditOpen",sampleEditOpen);
|
||||||
e->setConf("settingsOpen",settingsOpen);
|
conf.set("settingsOpen",settingsOpen);
|
||||||
e->setConf("mixerOpen",mixerOpen);
|
conf.set("mixerOpen",mixerOpen);
|
||||||
e->setConf("oscOpen",oscOpen);
|
conf.set("oscOpen",oscOpen);
|
||||||
e->setConf("chanOscOpen",chanOscOpen);
|
conf.set("chanOscOpen",chanOscOpen);
|
||||||
e->setConf("xyOscOpen",xyOscOpen);
|
conf.set("xyOscOpen",xyOscOpen);
|
||||||
e->setConf("memoryOpen",memoryOpen);
|
conf.set("memoryOpen",memoryOpen);
|
||||||
e->setConf("volMeterOpen",volMeterOpen);
|
conf.set("volMeterOpen",volMeterOpen);
|
||||||
e->setConf("statsOpen",statsOpen);
|
conf.set("statsOpen",statsOpen);
|
||||||
e->setConf("compatFlagsOpen",compatFlagsOpen);
|
conf.set("compatFlagsOpen",compatFlagsOpen);
|
||||||
e->setConf("pianoOpen",pianoOpen);
|
conf.set("pianoOpen",pianoOpen);
|
||||||
e->setConf("notesOpen",notesOpen);
|
conf.set("notesOpen",notesOpen);
|
||||||
e->setConf("channelsOpen",channelsOpen);
|
conf.set("channelsOpen",channelsOpen);
|
||||||
e->setConf("patManagerOpen",patManagerOpen);
|
conf.set("patManagerOpen",patManagerOpen);
|
||||||
e->setConf("sysManagerOpen",sysManagerOpen);
|
conf.set("sysManagerOpen",sysManagerOpen);
|
||||||
e->setConf("clockOpen",clockOpen);
|
conf.set("clockOpen",clockOpen);
|
||||||
e->setConf("speedOpen",speedOpen);
|
conf.set("speedOpen",speedOpen);
|
||||||
e->setConf("groovesOpen",groovesOpen);
|
conf.set("groovesOpen",groovesOpen);
|
||||||
e->setConf("regViewOpen",regViewOpen);
|
conf.set("regViewOpen",regViewOpen);
|
||||||
e->setConf("logOpen",logOpen);
|
conf.set("logOpen",logOpen);
|
||||||
e->setConf("effectListOpen",effectListOpen);
|
conf.set("effectListOpen",effectListOpen);
|
||||||
e->setConf("subSongsOpen",subSongsOpen);
|
conf.set("subSongsOpen",subSongsOpen);
|
||||||
e->setConf("findOpen",findOpen);
|
conf.set("findOpen",findOpen);
|
||||||
e->setConf("spoilerOpen",spoilerOpen);
|
conf.set("spoilerOpen",spoilerOpen);
|
||||||
e->setConf("userPresetsOpen",userPresetsOpen);
|
conf.set("userPresetsOpen",userPresetsOpen);
|
||||||
|
|
||||||
// commit dir state
|
// commit dir state
|
||||||
e->setConf("insListDir",insListDir);
|
conf.set("insListDir",insListDir);
|
||||||
e->setConf("waveListDir",waveListDir);
|
conf.set("waveListDir",waveListDir);
|
||||||
e->setConf("sampleListDir",sampleListDir);
|
conf.set("sampleListDir",sampleListDir);
|
||||||
|
|
||||||
// commit last window size
|
// commit last window size
|
||||||
e->setConf("lastWindowWidth",scrConfW);
|
conf.set("lastWindowWidth",scrConfW);
|
||||||
e->setConf("lastWindowHeight",scrConfH);
|
conf.set("lastWindowHeight",scrConfH);
|
||||||
e->setConf("lastWindowX",settings.saveWindowPos?scrConfX:(int)SDL_WINDOWPOS_CENTERED);
|
conf.set("lastWindowX",settings.saveWindowPos?scrConfX:(int)SDL_WINDOWPOS_CENTERED);
|
||||||
e->setConf("lastWindowY",settings.saveWindowPos?scrConfY:(int)SDL_WINDOWPOS_CENTERED);
|
conf.set("lastWindowY",settings.saveWindowPos?scrConfY:(int)SDL_WINDOWPOS_CENTERED);
|
||||||
e->setConf("lastWindowMax",scrMax);
|
conf.set("lastWindowMax",scrMax);
|
||||||
|
|
||||||
e->setConf("tempoView",tempoView);
|
conf.set("tempoView",tempoView);
|
||||||
e->setConf("waveHex",waveHex);
|
conf.set("waveHex",waveHex);
|
||||||
e->setConf("waveSigned",waveSigned);
|
conf.set("waveSigned",waveSigned);
|
||||||
e->setConf("waveGenVisible",waveGenVisible);
|
conf.set("waveGenVisible",waveGenVisible);
|
||||||
e->setConf("waveEditStyle",waveEditStyle);
|
conf.set("waveEditStyle",waveEditStyle);
|
||||||
e->setConf("patExtraButtons",patExtraButtons);
|
conf.set("patExtraButtons",patExtraButtons);
|
||||||
e->setConf("patChannelNames",patChannelNames);
|
conf.set("patChannelNames",patChannelNames);
|
||||||
e->setConf("patChannelPairs",patChannelPairs);
|
conf.set("patChannelPairs",patChannelPairs);
|
||||||
e->setConf("patChannelHints",(int)patChannelHints);
|
conf.set("patChannelHints",(int)patChannelHints);
|
||||||
e->setConf("lockLayout",lockLayout);
|
conf.set("lockLayout",lockLayout);
|
||||||
e->setConf("fullScreen",fullScreen);
|
conf.set("fullScreen",fullScreen);
|
||||||
e->setConf("mobileUI",mobileUI);
|
conf.set("mobileUI",mobileUI);
|
||||||
e->setConf("edit",edit);
|
conf.set("edit",edit);
|
||||||
e->setConf("followOrders",followOrders);
|
conf.set("followOrders",followOrders);
|
||||||
e->setConf("followPattern",followPattern);
|
conf.set("followPattern",followPattern);
|
||||||
e->setConf("orderEditMode",orderEditMode);
|
conf.set("orderEditMode",orderEditMode);
|
||||||
e->setConf("noteInputPoly",noteInputPoly);
|
conf.set("noteInputPoly",noteInputPoly);
|
||||||
if (settings.persistFadeOut) {
|
if (settings.persistFadeOut) {
|
||||||
e->setConf("exportLoops",audioExportOptions.loops);
|
conf.set("exportLoops",audioExportOptions.loops);
|
||||||
e->setConf("exportFadeOut",audioExportOptions.fadeOut);
|
conf.set("exportFadeOut",audioExportOptions.fadeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
// commit oscilloscope state
|
// commit oscilloscope state
|
||||||
e->setConf("oscZoom",oscZoom);
|
conf.set("oscZoom",oscZoom);
|
||||||
e->setConf("oscZoomSlider",oscZoomSlider);
|
conf.set("oscZoomSlider",oscZoomSlider);
|
||||||
e->setConf("oscWindowSize",oscWindowSize);
|
conf.set("oscWindowSize",oscWindowSize);
|
||||||
|
|
||||||
// commit piano state
|
// commit piano state
|
||||||
e->setConf("pianoOctaves",pianoOctaves);
|
conf.set("pianoOctaves",pianoOctaves);
|
||||||
e->setConf("pianoOctavesEdit",pianoOctavesEdit);
|
conf.set("pianoOctavesEdit",pianoOctavesEdit);
|
||||||
e->setConf("pianoOptions",pianoOptions);
|
conf.set("pianoOptions",pianoOptions);
|
||||||
e->setConf("pianoSharePosition",pianoSharePosition);
|
conf.set("pianoSharePosition",pianoSharePosition);
|
||||||
e->setConf("pianoOptionsSet",pianoOptionsSet);
|
conf.set("pianoOptionsSet",pianoOptionsSet);
|
||||||
e->setConf("pianoReadonly",pianoReadonly);
|
conf.set("pianoReadonly",pianoReadonly);
|
||||||
e->setConf("pianoOffset",pianoOffset);
|
conf.set("pianoOffset",pianoOffset);
|
||||||
e->setConf("pianoOffsetEdit",pianoOffsetEdit);
|
conf.set("pianoOffsetEdit",pianoOffsetEdit);
|
||||||
e->setConf("pianoView",pianoView);
|
conf.set("pianoView",pianoView);
|
||||||
e->setConf("pianoInputPadMode",pianoInputPadMode);
|
conf.set("pianoInputPadMode",pianoInputPadMode);
|
||||||
|
|
||||||
// commit per-chan osc state
|
// commit per-chan osc state
|
||||||
e->setConf("chanOscCols",chanOscCols);
|
conf.set("chanOscCols",chanOscCols);
|
||||||
e->setConf("chanOscAutoColsType",chanOscAutoColsType);
|
conf.set("chanOscAutoColsType",chanOscAutoColsType);
|
||||||
e->setConf("chanOscColorX",chanOscColorX);
|
conf.set("chanOscColorX",chanOscColorX);
|
||||||
e->setConf("chanOscColorY",chanOscColorY);
|
conf.set("chanOscColorY",chanOscColorY);
|
||||||
e->setConf("chanOscTextX",chanOscTextX);
|
conf.set("chanOscTextX",chanOscTextX);
|
||||||
e->setConf("chanOscTextY",chanOscTextY);
|
conf.set("chanOscTextY",chanOscTextY);
|
||||||
e->setConf("chanOscAmplify",chanOscAmplify);
|
conf.set("chanOscAmplify",chanOscAmplify);
|
||||||
e->setConf("chanOscLineSize",chanOscLineSize);
|
conf.set("chanOscLineSize",chanOscLineSize);
|
||||||
e->setConf("chanOscWindowSize",chanOscWindowSize);
|
conf.set("chanOscWindowSize",chanOscWindowSize);
|
||||||
e->setConf("chanOscWaveCorr",chanOscWaveCorr);
|
conf.set("chanOscWaveCorr",chanOscWaveCorr);
|
||||||
e->setConf("chanOscOptions",chanOscOptions);
|
conf.set("chanOscOptions",chanOscOptions);
|
||||||
e->setConf("chanOscNormalize",chanOscNormalize);
|
conf.set("chanOscNormalize",chanOscNormalize);
|
||||||
e->setConf("chanOscRandomPhase",chanOscRandomPhase);
|
conf.set("chanOscRandomPhase",chanOscRandomPhase);
|
||||||
e->setConf("chanOscTextFormat",chanOscTextFormat);
|
conf.set("chanOscTextFormat",chanOscTextFormat);
|
||||||
e->setConf("chanOscColorR",chanOscColor.x);
|
conf.set("chanOscColorR",chanOscColor.x);
|
||||||
e->setConf("chanOscColorG",chanOscColor.y);
|
conf.set("chanOscColorG",chanOscColor.y);
|
||||||
e->setConf("chanOscColorB",chanOscColor.z);
|
conf.set("chanOscColorB",chanOscColor.z);
|
||||||
e->setConf("chanOscColorA",chanOscColor.w);
|
conf.set("chanOscColorA",chanOscColor.w);
|
||||||
e->setConf("chanOscTextColorR",chanOscTextColor.x);
|
conf.set("chanOscTextColorR",chanOscTextColor.x);
|
||||||
e->setConf("chanOscTextColorG",chanOscTextColor.y);
|
conf.set("chanOscTextColorG",chanOscTextColor.y);
|
||||||
e->setConf("chanOscTextColorB",chanOscTextColor.z);
|
conf.set("chanOscTextColorB",chanOscTextColor.z);
|
||||||
e->setConf("chanOscTextColorA",chanOscTextColor.w);
|
conf.set("chanOscTextColorA",chanOscTextColor.w);
|
||||||
e->setConf("chanOscUseGrad",chanOscUseGrad);
|
conf.set("chanOscUseGrad",chanOscUseGrad);
|
||||||
e->setConf("chanOscGrad",chanOscGrad.toString());
|
conf.set("chanOscGrad",chanOscGrad.toString());
|
||||||
|
|
||||||
// commit x-y osc state
|
// commit x-y osc state
|
||||||
e->setConf("xyOscXChannel",xyOscXChannel);
|
conf.set("xyOscXChannel",xyOscXChannel);
|
||||||
e->setConf("xyOscXInvert",xyOscXInvert);
|
conf.set("xyOscXInvert",xyOscXInvert);
|
||||||
e->setConf("xyOscYChannel",xyOscYChannel);
|
conf.set("xyOscYChannel",xyOscYChannel);
|
||||||
e->setConf("xyOscYInvert",xyOscYInvert);
|
conf.set("xyOscYInvert",xyOscYInvert);
|
||||||
e->setConf("xyOscZoom",xyOscZoom);
|
conf.set("xyOscZoom",xyOscZoom);
|
||||||
e->setConf("xyOscSamples",xyOscSamples);
|
conf.set("xyOscSamples",xyOscSamples);
|
||||||
e->setConf("xyOscDecayTime",xyOscDecayTime);
|
conf.set("xyOscDecayTime",xyOscDecayTime);
|
||||||
e->setConf("xyOscIntensity",xyOscIntensity);
|
conf.set("xyOscIntensity",xyOscIntensity);
|
||||||
e->setConf("xyOscThickness",xyOscThickness);
|
conf.set("xyOscThickness",xyOscThickness);
|
||||||
|
|
||||||
// commit recent files
|
// commit recent files
|
||||||
for (int i=0; i<30; i++) {
|
for (int i=0; i<30; i++) {
|
||||||
String key=fmt::sprintf("recentFile%d",i);
|
String key=fmt::sprintf("recentFile%d",i);
|
||||||
if (i>=settings.maxRecentFile || i>=(int)recentFile.size()) {
|
if (i>=settings.maxRecentFile || i>=(int)recentFile.size()) {
|
||||||
e->setConf(key,"");
|
conf.set(key,"");
|
||||||
} else {
|
} else {
|
||||||
e->setConf(key,recentFile[i]);
|
conf.set(key,recentFile[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
e->setConf("cvHiScore",cvHiScore);
|
conf.set("cvHiScore",cvHiScore);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FurnaceGUI::finish(bool saveConfig) {
|
bool FurnaceGUI::finish(bool saveConfig) {
|
||||||
commitState();
|
commitState(e->getConfObject());
|
||||||
if (userPresetsOpen) {
|
if (userPresetsOpen) {
|
||||||
saveUserPresets(true);
|
saveUserPresets(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2789,7 +2789,8 @@ class FurnaceGUI {
|
||||||
void commitSettings();
|
void commitSettings();
|
||||||
void syncTutorial();
|
void syncTutorial();
|
||||||
void commitTutorial();
|
void commitTutorial();
|
||||||
void commitState();
|
void syncState();
|
||||||
|
void commitState(DivConfig& conf);
|
||||||
void processDrags(int dragX, int dragY);
|
void processDrags(int dragX, int dragY);
|
||||||
void processPoint(SDL_Event& ev);
|
void processPoint(SDL_Event& ev);
|
||||||
|
|
||||||
|
|
|
@ -5311,11 +5311,39 @@ bool FurnaceGUI::exportLayout(String path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FurnaceGUI::importConfig(String path) {
|
bool FurnaceGUI::importConfig(String path) {
|
||||||
return false;
|
DivConfig prevConf=e->getConfObject();
|
||||||
|
DivConfig& conf=e->getConfObject();
|
||||||
|
conf.clear();
|
||||||
|
if (!conf.loadFromFile(path.c_str(),false,false)) {
|
||||||
|
showError(fmt::sprintf("error while loading config! (%s)",strerror(errno)));
|
||||||
|
conf=prevConf;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
syncState();
|
||||||
|
syncSettings();
|
||||||
|
commitSettings();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FurnaceGUI::exportConfig(String path) {
|
bool FurnaceGUI::exportConfig(String path) {
|
||||||
return false;
|
DivConfig exConf=e->getConfObject();
|
||||||
|
writeConfig(exConf,GUI_SETTINGS_ALL);
|
||||||
|
commitState(exConf);
|
||||||
|
|
||||||
|
FILE* f=ps_fopen(path.c_str(),"wb");
|
||||||
|
if (f==NULL) {
|
||||||
|
logW("error while exporting config: %s",strerror(errno));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String result=exConf.toString();
|
||||||
|
|
||||||
|
if (fwrite(result.c_str(),1,result.size(),f)!=result.size()) {
|
||||||
|
logW("couldn't write config entirely.");
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FurnaceGUI::resetColors() {
|
void FurnaceGUI::resetColors() {
|
||||||
|
|
Loading…
Reference in a new issue