VGM export: prepare to fix NES DPCM

This commit is contained in:
tildearrow 2025-05-06 03:44:42 -05:00
parent 82bead2fe4
commit 1cabe743d6
5 changed files with 18 additions and 4 deletions

View file

@ -726,7 +726,7 @@ class DivEngine {
// - x to add x+1 ticks of trailing
// - -1 to auto-determine trailing
// - -2 to add a whole loop of trailing
SafeWriter* saveVGM(bool* sysToExport=NULL, bool loop=true, int version=0x171, bool patternHints=false, bool directStream=false, int trailingTicks=-1);
SafeWriter* saveVGM(bool* sysToExport=NULL, bool loop=true, int version=0x171, bool patternHints=false, bool directStream=false, int trailingTicks=-1, bool dpcm07=false);
// dump to TIunA.
SafeWriter* saveTiuna(const bool* sysToExport, const char* baseLabel, int firstBankSize, int otherBankSize);
// dump command stream.

View file

@ -1215,7 +1215,7 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
chipVol.push_back((_id)|(0x80000100)|(((unsigned int)_vol)<<16)); \
}
SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool patternHints, bool directStream, int trailingTicks) {
SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool patternHints, bool directStream, int trailingTicks, bool dpcm07) {
if (version<0x150) {
lastError="VGM version is too low";
return NULL;

View file

@ -202,8 +202,10 @@ void FurnaceGUI::drawExportVGM(bool onWindow) {
}
ImGui::Text(_("chips to export:"));
bool hasOneAtLeast=false;
bool hasNES=false;
for (int i=0; i<e->song.systemLen; i++) {
int minVersion=e->minVGMVersion(e->song.system[i]);
if (e->song.system[i]==DIV_SYSTEM_NES) hasNES=true;
ImGui::BeginDisabled(minVersion>vgmExportVersion || minVersion==0);
ImGui::Checkbox(fmt::sprintf("%d. %s##_SYSV%d",i+1,getSystemName(e->song.system[i]),i).c_str(),&willExport[i]);
ImGui::EndDisabled();
@ -220,6 +222,17 @@ void FurnaceGUI::drawExportVGM(bool onWindow) {
}
}
ImGui::Text(_("select the chip you wish to export, but only up to %d of each type."),(vgmExportVersion>=0x151)?2:1);
if (hasNES) {
ImGui::Text(_("NES DPCM bank switch method:"));
if (ImGui::RadioButton(_("data blocks"),!vgmExportDPCM07)) {
vgmExportDPCM07=false;
}
if (ImGui::RadioButton(_("RAM write commands"),vgmExportDPCM07)) {
vgmExportDPCM07=true;
}
}
if (hasOneAtLeast) {
if (onWindow) {
ImGui::Separator();

View file

@ -5645,7 +5645,7 @@ bool FurnaceGUI::loop() {
break;
}
case GUI_FILE_EXPORT_VGM: {
SafeWriter* w=e->saveVGM(willExport,vgmExportLoop,vgmExportVersion,vgmExportPatternHints,vgmExportDirectStream,vgmExportTrailingTicks);
SafeWriter* w=e->saveVGM(willExport,vgmExportLoop,vgmExportVersion,vgmExportPatternHints,vgmExportDirectStream,vgmExportTrailingTicks,vgmExportDPCM07);
if (w!=NULL) {
FILE* f=ps_fopen(copyOfName.c_str(),"wb");
if (f!=NULL) {
@ -8427,6 +8427,7 @@ FurnaceGUI::FurnaceGUI():
displayExporting(false),
vgmExportLoop(true),
vgmExportPatternHints(false),
vgmExportDPCM07(false),
vgmExportDirectStream(false),
displayInsTypeList(false),
portrait(false),

View file

@ -1668,7 +1668,7 @@ class FurnaceGUI {
std::vector<String> availRenderDrivers;
std::vector<String> availAudioDrivers;
bool quit, warnQuit, willCommit, edit, editClone, isPatUnique, modified, displayError, displayExporting, vgmExportLoop, vgmExportPatternHints;
bool quit, warnQuit, willCommit, edit, editClone, isPatUnique, modified, displayError, displayExporting, vgmExportLoop, vgmExportPatternHints, vgmExportDPCM07;
bool vgmExportDirectStream, displayInsTypeList, displayWaveSizeList;
bool portrait, injectBackUp, mobileMenuOpen, warnColorPushed;
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;