mirror of
https://github.com/sanni/cartreader.git
synced 2024-12-27 13:31:51 +01:00
Merge pull request #42 from ramapcsx2/various
SNES, MD: avoid dumping/writing 0 Byte files to SD card
This commit is contained in:
commit
6d47a68f29
@ -195,10 +195,18 @@ void mdCartMenu() {
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
display_Clear();
|
display_Clear();
|
||||||
|
|
||||||
|
// common ROM read fail state: no cart inserted - tends to report impossibly large cartSize
|
||||||
|
// largest known game so far is supposedly "Paprium" at 10MB, so cap sanity check at 16MB
|
||||||
|
if (cartSize != 0 && cartSize <= 16777216) {
|
||||||
// Change working dir to root
|
// Change working dir to root
|
||||||
sd.chdir("/");
|
sd.chdir("/");
|
||||||
readROM_MD();
|
readROM_MD();
|
||||||
//compare_checksum_MD();
|
//compare_checksum_MD();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print_Error(F("Cart has no ROM"), false);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -298,6 +298,7 @@ void n64CartMenu() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
display_Clear();
|
||||||
print_Error(F("Savetype Error"), false);
|
print_Error(F("Savetype Error"), false);
|
||||||
}
|
}
|
||||||
println_Msg(F("Press Button..."));
|
println_Msg(F("Press Button..."));
|
||||||
|
@ -49,7 +49,7 @@ static const char confMenuItem2[] PROGMEM = "4MB LoRom 256K Sram";
|
|||||||
static const char confMenuItem3[] PROGMEM = "4MB HiRom 64K Sram";
|
static const char confMenuItem3[] PROGMEM = "4MB HiRom 64K Sram";
|
||||||
static const char confMenuItem4[] PROGMEM = "6MB ExRom 256K Sram";
|
static const char confMenuItem4[] PROGMEM = "6MB ExRom 256K Sram";
|
||||||
static const char confMenuItem5[] PROGMEM = "Reset";
|
static const char confMenuItem5[] PROGMEM = "Reset";
|
||||||
static const char* const menuOptionsConf[] PROGMEM = {confMenuItem1, confMenuItem2, confMenuItem3, confMenuItem4, confMenuItem5};
|
static const char* const menuOptionsConfManual[] PROGMEM = {confMenuItem1, confMenuItem2, confMenuItem3, confMenuItem4, confMenuItem5};
|
||||||
|
|
||||||
// SNES start menu
|
// SNES start menu
|
||||||
void snsMenu() {
|
void snsMenu() {
|
||||||
@ -118,6 +118,7 @@ void snesMenu() {
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
|
if (numBanks > 0) {
|
||||||
display_Clear();
|
display_Clear();
|
||||||
// Change working dir to root
|
// Change working dir to root
|
||||||
sd.chdir("/");
|
sd.chdir("/");
|
||||||
@ -132,6 +133,11 @@ void snesMenu() {
|
|||||||
println_Msg(F("s"));
|
println_Msg(F("s"));
|
||||||
display_Update();
|
display_Update();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
display_Clear();
|
||||||
|
print_Error(F("Does not have ROM"), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
@ -239,11 +245,11 @@ void snesMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Menu for manual configuration
|
// Menu for manual configuration
|
||||||
void confMenu() {
|
void confMenuManual() {
|
||||||
// create menu with title and 5 options to choose from
|
// create menu with title and 5 options to choose from
|
||||||
unsigned char subMenu;
|
unsigned char subMenu;
|
||||||
// Copy menuOptions out of progmem
|
// Copy menuOptions out of progmem
|
||||||
convertPgm(menuOptionsConf, 5);
|
convertPgm(menuOptionsConfManual, 5);
|
||||||
subMenu = question_box(F("Choose mapping"), menuOptions, 5, 0);
|
subMenu = question_box(F("Choose mapping"), menuOptions, 5, 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
|
||||||
@ -658,7 +664,7 @@ void getCartInfo_SNES() {
|
|||||||
|
|
||||||
// Start manual config
|
// Start manual config
|
||||||
if (manualConfig == 1) {
|
if (manualConfig == 1) {
|
||||||
confMenu();
|
confMenuManual();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -834,7 +840,8 @@ boolean checkcart_SNES() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate sramSize
|
// Calculate sramSize
|
||||||
if (sramSizeExp != 0) {
|
// Fail states usually have sramSizeExp at 255 (no cart inserted, SA-1 failure, etc)
|
||||||
|
if (sramSizeExp != 0 && sramSizeExp != 255) {
|
||||||
sramSizeExp = sramSizeExp + 3;
|
sramSizeExp = sramSizeExp + 3;
|
||||||
sramSize = 1;
|
sramSize = 1;
|
||||||
while (sramSizeExp--)
|
while (sramSizeExp--)
|
||||||
|
Loading…
Reference in New Issue
Block a user