From 9fe0efd63ad799b2b1f38bb6e893e23fdfc9a826 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 23 Jan 2022 21:50:45 -0500 Subject: [PATCH] VGM export skeleton DOES NOT WORK VGM export not there yet. please don't use it. --- src/engine/engine.cpp | 148 +++++++++++++++++++++++++++++++++++++++++- src/gui/gui.cpp | 16 +++++ 2 files changed, 163 insertions(+), 1 deletion(-) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 1daf8534..e1d04dba 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -1912,12 +1912,158 @@ SafeWriter* DivEngine::saveVGM() { playSub(false); bool done=false; + int hasSN=0; + //int hasOPLL=0; + int hasOPN2=0; + int hasOPM=0; + int hasSegaPCM=0; + //int hasRFC=0; + //int hasOPN=0; + //int hasOPNA=0; + int hasOPNB=0; + //int hasOPL2=0; + //int hasOPL=0; + //int hasY8950=0; + //int hasOPL3=0; + //int hasZ280=0; + //int hasRFC1=0; + //int hasPWM=0; + int hasAY=0; + int hasGB=0; + int hasNES=0; + //int hasMultiPCM=0; + //int hasuPD7759=0; + //int hasOKIM6258=0; + //int hasK054539=0; + //int hasOKIM6295=0; + //int hasK051649=0; + //int hasK054539=0; + int hasPCE=0; + //int hasNamco=0; + //int hasK053260=0; + //int hasPOKEY=0; + //int hasQSound=0; + //int hasSCSP=0; + //int hasSwan=0; + //int hasVSU=0; + int hasSAA=0; + //int hasES5503=0; + //int hasX1=0; + //int hasC352=0; + //int hasGA20=0; + + SafeWriter* w=new SafeWriter; + w->init(); + + // write header + w->write("Vgm ",4); + w->writeI(0); // will be written later + w->writeI(0x171); // VGM 1.71 + + for (int i=0; itoggleRegisterDump(true); + } + } + while (!done) { if (nextTick()) done=true; + // get register dumps + for (int i=0; igetRegisterWrites()) { + printf("- (%d) %.2x = %.2x\n",i,j.addr,j.val); + } + } + } + + for (int i=0; itoggleRegisterDump(false); } isBusy.unlock(); - return NULL; + return w; } void _runExportThread(DivEngine* caller) { diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 6ba29d24..72cefae7 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -4032,6 +4032,22 @@ bool FurnaceGUI::loop() { } ImGui::EndMenu(); } + if (ImGui::MenuItem("DON'T CLICK ME")) { + SafeWriter* w=e->saveVGM(); + if (w!=NULL) { + FILE* f=fopen("test.vgm","wb"); + if (f!=NULL) { + fwrite(w->getFinalBuf(),1,w->size(),f); + fclose(f); + } else { + showError("FAK"); + } + w->finish(); + delete w; + } else { + showError("could not write VGM. dang it."); + } + } ImGui::Separator(); if (ImGui::BeginMenu("add system...")) { sysAddOption(DIV_SYSTEM_GENESIS);