Esempio n. 1
0
void fs_uae_configure_input()
{
    fs_uae_configure_mouse();
    fs_emu_log("configuring joystick ports:\n");
    amiga_set_option("joyport0", "none");
    amiga_set_option("joyport1", "none");

    fs_uae_configure_actions();

    //fs_emu_set_action_function(joystick_action);
    char *value;
    value = fs_config_get_string("joystick_port_0");
    if (value == NULL) {
        value = g_strdup("mouse");
    }
    configure_joystick_port(0, value, "joyport0", "joy0");
    g_free(value);

    value = fs_config_get_string("joystick_port_1");
    if (value == NULL) {
        value = g_strdup("auto");
    }
    configure_joystick_port(1, value, "joyport1", "joy1");
    g_free(value);

    value = fs_config_get_string("joystick_port_2");
    if (value == NULL) {
        value = g_strdup("nothing");
    }
    configure_joystick_port(2, value, "joyport2", "joy2");
    g_free(value);

    value = fs_config_get_string("joystick_port_3");
    if (value == NULL) {
        value = g_strdup("nothing");
    }
    configure_joystick_port(3, value, "joyport3", "joy3");
    g_free(value);

    value = fs_config_get_string("joystick_port_4");
    if (value == NULL) {
        value = g_strdup("nothing");
    }
    configure_joystick_port(4, value, "joyport4", "joy4");
    g_free(value);
}
Esempio n. 2
0
void fs_uae_configure_sound_card(amiga_config *c)
{
    const char *card = fs_config_get_const_string(OPTION_SOUND_CARD);
    if (card != NULL) {
        if (fs_uae_values_matches(card, "toccata")) {
            amiga_set_option("toccata", "true");
        } else {
            fs_emu_warning("Unrecognized sound card");
        }
    }
}
Esempio n. 3
0
int amiga_set_audio_frequency(int frequency) {
    char freq[13];
    snprintf(freq, 13, "%d", frequency);
    amiga_set_option("sound_frequency", freq);
    /*
    write_log("amiga_set_audio_frequency: %d\n", frequency);
    g_audio_frequency = frequency;
    changed_prefs.sound_freq = frequency;
    write_log("changed_prefs: %p\n", &changed_prefs);
    config_changed = 1;
    */
    return 1;
}
Esempio n. 4
0
void fs_uae_configure_input()
{
    fs_uae_configure_mouse();
    fs_emu_log("configuring joystick ports:\n");
    amiga_set_option("joyport0", "none");
    amiga_set_option("joyport1", "none");

    fs_uae_configure_actions();

    char *value;
    value = fs_config_get_string("joystick_port_1");
    if (!value) {
        value = g_strdup("auto");
    }
    configure_joystick_port(1, value, "joyport1", "joy1");
    g_free(value);
    value = fs_config_get_string("joystick_port_0");
    if (!value) {
        value = g_strdup("auto");
    }
    configure_joystick_port(0, value, "joyport0", "joy0");
    g_free(value);

    for (int i = 2; i < FS_UAE_NUM_INPUT_PORTS; i++) {
        gchar *key = g_strdup_printf("joystick_port_%d", i);
        value = fs_config_get_string(key);
        g_free(key);
        if (value == NULL) {
            value = g_strdup("nothing");
        }
        gchar *key2 = g_strdup_printf("joyport%d", i);
        gchar *key3 = g_strdup_printf("joy%d", i);
        configure_joystick_port(i, value, key2, key3);
        g_free(key3);
        g_free(key2);
        g_free(value);
    }
}
Esempio n. 5
0
static void parse_option(char *key, char *value) {
	static int first = 1;
	if (key[0] == 'u' && key[1] == 'a' && key[2] == 'e' && key[3] == '_') {
		if (first) {
			fs_log("WARNING: custom uae_* options used! Your warranty is "
			        "now void! ;)\n");
			fs_log("(not that there was any warranty before...)\n");
			first = 0;
		}
		fs_strchomp(value);
		//amiga_set_hardware_option(key + 4, value);
		amiga_set_option(key + 4, value);
	}
}
Esempio n. 6
0
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);
        }
    }
}
Esempio n. 7
0
static void configure_accuracy(amiga_config *c) {
#ifdef NEW_ACCURACY_SYSTEM
    int cpu_accuracy = fs_config_get_int("cpu_accuracy");
    if (cpu_accuracy == FS_CONFIG_NONE) {
    	cpu_accuracy = fs_config_get_int("accuracy");
    }
    if (cpu_accuracy != FS_CONFIG_NONE) {
    	if (cpu_accuracy <= 0) {
    		amiga_set_option("cpu_cycle_exact", "false");
    		if (g_fs_uae_amiga_model == MODEL_A1200
    				|| g_fs_uae_amiga_model == MODEL_CD32) {
    			// FIXME: test this setting some more
    			//amiga_set_option("cpu_speed", "2");
    		    amiga_set_option("cpu_speed", "0");
    		}
    	}
    	if (cpu_accuracy <= -1) {
    		amiga_set_option("cpu_compatible", "false");
    	}
    }
    int blitter_accuracy = fs_config_get_int("blitter_accuracy");
    if (blitter_accuracy == FS_CONFIG_NONE) {
    	blitter_accuracy = fs_config_get_int("accuracy");
    }
    if (blitter_accuracy != FS_CONFIG_NONE) {
    	if (blitter_accuracy <= 0) {
    		amiga_set_option("blitter_cycle_exact", "false");
    	}
    	if (blitter_accuracy <= -1) {
    		amiga_set_option("immediate_blits", "true");
    	}
    }
    int audio_accuracy = fs_config_get_int("audio_accuracy");
    if (audio_accuracy == FS_CONFIG_NONE) {
    	// we don't want to use interrupts unless we specifically requested
    	// audio_accuracy of -1
    	audio_accuracy = fs_config_get_int_clamped("accuracy", 0, 1);
    }
    if (audio_accuracy != FS_CONFIG_NONE) {
    	if (audio_accuracy == 0) {
    		amiga_set_option("sound_output", "normal");
    	}
    	else if (audio_accuracy <= -1) {
    		amiga_set_option("sound_output", "interrupts");
    	}
    }
#endif
}
Esempio n. 8
0
int amiga_set_audio_frequency(int frequency)
{
    if (frequency == 0) {
        /* Some code divides by frequency, so 0 is not a good idea */
        write_log("WARNING: amiga_set_audio_frequency 0, set to 44100\n");
        frequency = 44100;
    }
    char freq[13];
    snprintf(freq, 13, "%d", frequency);
    amiga_set_option("sound_frequency", freq);

    write_log("amiga_set_audio_frequency: %d\n", frequency);
    sdp->obtainedfreq = frequency;
    //changed_prefs.sound_freq = frequency;
    //write_log("changed_prefs: %p\n", &changed_prefs);
    //config_changed = 1;
    return 1;
}
Esempio n. 9
0
void fs_uae_configure_directories() {
    char *path;

    for (int i = 0; i < 10; i++) {
        char *src_name = g_strdup_printf("fs-uae-state_%d.uss", i);
        char *src = g_build_filename(fs_uae_state_dir(), src_name, NULL);
        g_free(src_name);
        char *dst_name = g_strdup_printf("Saved State %d.uss", i);
        char *dst = g_build_filename(fs_uae_state_dir(), dst_name, NULL);
        g_free(dst_name);
        if (fs_path_exists(src)) {
            fs_log("renaming file %s to %s\n", src, dst);
            if (g_rename(src, dst) != ZERO_SUCCESS) {
                fs_log("WARNING: renamed failed\n");
            }
        }
        g_free(src);
        g_free(dst);
    }
    char *state_base_name = g_build_filename(fs_uae_state_dir(),
            "Saved State", NULL);
    fs_uae_set_state_base_name(state_base_name);

    /*
    path = g_build_filename(fs_uae_state_dir(), "Autoload State.uss", NULL);
    if (fs_path_exists(path)) {
        fs_log("found autoload state at %s\n", path);
        amiga_set_option("statefile", path);
    }
    free(path);
    */

    /*
    path = fs_strconcat(state_base_name, ".uss", NULL);
    amiga_set_option("statefile_name", path);
    free(path);
    */

    path = g_strconcat(state_base_name, ".uss", NULL);
    amiga_set_option("statefile", path);
    free(path);

    if (g_fs_uae_amiga_model == MODEL_CD32) {
        // legacy file name
        path = g_build_filename(fs_uae_state_dir(), "cd32.nvr", NULL);
        if (!fs_path_exists(path)) {
            free(path);
            // new file name
            path = g_build_filename(fs_uae_state_dir(), "CD32 Storage.nvr", NULL);
        }
        amiga_set_option("flash_file", path);
        free(path);
    }
    else if (g_fs_uae_amiga_model == MODEL_CDTV) {
        // legacy file name
        path = g_build_filename(fs_uae_state_dir(), "cdtv.nvr", NULL);
        if (!fs_path_exists(path)) {
            free(path);
            // new file name
            path = g_build_filename(fs_uae_state_dir(), "CDTV Storage.nvr", NULL);
        }
        amiga_set_option("flash_file", path);
        free(path);
    }
    free(state_base_name);

    amiga_set_save_image_dir(fs_uae_state_dir());
    amiga_set_module_ripper_dir(fs_uae_module_ripper_dir());
}
Esempio n. 10
0
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);
    }
}
Esempio n. 11
0
static void configure_memory()
{
    int chip_memory = fs_uae_read_memory_option_small(OPTION_CHIP_MEMORY);
    if (chip_memory != FS_CONFIG_NONE) {
        if (chip_memory == 128) {
            amiga_set_int_option("chipmem_size", -1); /* 128 KB */
        } else if (chip_memory == 256) {
            amiga_set_int_option("chipmem_size", 0); /* 256 KB */
        } else if (chip_memory % 512 == 0) {
            amiga_set_int_option("chipmem_size", chip_memory / 512);
            if (chip_memory >= 2 && cfg->can_use_ecs_agnus) {
                fs_log("[CONFIG] >= 1 MB chip RAM, enabling ECS Agnus\n");
                amiga_set_option("chipset", "ecs_agnus");
            }
        } else {
            fs_emu_warning(_("Option chip_memory must be a multiple of 512"));
            chip_memory = 0;
        }
    } else {
        chip_memory = 0;
    }

    int slow_memory = fs_uae_read_memory_option_small(OPTION_SLOW_MEMORY);
    if (slow_memory != FS_CONFIG_NONE) {
        if (slow_memory % 256 == 0) {
            amiga_set_int_option("bogomem_size", slow_memory / 256);
        } else {
            fs_emu_warning(_("Option slow_memory must be a multiple of 256"));
            slow_memory = 0;
        }
    } else {
        slow_memory = 0;
    }

    int fast_memory = fs_uae_read_memory_option(OPTION_FAST_MEMORY);
    if (fast_memory != FS_CONFIG_NONE) {
        if (fast_memory % 1024 == 0) {
            amiga_set_int_option("fastmem_size", fast_memory / 1024);
        } else {
            fs_emu_warning(_("Option fast_memory must be a multiple of 1024"));
            fast_memory = 0;
        }
    } else {
        fast_memory = 0;
    }

    int z3_memory = fs_uae_read_memory_option(OPTION_ZORRO_III_MEMORY);
    if (z3_memory != FS_CONFIG_NONE) {
        if (z3_memory && !cfg->allow_z3_memory) {
            fs_emu_warning(_("Option zorro_iii_memory needs a CPU "
                             "with 32-bit addressing"));
        }
        if (z3_memory % 1024 != 0) {
            fs_emu_warning(_("Option zorro_iii_memory must be a multiple "
                             "of 1024"));
        }
        amiga_set_int_option("z3mem_size", z3_memory / 1024);
    }

    int mb_ram = fs_uae_read_memory_option(OPTION_MOTHERBOARD_RAM);
    if (mb_ram != FS_CONFIG_NONE) {
        if (mb_ram && !cfg->allow_z3_memory) {
            fs_emu_warning(_("Option motherboard_ram needs a CPU "
                             "with 32-bit addressing"));
            mb_ram = 0;
        } else if (mb_ram % 1024 == 0) {
            amiga_set_int_option("a3000mem_size", mb_ram / 1024);
        } else {
            fs_emu_warning(_("Option motherboard_ram must be a multiple "
                             "of 1024"));
            mb_ram = 0;
        }
    } else {
        mb_ram = 0;
    }
}
Esempio n. 12
0
static void configure_cpu(void)
{
    bool uae_cpu_24bit_addressing = !cfg->cpu_32bit_addressing;
    const char *uae_cpu_model = cfg->default_cpu;
    const char *uae_fpu_model = cfg->default_fpu;
    const char *uae_mmu_model = cfg->default_mmu;
    //bool allow_6888x_fpu = false;
    //bool allow_68040_fpu = false;
    //bool allow_68060_fpu = false;

    const char *cpu = fs_config_get_const_string(OPTION_CPU);
    if (cpu == NULL) {
        cpu = cfg->accelerator_cpu;
    }
    if (cpu == NULL || fs_uae_values_matches(cpu, "auto")) {
        /* Go with the already configured value */
    } else if (fs_uae_values_matches(cpu, "68000")) {
        uae_cpu_24bit_addressing = true;
        uae_cpu_model = "68000";
        uae_fpu_model = "0";
        uae_mmu_model = "0";
    } else if (fs_uae_values_matches(cpu, "68010")) {
        uae_cpu_24bit_addressing = true;
        uae_cpu_model = "68010";
        uae_fpu_model = "0";
        uae_mmu_model = "0";
    } else if (fs_uae_values_matches(cpu, "68EC020")) {
        uae_cpu_24bit_addressing = true;
        uae_cpu_model = "68020";
        uae_fpu_model = cfg->default_fpu_noninternal;
        uae_mmu_model = "0";
        //allow_6888x_fpu = true;
    } else if (fs_uae_values_matches(cpu, "68020")) {
        uae_cpu_24bit_addressing = false;
        uae_cpu_model = "68020";
        uae_fpu_model = cfg->default_fpu_noninternal;
        uae_mmu_model = "0";
    } else if (fs_uae_values_matches(cpu, "68EC030")) {
        uae_cpu_24bit_addressing = false;
        uae_cpu_model = "68030";
        uae_fpu_model = "0";
        uae_mmu_model = "0";
    } else if (fs_uae_values_matches(cpu, "68030")) {
        uae_cpu_24bit_addressing = false;
        uae_cpu_model = "68030";
        uae_fpu_model = cfg->default_fpu_noninternal;
        uae_mmu_model = "68030";
    } else if (fs_uae_values_matches(cpu, "68EC040")) {
        uae_cpu_24bit_addressing = false;
        uae_cpu_model = "68040";
        uae_fpu_model = "0";
        uae_mmu_model = "0";
    } else if (fs_uae_values_matches(cpu, "68LC040")) {
        uae_cpu_24bit_addressing = false;
        uae_cpu_model = "68040";
        uae_fpu_model = "0";
        uae_mmu_model = "68040";
    } else if (fs_uae_values_matches(cpu, "68040")) {
        uae_cpu_24bit_addressing = false;
        uae_cpu_model = "68040";
        uae_fpu_model = "68040";
        uae_mmu_model = "68040";
    } else if (fs_uae_values_matches(cpu, "68040-NOMMU")) {
        uae_cpu_24bit_addressing = false;
        uae_cpu_model = "68040";
        uae_fpu_model = "68040";
        uae_mmu_model = "0";
    } else if (fs_uae_values_matches(cpu, "68EC060")) {
        uae_cpu_24bit_addressing = false;
        uae_cpu_model = "68060";
        uae_fpu_model = "0";
        uae_mmu_model = "0";
    } else if (fs_uae_values_matches(cpu, "68LC060")) {
        uae_cpu_24bit_addressing = false;
        uae_cpu_model = "68060";
        uae_fpu_model = "0";
        uae_mmu_model = "68060";
    } else if (fs_uae_values_matches(cpu, "68060-NOMMU")) {
        uae_cpu_24bit_addressing = false;
        uae_cpu_model = "68060";
        uae_fpu_model = "68060";
        uae_mmu_model = "0";
    } else if (fs_uae_values_matches(cpu, "68060")) {
        uae_cpu_24bit_addressing = false;
        uae_cpu_model = "68060";
        uae_fpu_model = "68060";
        uae_mmu_model = "68060";
    } else {
        fs_emu_warning("Unknown CPU specified");
    }

    const char *fpu = fs_config_get_const_string(OPTION_FPU);
    if (fpu == NULL || fs_uae_values_matches(fpu, "auto")) {
        /* Go with the already configured value */
    } else if (fs_uae_values_matches(fpu, "0")) {
        uae_fpu_model = "0";
    } else if (fs_uae_values_matches(fpu, "68881")) {
        if (fs_uae_values_matches(uae_cpu_model, "68020")
                || fs_uae_values_matches(uae_cpu_model, "68030")) {
            uae_fpu_model = "68881";
        } else {
            fs_emu_warning("68881 FPU must be paired with 68020/68030 CPU\n");
        }
    } else if (fs_uae_values_matches(fpu, "68882")) {
        if (strcmp(uae_cpu_model, "68020") == 0
                || strcmp(uae_cpu_model, "68030") == 0) {
            uae_fpu_model = "68882";
        } else {
            fs_emu_warning("68882 FPU must be paired with 68020/68030 CPU\n");
        }
    } else if (fs_uae_values_matches(fpu, "68040")) {
        if (strcmp(uae_cpu_model, "68040") == 0) {
            uae_fpu_model = "68040";
        } else {
            fs_emu_warning("68040 FPU must be paired with 68040 CPU");
        }
    } else if (fs_uae_values_matches(fpu, "68060")) {
        if (strcmp(uae_cpu_model, "68060") == 0) {
            uae_fpu_model = "68060";
        } else {
            fs_emu_warning("68060 FPU must be paired with 68060 CPU");
        }
    } else {
        fs_emu_warning("Unknown FPU specified");
    }

    const char *mmu = fs_config_get_const_string(OPTION_MMU);
    if (mmu == NULL || fs_uae_values_matches(mmu, "auto")) {
        /* Go with the already configured value */
    } else if (fs_uae_values_matches(mmu, "0")) {
        uae_mmu_model = "0";
    } else if (fs_uae_values_matches(mmu, "68030")) {
        if (strcmp(uae_cpu_model, "68030") == 0) {
            uae_mmu_model = "68030";
        } else {
            fs_emu_warning("68030 MMU must be paired with 68030 CPU");
        }
    } else if (fs_uae_values_matches(mmu, "68040")) {
        if (strcmp(uae_cpu_model, "68040") == 0) {
            uae_mmu_model = "68040";
        } else {
            fs_emu_warning("68040 MMU must be paired with 68040 CPU");
        }
    } else if (fs_uae_values_matches(mmu, "68060")) {
        if (strcmp(uae_cpu_model, "68060") == 0) {
            uae_mmu_model = "68060";
        } else {
            fs_emu_warning("68060 MMU must be paired with 68060 CPU");
        }
    } else {
        fs_emu_warning("Unknown MMU specified");
    }

    if (uae_cpu_model[0]) {
        amiga_set_option("cpu_model", uae_cpu_model);
    }
    if (uae_fpu_model[0]) {
        amiga_set_option("fpu_model", uae_fpu_model);
    }
    if (uae_mmu_model[0]) {
        amiga_set_option("mmu_model", uae_mmu_model);
    }

    if (uae_cpu_24bit_addressing) {
        amiga_set_option("cpu_24bit_addressing", "true");
    } else {
        amiga_set_option("cpu_24bit_addressing", "false");
    }
    cfg->cpu_32bit_addressing = !uae_cpu_24bit_addressing;
    cfg->allow_z3_memory = !uae_cpu_24bit_addressing;

    int accuracy = fs_config_get_int("accuracy");
    if (accuracy == FS_CONFIG_NONE) {
        accuracy = 1;
    }

    int blitter_mode = BLITTER_MODE_NORMAL;
    int cpu_mode = CPU_MODE_CYCLE_EXACT;
    int cpu_speed = CPU_SPEED_REAL;

    if (strcmp(uae_cpu_model, "68030") == 0 ||
            strcmp(uae_cpu_model, "68040") == 0 ||
            strcmp(uae_cpu_model, "68060") == 0) {
        cpu_speed = CPU_SPEED_MAX;
        cpu_mode = CPU_MODE_NONCOMPATIBLE;
    } else {
        cpu_speed = CPU_SPEED_REAL;
        if (accuracy > 0) {
            cpu_mode = CPU_MODE_CYCLE_EXACT;
        } else if (accuracy == 0) {
            cpu_mode = CPU_MODE_COMPATIBLE;
        } else if (accuracy < 0) {
            cpu_mode = CPU_MODE_NONCOMPATIBLE;
        }
    }

    if (cpu_mode == CPU_MODE_CYCLE_EXACT &&
            strcmp(uae_cpu_model, "68000") == 0) {
        blitter_mode = BLITTER_MODE_NORMAL;
    } else if (accuracy < 0) {
        blitter_mode = BLITTER_MODE_IMMEDIATE;
    } else {
        blitter_mode = BLITTER_MODE_WAITING;
    }

    if (cpu_speed == CPU_SPEED_MAX) {
        amiga_set_option("cpu_speed", "max");
    } else {
        amiga_set_option("cpu_speed", "real");
    }

    if (cpu_mode == CPU_MODE_CYCLE_EXACT) {
        amiga_set_option("blitter_cycle_exact", "true");
        amiga_set_option("cpu_compatible", "true");
        amiga_set_option("cpu_cycle_exact", "true");
    } else if (cpu_mode == CPU_MODE_COMPATIBLE) {
        amiga_set_option("blitter_cycle_exact", "false");
        amiga_set_option("cpu_compatible", "true");
        amiga_set_option("cpu_cycle_exact", "false");
    } else if (cpu_mode == CPU_MODE_NONCOMPATIBLE) {
        amiga_set_option("blitter_cycle_exact", "false");
        amiga_set_option("cpu_compatible", "false");
        amiga_set_option("cpu_cycle_exact", "false");
    }

    if (blitter_mode == BLITTER_MODE_NORMAL) {
        amiga_set_option("waiting_blits", "false");
        amiga_set_option("immediate_blits", "false");
    } else if (blitter_mode == BLITTER_MODE_WAITING) {
        amiga_set_option("waiting_blits", "true");
        amiga_set_option("immediate_blits", "false");
    } else if (blitter_mode == BLITTER_MODE_IMMEDIATE) {
        amiga_set_option("waiting_blits", "false");
        amiga_set_option("immediate_blits", "true");
    }

    int cpu_idle = fs_config_get_int_clamped(OPTION_CPU_IDLE, 0, 10);
    if (cpu_idle == FS_CONFIG_NONE) {
        cpu_idle = cfg->cpu_idle;
    }
    if (cpu_idle != FS_CONFIG_NONE) {
        fs_log("Setting cpu_idle to %d\n", cpu_idle);
        amiga_set_cpu_idle(cpu_idle);
    }
}
Esempio n. 13
0
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)) {
Esempio n. 14
0
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);
    }
    */
}
Esempio n. 15
0
int amiga_set_int_option(const char *option, int value) {
    char *str_value = g_strdup_printf("%d", value);
    int result = amiga_set_option(option, str_value);
    g_free(str_value);
    return result;
}
Esempio n. 16
0
int amiga_set_option_and_free(const char *option, char *value,
        amiga_free_function free_function) {
    int result = amiga_set_option(option, value);
    free_function(value);
    return result;
}