Add SAVE_TYPE_DD64_CART_PORT

and Code style improvements
This commit is contained in:
Robin Jones 2023-10-23 22:48:22 +01:00
parent 08f1cc6870
commit d9cfeaac2d
2 changed files with 32 additions and 32 deletions

View File

@ -97,10 +97,10 @@ static flashcart_err_t ed64_deinit (void) {
static bool ed64_has_feature (flashcart_features_t feature) { static bool ed64_has_feature (flashcart_features_t feature) {
switch (feature) { switch (feature) {
case FLASHCART_FEATURE_64DD: case FLASHCART_FEATURE_64DD:
return false; return false;
default: default:
return false; return false;
} }
} }
@ -126,17 +126,19 @@ static flashcart_err_t ed64_load_rom (char *rom_path, flashcart_progress_callbac
} }
if (rom_size == MiB(64)) { if (rom_size == MiB(64)) {
ed64_save_type_t type = ed64_ll_get_save_type(); ed64_save_type_t type = ed64_ll_get_save_type();
switch (type) { switch (type) {
case SAVE_TYPE_SRAM: case SAVE_TYPE_SRAM:
rom_size -= KiB(32); rom_size -= KiB(32);
break; break;
case SAVE_TYPE_SRAM_128K: case SAVE_TYPE_SRAM_128K:
case SAVE_TYPE_FLASHRAM: case SAVE_TYPE_FLASHRAM:
rom_size -= KiB(128); rom_size -= KiB(128);
break; break;
case SAVE_TYPE_DD64_CART_PORT:
break;
default: default:
break; break;
} }
} }
@ -154,10 +156,6 @@ static flashcart_err_t ed64_load_rom (char *rom_path, flashcart_progress_callbac
progress(f_tell(&fil) / (float)(f_size(&fil))); progress(f_tell(&fil) / (float)(f_size(&fil)));
} }
} }
/*if (f_tell(&fil) != sdram_size) {
f_close(&fil);
return FLASHCART_ERR_LOAD;
}*/
if (f_close(&fil) != FR_OK) { if (f_close(&fil) != FR_OK) {
return FLASHCART_ERR_LOAD; return FLASHCART_ERR_LOAD;
@ -234,24 +232,26 @@ static flashcart_err_t ed64_load_save (char *save_path) {
ed64_save_type_t type = ed64_ll_get_save_type(); ed64_save_type_t type = ed64_ll_get_save_type();
switch (type) { switch (type) {
case SAVE_TYPE_EEPROM_4K: case SAVE_TYPE_EEPROM_4K:
case SAVE_TYPE_EEPROM_16K: case SAVE_TYPE_EEPROM_16K:
ed64_ll_set_eeprom(cartsave_data, save_size); ed64_ll_set_eeprom(cartsave_data, save_size);
break; break;
case SAVE_TYPE_SRAM: case SAVE_TYPE_SRAM:
ed64_ll_set_sram(cartsave_data, save_size); ed64_ll_set_sram(cartsave_data, save_size);
case SAVE_TYPE_SRAM_128K: case SAVE_TYPE_SRAM_128K:
ed64_ll_set_sram_128(cartsave_data, KiB(128)); ed64_ll_set_sram_128(cartsave_data, KiB(128));
break; break;
case SAVE_TYPE_FLASHRAM: case SAVE_TYPE_FLASHRAM:
ed64_ll_set_fram(cartsave_data, KiB(128)); ed64_ll_set_fram(cartsave_data, KiB(128));
// a cold and warm boot has no way of seeing save types and most types can be determined by size // a cold and warm boot has no way of seeing save types and most types can be determined by size
// this tells the cart to use flash instead of sram 128 since they are the same size // this tells the cart to use flash instead of sram 128 since they are the same size
current_state.is_fram_save_type = true; current_state.is_fram_save_type = true;
ed64_state_save(&current_state); ed64_state_save(&current_state);
break; break;
default: case SAVE_TYPE_DD64_CART_PORT:
break; break;
default:
break;
} }

View File

@ -59,7 +59,7 @@ typedef enum {
SAVE_TYPE_EEPROM_16K = 4, SAVE_TYPE_EEPROM_16K = 4,
SAVE_TYPE_FLASHRAM = 5, SAVE_TYPE_FLASHRAM = 5,
SAVE_TYPE_CPAK = 8, SAVE_TYPE_CPAK = 8,
SAVE_TYPE_DD64 = 16, SAVE_TYPE_DD64_CART_PORT = 16,
} ed64_save_type_t; } ed64_save_type_t;
#define ROM_ADDRESS (0xB0000000) #define ROM_ADDRESS (0xB0000000)