mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-15 01:15:06 +01:00
Add support for Dezaemon 3D 768KB save (thx to saturnu)
fff9a57a92
(This is untested)
This commit is contained in:
parent
d1b1c88af0
commit
0e48720efc
@ -274,6 +274,10 @@ void n64CartMenu() {
|
|||||||
println_Msg(F("Reading SRAM..."));
|
println_Msg(F("Reading SRAM..."));
|
||||||
display_Update();
|
display_Update();
|
||||||
readSram(32768, 1);
|
readSram(32768, 1);
|
||||||
|
} else if (saveType == 2) {
|
||||||
|
println_Msg(F("Reading Sram 768..."));
|
||||||
|
display_Update();
|
||||||
|
readSram(98304, 1);
|
||||||
} else if (saveType == 4) {
|
} else if (saveType == 4) {
|
||||||
getFramType();
|
getFramType();
|
||||||
println_Msg(F("Reading FLASH..."));
|
println_Msg(F("Reading FLASH..."));
|
||||||
@ -312,6 +316,22 @@ void n64CartMenu() {
|
|||||||
print_STR(_bytes_STR, 1);
|
print_STR(_bytes_STR, 1);
|
||||||
print_Error(did_not_verify_STR);
|
print_Error(did_not_verify_STR);
|
||||||
}
|
}
|
||||||
|
} else if (saveType == 2) {
|
||||||
|
// Launch file browser
|
||||||
|
fileBrowser(F("Select Sram 768 file"));
|
||||||
|
display_Clear();
|
||||||
|
|
||||||
|
writeSram(98304);
|
||||||
|
writeErrors = verifySram(98304, 1);
|
||||||
|
if (writeErrors == 0) {
|
||||||
|
println_Msg(F("Sram verified OK"));
|
||||||
|
display_Update();
|
||||||
|
} else {
|
||||||
|
print_STR(error_STR, 0);
|
||||||
|
print_Msg(writeErrors);
|
||||||
|
print_STR(_bytes_STR, 1);
|
||||||
|
print_Error(did_not_verify_STR);
|
||||||
|
}
|
||||||
} else if (saveType == 4) {
|
} else if (saveType == 4) {
|
||||||
// Launch file browser
|
// Launch file browser
|
||||||
fileBrowser(F("Select fla file"));
|
fileBrowser(F("Select fla file"));
|
||||||
@ -1937,6 +1957,9 @@ void printCartInfo_N64() {
|
|||||||
case 1:
|
case 1:
|
||||||
println_Msg(F("SRAM"));
|
println_Msg(F("SRAM"));
|
||||||
break;
|
break;
|
||||||
|
case 2:
|
||||||
|
println_Msg(F("SRAM 768"));
|
||||||
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
println_Msg(F("FLASH"));
|
println_Msg(F("FLASH"));
|
||||||
break;
|
break;
|
||||||
@ -2346,7 +2369,7 @@ unsigned long verifyEeprom() {
|
|||||||
*****************************************/
|
*****************************************/
|
||||||
// Write sram to cartridge
|
// Write sram to cartridge
|
||||||
void writeSram(unsigned long sramSize) {
|
void writeSram(unsigned long sramSize) {
|
||||||
if (saveType == 1) {
|
if (saveType == 1 || saveType == 2) {
|
||||||
// Create filepath
|
// Create filepath
|
||||||
sprintf(filePath, "%s/%s", filePath, fileName);
|
sprintf(filePath, "%s/%s", filePath, fileName);
|
||||||
println_Msg(F("Writing..."));
|
println_Msg(F("Writing..."));
|
||||||
@ -2400,6 +2423,8 @@ void readSram(unsigned long sramSize, byte flashramType) {
|
|||||||
suffix = "fla";
|
suffix = "fla";
|
||||||
} else if (saveType == 1) {
|
} else if (saveType == 1) {
|
||||||
suffix = "sra";
|
suffix = "sra";
|
||||||
|
} else if (saveType == 2) {
|
||||||
|
suffix = "768";
|
||||||
} else {
|
} else {
|
||||||
print_FatalError(F("Savetype Error"));
|
print_FatalError(F("Savetype Error"));
|
||||||
}
|
}
|
||||||
@ -4412,7 +4437,8 @@ void flashXplorer_N64() {
|
|||||||
println_Msg(FS(FSTRING_EMPTY));
|
println_Msg(FS(FSTRING_EMPTY));
|
||||||
println_Msg(F("Turn Cart Reader off now"));
|
println_Msg(F("Turn Cart Reader off now"));
|
||||||
display_Update();
|
display_Update();
|
||||||
while (1);
|
while (1)
|
||||||
|
;
|
||||||
} else {
|
} else {
|
||||||
display_Clear();
|
display_Clear();
|
||||||
display_Update();
|
display_Update();
|
||||||
@ -4498,24 +4524,14 @@ void backupXplorer_N64() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned long unscramble(unsigned long addr) {
|
unsigned long unscramble(unsigned long addr) {
|
||||||
unsigned long result = (((addr >> 4) & 0x001) | ((addr >> 8) & 0x002) |
|
unsigned long result = (((addr >> 4) & 0x001) | ((addr >> 8) & 0x002) | ((~addr >> 9) & 0x004) | ((addr >> 3) & 0x008) | ((addr >> 6) & 0x010) | ((addr >> 2) & 0x020) | ((~addr << 5) & 0x0C0) | ((~addr << 8) & 0x100) | ((~addr << 6) & 0x200) | ((~addr << 2) & 0x400) | ((addr << 6) & 0x800) | (addr & 0x1F000));
|
||||||
((~addr >> 9) & 0x004) | ((addr >> 3) & 0x008) |
|
|
||||||
((addr >> 6) & 0x010) | ((addr >> 2) & 0x020) |
|
|
||||||
((~addr << 5) & 0x0C0) | ((~addr << 8) & 0x100) |
|
|
||||||
((~addr << 6) & 0x200) | ((~addr << 2) & 0x400) |
|
|
||||||
((addr << 6) & 0x800) | (addr & 0x1F000));
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned long scramble(unsigned long addr) {
|
unsigned long scramble(unsigned long addr) {
|
||||||
unsigned long result = (((~addr >> 8) & 0x001) | ((~addr >> 5) & 0x006) |
|
unsigned long result = (((~addr >> 8) & 0x001) | ((~addr >> 5) & 0x006) | ((~addr >> 6) & 0x008) | ((addr << 4) & 0x010) | ((addr >> 6) & 0x020) | ((addr << 3) & 0x040) | ((addr << 2) & 0x080) | ((~addr >> 2) & 0x100) | ((addr << 8) & 0x200) | ((addr << 6) & 0x400) | ((~addr << 9) & 0x800) | (addr & 0x1F000));
|
||||||
((~addr >> 6) & 0x008) | ((addr << 4) & 0x010) |
|
|
||||||
((addr >> 6) & 0x020) | ((addr << 3) & 0x040) |
|
|
||||||
((addr << 2) & 0x080) | ((~addr >> 2) & 0x100) |
|
|
||||||
((addr << 8) & 0x200) | ((addr << 6) & 0x400) |
|
|
||||||
((~addr << 9) & 0x800) | (addr & 0x1F000));
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -4532,7 +4548,6 @@ void oddXPaddrWrite(unsigned long addr, word data) {
|
|||||||
setAddress_N64(0x10740000);
|
setAddress_N64(0x10740000);
|
||||||
readWord_N64();
|
readWord_N64();
|
||||||
readWord_N64();
|
readWord_N64();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void evenXPaddrWrite(unsigned long addr, word data) {
|
void evenXPaddrWrite(unsigned long addr, word data) {
|
||||||
@ -4592,7 +4607,7 @@ void writeXplorer_N64() {
|
|||||||
|
|
||||||
// Fill SD buffer with data in the order it will be expected by the CPLD
|
// Fill SD buffer with data in the order it will be expected by the CPLD
|
||||||
for (unsigned long i = 0; i < 256; i += 2) {
|
for (unsigned long i = 0; i < 256; i += 2) {
|
||||||
unsigned long unscrambled_address = (unscramble(((currPage*2) + i) / 2) * 2);
|
unsigned long unscrambled_address = (unscramble(((currPage * 2) + i) / 2) * 2);
|
||||||
myFile.seek(unscrambled_address);
|
myFile.seek(unscrambled_address);
|
||||||
myFile.read(&sdBuffer[i], 1);
|
myFile.read(&sdBuffer[i], 1);
|
||||||
myFile.seek(unscrambled_address + 1);
|
myFile.seek(unscrambled_address + 1);
|
||||||
@ -4607,10 +4622,10 @@ void writeXplorer_N64() {
|
|||||||
// Join two bytes into one word
|
// Join two bytes into one word
|
||||||
word currWord = ((sdBuffer[currByte] & 0xFF) << 8) | (sdBuffer[currByte + 1] & 0xFF);
|
word currWord = ((sdBuffer[currByte] & 0xFF) << 8) | (sdBuffer[currByte + 1] & 0xFF);
|
||||||
// Set address
|
// Set address
|
||||||
if ((((currByte/2) >> 4) & 0x1) == 0) {
|
if ((((currByte / 2) >> 4) & 0x1) == 0) {
|
||||||
evenXPaddrWrite(0x10400000 + (currPage*2) + currByte, currWord);
|
evenXPaddrWrite(0x10400000 + (currPage * 2) + currByte, currWord);
|
||||||
} else {
|
} else {
|
||||||
oddXPaddrWrite(0x10400000 + (currPage*2) + currByte, currWord);
|
oddXPaddrWrite(0x10400000 + (currPage * 2) + currByte, currWord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
processedProgressBar += 256;
|
processedProgressBar += 256;
|
||||||
|
@ -530,7 +530,7 @@ Destruction Derby 64 (USA).z64
|
|||||||
38F1B5D9,DEE584A2,16,0
|
38F1B5D9,DEE584A2,16,0
|
||||||
|
|
||||||
Dezaemon 3D (Japan).z64
|
Dezaemon 3D (Japan).z64
|
||||||
9E978488,8979169C,16,0
|
9E978488,8979169C,16,2
|
||||||
|
|
||||||
Diddy Kong Racing (Europe) (En,Fr,De) (Rev 1).z64
|
Diddy Kong Racing (Europe) (En,Fr,De) (Rev 1).z64
|
||||||
B1E87639,596E145B,12,5
|
B1E87639,596E145B,12,5
|
||||||
|
Loading…
Reference in New Issue
Block a user