Skip to content

Commit

Permalink
DSi-based themes: Change checkRomAP to return a bool value
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Nov 14, 2024
1 parent 6e11797 commit ec8e0ab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
26 changes: 13 additions & 13 deletions romsel_dsimenutheme/arm9/source/ndsheaderbanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,30 +91,30 @@ u32 getSDKVersion(FILE *ndsFile)
/**
* Check if NDS game has AP.
* @param filename NDS ROM filename.
* @return 1 or 2 on success; 0 if no AP.
* @return true on success; false if no AP.
*/
int checkRomAP(const char* filename, int num)
bool checkRomAP(const char* filename, int num)
{
{
char apFixPath[256];
sprintf(apFixPath, "%s:/_nds/nds-bootstrap/apFix/%s.ips", sys().isRunFromSD() ? "sd" : "fat", filename);
if (access(apFixPath, F_OK) == 0) {
return 0;
return false;
}

sprintf(apFixPath, "%s:/_nds/nds-bootstrap/apFix/%s.bin", sys().isRunFromSD() ? "sd" : "fat", filename);
if (access(apFixPath, F_OK) == 0) {
return 0;
return false;
}

sprintf(apFixPath, "%s:/_nds/nds-bootstrap/apFix/%s-%04X.ips", sys().isRunFromSD() ? "sd" : "fat", gameTid[num], headerCRC[num]);
if (access(apFixPath, F_OK) == 0) {
return 0;
return false;
}

sprintf(apFixPath, "%s:/_nds/nds-bootstrap/apFix/%s-%04X.bin", sys().isRunFromSD() ? "sd" : "fat", gameTid[num], headerCRC[num]);
if (access(apFixPath, F_OK) == 0) {
return 0;
return false;
}
}

Expand Down Expand Up @@ -152,7 +152,7 @@ int checkRomAP(const char* filename, int num)

if (crc == headerCRC[num]) { // CRC matches
fclose(file);
return 0;
return false;
} else if (crc < headerCRC[num]) {
left = mid + 1;
} else {
Expand All @@ -174,7 +174,7 @@ int checkRomAP(const char* filename, int num)
|| (memcmp(gameTid[num], "YEEJ", 4) == 0) // Inazuma Eleven (Japan)
|| (memcmp(gameTid[num], "CNSX", 4) == 0) // Naruto Shippuden: Naruto vs Sasuke (Europe)
|| (memcmp(gameTid[num], "BH2J", 4) == 0)) { // Super Scribblenauts (Japan)
return 0;
return false;
} else
// Check for ROMs that have AP measures.
if ((memcmp(gameTid[num], "VETP", 4) == 0) // 1000 Cooking Recipes from Elle a Table (Europe)
Expand Down Expand Up @@ -411,7 +411,7 @@ int checkRomAP(const char* filename, int num)
|| (memcmp(gameTid[num], "BYMJ", 4) == 0) // Yumeiro Patissiere: My Sweets Cooking (Japan)
|| (memcmp(gameTid[num], "BZQJ", 4) == 0) // Zac to Ombra: Maboroshi no Yuuenchi (Japan)
|| (memcmp(gameTid[num], "BZBJ", 4) == 0)) { // Zombie Daisuki (Japan)
return 1;
return true;
} else {
static const char ap_list[][4] = {
"YBN", // 100 Classic Books
Expand Down Expand Up @@ -529,7 +529,7 @@ int checkRomAP(const char* filename, int num)
for (unsigned int i = 0; i < sizeof(ap_list)/sizeof(ap_list[0]); i++) {
if (memcmp(gameTid[num], ap_list[i], 3) == 0) {
// Found a match.
return 1;
return true;
}
}

Expand All @@ -541,12 +541,12 @@ int checkRomAP(const char* filename, int num)
for (unsigned int i = 0; i < sizeof(ap_list2)/sizeof(ap_list2[0]); i++) {
if (memcmp(gameTid[num], ap_list2[i], 3) == 0) {
// Found a match.
return 2;
return true;
}
}
}
return 0;

return false;
}

sNDSBannerExt bnriconTile[41];
Expand Down
4 changes: 2 additions & 2 deletions romsel_dsimenutheme/arm9/source/ndsheaderbanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ u32 getSDKVersion(FILE* ndsFile);
/**
* Check if NDS game has AP.
* @param filename NDS ROM filename.
* @return 1 or 2 on success; 0 if no AP.
* @return true on success; false if no AP.
*/
int checkRomAP(const char* filename, int num);
bool checkRomAP(const char* filename, int num);

extern char gameTid[40][5];
extern u8 romVersion[40];
Expand Down

0 comments on commit ec8e0ab

Please sign in to comment.