blocksds / sdk

Main BlocksDS SDK repository
https://blocksds.github.io/docs/
164 stars 11 forks source link

DSi SD card swaps do not call setSDcallback() or invalidate cache/FatFs structures #224

Open asiekierka opened 2 weeks ago

asiekierka commented 2 weeks ago

It is technically possible to swap out the SD card at runtime on DSi/3DS consoles (and on flash cartridges too, but this is not entirely fixable there), however this will currently lead to potential data corruption, as the cache and mounted filesystem are not invalidated/deinitialized.

This is probably a low priority issue.

profi200 commented 2 weeks ago

My suggestion here would be to hook this up to some kind of event system. https://github.com/blocksds/libnds/blob/bb1e9e1510752fc1e402bcf5e34614aa54ab06f0/source/arm7/tmio.twl.c#L35

My only worry here is that delaying IRQ handler end even more is not good but since there is only 1 IRQ for status changes there is no other choice than to check for remove/insert status bits.

asiekierka commented 2 weeks ago

We already have the FIFO system, which should be sufficient; SDMMC_INSERT/REMOVE would be received by the ARM9 from the ARM7.