diff --git a/Makefile.main b/Makefile.main index d57a94ff..a5c1341e 100644 --- a/Makefile.main +++ b/Makefile.main @@ -55,7 +55,7 @@ ios := 249 #--------------------------------------------------------------------------------- FALSE_POSITIVES := -Wno-array-bounds -Wno-stringop-overflow -Wno-stringop-overread CFLAGS = -g -ggdb -O2 -Wall -Wno-multichar -Wno-address-of-packed-member -Wextra $(FALSE_POSITIVES) $(MACHDEP) $(INCLUDE) -D_GNU_SOURCE -DHAVE_CONFIG_H -CXXFLAGS = $(CFLAGS) +CXXFLAGS = $(CFLAGS) -std=c++20 LDFLAGS = -g -ggdb $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80620000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,wiiuse_register ifeq ($(GITHUB_ACTIONS),true) diff --git a/source/list/ListGenerator.cpp b/source/list/ListGenerator.cpp index 9e687245..7ea86d81 100644 --- a/source/list/ListGenerator.cpp +++ b/source/list/ListGenerator.cpp @@ -253,7 +253,7 @@ static void Add_Plugin_Game(char *FullPath) { /* Get roms's title without the extra ()'s or []'s */ string ShortName = m_plugin.GetRomName(FullPath); - //gprintf("shortName=%s\n", ShortName.c_str()); + //gprintf("fullName=%s, shortName=%s\n", FullPath, ShortName.c_str()); /* only add disc 1 of multi disc games */ const char *RomFilename = strrchr(FullPath, '/') + 1; @@ -466,9 +466,18 @@ void ListGenerator::CreateList(u32 Flow, const string& Path, const vector& FileTypes) { - for(vector::const_iterator cmp = FileTypes.begin(); cmp != FileTypes.end(); ++cmp) + auto fileName = std::string(File); + for (auto & fileType : FileTypes) { - if(strcasecmp(File, cmp->c_str()) == 0) + if (fileName.length() >= fileType.length() && + std::equal(fileName.end() - fileType.length(), + fileName.end(), fileType.begin(), + [](const char & c1, const char & c2) + { + return (c1 == c2 || + std::toupper(c1) == + std::toupper(c2)); + })) return true; } return false; @@ -503,9 +512,7 @@ void GetFiles(const char *Path, const vector& FileTypes, } else if(pent->d_type == DT_REG) { - NewFileName = strrchr(pent->d_name, '.');//the extension - if(NewFileName == NULL) NewFileName = pent->d_name; - if(IsFileSupported(NewFileName, FileTypes)) + if(IsFileSupported(pent->d_name, FileTypes)) { AddFile(FullPathChar); continue; @@ -547,4 +554,4 @@ void ListGenerator::createSFList(u8 maxBtns, Config &m_sourceMenuCfg, const stri Asciify(ListElement.title); m_cacheList.push_back(ListElement); } -} \ No newline at end of file +}