From 6cc5bd8eb577eb6a07fcbd5077cd912a73aa0993 Mon Sep 17 00:00:00 2001 From: bbbradsmith Date: Thu, 12 Dec 2024 15:52:07 -0500 Subject: [PATCH] Replace cumbersome command line output strings test with shared boolean --- src/main.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index e1c83d452..d15c57598 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -725,14 +725,16 @@ int main(int argc, char** argv) { return 1; } - if (fileName.empty() && (benchMode || infoMode || outName!="" || vgmOutName!="" || cmdOutName!="" || txtOutName!="")) { + const bool outputMode = outName!="" || vgmOutName!="" || cmdOutName!="" || txtOutName!=""; + + if (fileName.empty() && (benchMode || infoMode || outputMode)) { logE("provide a file!"); return 1; } #ifdef HAVE_GUI - if (e.preInit(consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || cmdOutName!="" || txtOutName!="")) { - if (consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || cmdOutName!="" || txtOutName!="") { + if (e.preInit(consoleMode || benchMode || infoMode || outputMode)) { + if (consoleMode || benchMode || infoMode || outputMode) { logW("engine wants safe mode, but Furnace GUI is not going to start."); } else { safeMode=true; @@ -744,7 +746,7 @@ int main(int argc, char** argv) { } #endif - if (safeMode && (consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || cmdOutName!="" || txtOutName!="")) { + if (safeMode && (consoleMode || benchMode || infoMode || outputMode)) { logE("you can't use safe mode and console/export mode together."); return 1; } @@ -761,7 +763,7 @@ int main(int argc, char** argv) { #endif - if (!fileName.empty() && ((!e.getConfBool("tutIntroPlayed",TUT_INTRO_PLAYED)) || e.getConfInt("alwaysPlayIntro",0)!=3 || consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || cmdOutName!="" || txtOutName!="")) { + if (!fileName.empty() && ((!e.getConfBool("tutIntroPlayed",TUT_INTRO_PLAYED)) || e.getConfInt("alwaysPlayIntro",0)!=3 || consoleMode || benchMode || infoMode || outputMode)) { logI("loading module..."); FILE* f=ps_fopen(fileName.c_str(),"rb"); if (f==NULL) { @@ -853,7 +855,7 @@ int main(int argc, char** argv) { return 0; } - if (outName!="" || vgmOutName!="" || cmdOutName!="" || txtOutName!="") { + if (outputMode) { if (cmdOutName!="") { SafeWriter* w=e.saveCommand(); if (w!=NULL) {