@@ -200,8 +200,84 @@ int main(int argc, char **argv) {
200
200
fadeType = true ;
201
201
202
202
extern const DISC_INTERFACE __my_io_dsisd;
203
+ const bool fatInited = fatMountSimple (" sd" , &__my_io_dsisd);
203
204
204
- if (!fatMountSimple (" sd" , &__my_io_dsisd)) {
205
+ *(u32 *)0x0CFFFD0C = 0x47444943 ; // 'CIDG'
206
+ while (*(u32 *)0x0CFFFD0C != 0 ) { swiDelay (100 ); }
207
+
208
+ {
209
+ DC_FlushRange ((void *)0x02810000 , 16 );
210
+
211
+ const u16 manufID = *(u16 *)0x0281000E ;
212
+ const char oemID[3 ] = {*(char *)0x0281000D , *(char *)0x0281000C , 0 };
213
+
214
+ // Source: https://web.archive.org/web/20130728131543/https://wiki.linaro.org/WorkingGroups/KernelArchived/Projects/FlashCardSurvey?action=show&redirect=WorkingGroups%2FKernel%2FProjects%2FFlashCardSurvey
215
+ if (
216
+ (manufID == 0x0001 && strcmp (oemID, " PA" ) == 0 ) // Panasonic
217
+ || (manufID == 0x0002 && strcmp (oemID, " TM" ) == 0 ) // Kingston/PNY
218
+ || (manufID == 0x0003 && strcmp (oemID, " SD" ) == 0 ) // SanDisk
219
+ || (manufID == 0x0009 && strcmp (oemID, " AP" ) == 0 ) // Lexar
220
+ || (manufID == 0x001B && strcmp (oemID, " SM" ) == 0 ) // PNY
221
+ || (manufID == 0x0027 && strcmp (oemID, " PH" ) == 0 ) // Sony
222
+ || (manufID == 0x0028 && strcmp (oemID, " BE" ) == 0 ) // Lexar/Polaroid
223
+ || (manufID == 0x0041 && strcmp (oemID, " 42" ) == 0 ) // Kingston
224
+ ){
225
+ // SD card is compatible!
226
+ } else {
227
+ char manufIdText[40 ];
228
+ sprintf (manufIdText, " Manufacturer ID: %04X" , manufID);
229
+ char oemIdText[16 ];
230
+ sprintf (oemIdText, " OEM ID: %s" , oemID);
231
+
232
+ waitBeforeFade = false ;
233
+
234
+ clearText ();
235
+ int yPos = 4 ;
236
+ printSmall (false , 4 , yPos, manufIdText);
237
+ yPos += 8 ;
238
+ printSmall (false , 4 , yPos, oemIdText);
239
+ yPos += 8 *2 ;
240
+ if (
241
+ (manufID == 0x001D && strcmp (oemID, " AD" ) == 0 ) // A-Data/extrememory/Microcenter
242
+ || (manufID == 0x0000 && strcmp (oemID, " " ) == 0 ) // Brandless
243
+ ){
244
+ printSmall (false , 4 , yPos, " The inserted SD card is not" );
245
+ yPos += 8 ;
246
+ printSmall (false , 4 , yPos, " compatible. Please switch to an" );
247
+ yPos += 8 ;
248
+ printSmall (false , 4 , yPos, " SD card of a well-known brand." );
249
+ yPos += 8 *2 ;
250
+ printSmall (false , 4 , yPos, " Press B to return to menu." );
251
+
252
+ goto pressB;
253
+ } else {
254
+ printSmall (false , 4 , yPos, " The inserted SD card has not" );
255
+ yPos += 8 ;
256
+ printSmall (false , 4 , yPos, " been tested, and is possible that" );
257
+ yPos += 8 ;
258
+ printSmall (false , 4 , yPos, " it will not work correctly." );
259
+ yPos += 8 *2 ;
260
+ printSmall (false , 4 , yPos, " If you encounter any issues," );
261
+ yPos += 8 ;
262
+ printSmall (false , 4 , yPos, " please switch to an SD card" );
263
+ yPos += 8 ;
264
+ printSmall (false , 4 , yPos, " of a well-known brand." );
265
+ yPos += 8 *2 ;
266
+ printSmall (false , 4 , yPos, " A: Continue" );
267
+ yPos += 8 ;
268
+ printSmall (false , 4 , yPos, " B: Return to menu" );
269
+
270
+ while (1 ) {
271
+ scanKeys ();
272
+ if (keysHeld () & KEY_A) break ;
273
+ else if (keysHeld () & KEY_B) goto pressedB;
274
+ swiWaitForVBlank ();
275
+ }
276
+ }
277
+ }
278
+ }
279
+
280
+ if (!fatInited) {
205
281
waitBeforeFade = false ;
206
282
// fadeType = true;
207
283
@@ -268,12 +344,14 @@ int main(int argc, char **argv) {
268
344
printSmall (false , 4 , returnTextPos, " Press B to return to menu." );
269
345
}
270
346
347
+ pressB:
271
348
while (1 ) {
272
349
scanKeys ();
273
350
if (keysHeld () & KEY_B) break ;
274
351
swiWaitForVBlank ();
275
352
}
276
353
354
+ pressedB:
277
355
fadeType = false ;
278
356
for (int i = 0 ; i < 24 ; i++) {
279
357
swiWaitForVBlank ();
0 commit comments