diff --git a/core/rend/boxart/boxart.cpp b/core/rend/boxart/boxart.cpp index 1bb61f9ad..44b8a1206 100644 --- a/core/rend/boxart/boxart.cpp +++ b/core/rend/boxart/boxart.cpp @@ -19,7 +19,7 @@ #include "boxart.h" #include "gamesdb.h" -static std::string getGameFileName(const std::string path) +static std::string getGameFileName(const std::string& path) { size_t slash = get_last_slash_pos(path); std::string fileName; @@ -59,10 +59,14 @@ std::future Boxart::fetchBoxart(const GameMedia& media) GameBoxart boxart; boxart.fileName = fileName; boxart.gamePath = media.path; - boxart.name = trim_trailing_ws(media.gameName); - while (boxart.name.back() == ')') + boxart.name = trim_trailing_ws(get_file_basename(media.gameName)); + while (!boxart.name.empty()) { - size_t pos = boxart.name.find_last_of('('); + size_t pos{ std::string::npos }; + if (boxart.name.back() == ')') + pos = boxart.name.find_last_of('('); + else if (boxart.name.back() == ']') + pos = boxart.name.find_last_of('['); if (pos == std::string::npos) break; boxart.name = trim_trailing_ws(boxart.name.substr(0, pos)); diff --git a/core/rend/boxart/scraper.cpp b/core/rend/boxart/scraper.cpp index 08c0d670e..8ec5025eb 100644 --- a/core/rend/boxart/scraper.cpp +++ b/core/rend/boxart/scraper.cpp @@ -36,7 +36,7 @@ bool Scraper::downloadImage(const std::string& url, const std::string& localName return false; } FILE *f = nowide::fopen(localName.c_str(), "wb"); - if (f == NULL) + if (f == nullptr) { WARN_LOG(COMMON, "can't create local file %s: error %d", localName.c_str(), errno); return false; diff --git a/core/rend/imgui_driver.h b/core/rend/imgui_driver.h index 0cad49293..86a2c4b26 100644 --- a/core/rend/imgui_driver.h +++ b/core/rend/imgui_driver.h @@ -38,8 +38,8 @@ public: virtual void present() = 0; virtual void setFrameRendered() {} - virtual ImTextureID getTexture(const std::string& name) { return ImTextureID{}; } - virtual ImTextureID updateTexture(const std::string& name, const u8 *data, int width, int height) { return ImTextureID{}; } + virtual ImTextureID getTexture(const std::string& name) = 0; + virtual ImTextureID updateTexture(const std::string& name, const u8 *data, int width, int height) = 0; }; extern std::unique_ptr imguiDriver;