Skip to content

Commit

Permalink
Add Flashram non-compliant
Browse files Browse the repository at this point in the history
  • Loading branch information
networkfusion committed Jan 14, 2025
1 parent b56dfe0 commit 48e7ee6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/flashcart/64drive/64drive.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ static flashcart_err_t d64_set_save_type (flashcart_save_type_t save_type) {
case FLASHCART_SAVE_TYPE_FLASHRAM_PKST2:
type = (device_variant == DEVICE_VARIANT_A) ? SAVE_TYPE_FLASHRAM_PKST2 : SAVE_TYPE_FLASHRAM_1MBIT;
break;
case FLASHCART_SAVE_TYPE_FLASHRAM_NONCOMPLIANT:
// NOTE: 64drive doesn't support the non-compliant FlashRam save type, Just thow an error.
return FLASHCART_ERR_ARGS;
default:
return FLASHCART_ERR_ARGS;
}
Expand Down
1 change: 1 addition & 0 deletions src/flashcart/flashcart.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ typedef enum {
FLASHCART_SAVE_TYPE_SRAM_1MBIT,
FLASHCART_SAVE_TYPE_FLASHRAM_1MBIT,
FLASHCART_SAVE_TYPE_FLASHRAM_PKST2,
FLASHCART_SAVE_TYPE_FLASHRAM_NONCOMPLIANT,
__FLASHCART_SAVE_TYPE_END
} flashcart_save_type_t;

Expand Down
3 changes: 3 additions & 0 deletions src/flashcart/sc64/sc64.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,9 @@ static flashcart_err_t sc64_set_save_type (flashcart_save_type_t save_type) {
case FLASHCART_SAVE_TYPE_FLASHRAM_PKST2:
type = SAVE_TYPE_FLASHRAM_1MBIT;
break;
case FLASHCART_SAVE_TYPE_FLASHRAM_NONCOMPLIANT:
// NOTE: SC64 doesn't support the non-compliant FlashRam save types (yet), Just thow an error.
return FLASHCART_ERR_ARGS;
default:
return FLASHCART_ERR_ARGS;
}
Expand Down
1 change: 1 addition & 0 deletions src/menu/cart_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ static flashcart_save_type_t convert_save_type (rom_save_type_t save_type) {
case SAVE_TYPE_SRAM_1MBIT: return FLASHCART_SAVE_TYPE_SRAM_1MBIT;
case SAVE_TYPE_FLASHRAM_1MBIT: return FLASHCART_SAVE_TYPE_FLASHRAM_1MBIT;
case SAVE_TYPE_FLASHRAM_PKST2: return FLASHCART_SAVE_TYPE_FLASHRAM_PKST2;
case SAVE_TYPE_FLASHRAM_NONCOMPLIANT: return FLASHCART_SAVE_TYPE_FLASHRAM_NONCOMPLIANT;
default: return FLASHCART_SAVE_TYPE_NONE;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/menu/rom_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ typedef enum {
SAVE_TYPE_EEPROM_16KBIT = 2,
SAVE_TYPE_SRAM_256KBIT = 3,
SAVE_TYPE_SRAM_BANKED = 4,
SAVE_TYPE_SRAM_1MBIT = 5,
SAVE_TYPE_SRAM_1MBIT = 5, // Not a real save type, but used for some ROMs due to ED64 support.
SAVE_TYPE_FLASHRAM_1MBIT = 6,
SAVE_TYPE_FLASHRAM_PKST2 = 7,
SAVE_TYPE_FLASHRAM_NONCOMPLIANT = 8, // Not a real save type, but used for some ROMs due to ED64 support.
SAVE_TYPE_AUTOMATIC = -1,
} rom_save_type_t;

Expand Down
2 changes: 2 additions & 0 deletions src/menu/views/load_rom.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ static const char *format_rom_save_type (rom_save_type_t save_type, bool support
case SAVE_TYPE_SRAM_1MBIT: return supports_cpak ? "SRAM 1Mbit | Controller PAK" : "SRAM 1Mbit";
case SAVE_TYPE_FLASHRAM_1MBIT: return supports_cpak ? "FlashRAM 1Mbit | Controller PAK" : "FlashRAM 1Mbit";
case SAVE_TYPE_FLASHRAM_PKST2: return supports_cpak ? "FlashRAM (Pokemon Stadium 2) | Controller PAK" : "FlashRAM (Pokemon Stadium 2)";
case SAVE_TYPE_FLASHRAM_NONCOMPLIANT: return supports_cpak ? "FlashRAM (Wrongly implemented) | Controller PAK" : "FlashRAM (Wrongly implemented)";
default: return "Unknown";
}
}
Expand Down Expand Up @@ -193,6 +194,7 @@ static component_context_menu_t set_save_type_context_menu = { .list = {
{ .text = "SRAM 768kbit / 3 banks", .action = set_save_type, .arg = (void *) (SAVE_TYPE_SRAM_BANKED) },
{ .text = "SRAM 1Mbit", .action = set_save_type, .arg = (void *) (SAVE_TYPE_SRAM_1MBIT) },
{ .text = "FlashRAM 1Mbit", .action = set_save_type, .arg = (void *) (SAVE_TYPE_FLASHRAM_1MBIT) },
{ .text = "FlashRAM Non-compliant", .action = set_save_type, .arg = (void *) (SAVE_TYPE_FLASHRAM_NONCOMPLIANT) },
COMPONENT_CONTEXT_MENU_LIST_END,
}};

Expand Down

0 comments on commit 48e7ee6

Please sign in to comment.