Skip to content
This repository was archived by the owner on Oct 18, 2021. It is now read-only.

Commit 109afe8

Browse files
fixed cheats not extracted for games whose title id was in lower case
1 parent b619cc9 commit 109afe8

File tree

5 files changed

+15
-20
lines changed

5 files changed

+15
-20
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ INCLUDES := include libs/minizip/include
4545
#ROMFS := romfs
4646
APP_TITLE := Cheats Updater
4747
APP_AUTHOR := HamletDuFromage
48-
APP_VERSION := 1.1.1
48+
APP_VERSION := 1.1.2
4949

5050
#---------------------------------------------------------------------------------
5151
# options for code generation

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
<img src = "https://user-images.githubusercontent.com/61667930/78696328-916c2a00-78ff-11ea-95e4-f104e8428e64.jpg"\>
44
</p>
55

6-
A Nintendo Switch homebrew app to automatically update your cheat files for your installed games. Supports Atmosphere and SXOS.
6+
A Nintendo Switch homebrew app to automatically update your cheat files for your installed games. Supports Atmosphere.
7+
8+
/!\ It seems to be somewhat broken on SXOS atm and not extracting cheats. I'm working on a fix
79

810

911
Fetches the latest cheats from the [gbatemp general thread](https://gbatemp.net/download/cheat-codes-sxos-and-ams-main-cheat-file-updated.36311/updates) through [my mirror](https://github.com/HamletDuFromage/switch-cheats-db/releases) (updates once a day)

include/extract.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ int extractCheats(std::string zipPath, std::vector<std::string> titles, bool sxo
2828

2929
int removeCheats(bool sxos);
3030

31-
struct caselessCompare;
31+
bool caselessCompare (const std::string& a, const std::string& b);
3232

3333
static constexpr u32 MaxTitleCount = 64000;
3434

source/extract.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,10 @@ std::string formatApplicationId(u64 ApplicationId){
3131
return strm.str();
3232
}
3333

34-
int isSXOS()
35-
{
36-
Handle tmph = 0;
37-
SmServiceName TX = {"tx\0"};
38-
Result rc = smRegisterService(&tmph, TX, false, 1);
39-
if(R_FAILED(rc)) return true;
40-
smUnregisterService(TX);
41-
return 1;
34+
bool caselessCompare (const std::string& a, const std::string& b){
35+
return strcasecmp(a.c_str(), b.c_str()) < 0;
4236
}
4337

44-
struct caselessCompare {
45-
bool operator() (const std::string& a, const std::string& b) const {
46-
return strcasecmp(a.substr(7, 16).c_str(), b.c_str()) < 0;
47-
}
48-
};
49-
5038
int extractCheats(std::string zipPath, std::vector<std::string> titles, bool sxos, bool credits){
5139
zipper::Unzipper unzipper(zipPath);
5240
std::vector<zipper::ZipEntry> entries = unzipper.entries();
@@ -67,7 +55,7 @@ int extractCheats(std::string zipPath, std::vector<std::string> titles, bool sxo
6755
entriesNames.push_back(entries[i].name);
6856
}
6957

70-
std::sort(entriesNames.begin(), entriesNames.end());
58+
std::sort(entriesNames.begin(), entriesNames.end(), caselessCompare);
7159
std::sort(titles.begin(), titles.end());
7260

7361
std::vector<std::string> parents;

source/main.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include <switch.h>
1010

11-
#define VERSION "1.1.1"
11+
#define VERSION "1.1.2"
1212
#define RELEASE_URL "https://github.com/HamletDuFromage/switch-cheats-db/releases/tag/v1.0"
1313
#define ARCHIVE_URL "https://github.com/HamletDuFromage/switch-cheats-db/releases/download/v1.0/"
1414

@@ -75,7 +75,12 @@ void run(){
7575
}
7676

7777
//std::vector<NcmStorageId> storageIds = {NcmStorageId_BuiltInUser, NcmStorageId_GameCard, NcmStorageId_SdCard};
78-
std::vector<std::string> titles = getInstalledTitles({NcmStorageId_BuiltInUser, NcmStorageId_GameCard, NcmStorageId_SdCard});
78+
std::vector<std::string> titles;
79+
//if(sxos)
80+
//titles = getInstalledTitles({NcmStorageId_SdCard, NcmStorageId_BuiltInSystem});
81+
//else
82+
titles = getInstalledTitles({NcmStorageId_BuiltInUser, NcmStorageId_GameCard, NcmStorageId_SdCard});
83+
7984
std::cout << "Found " << titles.size() << " installed titles" << std::endl;
8085
consoleUpdate(NULL);
8186

0 commit comments

Comments
 (0)