Merge pull request #42 from ramapcsx2/various

SNES, MD: avoid dumping/writing 0 Byte files to SD card
This commit is contained in:
sanni 2019-09-11 20:54:54 +02:00 committed by GitHub
commit 6d47a68f29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 22 deletions

View File

@ -195,10 +195,18 @@ void mdCartMenu() {
{
case 0:
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
sd.chdir("/");
readROM_MD();
//compare_checksum_MD();
}
else {
print_Error(F("Cart has no ROM"), false);
}
break;
case 1:

View File

@ -298,6 +298,7 @@ void n64CartMenu() {
}
}
else {
display_Clear();
print_Error(F("Savetype Error"), false);
}
println_Msg(F("Press Button..."));

View File

@ -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 confMenuItem4[] PROGMEM = "6MB ExRom 256K Sram";
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
void snsMenu() {
@ -118,6 +118,7 @@ void snesMenu() {
{
case 0:
{
if (numBanks > 0) {
display_Clear();
// Change working dir to root
sd.chdir("/");
@ -132,6 +133,11 @@ void snesMenu() {
println_Msg(F("s"));
display_Update();
}
else {
display_Clear();
print_Error(F("Does not have ROM"), false);
}
}
break;
case 1:
@ -239,11 +245,11 @@ void snesMenu() {
}
// Menu for manual configuration
void confMenu() {
void confMenuManual() {
// create menu with title and 5 options to choose from
unsigned char subMenu;
// Copy menuOptions out of progmem
convertPgm(menuOptionsConf, 5);
convertPgm(menuOptionsConfManual, 5);
subMenu = question_box(F("Choose mapping"), menuOptions, 5, 0);
// wait for user choice to come back from the question box menu
@ -658,7 +664,7 @@ void getCartInfo_SNES() {
// Start manual config
if (manualConfig == 1) {
confMenu();
confMenuManual();
}
}
@ -834,7 +840,8 @@ boolean checkcart_SNES() {
}
// 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;
sramSize = 1;
while (sramSizeExp--)