partially implement command stream binary mode

This commit is contained in:
tildearrow 2022-08-04 18:50:52 -05:00
parent f2b6f854a9
commit 3a18e1e6fc
3 changed files with 181 additions and 48 deletions

View file

@ -64,6 +64,7 @@ bool consoleMode=true;
#endif
bool displayEngineFailError=false;
bool cmdOutBinary=false;
std::vector<TAParam> params;
@ -115,6 +116,11 @@ TAParamResult pConsole(String val) {
return TA_PARAM_SUCCESS;
}
TAParamResult pBinary(String val) {
cmdOutBinary=true;
return TA_PARAM_SUCCESS;
}
TAParamResult pLogLevel(String val) {
if (val=="trace") {
logLevel=LOGLEVEL_TRACE;
@ -273,6 +279,7 @@ void initParams() {
params.push_back(TAParam("o","output",true,pOutput,"<filename>","output audio to file"));
params.push_back(TAParam("O","vgmout",true,pVGMOut,"<filename>","output .vgm data"));
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 (pattern by default)"));
params.push_back(TAParam("c","console",false,pConsole,"","enable console mode"));
@ -454,7 +461,7 @@ int main(int argc, char** argv) {
}
if (outName!="" || vgmOutName!="" || cmdOutName!="") {
if (cmdOutName!="") {
SafeWriter* w=e.saveCommand(false);
SafeWriter* w=e.saveCommand(cmdOutBinary);
if (w!=NULL) {
FILE* f=fopen(cmdOutName.c_str(),"wb");
if (f!=NULL) {