gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Does the card functions of NdsLib works or not ? [solved]

#165930 - pilch - Tue Jan 13, 2009 2:22 pm

Hi everyone,

I still don't know if the functions in card.h are working (my test failed, but it perhaps comes from my code).
Does anyone achieve to read from the card with key 2 encrypted commands AND without reinserting the card ??
Or does anyone know that it is not possible with NdsLib functions ?

I plan to reverse enginer a game to find how it acces the card (in fact I already started), but since it is very time consuming, I would like to be sure these informations are not already known...

Thanks for help !


Last edited by pilch on Wed Jan 14, 2009 5:30 pm; edited 1 time in total

#165956 - chishm - Wed Jan 14, 2009 11:01 am

You can only read the card for addresses above 0x8000 after it has passed the initialisation stage. Use the 0xB7 command in the following manner:
Code:
cardParamCommand (CARD_CMD_DATA_READ, src,
   (portFlags &~CARD_BLK_SIZE(7)) | CARD_ACTIVATE | CARD_nRESET | CARD_BLK_SIZE(1),
   dest, CARD_DATA_BLOCK_SIZE);

Here src is the offset address on the card, dest is the destination memory address and portFlags are the DS card flags specified by ndsHeader.cardControl13 (read from the card during initialisation, don't try using the flags from the running binary). This will read 512 bytes from the card.
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com

#165960 - pilch - Wed Jan 14, 2009 1:30 pm

chishm wrote:
You can only read the card for addresses above 0x8000 after it has passed the initialisation stage. Use the 0xB7 command in the following manner:
Code:
cardParamCommand (CARD_CMD_DATA_READ, src,
   (portFlags &~CARD_BLK_SIZE(7)) | CARD_ACTIVATE | CARD_nRESET | CARD_BLK_SIZE(1),
   dest, CARD_DATA_BLOCK_SIZE);

Here src is the offset address on the card, dest is the destination memory address and portFlags are the DS card flags specified by ndsHeader.cardControl13 (read from the card during initialisation, don't try using the flags from the running binary). This will read 512 bytes from the card.


I know that... but did you test it ?
Did it work ?
(I mean on real hardware, not on no$gba)

#165962 - Maxxie - Wed Jan 14, 2009 2:00 pm

Chishm is a trusted source on that. It will work.
_________________
Trying to bring more detail into understanding the wireless hardware

#165965 - pilch - Wed Jan 14, 2009 5:33 pm

chishm wrote:
You can only read the card for addresses above 0x8000 after it has passed the initialisation stage. Use the 0xB7 command in the following manner:
Code:
cardParamCommand (CARD_CMD_DATA_READ, src,
   (portFlags &~CARD_BLK_SIZE(7)) | CARD_ACTIVATE | CARD_nRESET | CARD_BLK_SIZE(1),
   dest, CARD_DATA_BLOCK_SIZE);

Here src is the offset address on the card, dest is the destination memory address and portFlags are the DS card flags specified by ndsHeader.cardControl13 (read from the card during initialisation, don't try using the flags from the running binary). This will read 512 bytes from the card.


Wow, it works !
Thanks a lot ! I was really stuck with this !
Thanks Maxxie too :)

.. I wonder why my previous code failed, have to check it...

#165987 - chishm - Thu Jan 15, 2009 10:53 am

pilch wrote:
I know that... but did you test it ?
Did it work ?
(I mean on real hardware, not on no$gba)

It's used in NitroHax so yes it's tested and works, but I guess you know that now.
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com