mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-26 14:33:01 +00:00
remove text command stream export
NOTE: this is not removal of text export.
This commit is contained in:
parent
5dd62d45fa
commit
db9a11a674
9 changed files with 203 additions and 280 deletions
|
@ -76,10 +76,9 @@ click on **Begin Export** to... you know.
|
|||
|
||||
## export command stream
|
||||
|
||||
this option exports a text or binary file which contains a dump of the internal command stream produced when playing the song.
|
||||
this option exports a binary file which contains a dump of the internal command stream produced when playing the song.
|
||||
|
||||
it's not really useful, unless you're a developer and want to use a command stream dump for some reason (e.g. writing a hardware sound driver).
|
||||
|
||||
- **export (binary)**: exports in Furnace's own command stream format (FCS). see `export-tech.md` in `papers/` for details.
|
||||
- **export (text)**: exports the command stream as a text file. only useful for analysis, really.
|
||||
- **export**: exports in Furnace's own command stream format (FCS). see `export-tech.md` in `papers/` for details.
|
||||
|
||||
|
|
|
@ -83,7 +83,6 @@ the following parameters may be used:
|
|||
|
||||
- `-cmdout path`: output command stream dump to `path`.
|
||||
- you must provide a file, otherwise Furnace will quit.
|
||||
- `-binary`: set command stream output format to binary.
|
||||
|
||||
## COMMAND LINE INTERFACE
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "../ta-log.h"
|
||||
|
||||
#define WRITE_TICK(x) \
|
||||
if (binary) { \
|
||||
if (!wroteTick[x]) { \
|
||||
wroteTick[x]=true; \
|
||||
if (tick-lastTick[x]>255) { \
|
||||
|
@ -35,12 +34,6 @@
|
|||
chanStream[x]->writeC(0xfe); \
|
||||
} \
|
||||
lastTick[x]=tick; \
|
||||
} \
|
||||
} else { \
|
||||
if (!wroteTickGlobal) { \
|
||||
wroteTickGlobal=true; \
|
||||
w->writeText(fmt::sprintf(">> TICK %d\n",tick)); \
|
||||
} \
|
||||
}
|
||||
|
||||
void writePackedCommandValues(SafeWriter* w, const DivCommand& c) {
|
||||
|
@ -205,7 +198,7 @@ void writePackedCommandValues(SafeWriter* w, const DivCommand& c) {
|
|||
}
|
||||
}
|
||||
|
||||
SafeWriter* DivEngine::saveCommand(bool binary) {
|
||||
SafeWriter* DivEngine::saveCommand() {
|
||||
stop();
|
||||
repeatPattern=false;
|
||||
shallStop=false;
|
||||
|
@ -243,7 +236,6 @@ SafeWriter* DivEngine::saveCommand(bool binary) {
|
|||
w->init();
|
||||
|
||||
// write header
|
||||
if (binary) {
|
||||
w->write("FCS",4);
|
||||
w->writeI(chans);
|
||||
// offsets
|
||||
|
@ -256,36 +248,11 @@ SafeWriter* DivEngine::saveCommand(bool binary) {
|
|||
for (int i=0; i<32; i++) {
|
||||
w->writeC(0);
|
||||
}
|
||||
} else {
|
||||
w->writeText("# Furnace Command Stream\n\n");
|
||||
|
||||
w->writeText("[Information]\n");
|
||||
w->writeText(fmt::sprintf("name: %s\n",song.name));
|
||||
w->writeText(fmt::sprintf("author: %s\n",song.author));
|
||||
w->writeText(fmt::sprintf("category: %s\n",song.category));
|
||||
w->writeText(fmt::sprintf("system: %s\n",song.systemName));
|
||||
|
||||
w->writeText("\n");
|
||||
|
||||
w->writeText("[SubSongInformation]\n");
|
||||
w->writeText(fmt::sprintf("name: %s\n",curSubSong->name));
|
||||
w->writeText(fmt::sprintf("tickRate: %f\n",curSubSong->hz));
|
||||
|
||||
w->writeText("\n");
|
||||
|
||||
w->writeText("[SysDefinition]\n");
|
||||
// TODO
|
||||
|
||||
w->writeText("\n");
|
||||
}
|
||||
|
||||
// play the song ourselves
|
||||
bool done=false;
|
||||
playSub(false);
|
||||
|
||||
if (!binary) {
|
||||
w->writeText("[Stream]\n");
|
||||
}
|
||||
int tick=0;
|
||||
bool oldCmdStreamEnabled=cmdStreamEnabled;
|
||||
cmdStreamEnabled=true;
|
||||
|
@ -305,12 +272,8 @@ SafeWriter* DivEngine::saveCommand(bool binary) {
|
|||
if (curDivider!=divider) {
|
||||
curDivider=divider;
|
||||
WRITE_TICK(0);
|
||||
if (binary) {
|
||||
chanStream[0]->writeC(0xfb);
|
||||
chanStream[0]->writeI((int)(curDivider*65536));
|
||||
} else {
|
||||
w->writeText(fmt::sprintf(">> SET_RATE %f\n",curDivider));
|
||||
}
|
||||
}
|
||||
for (DivCommand& i: cmdStream) {
|
||||
switch (i.cmd) {
|
||||
|
@ -329,12 +292,8 @@ SafeWriter* DivEngine::saveCommand(bool binary) {
|
|||
break;
|
||||
default:
|
||||
WRITE_TICK(i.chan);
|
||||
if (binary) {
|
||||
cmdPopularity[i.cmd]++;
|
||||
writePackedCommandValues(chanStream[i.chan],i);
|
||||
} else {
|
||||
w->writeText(fmt::sprintf(" %d: %s %d %d\n",i.chan,cmdName[i.cmd],i.value,i.value2));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -348,7 +307,6 @@ SafeWriter* DivEngine::saveCommand(bool binary) {
|
|||
}
|
||||
cmdStreamEnabled=oldCmdStreamEnabled;
|
||||
|
||||
if (binary) {
|
||||
int sortCand=-1;
|
||||
int sortPos=0;
|
||||
while (sortPos<16) {
|
||||
|
@ -528,13 +486,6 @@ SafeWriter* DivEngine::saveCommand(bool binary) {
|
|||
w->writeC(sortedCmd[i]);
|
||||
if (sortedCmdPopularity[i]) logD("- %s: %d",cmdName[sortedCmd[i]],sortedCmdPopularity[i]);
|
||||
}
|
||||
} else {
|
||||
if (!playing) {
|
||||
w->writeText(">> END\n");
|
||||
} else {
|
||||
w->writeText(">> LOOP 0\n");
|
||||
}
|
||||
}
|
||||
|
||||
remainingLoops=-1;
|
||||
playing=false;
|
||||
|
|
|
@ -655,7 +655,7 @@ class DivEngine {
|
|||
// dump to ZSM.
|
||||
SafeWriter* saveZSM(unsigned int zsmrate=60, bool loop=true, bool optimize=true);
|
||||
// dump command stream.
|
||||
SafeWriter* saveCommand(bool binary=false);
|
||||
SafeWriter* saveCommand();
|
||||
// export to text
|
||||
SafeWriter* saveText(bool separatePatterns=true);
|
||||
// export to an audio file
|
||||
|
|
|
@ -44,7 +44,7 @@ void FurnaceGUI::drawCSPlayer() {
|
|||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Burn Current Song")) {
|
||||
SafeWriter* w=e->saveCommand(true);
|
||||
SafeWriter* w=e->saveCommand();
|
||||
if (w!=NULL) {
|
||||
if (!e->playStream(w->getFinalBuf(),w->size())) {
|
||||
showError(e->getLastError());
|
||||
|
|
|
@ -242,15 +242,10 @@ void FurnaceGUI::drawExportCommand(bool onWindow) {
|
|||
);
|
||||
if (onWindow) {
|
||||
ImGui::Separator();
|
||||
if (ImGui::Button("Cancel",ImVec2(133.3f*dpiScale,0))) ImGui::CloseCurrentPopup();
|
||||
if (ImGui::Button("Cancel",ImVec2(200.0f*dpiScale,0))) ImGui::CloseCurrentPopup();
|
||||
ImGui::SameLine();
|
||||
}
|
||||
if (ImGui::Button("Export (binary)",ImVec2(133.3f*dpiScale,0))) {
|
||||
openFileDialog(GUI_FILE_EXPORT_CMDSTREAM_BINARY);
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Export (text)",ImVec2(133.3f*dpiScale,0))) {
|
||||
if (ImGui::Button("Export",ImVec2(200.0f*dpiScale,0))) {
|
||||
openFileDialog(GUI_FILE_EXPORT_CMDSTREAM);
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
|
|
@ -1894,15 +1894,6 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
|||
);
|
||||
break;
|
||||
case GUI_FILE_EXPORT_CMDSTREAM:
|
||||
if (!dirExists(workingDirROMExport)) workingDirROMExport=getHomeDir();
|
||||
hasOpened=fileDialog->openSave(
|
||||
"Export Command Stream",
|
||||
{"text file", "*.txt"},
|
||||
workingDirROMExport,
|
||||
dpiScale
|
||||
);
|
||||
break;
|
||||
case GUI_FILE_EXPORT_CMDSTREAM_BINARY:
|
||||
if (!dirExists(workingDirROMExport)) workingDirROMExport=getHomeDir();
|
||||
hasOpened=fileDialog->openSave(
|
||||
"Export Command Stream",
|
||||
|
@ -4829,7 +4820,6 @@ bool FurnaceGUI::loop() {
|
|||
case GUI_FILE_EXPORT_ROM:
|
||||
case GUI_FILE_EXPORT_TEXT:
|
||||
case GUI_FILE_EXPORT_CMDSTREAM:
|
||||
case GUI_FILE_EXPORT_CMDSTREAM_BINARY:
|
||||
workingDirROMExport=fileDialog->getPath()+DIR_SEPARATOR_STR;
|
||||
break;
|
||||
case GUI_FILE_LOAD_MAIN_FONT:
|
||||
|
@ -4919,10 +4909,10 @@ bool FurnaceGUI::loop() {
|
|||
if (curFileDialog==GUI_FILE_EXPORT_ZSM) {
|
||||
checkExtension(".zsm");
|
||||
}
|
||||
if (curFileDialog==GUI_FILE_EXPORT_CMDSTREAM || curFileDialog==GUI_FILE_EXPORT_TEXT) {
|
||||
if (curFileDialog==GUI_FILE_EXPORT_TEXT) {
|
||||
checkExtension(".txt");
|
||||
}
|
||||
if (curFileDialog==GUI_FILE_EXPORT_CMDSTREAM_BINARY) {
|
||||
if (curFileDialog==GUI_FILE_EXPORT_CMDSTREAM) {
|
||||
checkExtension(".bin");
|
||||
}
|
||||
if (curFileDialog==GUI_FILE_EXPORT_COLORS) {
|
||||
|
@ -5316,11 +5306,8 @@ bool FurnaceGUI::loop() {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case GUI_FILE_EXPORT_CMDSTREAM:
|
||||
case GUI_FILE_EXPORT_CMDSTREAM_BINARY: {
|
||||
bool isBinary=(curFileDialog==GUI_FILE_EXPORT_CMDSTREAM_BINARY);
|
||||
|
||||
SafeWriter* w=e->saveCommand(isBinary);
|
||||
case GUI_FILE_EXPORT_CMDSTREAM: {
|
||||
SafeWriter* w=e->saveCommand();
|
||||
if (w!=NULL) {
|
||||
FILE* f=ps_fopen(copyOfName.c_str(),"wb");
|
||||
if (f!=NULL) {
|
||||
|
|
|
@ -537,7 +537,6 @@ enum FurnaceGUIFileDialogs {
|
|||
GUI_FILE_EXPORT_VGM,
|
||||
GUI_FILE_EXPORT_ZSM,
|
||||
GUI_FILE_EXPORT_CMDSTREAM,
|
||||
GUI_FILE_EXPORT_CMDSTREAM_BINARY,
|
||||
GUI_FILE_EXPORT_TEXT,
|
||||
GUI_FILE_EXPORT_ROM,
|
||||
GUI_FILE_LOAD_MAIN_FONT,
|
||||
|
|
|
@ -72,7 +72,6 @@ bool consoleMode=true;
|
|||
#endif
|
||||
|
||||
bool displayEngineFailError=false;
|
||||
bool cmdOutBinary=false;
|
||||
bool vgmOutDirect=false;
|
||||
|
||||
bool safeMode=false;
|
||||
|
@ -153,11 +152,6 @@ TAParamResult pSafeModeAudio(String val) {
|
|||
#endif
|
||||
}
|
||||
|
||||
TAParamResult pBinary(String val) {
|
||||
cmdOutBinary=true;
|
||||
return TA_PARAM_SUCCESS;
|
||||
}
|
||||
|
||||
TAParamResult pDirect(String val) {
|
||||
vgmOutDirect=true;
|
||||
return TA_PARAM_SUCCESS;
|
||||
|
@ -373,7 +367,6 @@ void initParams() {
|
|||
params.push_back(TAParam("D","direct",false,pDirect,"","set VGM export direct stream mode"));
|
||||
params.push_back(TAParam("Z","zsmout",true,pZSMOut,"<filename>","output .zsm data for Commander X16 Zsound"));
|
||||
params.push_back(TAParam("C","cmdout",true,pCmdOut,"<filename>","output command stream"));
|
||||
params.push_back(TAParam("b","binary",false,pBinary,"","set command stream output format to binary"));
|
||||
params.push_back(TAParam("L","loglevel",true,pLogLevel,"debug|info|warning|error","set the log level (info by default)"));
|
||||
params.push_back(TAParam("v","view",true,pView,"pattern|commands|nothing","set visualization (nothing by default)"));
|
||||
params.push_back(TAParam("i","info",false,pInfo,"","get info about a song"));
|
||||
|
@ -660,7 +653,7 @@ int main(int argc, char** argv) {
|
|||
|
||||
if (outName!="" || vgmOutName!="" || cmdOutName!="") {
|
||||
if (cmdOutName!="") {
|
||||
SafeWriter* w=e.saveCommand(cmdOutBinary);
|
||||
SafeWriter* w=e.saveCommand();
|
||||
if (w!=NULL) {
|
||||
FILE* f=fopen(cmdOutName.c_str(),"wb");
|
||||
if (f!=NULL) {
|
||||
|
|
Loading…
Reference in a new issue