Implement ability to change ROMs and use default ROMs for different Amigas

(if it's possible to actually load them)
This commit is contained in:
simon.kagstrom 2009-05-22 13:15:18 +00:00
parent e8fa4f96e0
commit 22ac10ec91
3 changed files with 48 additions and 2 deletions

View File

@ -6,6 +6,9 @@
* Copyright 1996 Bernd Schmidt * Copyright 1996 Bernd Schmidt
*/ */
#include <sys/types.h>
#include <sys/stat.h>
#include "sysconfig.h" #include "sysconfig.h"
#include "sysdeps.h" #include "sysdeps.h"
#include "savestate.h" #include "savestate.h"
@ -26,7 +29,7 @@ static const char *main_menu_messages[] = {
/*03*/ "^|Load|Save|Delete", /*03*/ "^|Load|Save|Delete",
/*04*/ "#1-------------------------------------", /*04*/ "#1-------------------------------------",
/*05*/ "Reset UAE", /*05*/ "Reset UAE",
/*06*/ "Amiga model", /*06*/ "Amiga options",
/*07*/ "Keyboard bindings", /*07*/ "Keyboard bindings",
/*08*/ "Options", /*08*/ "Options",
/*09*/ "Help", /*09*/ "Help",
@ -51,6 +54,7 @@ static const char *amiga_model_messages[] = {
/*03*/ "^|Fast|Compatible|Cycle-exact", /*03*/ "^|Fast|Compatible|Cycle-exact",
/*04*/ "Memory options", /*04*/ "Memory options",
/*05*/ "CPU/Chipset options", /*05*/ "CPU/Chipset options",
/*06*/ "Change ROM",
NULL NULL
}; };
@ -116,6 +120,23 @@ static int find_index_by_val(int val, const int vec[], int vec_size)
return 0; return 0;
} }
/* From PSPUAE (implementation is different though!) */
static void maybe_load_kick_rom(const char *name)
{
const char *dir = prefs_get_attr("rom_path");
char buf[255];
struct stat st;
if (!dir)
dir="";
snprintf(buf, 255, "%s/%s", dir, name);
if (stat(buf, &st) < 0)
return;
/* Setup the new kickstart ROM */
if (!S_ISDIR(st.st_mode))
strncpy(changed_prefs.romfile, buf, 255);
}
/* All this is taken directly from PSPUAE */ /* All this is taken directly from PSPUAE */
static void A500_config(void) static void A500_config(void)
@ -127,6 +148,8 @@ static void A500_config(void)
changed_prefs.chipmem_size = 512 * 1024; //512 changed_prefs.chipmem_size = 512 * 1024; //512
changed_prefs.bogomem_size = 512 * 1024; //512 changed_prefs.bogomem_size = 512 * 1024; //512
changed_prefs.chipset_mask = 0; //OCS changed_prefs.chipset_mask = 0; //OCS
maybe_load_kick_rom("kick13.rom");
} }
static void A600_config(void) static void A600_config(void)
@ -138,6 +161,8 @@ static void A600_config(void)
changed_prefs.chipmem_size = 1024 * 1024; //1024 changed_prefs.chipmem_size = 1024 * 1024; //1024
changed_prefs.bogomem_size = 0; //OFF changed_prefs.bogomem_size = 0; //OFF
changed_prefs.chipset_mask = CSMASK_ECS_DENISE; //ECS Denise changed_prefs.chipset_mask = CSMASK_ECS_DENISE; //ECS Denise
maybe_load_kick_rom("kick20.rom");
} }
static void A1000_config(void) static void A1000_config(void)
@ -149,6 +174,8 @@ static void A1000_config(void)
changed_prefs.chipmem_size = 512 * 1024; //512 changed_prefs.chipmem_size = 512 * 1024; //512
changed_prefs.bogomem_size = 0; //OFF changed_prefs.bogomem_size = 0; //OFF
changed_prefs.chipset_mask = 0; //OCS changed_prefs.chipset_mask = 0; //OCS
maybe_load_kick_rom("kick12.rom");
} }
static void A1200_config(void) static void A1200_config(void)
@ -160,6 +187,8 @@ static void A1200_config(void)
changed_prefs.chipmem_size = 1024 * 2048; //2048 changed_prefs.chipmem_size = 1024 * 2048; //2048
changed_prefs.bogomem_size = 0; changed_prefs.bogomem_size = 0;
changed_prefs.chipset_mask = CSMASK_AGA; //AGA changed_prefs.chipset_mask = CSMASK_AGA; //AGA
maybe_load_kick_rom("kick30.rom");
} }
static void default_config(void) static void default_config(void)
@ -185,6 +214,20 @@ static void insert_floppy(int which)
changed_prefs.df[which][0] = '\0'; changed_prefs.df[which][0] = '\0';
} }
static void insert_rom(void)
{
const char *name = menu_select_file(prefs_get_attr("rom_path"));
/* None or NULL means no change */
if (name != NULL)
{
if (strcmp(name, "None") == 0)
return;
strcpy (changed_prefs.romfile, name);
free((void*)name);
}
}
static void cpu_chipset_options(void) static void cpu_chipset_options(void)
{ {
const int cpu_levels[] = { 0, 1, 2, 3, 4, 6}; const int cpu_levels[] = { 0, 1, 2, 3, 4, 6};
@ -457,6 +500,8 @@ static void amiga_model_options(void)
memory_options(); memory_options();
else if (opt == 5) else if (opt == 5)
cpu_chipset_options(); cpu_chipset_options();
else if (opt == 6)
insert_rom();
prefs_has_changed = 1; prefs_has_changed = 1;
} }

View File

@ -265,7 +265,7 @@ static const char **get_file_list(const char *base_dir)
{ {
char buf[255]; char buf[255];
const char *exts[] = {".adf", ".ADF", ".adz", ".ADZ", const char *exts[] = {".adf", ".ADF", ".adz", ".ADZ",
".sav", ".SAV", ".uss", ".USS", NULL}; ".sav", ".SAV", ".uss", ".USS", ".rom", ".ROM", NULL};
struct stat st; struct stat st;
snprintf(buf, 255, "%s/%s", base_dir, de->d_name); snprintf(buf, 255, "%s/%s", base_dir, de->d_name);

View File

@ -1,3 +1,4 @@
unix.rom_path=/uae/roms
kickstart_rom_file=/uae/roms/kick.rom kickstart_rom_file=/uae/roms/kick.rom
#kickstart_ext_rom_file= #kickstart_ext_rom_file=
floppy0=/uae/floppies/ floppy0=/uae/floppies/