From b213586ca413179242648f7e37c6863e604c86c9 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 8 Aug 2024 15:30:17 -0500 Subject: [PATCH] add options for ZSM and TIunA out --- src/main.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 9bf68e722..70999859e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -112,6 +112,9 @@ bool infoMode=false; bool noReportError=false; +int tiunaFirstBankSize=3072; +int tiunaOtherBankSize=4096-48; + std::vector params; #ifdef HAVE_LOCALE @@ -891,6 +894,39 @@ int main(int argc, char** argv) { reportError(_("could not write VGM!")); } } + if (zsmOutName!="") { + // TODO: changing parameters + SafeWriter* w=e.saveZSM(60,true,true); + if (w!=NULL) { + FILE* f=ps_fopen(zsmOutName.c_str(),"wb"); + if (f!=NULL) { + fwrite(w->getFinalBuf(),1,w->size(),f); + fclose(f); + } else { + reportError(fmt::sprintf(_("could not open file! (%s)"),e.getLastError())); + } + w->finish(); + delete w; + } else { + reportError(fmt::sprintf(_("could not write ZSM! (%s)"),e.getLastError())); + } + } + if (tiunaOutName!="") { + SafeWriter* w=e.saveTiuna(NULL,"asmBaseLabel",tiunaFirstBankSize,tiunaOtherBankSize); + if (w!=NULL) { + FILE* f=ps_fopen(tiunaOutName.c_str(),"wb"); + if (f!=NULL) { + fwrite(w->getFinalBuf(),1,w->size(),f); + fclose(f); + } else { + reportError(fmt::sprintf(_("could not open file! (%s)"),e.getLastError())); + } + w->finish(); + delete w; + } else { + reportError(fmt::sprintf("could not write TIunA! (%s)",e.getLastError())); + } + } if (outName!="") { e.setConsoleMode(true); e.saveAudio(outName.c_str(),exportOptions);