Open lucasmr opened 3 years ago
the default FAT32 cluster size for 2-4GB cards is 4KB, less than 16KB can cause file system read issues with the fat library used, and 32KB is most optimal for SD reads of files tens or hundreds megabytes in size.
Pokemon Black and White 2 for example will not work properly on any flashcard with a cluster size less than 32KB.
Solution would be to move the data off the card, and format it to 32K clusters.
Actually, a 2GB SD card cannot even format to 32KB clusters using FAT32. That's why FAT16 is used as default when formatting a 2GB SD card. I can even confirm that formatting to FAT16, 32KB clusters work just fine.
This may need to be elaborated on in the DSi guide and the wiki. If 32KB clusters is a must (and it is), then a note for people using SD cards 2GB or less to use FAT16 (also known as FAT on Windows) would be necessary.
Actually, a 2GB SD card cannot even format to 32KB clusters using FAT32
Actually, yes it can but you're getting into CMD vs Windows GUI differences to achieve it.
There are of course, HP, SecureDigital and other Windows tools that will happily format a 2GB sd card to FAT32 @ 32KB clusters.
You appear to be correct, mkdosfs
did format it to FAT32 with 32KB clusters; however, it did give me a warning that cluster was larger than recommended. Let's see if that warning is valid...
I have 5 TWiLight compatible flashcards. I'll list my observations of FAT32, 32KB clusters on a 2GB SD card with each flashcard, and list it below:
Acekard 2.1
Original R4
M3 Simply
DSTT
R4i-Gold.com V1.4.1
Just to make sure this wasn't a problem with just these carts, I tested 4 other flashcards (not TWiLight supported, so I won't list those):
r4isdhc.com.cn
Ace3DS+
N5
M3 DS Real
For the fun of it, I threw TWiLight-DSi into this SD and attempted to boot my DSi, which has Unlaunch installed:
If there's anything I learned from this experience, it's one thing: There's a reason Windows doesn't let you format a 2GB SD card to FAT32 using 32KB clusters.
Moral of the story: just format it to FAT16, 32KB clusters. It works.
Anyway, I did some testing.
It appears the issue is around the specific DLDI patch that TWiLight Menu uses for this card. Right now, it is using boyakkey's DSTT DLDI.
This specific DLDI appears to be the true reason why the timebomb cart, such as the OP's, is not working. In fact, I even reproduced this issue on a genuine DSTT.
How I figured out the DLDI was the issue: I tried loading the original kernel first, then booted into TWiLight Menu++. This worked. The kernel automatically DLDI patches anything that is homebrew, so that means it was auto-DLDI-patched correctly. What I concur from that is that the DLDI library used to patch TWiLight at build time isn't working. I then used dlditool to patch it using the original TTCARD IO DLDI. When using this, TWiLight Menu++ successfully autobooted on both the DSTT and my R4i-Gold V1.4.1 (a timebomb cart that functions identically to OP's r4isdhc.com card.)
So from my testing, it seems TTCARD IO Library will work, while boyakkey's library doesn't. Preferably further testing should be done, however, because the TTCARD IO Library is quite dated.
For those who use the DSTT or R4i-SDHC, r4isdhc.com cards, etc, autoboot files, if you want to test it out, these are patched with the TTCARD IO Library. I have personally tested this working on 2GB SD cards. Preferably test other SD card sizes, if possible. As long as it boots, it is good.
This issue has been fixed with the PR above and should be closed.
So that PR didn't go well.
Unfortunately, there won't be a way to get around this without a rewrite of the DLDI to allow FAT16 initializing. Which should be possible, but unlikely.
It appears the issue here is that the DSTT does the SDHC check in the bootloader and then writes it to 0x027FFE24. However, this is the exact same location as ARGV.
Thus, without completely redoing the bootloader or implementing SD init into the DLDI this won't be possible. I've tried implementing it already and it didn't work at all.
The onends branch can solve this issue, but that seems like a goal too far away for now.
PR https://github.com/DS-Homebrew/TWiLightMenu/pull/2140 aims to fix this issue with a brand-new DLDI driver.
All affected users can feel free to test the pull request.
Console Configuration: NDS Lite, r4isdhc.com card TWiLight Menu++ Version: v18.0.0 TWiLight Menu++ Theme:
Expected behaviour
Menu should boot up.
Actual behaviour
A message
FAT init failed!
is displayed if using a 2GB SD card. This card is working properly if using the default kernel (2019 r4isdhc gold pro). Using a 8GB SD card loads fine.Steps to reproduce