mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
Fix restoring to ID 0xC22017 cards (#107)
This commit is contained in:
parent
520327dcdf
commit
c7694df14c
@ -39,6 +39,7 @@ int cardEepromGetTypeFixed(void) {
|
||||
//---------------------------------------------------------------------------------
|
||||
// https://github.com/devkitPro/libnds/blob/master/source/common/cardEeprom.c#L88
|
||||
// with type 2 fixed if the first word and another % 8192 location are 0x00000000
|
||||
// and type 3 with ID 0xC22017 added
|
||||
uint32 cardEepromGetSizeFixed() {
|
||||
//---------------------------------------------------------------------------------
|
||||
|
||||
@ -142,6 +143,20 @@ uint32 cardEepromGetSizeFixed() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// https://github.com/devkitPro/libnds/blob/master/source/common/cardEeprom.c#L263
|
||||
// but using our fixed size function
|
||||
//---------------------------------------------------------------------------------
|
||||
void cardEepromChipEraseFixed(void) {
|
||||
//---------------------------------------------------------------------------------
|
||||
int sz, sector;
|
||||
sz=cardEepromGetSizeFixed();
|
||||
|
||||
for ( sector = 0; sector < sz; sector+=0x10000) {
|
||||
cardEepromSectorErase(sector);
|
||||
}
|
||||
}
|
||||
|
||||
void ndsCardSaveDump(const char* filename) {
|
||||
FILE *out = fopen(filename, "wb");
|
||||
if(out) {
|
||||
@ -264,7 +279,7 @@ void ndsCardSaveRestore(const char *filename) {
|
||||
if(auxspi)
|
||||
auxspi_erase(card_type);
|
||||
else
|
||||
cardEepromChipErase();
|
||||
cardEepromChipEraseFixed();
|
||||
}
|
||||
if(auxspi){
|
||||
buffer = new unsigned char[LEN];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user