Only blacklist system titles from console region

This commit is contained in:
Pk11 2022-04-30 14:54:25 -05:00
parent db69aca1b4
commit 7ea87f3bd5
4 changed files with 46 additions and 14 deletions

View File

@ -432,7 +432,11 @@ bool install(char* fpath, bool systemTitle)
)) || (h->tid_high == 0x00030015 && ( )) || (h->tid_high == 0x00030015 && (
tidLow == 0x484e4200 || // System Settings tidLow == 0x484e4200 || // System Settings
tidLow == 0x484e4600 // Nintendo DSi Shop tidLow == 0x484e4600 // Nintendo DSi Shop
)))) ))) && (
(h->tid_low & 0xFF) == region || //only blacklist console region
(h->tid_low & 0xFF) == 'A' || //and 'A' (all region)
region == 0 //if the region check failed somehow, blacklist everything
))
{ {
iprintf("\x1B[31m"); //red iprintf("\x1B[31m"); //red
iprintf("Error: "); iprintf("Error: ");

View File

@ -12,6 +12,7 @@ bool unlaunchFound = false;
bool arm7Exiting = false; bool arm7Exiting = false;
bool charging = false; bool charging = false;
u8 batteryLevel = 0; u8 batteryLevel = 0;
u8 region = 0;
PrintConsole topScreen; PrintConsole topScreen;
PrintConsole bottomScreen; PrintConsole bottomScreen;
@ -142,7 +143,7 @@ int main(int argc, char **argv)
return 0; return 0;
} }
//check for unlaunch //check for unlaunch and region
{ {
FILE *file = fopen("nand:/sys/HWINFO_S.dat", "rb"); FILE *file = fopen("nand:/sys/HWINFO_S.dat", "rb");
if (file) if (file)
@ -152,6 +153,8 @@ int main(int argc, char **argv)
fread(&launcherTid, sizeof(u32), 1, file); fread(&launcherTid, sizeof(u32), 1, file);
fclose(file); fclose(file);
region = launcherTid & 0xFF;
char path[64]; char path[64];
sprintf(path, "nand:/title/00030017/%08lx/content/title.tmd", launcherTid); sprintf(path, "nand:/title/00030017/%08lx/content/title.tmd", launcherTid);
unsigned long long tmdSize = getFileSizePath(path); unsigned long long tmdSize = getFileSizePath(path);

View File

@ -10,6 +10,7 @@ extern bool sdnandMode;
extern bool unlaunchFound; extern bool unlaunchFound;
extern bool charging; extern bool charging;
extern u8 batteryLevel; extern u8 batteryLevel;
extern u8 region;
void installMenu(); void installMenu();
void titleMenu(); void titleMenu();

View File

@ -95,6 +95,25 @@ static void generateList(Menu* m)
"00030015" "00030015"
}; };
const char* blacklist[3][6] = {
{ // 00030004
NULL //nothing blacklisted
},
{ // 00030005
"484e44", // DS Download Play
"484e45", // PictoChat
"484e49", // Nintendo DSi Camera
"484e4a", // Nintendo Zone
"484e4b", // Nintendo DSi Sound
NULL
},
{ // 00030015
"484e42", // System Settings
"484e46", // Nintendo DSi Shop
NULL
}
};
//Reset menu //Reset menu
clearMenu(m); clearMenu(m);
@ -121,19 +140,24 @@ static void generateList(Menu* m)
continue; continue;
//blacklisted titles //blacklisted titles
if (!sdnandMode && ( if (!sdnandMode)
(i == 1 && (
strncmp(ent->d_name, "484e44", 6) == 0 || // DS Download Play
strncmp(ent->d_name, "484e45", 6) == 0 || // PictoChat
strncmp(ent->d_name, "484e49", 6) == 0 || // Nintendo DSi Camera
strncmp(ent->d_name, "484e4a", 6) == 0 || // Nintendo Zone
strncmp(ent->d_name, "484e4b", 6) == 0 // Nintendo DSi Sound
)) || (i == 2 && (
strncmp(ent->d_name, "484e42", 6) == 0 || // System Settings
strncmp(ent->d_name, "484e46", 6) == 0 // Nintendo DSi Shop
))))
{ {
continue; //if the region check somehow failed blacklist all-non DSiWare
if (region == 0 && i > 0) continue;
bool blacklisted = false;
for (int j = 0; blacklist[i][j] != NULL; j++)
{
char titleId[9];
sprintf(titleId, "%s%02x", blacklist[i][j], region);
if (strcmp(titleId, ent->d_name) == 0)
blacklisted = true;
sprintf(titleId, "%s41", blacklist[i][j]); // also blacklist region 'a'
if (strcmp(titleId, ent->d_name) == 0)
blacklisted = true;
}
if (blacklisted) continue;
} }
if (ent->d_type == DT_DIR) if (ent->d_type == DT_DIR)