* Add cart_id2 to gamecart.h
This prepares changes to fix private header dumps.
The name ID2 matches Lotus3 (see Switchbrew) since it's evident Lotus3 is just a continuation of the 3DS cart controller
* Add Cart_GetID2() to protocol.h
This prepares changes to fix private header dumps.
The name ID2 matches Lotus3 (see Switchbrew) since it's evident Lotus3 is just a continuation of the 3DS cart controller.
* gc protocol: Add support to get ID2
This renames the unknowna0_cmd to its proper name and the A0_Response to CartID2, matching Lotus3 terminology.
* Store ID2 in private header at +0x44
The ID2 contains important information that in particular determines the cryptographic keys used. It is impossible to decrypt a dump of cart<->controller communications without knowing the ID2 or trying all possible keys.
This behavior matches Gateway. I suppose that it was presumed that Gateway would always store zeroes there because regular cartridges on retail would always report zero and then everybody just copied this false assumption.
* fix build (gamecart.c): memset->memcpy
* fix build (protocol.c): Fix dupe definition of Cart_GetID()
This is my second attempt to resolve#553
Props to @wwylele for pointing out that the last byte of the JEDEC ID is
just the exponent of the size (base 2)
It's possible to flash a TWL-enhanced ROM image to an NTR dev cart.
This cart would function properly as a Nintendo DS game, but might
have issues on a DSi or 3DS.
GodMode9 couldn't dump this type of cartridge before because the ROM
header indicates TWL, but the cartridge doesn't understand the 0x3D
TWL secure area init command, so key exchange failed.
Some development carts have an incorrect ROM header, but the cart ID
is always correct, so prefer the chip ID. If the chip ID is invalid
(unlikely), then fall back to the ROM header.
This is meant to replace the Prompt I was using previously.
Fun fact: WarioWare DIY seems to have *something* on the SPI bus, as it
returns an ID of 0x000001 consistently. Or am I just glitching the
parallel flash? Or did I get a fake?