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?
* Fixed card reading (I didn't notice I broke it)
* Fixed cart swapping
* Still unsupported: CTR carts
* Still hangs if cart has no SPI flash (see WarioWare DIY)
The initialization code was simplified to only enable the SPICARD
interface, which assumes the *TRCARD interface has been initialized
beforehand.
To keep things simple, I just wrapped SPIWriteRead with SPICARD_Init and
SPICARD_deinit (which does the exact opposite)
For some reason (messed up memory access?) the first two time I read the
status register, I get garbage.
Also:
* Reinserting card breaks SPI (everything reads 0xff
* No support for CTR carts for now
- removed most of lodepng's optional features
- lodepng now uses the already existing CRC32 code instead of using its own copy
- fixed GIC interrupt priority