From d9cfeaac2d0c3aa9d18fdb797ea9c76db8bd6354 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 23 Oct 2023 22:48:22 +0100 Subject: [PATCH] Add SAVE_TYPE_DD64_CART_PORT and Code style improvements --- src/flashcart/ed64/ed64.c | 62 ++++++++++++++++++------------------ src/flashcart/ed64/ed64_ll.h | 2 +- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/flashcart/ed64/ed64.c b/src/flashcart/ed64/ed64.c index a453b117..666e45d9 100644 --- a/src/flashcart/ed64/ed64.c +++ b/src/flashcart/ed64/ed64.c @@ -97,10 +97,10 @@ static flashcart_err_t ed64_deinit (void) { static bool ed64_has_feature (flashcart_features_t feature) { switch (feature) { - case FLASHCART_FEATURE_64DD: - return false; - default: - return false; + case FLASHCART_FEATURE_64DD: + return false; + default: + return false; } } @@ -126,17 +126,19 @@ static flashcart_err_t ed64_load_rom (char *rom_path, flashcart_progress_callbac } if (rom_size == MiB(64)) { - ed64_save_type_t type = ed64_ll_get_save_type(); - switch (type) { + ed64_save_type_t type = ed64_ll_get_save_type(); + switch (type) { case SAVE_TYPE_SRAM: rom_size -= KiB(32); - break; + break; case SAVE_TYPE_SRAM_128K: case SAVE_TYPE_FLASHRAM: rom_size -= KiB(128); - break; + break; + case SAVE_TYPE_DD64_CART_PORT: + break; 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))); } } - /*if (f_tell(&fil) != sdram_size) { - f_close(&fil); - return FLASHCART_ERR_LOAD; - }*/ if (f_close(&fil) != FR_OK) { 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(); switch (type) { - case SAVE_TYPE_EEPROM_4K: - case SAVE_TYPE_EEPROM_16K: - ed64_ll_set_eeprom(cartsave_data, save_size); - break; - case SAVE_TYPE_SRAM: - ed64_ll_set_sram(cartsave_data, save_size); - case SAVE_TYPE_SRAM_128K: - ed64_ll_set_sram_128(cartsave_data, KiB(128)); - break; - case SAVE_TYPE_FLASHRAM: - 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 - // this tells the cart to use flash instead of sram 128 since they are the same size - current_state.is_fram_save_type = true; - ed64_state_save(¤t_state); - break; - default: - break; + case SAVE_TYPE_EEPROM_4K: + case SAVE_TYPE_EEPROM_16K: + ed64_ll_set_eeprom(cartsave_data, save_size); + break; + case SAVE_TYPE_SRAM: + ed64_ll_set_sram(cartsave_data, save_size); + case SAVE_TYPE_SRAM_128K: + ed64_ll_set_sram_128(cartsave_data, KiB(128)); + break; + case SAVE_TYPE_FLASHRAM: + 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 + // this tells the cart to use flash instead of sram 128 since they are the same size + current_state.is_fram_save_type = true; + ed64_state_save(¤t_state); + break; + case SAVE_TYPE_DD64_CART_PORT: + break; + default: + break; } diff --git a/src/flashcart/ed64/ed64_ll.h b/src/flashcart/ed64/ed64_ll.h index 0f36618d..e4436262 100644 --- a/src/flashcart/ed64/ed64_ll.h +++ b/src/flashcart/ed64/ed64_ll.h @@ -59,7 +59,7 @@ typedef enum { SAVE_TYPE_EEPROM_16K = 4, SAVE_TYPE_FLASHRAM = 5, SAVE_TYPE_CPAK = 8, - SAVE_TYPE_DD64 = 16, + SAVE_TYPE_DD64_CART_PORT = 16, } ed64_save_type_t; #define ROM_ADDRESS (0xB0000000)