static void insert_cdrom(int drive_index, int disk_index) { if (disk_index == -1) { fs_emu_log("menu: eject CD from drive %d\n", drive_index); amiga_cdrom_set_file(drive_index, ""); return; } fs_emu_log("menu: insert CD index %d into drive %d\n", disk_index, drive_index); char *key = g_strdup_printf("cdrom_image_%d", disk_index); char* path = fs_config_get_string(key); free(key); if (path == NULL) { fs_emu_log("no CD at this index in CD-ROM list\n"); } path = fs_uae_expand_path_and_free(path); path = fs_uae_resolve_path_and_free(path, FS_UAE_CD_PATHS); amiga_cdrom_set_file(drive_index, path); free(path); }
static char *get_or_create_default_dir(const char *name, const char *key1, const char *key2, const char *dashed_key, int create, int cache) { char *path = NULL; if (path == NULL && key1 != NULL) { path = fs_config_get_string(key1); } if (path == NULL && key2 != NULL) { path = fs_config_get_string(key2); } if (path == NULL && dashed_key != NULL) { path = read_custom_path(dashed_key); } if (path == NULL) { if (cache) { path = g_build_filename(fs_uae_cache_dir(), name, NULL); } else { path = g_build_filename(fs_uae_base_dir(), name, NULL); } } char *expanded_path = fs_uae_expand_path_and_free(path); path = fs_uae_resolve_path(expanded_path, FS_UAE_DIR_PATHS); free(expanded_path); if (create) { int result = g_mkdir_with_parents(path, 0755); if (result == -1) { fs_emu_warning("Could not create %s directory", name); free(path); path = g_strdup(fs_uae_base_dir()); } } fs_log("- using \"%s\" directory \"%s\"\n", name, path); return path; }
void fs_uae_configure_cdrom() { /* if (g_fs_uae_amiga_model != MODEL_CDTV && g_fs_uae_amiga_model != MODEL_CD32) { return; } */ fs_emu_log("configure_cdrom\n"); char *path = fs_config_get_string("cdrom_drive_0"); if (path) { path = fs_uae_expand_path_and_free(path); path = fs_uae_resolve_path_and_free(path, FS_UAE_CD_PATHS); //set_default_dirs_from_file_path(path); char* temp = fs_strconcat(path, ",", NULL); amiga_set_option("cdimage0", temp); free(temp); free(path); if (g_fs_uae_amiga_model != MODEL_CDTV && g_fs_uae_amiga_model != MODEL_CD32) { amiga_set_option("scsi", "true"); amiga_map_cd_drives(1); } } }
void fs_uae_configure_graphics_card(amiga_config *c) { const char *card = NULL; int memory = 0; bool found = false; if (fs_config_get_const_string(OPTION_GRAPHICS_CARD)) { card = fs_config_get_const_string(OPTION_GRAPHICS_CARD); } else { int uaegfx_card = fs_config_get_boolean(OPTION_UAEGFX_CARD); if (uaegfx_card != FS_CONFIG_NONE) { fs_log("DEPRECATED: uaegfx_card is deprecated, use graphics_card " "instead\n"); if (uaegfx_card == 1) { if (!c->allow_z3_memory) { fs_emu_warning(_("Option uaegfx.card needs a CPU with " "32-bit addressing")); } else { card = "ZorroIII"; memory = 32; found = true; } } } } if (card == NULL) { /* For example A4000/OS4 defaults to picasso-iv-z3 */ card = cfg->default_graphics_card; } CHECK_CARD("none", NULL, 0, NULL, 0) CHECK_CARD("uaegfx", "ZorroII", 8, "ZorroIII", 512) CHECK_CARD("picasso-ii", "PicassoII", 2, NULL, 0) CHECK_CARD("picasso-ii+", "PicassoII+", 2, NULL, 0) CHECK_CARD("picasso-iv", "PicassoIV_Z2", 4, "PicassoIV_Z3", 4) if (card && !found) { fs_emu_warning("Unsupported graphics card: %s\n", card); } if (fs_config_get_const_string(OPTION_GRAPHICS_CARD_MEMORY)) { memory = fs_uae_read_memory_option(OPTION_GRAPHICS_CARD_MEMORY); memory /= 1024; fs_log("CONFIG: Overriding graphics card memory: %d MB\n", memory); } if (card != NULL) { if (memory != 0) { amiga_set_option("gfxcard_type", card); amiga_set_int_option("gfxcard_size", memory); } } char *path = fs_config_get_string(OPTION_GRAPHICS_CARD_ROM); if (path) { path = fs_uae_expand_path_and_free(path); path = fs_uae_resolve_path_and_free(path, FS_UAE_ROM_PATHS); amiga_set_option("picassoiv_rom_file", path); g_free(path); } }
void fs_uae_configure_hard_drives() { static const char *ro_string = "ro"; static const char *rw_string = "rw"; const char *read_write = rw_string; fs_emu_log("fs_uae_configure_hard_drives\n"); for(int i = 0; i < 10; i++) { char *fs_uae_option = fs_strdup_printf("hard_drive_%d", i); char *path = fs_config_get_string(fs_uae_option); free(fs_uae_option); if (path == NULL) { continue; } if (path[0] == '\0') { continue; } path = fs_uae_expand_path_and_free(path); path = fs_uae_resolve_path_and_free(path, FS_UAE_HD_PATHS); if (!fs_path_exists(path)) { char *msg = fs_strdup_printf("HD path \"%s\" does not exist", path); fs_emu_warning(msg); free(msg); continue; } int boot_priority = -i; read_write = rw_string; char *device = fs_strdup_printf("DH%d", i); int virtual = 0; if (fs_path_is_dir(path)) { virtual = 1; } else if (fs_str_has_suffix(path, ".zip")) { virtual = 1; read_write = ro_string; } fs_uae_option = fs_strdup_printf("hard_drive_%d_read_only", i); if (fs_config_get_boolean(fs_uae_option) == 1) { read_write = ro_string; } free(fs_uae_option); if (virtual) { char *type = fs_strdup("dir"); int surfaces = 1; int reserved = 2; //char *hd_controller = g_strdup("ide0"); int sectors = 32; int block_size = 512; char *mount_name; char *label_option_name = fs_strdup_printf( "hard_drive_%d_label", i); char *label_option = fs_config_get_string(label_option_name); if (label_option) { mount_name = label_option; } else { mount_name = fs_path_get_basename(path); } fs_emu_log("hard drive mount: %s\n", path); fs_emu_log("device: %s\n", device); fs_emu_log("mount name: %s\n", mount_name); fs_emu_log("read/write: %s\n", read_write); fs_emu_log("boot priority: %d\n", boot_priority); /* char *option = fs_strdup_printf("uaehf%d", i); char *value = fs_strdup_printf("%s,%s,%s:%s:%s,%d", type, read_write, device, mount_name, path, boot_priority); amiga_set_option(option, value); */ char *option2 = fs_strdup("filesystem2"); char *value2 = fs_strdup_printf("%s,%s:%s:%s,%d", read_write, device, mount_name, path, boot_priority); amiga_set_option(option2, value2); free(option2); free(value2); // uaehf0=hdf,rw,DH0:path.hdf,32,1,2,512,0,,uae; //free(option); //free(value); free(device); free(type); free(mount_name); continue; } else if (fs_path_exists(path)) {
void fs_uae_configure_amiga_hardware() { amiga_config *c = g_fs_uae_amiga_configs + g_fs_uae_amiga_config; char *path; fs_emu_log("fs_uae_configure_amiga_hardware\n"); fs_uae_load_rom_files(fs_uae_kickstarts_dir()); #ifdef NEW_ACCURACY_SYSTEM g_accuracy = 1; #endif fs_emu_log("configuring \"%s\", accuracy=%d\n", c->name, g_accuracy); amiga_quickstart(c->quickstart_model, c->quickstart_config, g_accuracy); amiga_set_option("cachesize", "0"); if (c->cpu_model) { amiga_set_option("cpu_model", c->cpu_model); } if (c->z3mem_size) { amiga_set_int_option("z3mem_size", c->z3mem_size); } if (c->cpu_32bit_addressing) { amiga_set_option("cpu_24bit_addressing", "false"); } if (c->fast) { amiga_set_option("cpu_speed", "max"); amiga_set_option("blitter_cycle_exact", "false"); amiga_set_option("cpu_cycle_exact", "false"); amiga_set_option("cpu_compatible", "false"); amiga_set_option("immediate_blits", "true"); } //if (g_fs_uae_fastest_possible) { amiga_set_cpu_idle(2); //} if (g_fs_uae_ntsc_mode) { // FIXME: ciiatod on some Amiga models? amiga_set_option("ntsc", "true"); } path = fs_config_get_string("kickstart_file"); if (path) { path = fs_uae_expand_path_and_free(path); path = fs_uae_resolve_path_and_free(path, FS_UAE_ROM_PATHS); amiga_set_option("kickstart_rom_file", path); free(path); } path = fs_config_get_string("kickstart_ext_file"); if (path) { path = fs_uae_expand_path_and_free(path); path = fs_uae_resolve_path_and_free(path, FS_UAE_ROM_PATHS); amiga_set_option("kickstart_ext_rom_file", path); free(path); } configure_memory(c); if (fs_config_get_boolean("bsdsocket_library") == 1) { amiga_set_option("bsdsocket_emu", "yes"); } amiga_enable_serial_port(); configure_accuracy(c); /* if (g_fs_uae_amiga_model == MODEL_A500) { if (slow_memory || fast_memory || chip_memory > 512) { fs_log("using A500 and memory expansions, " "enabling real-time clock"); amiga_set_option("rtc", "MSM6242B"); } } */ /* char **keys = g_key_file_get_keys(g_fs_uae_config, "uae", NULL, NULL); if (keys) { for (char **key = keys; *key; key++) { char *value = g_key_file_get_string(g_fs_uae_config, "uae", *key, NULL); if (value != NULL) { amiga_set_option(*key, value); free(value); } } g_strfreev(keys); } */ }