Merge pull request #726 from PsyK0p4T/master

Update MD.ino
This commit is contained in:
sanni 2023-03-06 08:43:28 +01:00 committed by GitHub
commit a8473341a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 59 additions and 53 deletions

View File

@ -720,6 +720,22 @@ void getCartInfo_MD() {
} }
// Fix cartridge sizes according to no-intro database // Fix cartridge sizes according to no-intro database
if (cartSize == 0x400000) {
switch (chksum) {
case 0xCE25: // Super Street Fighter 2 (J) 40Mbit
case 0xE41D: // Super Street Fighter 2 (E) 40Mbit
case 0xE017: // Super Street Fighter 2 (U) 40Mbit
cartSize = 0x500000;
break;
case 0x0000: // Demons of Asteborg v1.0 (W) 120Mbit
cartSize = 0xEAF2F4;
break;
case 0xBCBF: // Demons of Asteborg v1.1 (W) 120Mbit
case 0x6E1E: // Demons of Asteborg v1.11 (W) 120Mbit
cartSize = 0xEA0000;
break;
}
}
if (cartSize == 0x300000) { if (cartSize == 0x300000) {
switch (chksum) { switch (chksum) {
case 0xBC5F: //Batman Forever (World).md case 0xBC5F: //Batman Forever (World).md
@ -754,14 +770,6 @@ void getCartInfo_MD() {
break; break;
} }
} }
if (cartSize == 0x40000) {
switch (chksum) {
case 0x8BC6: //Pac-Attack (USA).md
case 0xB344: //Pac-Panic (Europe).md
cartSize = 0x100000;
break;
}
}
if (cartSize == 0x80000) { if (cartSize == 0x80000) {
switch (chksum) { switch (chksum) {
case 0xD07D: //Zero Wing (Japan).md case 0xD07D: //Zero Wing (Japan).md
@ -775,24 +783,23 @@ void getCartInfo_MD() {
break; break;
} }
} }
if (cartSize == 0x40000) {
// Super Street Fighter 2 + Demons of Asteborg Check
if (cartSize == 0x400000) {
switch (chksum) { switch (chksum) {
// Super Street Fighter 2 case 0x8BC6: //Pac-Attack (USA).md
case 0xCE25: // Super Street Fighter 2 (J) 40Mbit case 0xB344: //Pac-Panic (Europe).md
case 0xE41D: // Super Street Fighter 2 (E) 40Mbit cartSize = 0x100000;
case 0xE017: // Super Street Fighter 2 (U) 40Mbit
cartSize = 0x500000;
break; break;
}
// Demons of Asteborg }
case 0x0000: // Demons of Asteborg v1.0 (W) 120Mbit if (cartSize == 0x20000) {
cartSize = 0xEAF2F4; switch (chksum) {
case 0x7E50: //Micro Machines 2 - Turbo Tournament (Europe).md
cartSize = 0x100000;
chksum = 0xD074;
break; break;
case 0xBCBF: // Demons of Asteborg v1.1 (W) 120Mbit case 0x168B: //Micro Machines - Military (Europe).md
case 0x6E1E: // Demons of Asteborg v1.11 (W) 120Mbit cartSize = 0x100000;
cartSize = 0xEA0000; chksum = 0xCEE0;
break; break;
} }
} }

View File

@ -19,6 +19,7 @@
#define TURBOCHIP 1 #define TURBOCHIP 1
#define HUCARD_NOSWAP 2 #define HUCARD_NOSWAP 2
#define DETECTION_SIZE 64 #define DETECTION_SIZE 64
#define FORCED_SIZE 1024
#define CHKSUM_SKIP 0 #define CHKSUM_SKIP 0
#define CHKSUM_OK 1 #define CHKSUM_OK 1
#define CHKSUM_ERROR 2 #define CHKSUM_ERROR 2
@ -52,21 +53,19 @@ uint8_t tennokoe_bank_index = 0;
static const char pceMenuItem1[] PROGMEM = "HuCARD (swapped)"; static const char pceMenuItem1[] PROGMEM = "HuCARD (swapped)";
static const char pceMenuItem2[] PROGMEM = "HuCARD(not swapped)"; static const char pceMenuItem2[] PROGMEM = "HuCARD(not swapped)";
static const char pceMenuItem3[] PROGMEM = "Turbochip"; static const char pceMenuItem3[] PROGMEM = "Turbochip";
//static const char pceMenuItem4[] PROGMEM = "Reset"; (stored in common strings array)
static const char *const menuOptionspce[] PROGMEM = { pceMenuItem1, pceMenuItem2, pceMenuItem3, string_reset2 }; static const char *const menuOptionspce[] PROGMEM = { pceMenuItem1, pceMenuItem2, pceMenuItem3, string_reset2 };
// PCE card menu items // PCE card menu items
static const char menuOptionspceCart_0[] PROGMEM = "Read ROM"; static const char menuOptionspceCart_0[] PROGMEM = "Read ROM";
static const char menuOptionspceCart_1_fmt[] PROGMEM = "Read RAM Bank %d"; static const char menuOptionspceCart_1[] PROGMEM = "Read RAM Bank %d";
static const char menuOptionspceCart_2_fmt[] PROGMEM = "Write RAM Bank %d"; static const char menuOptionspceCart_2[] PROGMEM = "Write RAM Bank %d";
static const char menuOptionspceCart_4[] PROGMEM = "Inc Bank Number"; static const char menuOptionspceCart_3[] PROGMEM = "Inc Bank Number";
static const char menuOptionspceCart_5[] PROGMEM = "Dec Bank Number"; static const char menuOptionspceCart_4[] PROGMEM = "Dec Bank Number";
static const char menuOptionspceCart_6_fmt[] PROGMEM = "ROM size now %dK"; static const char menuOptionspceCart_5[] PROGMEM = "Force 1MB ROM size";
static const char menuOptionspceCart_6[] PROGMEM = "Force ROM size"; static const char menuOptionspceCart_5_fmt[] PROGMEM = "ROM size now %dK";
// Turbochip menu items // Turbochip menu items
static const char pceTCMenuItem1[] PROGMEM = "Read ROM"; static const char pceTCMenuItem1[] PROGMEM = "Read ROM";
//static const char pceTCMenuItem2[] PROGMEM = "Reset"; (stored in common strings array)
static const char *const menuOptionspceTC[] PROGMEM = { pceTCMenuItem1, string_reset2 }; static const char *const menuOptionspceTC[] PROGMEM = { pceTCMenuItem1, string_reset2 };
// PCE start menu // PCE start menu
@ -150,7 +149,6 @@ void pin_read_write_PCE(void) {
} }
void pin_init_PCE(void) { void pin_init_PCE(void) {
//Set Address Pins to input and pull up //Set Address Pins to input and pull up
DDRF = 0x00; DDRF = 0x00;
PORTF = 0xFF; PORTF = 0xFF;
@ -536,7 +534,7 @@ void read_tennokoe_bank_PCE(int bank_index) {
// create a new folder for the save file // create a new folder for the save file
EEPROM_readAnything(0, foldern); EEPROM_readAnything(0, foldern);
sd.chdir("/"); sd.chdir("/");
sprintf(folder, "PCE/ROM/%d", foldern); sprintf(folder, "PCE/RAM/%d", foldern);
sd.mkdir(folder, true); sd.mkdir(folder, true);
sd.chdir(folder); sd.chdir(folder);
@ -799,49 +797,53 @@ void pceMenu() {
if (pce_internal_mode == HUCARD || pce_internal_mode == HUCARD_NOSWAP) { if (pce_internal_mode == HUCARD || pce_internal_mode == HUCARD_NOSWAP) {
strcpy_P(menuOptions[0], menuOptionspceCart_0); strcpy_P(menuOptions[0], menuOptionspceCart_0);
sprintf_P(menuOptions[1], menuOptionspceCart_1_fmt, tennokoe_bank_index + 1); sprintf_P(menuOptions[1], menuOptionspceCart_1, tennokoe_bank_index + 1);
sprintf_P(menuOptions[2], menuOptionspceCart_2_fmt, tennokoe_bank_index + 1); sprintf_P(menuOptions[2], menuOptionspceCart_2, tennokoe_bank_index + 1);
strcpy_P(menuOptions[3], string_reset2); strcpy_P(menuOptions[3], menuOptionspceCart_3);
strcpy_P(menuOptions[4], menuOptionspceCart_4); strcpy_P(menuOptions[4], menuOptionspceCart_4);
strcpy_P(menuOptions[5], menuOptionspceCart_5);
if (pce_force_rom_size > 0) { if (pce_force_rom_size > 0) {
sprintf_P(menuOptions[6], menuOptionspceCart_6_fmt, pce_force_rom_size); sprintf_P(menuOptions[5], menuOptionspceCart_5_fmt, pce_force_rom_size);
} else { } else {
strcpy_P(menuOptions[6], menuOptionspceCart_6); sprintf_P(menuOptions[5], menuOptionspceCart_5, FORCED_SIZE);
} }
strcpy_P(menuOptions[6], string_reset2);
mainMenu = question_box(F("PCE HuCARD menu"), menuOptions, 7, 0); mainMenu = question_box(F("PCE HuCARD menu"), menuOptions, 7, 0);
// wait for user choice to come back from the question box menu // wait for user choice to come back from the question box menu
switch (mainMenu) { switch (mainMenu) {
case 0: case 0:
display_Clear();
// Change working dir to root
sd.chdir("/");
read_rom_PCE(); read_rom_PCE();
break; break;
case 1: case 1:
display_Clear();
read_tennokoe_bank_PCE(tennokoe_bank_index); read_tennokoe_bank_PCE(tennokoe_bank_index);
break; break;
case 2: case 2:
display_Clear();
write_tennokoe_bank_PCE(tennokoe_bank_index); write_tennokoe_bank_PCE(tennokoe_bank_index);
break; break;
case 3: case 3:
resetArduino();
break;
case 4:
if (tennokoe_bank_index < 3) { if (tennokoe_bank_index < 3) {
tennokoe_bank_index++; tennokoe_bank_index++;
} }
pceMenu();
break; break;
case 5:
case 4:
if (tennokoe_bank_index > 0) { if (tennokoe_bank_index > 0) {
tennokoe_bank_index--; tennokoe_bank_index--;
} }
pceMenu();
break; break;
case 5:
pce_force_rom_size = FORCED_SIZE;
pceMenu();
break;
case 6: case 6:
pce_force_rom_size = 1024; resetArduino();
break; break;
} }
} else { } else {
@ -852,9 +854,6 @@ void pceMenu() {
// wait for user choice to come back from the question box menu // wait for user choice to come back from the question box menu
switch (mainMenu) { switch (mainMenu) {
case 0: case 0:
display_Clear();
// Change working dir to root
sd.chdir("/");
read_rom_PCE(); read_rom_PCE();
break; break;
@ -875,4 +874,4 @@ void pceMenu() {
//****************************************** //******************************************
// End of File // End of File
//****************************************** //******************************************