GUI: prevent unified view from bricking mobile

This commit is contained in:
tildearrow 2023-05-18 02:34:19 -05:00
parent c05557b59d
commit dae87a4980

View file

@ -463,181 +463,185 @@ void FurnaceGUI::drawMobileControls() {
ImGui::Separator();
if (settings.unifiedDataView) {
drawInsList(true);
} else {
switch (mobScene) {
case GUI_SCENE_PATTERN:
case GUI_SCENE_ORDERS:
case GUI_SCENE_INSTRUMENT:
switch (mobScene) {
case GUI_SCENE_PATTERN:
case GUI_SCENE_ORDERS:
case GUI_SCENE_INSTRUMENT:
drawInsList(true);
break;
case GUI_SCENE_WAVETABLE:
if (settings.unifiedDataView) {
drawInsList(true);
break;
case GUI_SCENE_WAVETABLE:
} else {
drawWaveList(true);
break;
case GUI_SCENE_SAMPLE:
}
break;
case GUI_SCENE_SAMPLE:
if (settings.unifiedDataView) {
drawInsList(true);
} else {
drawSampleList(true);
break;
case GUI_SCENE_SONG: {
if (ImGui::Button("New")) {
mobileMenuOpen=false;
//doAction(GUI_ACTION_NEW);
if (modified) {
showWarning("Unsaved changes! Save changes before creating a new song?",GUI_WARN_NEW);
} else {
displayNew=true;
}
}
ImGui::SameLine();
if (ImGui::Button("Open")) {
mobileMenuOpen=false;
doAction(GUI_ACTION_OPEN);
}
ImGui::SameLine();
if (ImGui::Button("Save")) {
mobileMenuOpen=false;
doAction(GUI_ACTION_SAVE);
}
ImGui::SameLine();
if (ImGui::Button("Save as...")) {
mobileMenuOpen=false;
doAction(GUI_ACTION_SAVE_AS);
}
ImGui::Button("1.1+ .dmf");
ImGui::SameLine();
ImGui::Button("Legacy .dmf");
ImGui::SameLine();
if (ImGui::Button("Export Audio")) {
openFileDialog(GUI_FILE_EXPORT_AUDIO_ONE);
}
ImGui::SameLine();
if (ImGui::Button("Export VGM")) {
openFileDialog(GUI_FILE_EXPORT_VGM);
}
if (ImGui::Button("CmdStream")) {
openFileDialog(GUI_FILE_EXPORT_CMDSTREAM_BINARY);
}
ImGui::SameLine();
if (ImGui::Button("CmdStream Text")) {
openFileDialog(GUI_FILE_EXPORT_CMDSTREAM);
}
if (ImGui::Button("Restore Backup")) {
mobileMenuOpen=false;
doAction(GUI_ACTION_OPEN_BACKUP);
}
ImGui::Separator();
if (ImGui::BeginTabBar("MobileSong")) {
if (ImGui::BeginTabItem("Song Info")) {
drawSongInfo(true);
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Subsongs")) {
drawSubSongs(true);
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Speed")) {
drawSpeed(true);
ImGui::EndTabItem();
}
ImGui::EndTabBar();
}
break;
}
case GUI_SCENE_CHANNELS:
ImGui::Text("Channels here...");
break;
case GUI_SCENE_CHIPS:
ImGui::Text("Chips here...");
break;
case GUI_SCENE_MIXER:
ImGui::Text("What the hell...");
break;
case GUI_SCENE_OTHER: {
if (ImGui::Button("Osc")) {
oscOpen=!oscOpen;
break;
case GUI_SCENE_SONG: {
if (ImGui::Button("New")) {
mobileMenuOpen=false;
//doAction(GUI_ACTION_NEW);
if (modified) {
showWarning("Unsaved changes! Save changes before creating a new song?",GUI_WARN_NEW);
} else {
displayNew=true;
}
ImGui::SameLine();
if (ImGui::Button("ChanOsc")) {
chanOscOpen=!chanOscOpen;
}
ImGui::SameLine();
if (ImGui::Button("RegView")) {
regViewOpen=!regViewOpen;
}
ImGui::SameLine();
if (ImGui::Button("Stats")) {
statsOpen=!statsOpen;
}
if (ImGui::Button("Compat Flags")) {
compatFlagsOpen=!compatFlagsOpen;
}
ImGui::Separator();
ImGui::Button("Panic");
ImGui::SameLine();
if (ImGui::Button("Settings")) {
mobileMenuOpen=false;
settingsOpen=true;
}
ImGui::SameLine();
if (ImGui::Button("Log")) {
logOpen=!logOpen;
}
ImGui::SameLine();
if (ImGui::Button("Debug")) {
debugOpen=!debugOpen;
}
ImGui::SameLine();
if (ImGui::Button("About")) {
mobileMenuOpen=false;
mobileMenuPos=0.0f;
aboutOpen=true;
}
if (ImGui::Button("Switch to Desktop Mode")) {
toggleMobileUI(!mobileUI);
}
int numAmiga=0;
for (int i=0; i<e->song.systemLen; i++) {
if (e->song.system[i]==DIV_SYSTEM_AMIGA) numAmiga++;
}
if (numAmiga) {
ImGui::Text(
"this is NOT ROM export! only use for making sure the\n"
"Furnace Amiga emulator is working properly by\n"
"comparing it with real Amiga output."
);
ImGui::Text("Directory");
ImGui::SameLine();
ImGui::InputText("##AVDPath",&workingDirROMExport);
if (ImGui::Button("Bake Data")) {
std::vector<DivROMExportOutput> out=e->buildROM(DIV_ROM_AMIGA_VALIDATION);
if (workingDirROMExport.size()>0) {
if (workingDirROMExport[workingDirROMExport.size()-1]!=DIR_SEPARATOR) workingDirROMExport+=DIR_SEPARATOR_STR;
}
for (DivROMExportOutput& i: out) {
String path=workingDirROMExport+i.name;
FILE* outFile=ps_fopen(path.c_str(),"wb");
if (outFile!=NULL) {
fwrite(i.data->getFinalBuf(),1,i.data->size(),outFile);
fclose(outFile);
}
i.data->finish();
delete i.data;
}
showError(fmt::sprintf("Done! Baked %d files.",(int)out.size()));
}
}
break;
}
ImGui::SameLine();
if (ImGui::Button("Open")) {
mobileMenuOpen=false;
doAction(GUI_ACTION_OPEN);
}
ImGui::SameLine();
if (ImGui::Button("Save")) {
mobileMenuOpen=false;
doAction(GUI_ACTION_SAVE);
}
ImGui::SameLine();
if (ImGui::Button("Save as...")) {
mobileMenuOpen=false;
doAction(GUI_ACTION_SAVE_AS);
}
ImGui::Button("1.1+ .dmf");
ImGui::SameLine();
ImGui::Button("Legacy .dmf");
ImGui::SameLine();
if (ImGui::Button("Export Audio")) {
openFileDialog(GUI_FILE_EXPORT_AUDIO_ONE);
}
ImGui::SameLine();
if (ImGui::Button("Export VGM")) {
openFileDialog(GUI_FILE_EXPORT_VGM);
}
if (ImGui::Button("CmdStream")) {
openFileDialog(GUI_FILE_EXPORT_CMDSTREAM_BINARY);
}
ImGui::SameLine();
if (ImGui::Button("CmdStream Text")) {
openFileDialog(GUI_FILE_EXPORT_CMDSTREAM);
}
if (ImGui::Button("Restore Backup")) {
mobileMenuOpen=false;
doAction(GUI_ACTION_OPEN_BACKUP);
}
ImGui::Separator();
if (ImGui::BeginTabBar("MobileSong")) {
if (ImGui::BeginTabItem("Song Info")) {
drawSongInfo(true);
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Subsongs")) {
drawSubSongs(true);
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Speed")) {
drawSpeed(true);
ImGui::EndTabItem();
}
ImGui::EndTabBar();
}
break;
}
case GUI_SCENE_CHANNELS:
ImGui::Text("Channels here...");
break;
case GUI_SCENE_CHIPS:
ImGui::Text("Chips here...");
break;
case GUI_SCENE_MIXER:
ImGui::Text("What the hell...");
break;
case GUI_SCENE_OTHER: {
if (ImGui::Button("Osc")) {
oscOpen=!oscOpen;
}
ImGui::SameLine();
if (ImGui::Button("ChanOsc")) {
chanOscOpen=!chanOscOpen;
}
ImGui::SameLine();
if (ImGui::Button("RegView")) {
regViewOpen=!regViewOpen;
}
ImGui::SameLine();
if (ImGui::Button("Stats")) {
statsOpen=!statsOpen;
}
if (ImGui::Button("Compat Flags")) {
compatFlagsOpen=!compatFlagsOpen;
}
ImGui::Separator();
ImGui::Button("Panic");
ImGui::SameLine();
if (ImGui::Button("Settings")) {
mobileMenuOpen=false;
settingsOpen=true;
}
ImGui::SameLine();
if (ImGui::Button("Log")) {
logOpen=!logOpen;
}
ImGui::SameLine();
if (ImGui::Button("Debug")) {
debugOpen=!debugOpen;
}
ImGui::SameLine();
if (ImGui::Button("About")) {
mobileMenuOpen=false;
mobileMenuPos=0.0f;
aboutOpen=true;
}
if (ImGui::Button("Switch to Desktop Mode")) {
toggleMobileUI(!mobileUI);
}
int numAmiga=0;
for (int i=0; i<e->song.systemLen; i++) {
if (e->song.system[i]==DIV_SYSTEM_AMIGA) numAmiga++;
}
if (numAmiga) {
ImGui::Text(
"this is NOT ROM export! only use for making sure the\n"
"Furnace Amiga emulator is working properly by\n"
"comparing it with real Amiga output."
);
ImGui::Text("Directory");
ImGui::SameLine();
ImGui::InputText("##AVDPath",&workingDirROMExport);
if (ImGui::Button("Bake Data")) {
std::vector<DivROMExportOutput> out=e->buildROM(DIV_ROM_AMIGA_VALIDATION);
if (workingDirROMExport.size()>0) {
if (workingDirROMExport[workingDirROMExport.size()-1]!=DIR_SEPARATOR) workingDirROMExport+=DIR_SEPARATOR_STR;
}
for (DivROMExportOutput& i: out) {
String path=workingDirROMExport+i.name;
FILE* outFile=ps_fopen(path.c_str(),"wb");
if (outFile!=NULL) {
fwrite(i.data->getFinalBuf(),1,i.data->size(),outFile);
fclose(outFile);
}
i.data->finish();
delete i.data;
}
showError(fmt::sprintf("Done! Baked %d files.",(int)out.size()));
}
}
break;
}
}
}