support empty short command line param names
also add a parameter to disable command stream export optimizations
This commit is contained in:
parent
f79c0689ba
commit
2fd6fa1a87
17
src/main.cpp
17
src/main.cpp
|
@ -90,6 +90,7 @@ String romOutName;
|
|||
String txtOutName;
|
||||
int benchMode=0;
|
||||
int subsong=-1;
|
||||
int cmdDisableOpt=0;
|
||||
DivAudioExportOptions exportOptions;
|
||||
DivConfig romExportConfig;
|
||||
|
||||
|
@ -441,6 +442,17 @@ TAParamResult pCmdOut(String val) {
|
|||
return TA_PARAM_SUCCESS;
|
||||
}
|
||||
|
||||
TAParamResult pCmdOpt(String val) {
|
||||
try {
|
||||
int v=std::stoi(val);
|
||||
cmdDisableOpt=v;
|
||||
} catch (std::exception& e) {
|
||||
logE("command stream export optimization disable bitmask shall be a number.");
|
||||
return TA_PARAM_ERROR;
|
||||
}
|
||||
return TA_PARAM_SUCCESS;
|
||||
}
|
||||
|
||||
TAParamResult pROMOut(String val) {
|
||||
romOutName=val;
|
||||
e.setAudio(DIV_AUDIO_DUMMY);
|
||||
|
@ -482,6 +494,7 @@ void initParams() {
|
|||
params.push_back(TAParam("O","vgmout",true,pVGMOut,"<filename>","output .vgm data"));
|
||||
params.push_back(TAParam("D","direct",false,pDirect,"","set VGM export direct stream mode"));
|
||||
params.push_back(TAParam("C","cmdout",true,pCmdOut,"<filename>","output command stream"));
|
||||
params.push_back(TAParam("","cmdopt",true,pCmdOpt,"<bitmask>","disable command stream optimization passes (+1 command, +2 delay, +4 sub-block)"));
|
||||
params.push_back(TAParam("r","romout",true,pROMOut,"<filename|path>","export ROM file, or path for multi-file export"));
|
||||
params.push_back(TAParam("R","romconf",true,pROMConf,"<key>=<value>","set configuration parameter for ROM export"));
|
||||
params.push_back(TAParam("t","txtout",true,pTxtOut,"<filename>","export as text file"));
|
||||
|
@ -708,7 +721,7 @@ int main(int argc, char** argv) {
|
|||
arg=arg.substr(0,eqSplit);
|
||||
}
|
||||
for (size_t j=0; j<params.size(); j++) {
|
||||
if (params[j].name==arg || params[j].shortName==arg) {
|
||||
if (params[j].name==arg || (params[j].shortName!="" && params[j].shortName==arg)) {
|
||||
switch (params[j].func(val)) {
|
||||
case TA_PARAM_ERROR:
|
||||
return 1;
|
||||
|
@ -881,7 +894,7 @@ int main(int argc, char** argv) {
|
|||
|
||||
if (outputMode) {
|
||||
if (cmdOutName!="") {
|
||||
SafeWriter* w=e.saveCommand();
|
||||
SafeWriter* w=e.saveCommand(NULL,cmdDisableOpt);
|
||||
if (w!=NULL) {
|
||||
FILE* f=ps_fopen(cmdOutName.c_str(),"wb");
|
||||
if (f!=NULL) {
|
||||
|
|
Loading…
Reference in a new issue