GUI: add advanced VGM export menu

does NOT work yet!
This commit is contained in:
tildearrow 2022-01-26 00:26:15 -05:00
parent b2d2da1f1c
commit 496501803f
4 changed files with 58 additions and 3 deletions

View File

@ -625,6 +625,29 @@ DivInstrumentType DivEngine::getPreferInsType(int chan) {
return DIV_INS_FM;
}
bool DivEngine::isVGMExportable(DivSystem which) {
switch (which) {
case DIV_SYSTEM_GENESIS:
case DIV_SYSTEM_GENESIS_EXT:
case DIV_SYSTEM_SMS:
case DIV_SYSTEM_GB:
case DIV_SYSTEM_PCE:
case DIV_SYSTEM_NES:
case DIV_SYSTEM_ARCADE:
case DIV_SYSTEM_YM2151:
case DIV_SYSTEM_YM2612:
case DIV_SYSTEM_YM2610:
case DIV_SYSTEM_YM2610_EXT:
case DIV_SYSTEM_AY8910:
case DIV_SYSTEM_AY8930:
case DIV_SYSTEM_SAA1099:
return true;
default:
return false;
}
return false;
}
const char* DivEngine::getEffectDesc(unsigned char effect, int chan) {
switch (effect) {
case 0x00:

View File

@ -234,6 +234,9 @@ class DivEngine {
// notify wavetable change
void notifyWaveChange(int wave);
// returns whether a system is VGM compatible
bool isVGMExportable(DivSystem which);
// save config
bool saveConf();

View File

@ -4038,8 +4038,33 @@ bool FurnaceGUI::loop() {
}
ImGui::EndMenu();
}
if (ImGui::MenuItem("export VGM...")) {
openFileDialog(GUI_FILE_EXPORT_VGM);
if (ImGui::BeginMenu("export VGM...")) {
ImGui::Text("settings:");
ImGui::Checkbox("loop",&vgmExportLoop);
ImGui::Text("systems to export:");;
bool hasOneAtLeast=false;
for (int i=0; i<e->song.systemLen; i++) {
ImGui::BeginDisabled(!e->isVGMExportable(e->song.system[i]));
ImGui::Checkbox(fmt::sprintf("%d. %s##_SYSV%d",i+1,e->getSystemName(e->song.system[i]),i).c_str(),&willExport[i]);
ImGui::EndDisabled();
if (!e->isVGMExportable(e->song.system[i])) {
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
ImGui::SetTooltip("this system is not supported by the VGM format!");
}
} else {
if (willExport[i]) hasOneAtLeast=true;
}
}
ImGui::Text("select the systems you wish to export,");
ImGui::Text("but only up to 2 of each type.");
if (hasOneAtLeast) {
if (ImGui::MenuItem("click to export")) {
openFileDialog(GUI_FILE_EXPORT_VGM);
}
} else {
ImGui::Text("nothing to export");
}
ImGui::EndMenu();
}
ImGui::Separator();
if (ImGui::BeginMenu("add system...")) {
@ -4742,6 +4767,7 @@ FurnaceGUI::FurnaceGUI():
modified(false),
displayError(false),
displayExporting(false),
vgmExportLoop(true),
curFileDialog(GUI_FILE_OPEN),
warnAction(GUI_WARN_OPEN),
scrW(1280),
@ -4869,4 +4895,6 @@ FurnaceGUI::FurnaceGUI():
valueKeys[SDLK_d]=13;
valueKeys[SDLK_e]=14;
valueKeys[SDLK_f]=15;
memset(willExport,1,32*sizeof(bool));
}

View File

@ -162,7 +162,8 @@ class FurnaceGUI {
String workingDir, fileName, clipboard, warnString, errorString, lastError, curFileName;
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting;
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop;
bool willExport[32];
FurnaceGUIFileDialogs curFileDialog;
FurnaceGUIWarnings warnAction;