Add support for Dezaemon 3D 768KB save (thx to saturnu)

fff9a57a92

(This is untested)
This commit is contained in:
sanni 2024-06-30 12:10:47 +02:00
parent d1b1c88af0
commit 0e48720efc
2 changed files with 75 additions and 60 deletions

View File

@ -274,6 +274,10 @@ void n64CartMenu() {
println_Msg(F("Reading SRAM..."));
display_Update();
readSram(32768, 1);
} else if (saveType == 2) {
println_Msg(F("Reading Sram 768..."));
display_Update();
readSram(98304, 1);
} else if (saveType == 4) {
getFramType();
println_Msg(F("Reading FLASH..."));
@ -312,6 +316,22 @@ void n64CartMenu() {
print_STR(_bytes_STR, 1);
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) {
// Launch file browser
fileBrowser(F("Select fla file"));
@ -1937,6 +1957,9 @@ void printCartInfo_N64() {
case 1:
println_Msg(F("SRAM"));
break;
case 2:
println_Msg(F("SRAM 768"));
break;
case 4:
println_Msg(F("FLASH"));
break;
@ -2346,7 +2369,7 @@ unsigned long verifyEeprom() {
*****************************************/
// Write sram to cartridge
void writeSram(unsigned long sramSize) {
if (saveType == 1) {
if (saveType == 1 || saveType == 2) {
// Create filepath
sprintf(filePath, "%s/%s", filePath, fileName);
println_Msg(F("Writing..."));
@ -2400,6 +2423,8 @@ void readSram(unsigned long sramSize, byte flashramType) {
suffix = "fla";
} else if (saveType == 1) {
suffix = "sra";
} else if (saveType == 2) {
suffix = "768";
} else {
print_FatalError(F("Savetype Error"));
}
@ -4412,7 +4437,8 @@ void flashXplorer_N64() {
println_Msg(FS(FSTRING_EMPTY));
println_Msg(F("Turn Cart Reader off now"));
display_Update();
while (1);
while (1)
;
} else {
display_Clear();
display_Update();
@ -4498,24 +4524,14 @@ void backupXplorer_N64() {
}
unsigned long unscramble(unsigned long addr) {
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));
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));
return result;
}
unsigned long scramble(unsigned long addr) {
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));
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));
return result;
}
@ -4532,7 +4548,6 @@ void oddXPaddrWrite(unsigned long addr, word data) {
setAddress_N64(0x10740000);
readWord_N64();
readWord_N64();
}
void evenXPaddrWrite(unsigned long addr, word data) {

View File

@ -530,7 +530,7 @@ Destruction Derby 64 (USA).z64
38F1B5D9,DEE584A2,16,0
Dezaemon 3D (Japan).z64
9E978488,8979169C,16,0
9E978488,8979169C,16,2
Diddy Kong Racing (Europe) (En,Fr,De) (Rev 1).z64
B1E87639,596E145B,12,5