Hi!
first of all I want to mention that this thread is somewhat related to my thread here: Gathering DS flashcard knowledge - DIY "opencard" idea.
I am trying to rewrite the DevkitPro EEPROM example to also be compatible with DSi hardware (granted the howebrew is ran in DSi-mode through an exploit like MemoryPIT or Flipnote Lenny).
However, I am struggling with this.
GBATEK mentions that ejecting a cartridge from the DSi's physical slot will result in the SLOT-1 slot being powered off, requiring a DSi reboot (I assume) to be used again. A card reset is required however to read the header (because the encryption needs to be disabled on the physical cartridge).
I cannot get this to work.
My plan of attack was to check if the homebrew is in DSi mode, and if it is, use the
Code snippet for reference:
I do still get Null values (leading me to believe SLOT-1 is still powered off). I do not know how to work around this or if I'm thinking fundamently wrong about this whole DSi slot-1 disabling thing.
What amazes me is when I run this homebrew from the SD card (not SLOT-1) with SLOT-1 being empty, and then inserting a card, I still get null values. This confuses me as I believed a reset has not occured yet and thus the CARD slot should not be disabled (or return null values on read). It does however so I'm confused.
It must be possible to circumvent as homebrew like GodMode9i allow you to dump multiple cartridges in and it does not seem to have this null issue (also somewhat confusing, if GBATEK is right and the reading slot is powered off, how can GodMode9i keep reading???). The GodMode9i source repository is quite big and I don't know where to look to find out how they fought this problem, but it must be possible.
Anyone who can explain to me what is going on here? I don't really understand what's going on under the hood and the behaviour I observed confuses me.
first of all I want to mention that this thread is somewhat related to my thread here: Gathering DS flashcard knowledge - DIY "opencard" idea.
I am trying to rewrite the DevkitPro EEPROM example to also be compatible with DSi hardware (granted the howebrew is ran in DSi-mode through an exploit like MemoryPIT or Flipnote Lenny).
However, I am struggling with this.
GBATEK mentions that ejecting a cartridge from the DSi's physical slot will result in the SLOT-1 slot being powered off, requiring a DSi reboot (I assume) to be used again. A card reset is required however to read the header (because the encryption needs to be disabled on the physical cartridge).
I cannot get this to work.
My plan of attack was to check if the homebrew is in DSi mode, and if it is, use the
disableSlot1()
and enableSlot1()
features of the devkitPro stack to do a "digitally triggered" card reset - this does however seem to simply not work.Code snippet for reference:
C++:
...
// Read the header twice to verify.
// If the card is being encrypted, we will get random junk
cardReadHeader(header1);
cardReadHeader(header2);
// Make sure we got the same data twice
while (memcmp(header1, header2, 32) != 0)
{
// If not, the card needs ejected and reinserted into the DS
// Or reset if ran in DSi mode, as the DSi does not have reinstert option
if (isDSiMode())
{
disableSlot1();
// Don't know if required, but inject some artificial wait (I have also tried without, no change)
for (int i = 0; i < 25; i++)
swiWaitForVBlank();
enableSlot1();
for (int i = 0; i < 15; i++)
swiWaitForVBlank();
}
else
{
printf("Please eject & reinsert DS card.\n");
}
ButtonWait();
cardReadHeader(header1);
cardReadHeader(header2);
}
...
I do still get Null values (leading me to believe SLOT-1 is still powered off). I do not know how to work around this or if I'm thinking fundamently wrong about this whole DSi slot-1 disabling thing.
What amazes me is when I run this homebrew from the SD card (not SLOT-1) with SLOT-1 being empty, and then inserting a card, I still get null values. This confuses me as I believed a reset has not occured yet and thus the CARD slot should not be disabled (or return null values on read). It does however so I'm confused.
It must be possible to circumvent as homebrew like GodMode9i allow you to dump multiple cartridges in and it does not seem to have this null issue (also somewhat confusing, if GBATEK is right and the reading slot is powered off, how can GodMode9i keep reading???). The GodMode9i source repository is quite big and I don't know where to look to find out how they fought this problem, but it must be possible.
Anyone who can explain to me what is going on here? I don't really understand what's going on under the hood and the behaviour I observed confuses me.