diff --git a/romsel_dsimenutheme/arm9/source/main.cpp b/romsel_dsimenutheme/arm9/source/main.cpp index f6cb223fbe..43c20e0638 100644 --- a/romsel_dsimenutheme/arm9/source/main.cpp +++ b/romsel_dsimenutheme/arm9/source/main.cpp @@ -284,9 +284,12 @@ void SetDonorSDK(const char* filename) { scanKeys(); FILE *f_nds_file = fopen(filename, "rb"); + fseek(f_nds_file, offsetof(sNDSHeadertitlecodeonly, gameCode), SEEK_SET); + char game_TID_full[5]; + fread(game_TID_full, 1, 4, f_nds_file); + game_TID_full[4] = 0; char game_TID[5]; - fseek(f_nds_file, offsetof(sNDSHeadertitlecodeonly, gameCode), SEEK_SET); fread(game_TID, 1, 4, f_nds_file); game_TID[4] = 0; game_TID[3] = 0; @@ -327,22 +330,47 @@ void SetDonorSDK(const char* filename) { "AZL", // Style Savvy }; + // TIDs without 4th letter static const char sdk5_list[][4] = { "CS3", // Sonic and Sega All Stars Racing + "B2D", // Doctor Who: Evacuation Earth + "BH2", // Super Scribblenauts "BXS", // Sonic Colo(u)rs + "BOE", // Inazuma Eleven 3: Sekai heno Chousen! The Ogre + "BQ8", // Crafting Mama "BK9", // Kingdom Hearts: Re-Coded + "BWB", // Plants vs. Zombies + "BRJ", // Radiant Historia + "B3R", // Pokemon Ranger: Guardian Signs "IRA", // Pokemon Black Version "IRB", // Pokemon White Version "BOO", // Okamiden "BT2", // TrackMania Turbo "BYY", // Yu-Gi-Oh 5Ds World Championship 2011: Over The Nexus - "TAD", // Kirby Mass Attack + "BLF", // Professor Layton and the Last Specter + "UZP", // Learn with Pokemon: Typing Adventure "IRE", // Pokemon Black Version 2 "IRD", // Pokemon White Version 2 - "TCS", // Scribblenauts Collection "BVP", // Drawn to Life Collection - "TFB", // Frozen: Olaf's Quest - "THM", // FabStyle + }; + + // Full TIDs + static const char sdk5_list2[][5] = { + "YEED", // Inazuma Eleven (Germany) + "YEEF", // Inazuma Eleven (France) + "YEEI", // Inazuma Eleven (Italy) + "YEEP", // Inazuma Eleven (Europe) + "YEES", // Inazuma Eleven (Spain) + "BEBD", // Inazuma Eleven 2: Blizzard (Germany) + "BEBF", // Inazuma Eleven 2: Blizzard (France) + "BEBI", // Inazuma Eleven 2: Blizzard (Italy) + "BEBP", // Inazuma Eleven 2: Blizzard (Europe) + "BEBS", // Inazuma Eleven 2: Blizzard (Spain) + "BEED", // Inazuma Eleven 2: Firestorm (Germany) + "BEEF", // Inazuma Eleven 2: Firestorm (France) + "BEEI", // Inazuma Eleven 2: Firestorm (Italy) + "BEEP", // Inazuma Eleven 2: Firestorm (Europe) + "BEES", // Inazuma Eleven 2: Firestorm (Spain) }; // TODO: If the list gets large enough, switch to bsearch(). @@ -372,9 +400,6 @@ void SetDonorSDK(const char* filename) { } } - if(strcmp("V", game_TID_char1) == 0) { - donorSdkVer = 5; - } else // TODO: If the list gets large enough, switch to bsearch(). for (unsigned int i = 0; i < sizeof(sdk5_list)/sizeof(sdk5_list[0]); i++) { if (!memcmp(game_TID, sdk5_list[i], 3)) { @@ -384,7 +409,16 @@ void SetDonorSDK(const char* filename) { } } - if(keysHeld() & KEY_UP){ + // TODO: If the list gets large enough, switch to bsearch(). + for (unsigned int i = 0; i < sizeof(sdk5_list2)/sizeof(sdk5_list2[0]); i++) { + if (!memcmp(game_TID_full, sdk5_list2[i], 4)) { + // Found a match. + donorSdkVer = 5; + break; + } + } + + if((keysHeld() & KEY_UP) || (strcmp("T", game_TID_char1) == 0) || (strcmp("V", game_TID_char1) == 0)) { donorSdkVer = 5; } } diff --git a/romsel_dsmenutheme/arm9/source/main.cpp b/romsel_dsmenutheme/arm9/source/main.cpp index 035e990223..3ed7b721fe 100644 --- a/romsel_dsmenutheme/arm9/source/main.cpp +++ b/romsel_dsmenutheme/arm9/source/main.cpp @@ -171,9 +171,12 @@ void SetDonorSDK(const char* filename) { scanKeys(); FILE *f_nds_file = fopen(filename, "rb"); + fseek(f_nds_file, offsetof(sNDSHeadertitlecodeonly, gameCode), SEEK_SET); + char game_TID_full[5]; + fread(game_TID_full, 1, 4, f_nds_file); + game_TID_full[4] = 0; char game_TID[5]; - fseek(f_nds_file, offsetof(sNDSHeadertitlecodeonly, gameCode), SEEK_SET); fread(game_TID, 1, 4, f_nds_file); game_TID[4] = 0; game_TID[3] = 0; @@ -214,22 +217,47 @@ void SetDonorSDK(const char* filename) { "AZL", // Style Savvy }; + // TIDs without 4th letter static const char sdk5_list[][4] = { "CS3", // Sonic and Sega All Stars Racing + "B2D", // Doctor Who: Evacuation Earth + "BH2", // Super Scribblenauts "BXS", // Sonic Colo(u)rs + "BOE", // Inazuma Eleven 3: Sekai heno Chousen! The Ogre + "BQ8", // Crafting Mama "BK9", // Kingdom Hearts: Re-Coded + "BWB", // Plants vs. Zombies + "BRJ", // Radiant Historia + "B3R", // Pokemon Ranger: Guardian Signs "IRA", // Pokemon Black Version "IRB", // Pokemon White Version "BOO", // Okamiden "BT2", // TrackMania Turbo "BYY", // Yu-Gi-Oh 5Ds World Championship 2011: Over The Nexus - "TAD", // Kirby Mass Attack + "BLF", // Professor Layton and the Last Specter + "UZP", // Learn with Pokemon: Typing Adventure "IRE", // Pokemon Black Version 2 "IRD", // Pokemon White Version 2 - "TCS", // Scribblenauts Collection "BVP", // Drawn to Life Collection - "TFB", // Frozen: Olaf's Quest - "THM", // FabStyle + }; + + // Full TIDs + static const char sdk5_list2[][5] = { + "YEED", // Inazuma Eleven (Germany) + "YEEF", // Inazuma Eleven (France) + "YEEI", // Inazuma Eleven (Italy) + "YEEP", // Inazuma Eleven (Europe) + "YEES", // Inazuma Eleven (Spain) + "BEBD", // Inazuma Eleven 2: Blizzard (Germany) + "BEBF", // Inazuma Eleven 2: Blizzard (France) + "BEBI", // Inazuma Eleven 2: Blizzard (Italy) + "BEBP", // Inazuma Eleven 2: Blizzard (Europe) + "BEBS", // Inazuma Eleven 2: Blizzard (Spain) + "BEED", // Inazuma Eleven 2: Firestorm (Germany) + "BEEF", // Inazuma Eleven 2: Firestorm (France) + "BEEI", // Inazuma Eleven 2: Firestorm (Italy) + "BEEP", // Inazuma Eleven 2: Firestorm (Europe) + "BEES", // Inazuma Eleven 2: Firestorm (Spain) }; // TODO: If the list gets large enough, switch to bsearch(). @@ -259,9 +287,6 @@ void SetDonorSDK(const char* filename) { } } - if(strcmp("V", game_TID_char1) == 0) { - donorSdkVer = 5; - } else // TODO: If the list gets large enough, switch to bsearch(). for (unsigned int i = 0; i < sizeof(sdk5_list)/sizeof(sdk5_list[0]); i++) { if (!memcmp(game_TID, sdk5_list[i], 3)) { @@ -271,7 +296,16 @@ void SetDonorSDK(const char* filename) { } } - if(keysHeld() & KEY_UP){ + // TODO: If the list gets large enough, switch to bsearch(). + for (unsigned int i = 0; i < sizeof(sdk5_list2)/sizeof(sdk5_list2[0]); i++) { + if (!memcmp(game_TID_full, sdk5_list2[i], 4)) { + // Found a match. + donorSdkVer = 5; + break; + } + } + + if((keysHeld() & KEY_UP) || (strcmp("T", game_TID_char1) == 0) || (strcmp("V", game_TID_char1) == 0)) { donorSdkVer = 5; } }