prepare for new preset format

This commit is contained in:
tildearrow 2022-11-13 15:41:40 -05:00
parent 8ea5c7acc2
commit fbacfd421c
6 changed files with 52 additions and 23 deletions

View file

@ -107,7 +107,7 @@ void FurnaceGUI::drawNewSong() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
if (ImGui::Selectable(i.name,false,ImGuiSelectableFlags_DontClosePopups)) {
nextDesc=i.definition.data();
nextDesc=i.definition;
nextDescName=i.name;
accepted=true;
}
@ -129,7 +129,7 @@ void FurnaceGUI::drawNewSong() {
ImGui::CloseCurrentPopup();
} else {
unsigned int selection=rand()%newSystemCat->systems.size();
nextDesc=newSystemCat->systems[selection].definition.data();
nextDesc=newSystemCat->systems[selection].definition;
nextDescName=newSystemCat->systems[selection].name;
accepted=true;
}
@ -143,16 +143,7 @@ void FurnaceGUI::drawNewSong() {
}
if (accepted) {
// TODO: remove after porting all presets to new format
String oldDescFormat;
for (const int* i=nextDesc; *i; i+=4) {
oldDescFormat+=fmt::sprintf("%d ",e->systemToFileFur((DivSystem)i[0]));
oldDescFormat+=fmt::sprintf("%d ",i[1]);
oldDescFormat+=fmt::sprintf("%d ",i[2]);
oldDescFormat+=fmt::sprintf("%d ",i[3]);
}
String oldDesc=e->decodeSysDesc(oldDescFormat.c_str());
e->createNew(oldDesc.c_str(),nextDescName);
e->createNew(nextDesc.c_str(),nextDescName);
undoHist.clear();
redoHist.clear();
curFileName="";