mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
Merge remote-tracking branch 'upstream/master' into bitmap-mode-and-cleanup
This commit is contained in:
commit
e296e4cb68
@ -39,6 +39,7 @@ int cardEepromGetTypeFixed(void) {
|
|||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
// https://github.com/devkitPro/libnds/blob/master/source/common/cardEeprom.c#L88
|
// 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
|
// with type 2 fixed if the first word and another % 8192 location are 0x00000000
|
||||||
|
// and type 3 with ID 0xC22017 added
|
||||||
uint32 cardEepromGetSizeFixed() {
|
uint32 cardEepromGetSizeFixed() {
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -117,8 +118,15 @@ uint32 cardEepromGetSizeFixed() {
|
|||||||
|
|
||||||
if ( ((id >> 16) & 0xff) == 0xC2 ) { // Macronix
|
if ( ((id >> 16) & 0xff) == 0xC2 ) { // Macronix
|
||||||
|
|
||||||
if (device == 0x2211)
|
switch(device) {
|
||||||
|
|
||||||
|
case 0x2211:
|
||||||
return 128*1024; // 1Mbit(128KByte) - MX25L1021E
|
return 128*1024; // 1Mbit(128KByte) - MX25L1021E
|
||||||
|
break;
|
||||||
|
case 0x2017:
|
||||||
|
return 8*1024*1024; // 64Mbit(8 meg)
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id == 0xffffff) {
|
if (id == 0xffffff) {
|
||||||
@ -135,6 +143,20 @@ uint32 cardEepromGetSizeFixed() {
|
|||||||
return 0;
|
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) {
|
void ndsCardSaveDump(const char* filename) {
|
||||||
FILE *out = fopen(filename, "wb");
|
FILE *out = fopen(filename, "wb");
|
||||||
if(out) {
|
if(out) {
|
||||||
@ -254,7 +276,7 @@ void ndsCardSaveRestore(const char *filename) {
|
|||||||
if(auxspi)
|
if(auxspi)
|
||||||
auxspi_erase(card_type);
|
auxspi_erase(card_type);
|
||||||
else
|
else
|
||||||
cardEepromChipErase();
|
cardEepromChipEraseFixed();
|
||||||
}
|
}
|
||||||
if(auxspi){
|
if(auxspi){
|
||||||
buffer = new unsigned char[LEN];
|
buffer = new unsigned char[LEN];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user