20 Commits

Author SHA1 Message Date
Balint Kovacs
48d8c48d12 Completely refactor SPI.h, write CTR flash
Also (hopefully?) write Art Academy, and also implement sector-based
write on Sanyo 256K chips.
2019-10-11 16:24:08 +02:00
Balint Kovacs
004341e1ef Add a little utility to test gamecard flash chips 2019-10-11 16:24:08 +02:00
Balint Kovacs
fa741b265b Write support for NTR saves
Why does this work? We are writing flash memories without erasing them,
and writing pages without regard to alignment. Yet it works?
2019-10-11 16:24:08 +02:00
Balint Kovacs
38d9a23427 Minor cleanup of gamecart.c 2019-10-11 16:24:07 +02:00
Balint Kovacs
7b0a101f13 Add read support for CTR cartridge saves
I have done nothing, however, to decrypt them. There is also no write
support.
2019-10-11 16:24:07 +02:00
Balint Kovacs
f60a4c1f63 Add a vfile to show the JEDEC id for the inserted cart
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?
2019-10-11 16:24:07 +02:00
Balint Kovacs
fd48c95deb Add a timeout to SPIWaitWriteEnd
Solves the WarioWare issue
2019-10-11 16:24:07 +02:00
Balint Kovacs
556c75c337 Fix many bugs by simplifying SPICARD init
* 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)
2019-10-11 16:24:07 +02:00
Balint Kovacs
ac4ec6ee90 spicard.h: use void* pointers
First initialized cart reads correctly now, and cardswap just hangs.
2019-10-11 16:24:07 +02:00
Balint Kovacs
2ceafc545b First viable(-ish) prototype
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
2019-10-11 16:24:07 +02:00
d0k3
a3cc272e63 Try to fix the infloop
Debug output (revert this later)
2019-10-11 16:24:07 +02:00
d0k3
01bc082ca0 Initial support of cartridge savegame reads 2019-10-11 16:24:07 +02:00
Wolfvak
d6c6f56526 fix compilation warnings due to unaligned packed structures in newer gcc 2019-09-29 19:53:27 +02:00
Wolfvak
2f64a8046a - compile with size optimizations, reduces inst cache pressure
- 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
2019-06-03 02:28:24 +02:00
d0k3
e4352d4cb0 Updated gamecart reset routines
thanks @profi200
2018-06-25 23:14:17 +02:00
d0k3
28c2f7b06e Actually wipe card2 gamecart savedata when dumping 2018-06-05 00:55:46 +02:00
d0k3
a4a7b8f1e0 Fix GCC v8.1 (new dkA) warnings
... this also fixes #371
2018-05-24 01:08:00 +02:00
d0k3
3a7c7432ca Always read CTR carts in 1MB chunks
This fixes #346
2018-04-18 01:24:27 +02:00
d0k3
b204921554 CPPcheck audit, fixed some minor stuff 2018-02-07 00:43:20 +01:00
Wolfvak
beeea37d07 Revised Makefile 2017-11-17 19:37:45 +01:00