mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-30 16:34:14 +01:00
Update NGP.ino
This commit is contained in:
parent
7a975ec97b
commit
a6f3e8c90b
@ -9,10 +9,10 @@ static const char ngpMenuItem1[] PROGMEM = "Read Rom";
|
||||
static const char ngpMenuItemReset[] PROGMEM = "Reset";
|
||||
static const char* const menuOptionsNGP[] PROGMEM = {ngpMenuItem1, ngpMenuItemReset};
|
||||
|
||||
static const char ngpRomItem1[] PROGMEM = "4 Mbits";
|
||||
static const char ngpRomItem2[] PROGMEM = "8 Mbits";
|
||||
static const char ngpRomItem3[] PROGMEM = "16 Mbits";
|
||||
static const char ngpRomItem4[] PROGMEM = "32 Mbits";
|
||||
static const char ngpRomItem1[] PROGMEM = "4 Mbits / 512 KB";
|
||||
static const char ngpRomItem2[] PROGMEM = "8 Mbits / 1 MB";
|
||||
static const char ngpRomItem3[] PROGMEM = "16 Mbits / 2 MB";
|
||||
static const char ngpRomItem4[] PROGMEM = "32 Mbits / 4 MB";
|
||||
static const char* const ngpRomOptions[] PROGMEM = {ngpRomItem1, ngpRomItem2, ngpRomItem3, ngpRomItem4};
|
||||
|
||||
char ngpRomVersion[3];
|
||||
@ -100,48 +100,21 @@ bool getCartInfo_NGP() {
|
||||
*(tmp + 1) = manufacturerID;
|
||||
|
||||
switch (romSize) {
|
||||
// detection error
|
||||
case 0xffff:
|
||||
return false;
|
||||
break;
|
||||
|
||||
// 4 Mbits
|
||||
case 0x98ab:
|
||||
cartSize = 524288;
|
||||
break;
|
||||
// Toshiba ?
|
||||
case 0x204c:
|
||||
cartSize = 524288;
|
||||
break;
|
||||
|
||||
// 8 Mbits
|
||||
// Toshiba
|
||||
case 0x982c:
|
||||
cartSize = 1048576;
|
||||
break;
|
||||
// Samsung
|
||||
case 0xec2c:
|
||||
cartSize = 1048576;
|
||||
break;
|
||||
|
||||
// 16 Mbits
|
||||
// Toshiba
|
||||
case 0x982f:
|
||||
cartSize = 2097152;
|
||||
break;
|
||||
// Samsung
|
||||
case 0xec2f:
|
||||
cartSize = 2097152;
|
||||
break;
|
||||
case 0xffff: return false; break; // detection error (no cart inserted or hw problem)
|
||||
case 0x98ab: cartSize = 524288; break; // 4 Mbits - Toshiba
|
||||
case 0x204c: cartSize = 524288; break; // 4 Mbits - STMicroelectronics ?
|
||||
case 0x982c: cartSize = 1048576; break; // 8 Mbits - Toshiba
|
||||
case 0xec2c: cartSize = 1048576; break; // 8 Mbits - Samsung
|
||||
case 0x982f: cartSize = 2097152; break; // 16 Mbits - Toshiba
|
||||
case 0xec2f: cartSize = 2097152; break; // 16 Mbits - Samsung
|
||||
}
|
||||
|
||||
// reset to read mode
|
||||
dataOut();
|
||||
writeByte_NGP(0x0, 0xf0);
|
||||
|
||||
dataIn();
|
||||
|
||||
// confirm NGP cart recognition
|
||||
dataIn();
|
||||
for (uint32_t addr = 0; addr < 28; addr++)
|
||||
sdBuffer[addr] = readByte_NGP(addr);
|
||||
if (memcmp_P(sdBuffer, PSTR("COPYRIGHT BY SNK CORPORATION"), 28) != 0 && memcmp_P(sdBuffer, PSTR(" LICENSED BY SNK CORPORATION"), 28) != 0)
|
||||
@ -150,7 +123,7 @@ bool getCartInfo_NGP() {
|
||||
// get app ID
|
||||
snprintf(cartID, 5, "%02X%02X", readByte_NGP(0x21), readByte_NGP(0x20));
|
||||
|
||||
// force rom size to 32Mbits for few titles
|
||||
// force rom size to 32 Mbits for few titles
|
||||
if (strcmp(cartID,"0060") == 0 || strcmp(cartID,"0061") == 0 || strcmp(cartID,"0069") == 0 )
|
||||
cartSize = 4194304;
|
||||
|
||||
@ -192,6 +165,7 @@ void printCartInfo_NGP() {
|
||||
print_Msg(F("Rom Size: "));
|
||||
if (cartSize == 0) {
|
||||
println_Msg(F("Unknown"));
|
||||
// display the chip IDs if unknown
|
||||
print_Msg(F("Chip ID: "));
|
||||
println_Msg(String(manufacturerID,HEX) + " " + String(deviceID,HEX));
|
||||
}
|
||||
@ -217,22 +191,18 @@ void readROM_NGP(char *outPathBuf, size_t bufferSize) {
|
||||
// wait for user choice to come back from the question box menu
|
||||
switch (ngpRomMenu) {
|
||||
case 0:
|
||||
// 4 Mbits
|
||||
cartSize = 524288;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// 8 Mbits
|
||||
cartSize = 1048576;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// 16 Mbits
|
||||
cartSize = 2097152;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// 32 Mbits
|
||||
cartSize = 4194304;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user