From a40bb2eaa11c126da20b1a068f0c07d82d00280b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 9 May 2021 17:24:04 -0700 Subject: [PATCH] headless: Avoid empty string compares for mountIso. --- Core/System.cpp | 2 +- UI/EmuScreen.cpp | 4 ++-- android/jni/TestRunner.cpp | 2 +- headless/Headless.cpp | 12 +++++++----- libretro/libretro.cpp | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Core/System.cpp b/Core/System.cpp index 60a2e03b6b..1aa5076968 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -239,7 +239,7 @@ bool CPU_Init() { IdentifiedFileType type = Identify_File(loadedFile); // TODO: Put this somewhere better? - if (coreParameter.mountIso != "") { + if (!coreParameter.mountIso.empty()) { coreParameter.mountIsoLoader = ConstructFileLoader(coreParameter.mountIso); } diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index f10a3778c7..ba44a9f95d 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -246,8 +246,8 @@ void EmuScreen::bootGame(const std::string &filename) { coreParam.graphicsContext = PSP_CoreParameter().graphicsContext; coreParam.enableSound = g_Config.bEnableSound; coreParam.fileToStart = filename; - coreParam.mountIso = ""; - coreParam.mountRoot = ""; + coreParam.mountIso.clear(); + coreParam.mountRoot.clear(); coreParam.startBreak = !g_Config.bAutoRun; coreParam.printfEmuLog = false; coreParam.headLess = false; diff --git a/android/jni/TestRunner.cpp b/android/jni/TestRunner.cpp index 3f9feed41a..2b63a84ed0 100644 --- a/android/jni/TestRunner.cpp +++ b/android/jni/TestRunner.cpp @@ -93,7 +93,7 @@ bool RunTests() { coreParam.gpuCore = GPUCORE_SOFTWARE; coreParam.enableSound = g_Config.bEnableSound; coreParam.graphicsContext = nullptr; - coreParam.mountIso = ""; + coreParam.mountIso.clear(); coreParam.mountRoot = baseDirectory + "pspautotests/"; coreParam.startBreak = false; coreParam.printfEmuLog = false; diff --git a/headless/Headless.cpp b/headless/Headless.cpp index e161f1d598..9261142ed0 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -245,9 +245,9 @@ int main(int argc, const char* argv[]) int debuggerPort = -1; std::vector testFilenames; - const char *mountIso = 0; - const char *mountRoot = 0; - const char *screenshotFilename = 0; + const char *mountIso = nullptr; + const char *mountRoot = nullptr; + const char *screenshotFilename = nullptr; float timeout = std::numeric_limits::infinity(); for (int i = 1; i < argc; i++) @@ -355,8 +355,10 @@ int main(int argc, const char* argv[]) coreParameter.gpuCore = glWorking ? gpuCore : GPUCORE_SOFTWARE; coreParameter.graphicsContext = graphicsContext; coreParameter.enableSound = false; - coreParameter.mountIso = mountIso ? mountIso : ""; - coreParameter.mountRoot = mountRoot ? mountRoot : ""; + if (mountIso) + coreParameter.mountIso = mountIso; + if (mountRoot) + coreParameter.mountRoot = mountRoot; coreParameter.startBreak = false; coreParameter.printfEmuLog = !autoCompare; coreParameter.headLess = true; diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index caa3e33072..a1562a53fa 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -650,7 +650,7 @@ bool retro_load_game(const struct retro_game_info *game) CoreParameter coreParam = {}; coreParam.enableSound = true; coreParam.fileToStart = std::string(game->path); - coreParam.mountIso = ""; + coreParam.mountIso.clear(); coreParam.startBreak = false; coreParam.printfEmuLog = true; coreParam.headLess = true;