convert presets to new format, part 2
This commit is contained in:
parent
d422372b7f
commit
ea643c574c
|
@ -1390,10 +1390,14 @@ String DivEngine::decodeSysDesc(String desc) {
|
|||
return newDesc.toBase64();
|
||||
}
|
||||
|
||||
void DivEngine::initSongWithDesc(const char* description) {
|
||||
void DivEngine::initSongWithDesc(const char* description, bool inBase64) {
|
||||
int chanCount=0;
|
||||
DivConfig c;
|
||||
c.loadFromBase64(description);
|
||||
if (inBase64) {
|
||||
c.loadFromBase64(description);
|
||||
} else {
|
||||
c.loadFromMemory(description);
|
||||
}
|
||||
int index=0;
|
||||
for (; index<32; index++) {
|
||||
song.system[index]=systemFromFileFur(c.getInt(fmt::sprintf("id%d",index),0));
|
||||
|
@ -1414,7 +1418,7 @@ void DivEngine::initSongWithDesc(const char* description) {
|
|||
song.systemLen=index;
|
||||
}
|
||||
|
||||
void DivEngine::createNew(const char* description, String sysName) {
|
||||
void DivEngine::createNew(const char* description, String sysName, bool inBase64) {
|
||||
quitDispatch();
|
||||
BUSY_BEGIN;
|
||||
saveLock.lock();
|
||||
|
@ -1422,7 +1426,7 @@ void DivEngine::createNew(const char* description, String sysName) {
|
|||
song=DivSong();
|
||||
changeSong(0);
|
||||
if (description!=NULL) {
|
||||
initSongWithDesc(description);
|
||||
initSongWithDesc(description,inBase64);
|
||||
}
|
||||
if (sysName=="") {
|
||||
song.systemName=getSongSystemLegacyName(song,!getConfInt("noMultiSystem",0));
|
||||
|
|
|
@ -467,7 +467,7 @@ class DivEngine {
|
|||
bool deinitAudioBackend(bool dueToSwitchMaster=false);
|
||||
|
||||
void registerSystems();
|
||||
void initSongWithDesc(const char* description);
|
||||
void initSongWithDesc(const char* description, bool inBase64=true);
|
||||
|
||||
void exchangeIns(int one, int two);
|
||||
void swapChannels(int src, int dest);
|
||||
|
@ -501,7 +501,7 @@ class DivEngine {
|
|||
// parse old system setup description
|
||||
String decodeSysDesc(String desc);
|
||||
// start fresh
|
||||
void createNew(const char* description, String sysName);
|
||||
void createNew(const char* description, String sysName, bool inBase64=true);
|
||||
// load a file.
|
||||
bool load(unsigned char* f, size_t length);
|
||||
// save as .dmf.
|
||||
|
|
|
@ -4438,9 +4438,14 @@ bool FurnaceGUI::loop() {
|
|||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
ImGui::SetNextWindowSizeConstraints(ImVec2(400.0f*dpiScale,200.0f*dpiScale),ImVec2(canvasW,canvasH));
|
||||
ImVec2 newSongMinSize=mobileUI?ImVec2(canvasW-(portrait?0:(60.0*dpiScale)),canvasH-60.0*dpiScale):ImVec2(400.0f*dpiScale,200.0f*dpiScale);
|
||||
ImVec2 newSongMaxSize=ImVec2(canvasW-((mobileUI && !portrait)?(60.0*dpiScale):0),canvasH-(mobileUI?(60.0*dpiScale):0));
|
||||
ImGui::SetNextWindowSizeConstraints(newSongMinSize,newSongMaxSize);
|
||||
if (ImGui::BeginPopupModal("New Song",NULL,ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoScrollWithMouse|ImGuiWindowFlags_NoScrollbar)) {
|
||||
ImGui::SetWindowPos(ImVec2(((canvasW)-ImGui::GetWindowSize().x)*0.5,((canvasH)-ImGui::GetWindowSize().y)*0.5));
|
||||
if (ImGui::GetWindowSize().x<newSongMinSize.x || ImGui::GetWindowSize().y<newSongMinSize.y) {
|
||||
ImGui::SetWindowSize(newSongMinSize,ImGuiCond_Always);
|
||||
}
|
||||
drawNewSong();
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ void FurnaceGUI::drawNewSong() {
|
|||
}
|
||||
|
||||
if (accepted) {
|
||||
e->createNew(nextDesc.c_str(),nextDescName);
|
||||
e->createNew(nextDesc.c_str(),nextDescName,false);
|
||||
undoHist.clear();
|
||||
redoHist.clear();
|
||||
curFileName="";
|
||||
|
|
|
@ -2335,16 +2335,16 @@ FurnaceGUISysDef::FurnaceGUISysDef(const char* n, std::initializer_list<int> def
|
|||
if (uncompiled[i]==0) break;
|
||||
|
||||
DivConfig oldFlags;
|
||||
DivEngine::convertOldFlags(uncompiled[3],oldFlags,(DivSystem)uncompiled[0]);
|
||||
DivEngine::convertOldFlags(uncompiled[i+3],oldFlags,(DivSystem)uncompiled[i]);
|
||||
|
||||
definition+=fmt::sprintf(
|
||||
"id%d=%d\nvol%d=%d\npan%d=%d\nflags%d=%s\n",
|
||||
index,
|
||||
DivEngine::systemToFileFur((DivSystem)uncompiled[0]),
|
||||
DivEngine::systemToFileFur((DivSystem)uncompiled[i]),
|
||||
index,
|
||||
uncompiled[1],
|
||||
uncompiled[i+1],
|
||||
index,
|
||||
uncompiled[2],
|
||||
uncompiled[i+2],
|
||||
index,
|
||||
oldFlags.toBase64()
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue