Skip to content

Commit

Permalink
Add support for zx-spectrum
Browse files Browse the repository at this point in the history
Adds ROM extension support, but until someone creates a specific emulator, just uses a generic filename.
  • Loading branch information
networkfusion committed Dec 30, 2024
1 parent f2cff4c commit fb2afc0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/menu/cart_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ cart_load_err_t cart_load_emulator (menu_t *menu, cart_load_emu_type_t emu_type,
path_push(path, "Press-F.z64");
save_type = FLASHCART_SAVE_TYPE_NONE;
break;
case CART_LOAD_EMU_TYPE_SINCLAIR_ZXSPECTRUM:
path_push(path, "zx-spectrum.z64");
save_type = FLASHCART_SAVE_TYPE_NONE;
break;
}

if (!file_exists(path_get(path))) {
Expand Down
3 changes: 2 additions & 1 deletion src/menu/cart_load.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ typedef enum {
CART_LOAD_EMU_TYPE_SEGA_GENERIC_8BIT,
/** @brief The ROM is designed for a Fairchild Channel F system. */
CART_LOAD_EMU_TYPE_FAIRCHILD_CHANNELF,
/** @brief The ROM is designed for a Sinclair ZX Spectrum system. */
CART_LOAD_EMU_TYPE_SINCLAIR_ZXSPECTRUM,
} cart_load_emu_type_t;


Expand All @@ -64,5 +66,4 @@ cart_load_err_t cart_load_n64_rom_and_save (menu_t *menu, flashcart_progress_cal
cart_load_err_t cart_load_64dd_ipl_and_disk (menu_t *menu, flashcart_progress_callback_t progress);
cart_load_err_t cart_load_emulator (menu_t *menu, cart_load_emu_type_t emu_type, flashcart_progress_callback_t progress);


#endif
2 changes: 1 addition & 1 deletion src/menu/views/browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

static const char *rom_extensions[] = { "z64", "n64", "v64", "rom", NULL };
static const char *disk_extensions[] = { "ndd", NULL };
static const char *emulator_extensions[] = { "nes", "sfc", "smc", "gb", "gbc", "sms", "gg", "sg", "chf", NULL };
static const char *emulator_extensions[] = { "nes", "sfc", "smc", "gb", "gbc", "sms", "gg", "sg", "chf", "rzx", NULL };
// TODO: "eep", "sra", "srm", "fla" could be used if transfered from different flashcarts.
static const char *save_extensions[] = { "sav", NULL };
static const char *image_extensions[] = { "png", NULL };
Expand Down
2 changes: 1 addition & 1 deletion src/menu/views/file_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static const char *archive_extensions[] = { "zip", "rar", "7z", "tar", "gz", NUL
static const char *image_extensions[] = { "png", "jpg", "gif", NULL };
static const char *music_extensions[] = { "mp3", "wav", "ogg", "wma", "flac", NULL };
static const char *controller_pak_extensions[] = { "mpk", "pak", NULL };
static const char *emulator_extensions[] = { "nes", "smc", "gb", "gbc", "sms", "gg", "chf", NULL };
static const char *emulator_extensions[] = { "nes", "smc", "gb", "gbc", "sms", "gg", "chf", "rzx", NULL };


static struct stat st;
Expand Down
5 changes: 5 additions & 0 deletions src/menu/views/load_emulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ static const char *emu_gameboy_rom_extensions[] = { "gb", NULL };
static const char *emu_gameboy_color_rom_extensions[] = { "gbc", NULL };
static const char *emu_sega_8bit_rom_extensions[] = { "sms", "gg", "sg", NULL };
static const char *emu_fairchild_channelf_rom_extensions[] = { "chf", NULL };
static const char *emu_sinclair_zxspectrum_rom_extensions[] = { "rzx", NULL };

static cart_load_emu_type_t emu_type;

Expand All @@ -28,6 +29,8 @@ static char *format_emulator_name (cart_load_emu_type_t emulator_info) {
return "SEGA 8bit system";
case CART_LOAD_EMU_TYPE_FAIRCHILD_CHANNELF:
return "Fairchild Channel F";
case CART_LOAD_EMU_TYPE_SINCLAIR_ZXSPECTRUM:
return "Sinclair ZX Spectrum";
default:
return "Unknown";
}
Expand Down Expand Up @@ -125,6 +128,8 @@ void view_load_emulator_init (menu_t *menu) {
emu_type = CART_LOAD_EMU_TYPE_SEGA_GENERIC_8BIT;
} else if (file_has_extensions(path_get(path), emu_fairchild_channelf_rom_extensions)) {
emu_type = CART_LOAD_EMU_TYPE_FAIRCHILD_CHANNELF;
} else if (file_has_extensions(path_get(path), emu_sinclair_zxspectrum_rom_extensions)) {
emu_type = CART_LOAD_EMU_TYPE_SINCLAIR_ZXSPECTRUM;
} else {
menu_show_error(menu, "Unsupported ROM");
}
Expand Down

0 comments on commit fb2afc0

Please sign in to comment.