Ejemplo n.º 1
0
static int set_sfx_soundsampler_enabled(int val, void *param)
{
    if (sfx_soundsampler_sound_chip.chip_enabled != val) {
        if (val) {
            if (c64export_add(&export_res) < 0) {
                return -1;
            }
            if (machine_class == VICE_MACHINE_VIC20) {
                if (sfx_soundsampler_io_swap) {
                    sfx_soundsampler_device.start_address = 0x9c00;
                    sfx_soundsampler_device.end_address = 0x9fff;
                } else {
                    sfx_soundsampler_device.start_address = 0x9800;
                    sfx_soundsampler_device.end_address = 0x9bff;
                }
            }
            sfx_soundsampler_list_item = io_source_register(&sfx_soundsampler_device);
            sfx_soundsampler_sound_chip.chip_enabled = 1;
        } else {
            c64export_remove(&export_res);
            io_source_unregister(sfx_soundsampler_list_item);
            sfx_soundsampler_list_item = NULL;
            sfx_soundsampler_sound_chip.chip_enabled = 0;
        }
    }
    return 0;
}
Ejemplo n.º 2
0
/* FIXME: resetting the c64 should be handled in the upper layer */
static int set_mmc64_enabled(int val, void *param)
{
    LOG(("MMC64: set_enabled: '%s' %d to %d", mmc64_bios_filename, mmc64_enabled, val));
    if (!mmc64_enabled && val) {
        /* activate mmc64 */
        if (param) {
            /* if the param is != NULL, then we should load the default image file */
            LOG(("MMC64: set_enabled(1) '%s'", mmc64_bios_filename));
            if (mmc64_bios_filename) {
                if (*mmc64_bios_filename) {
                    if (cartridge_attach_image(CARTRIDGE_MMC64, mmc64_bios_filename) < 0) {
                        LOG(("MMC64: set_enabled(1) did not register"));
                        return -1;
                    }
                    /* mmc64_enabled = 1; */ /* cartridge_attach_image will end up calling set_mmc64_enabled again */
                    return 0;
                }
            }
        } else {
            LOG(("MMC64: set_enabled(0) '%s'", mmc64_bios_filename));
            cart_power_off();
            /* if the param is == NULL, then we should actually set the resource */
            if (c64export_add(&export_res) < 0) {
                LOG(("MMC64: set_enabled(0) did not register"));
                return -1;
            } else {
                LOG(("MMC64: set_enabled registered"));

                if (mmc64_activate() < 0) {
                    return -1;
                }
                mmc64_enabled = 1;
                cart_set_port_exrom_slot0(1);
                cart_port_config_changed_slot0();
                mmc64_clockport_list_item = io_source_register(mmc64_current_clockport_device);
                mmc64_io1_list_item = io_source_register(&mmc64_io1_device);
                mmc64_io2_list_item = io_source_register(&mmc64_io2_device);
                mmc64_reset();
            }
        }
    } else if (mmc64_enabled && !val) {
        /* remove mmc64 */
        if (mmc64_deactivate() < 0) {
            return -1;
        }
        cart_power_off();
        c64export_remove(&export_res);
        mmc64_enabled = 0;
        cart_set_port_exrom_slot0(0);
        cart_port_config_changed_slot0();
        io_source_unregister(mmc64_clockport_list_item);
        io_source_unregister(mmc64_io1_list_item);
        io_source_unregister(mmc64_io2_list_item);
        mmc64_clockport_list_item = NULL;
        mmc64_io1_list_item = NULL;
        mmc64_io2_list_item = NULL;
    }
    LOG(("MMC64: set_enabled done: '%s' %d : %d", mmc64_bios_filename, val, mmc64_enabled));
    return 0;
}
Ejemplo n.º 3
0
static int set_expert_enabled(int val, void *param)
{
    DBG(("EXPERT: set enabled: %d:%d\n", expert_enabled, val));

    if (expert_enabled && !val) {
        DBG(("EXPERT: disable\n"));
        if (expert_deactivate() < 0) {
            return -1;
        }
        io_source_unregister(expert_io1_list_item);
        expert_io1_list_item = NULL;
        c64export_remove(&export_res);
        expert_enabled = 0;
        cart_power_off();
    } else if (!expert_enabled && val) {
        DBG(("EXPERT: enable\n"));
        if (expert_activate() < 0) {
            return -1;
        }
        expert_io1_list_item = io_source_register(&expert_io1_device);
        if (c64export_add(&export_res) < 0) {
            DBG(("EXPERT: set enabled: error\n"));
            io_source_unregister(expert_io1_list_item);
            expert_io1_list_item = NULL;
            expert_enabled = 0;
            return -1;
        }
        expert_enabled = 1;
        resources_set_int("ExpertCartridgeMode", cartmode);
        cart_power_off();
    }
    
    return 0;
}
Ejemplo n.º 4
0
void freezeframe_detach(void)
{
    c64export_remove(&export_res);
    c64io_unregister(freezeframe_io1_list_item);
    c64io_unregister(freezeframe_io2_list_item);
    freezeframe_io1_list_item = NULL;
    freezeframe_io2_list_item = NULL;
}
Ejemplo n.º 5
0
void warpspeed_detach(void)
{
    c64export_remove(&export_res_warpspeed);
    c64io_unregister(warpspeed_io1_list_item);
    c64io_unregister(warpspeed_io2_list_item);
    warpspeed_io1_list_item = NULL;
    warpspeed_io2_list_item = NULL;
}
Ejemplo n.º 6
0
void final_v1_detach(void)
{
    c64export_remove(&export_res_v1);
    io_source_unregister(final1_io1_list_item);
    io_source_unregister(final1_io2_list_item);
    final1_io1_list_item = NULL;
    final1_io2_list_item = NULL;
}
Ejemplo n.º 7
0
void ross_detach(void)
{
    c64export_remove(&export_res);
    c64io_unregister(ross_io1_list_item);
    c64io_unregister(ross_io2_list_item);
    ross_io1_list_item = NULL;
    ross_io2_list_item = NULL;
}
Ejemplo n.º 8
0
void freezemachine_detach(void)
{
    c64export_remove(&export_res);
    io_source_unregister(freezemachine_io1_list_item);
    io_source_unregister(freezemachine_io2_list_item);
    freezemachine_io1_list_item = NULL;
    freezemachine_io2_list_item = NULL;
}
Ejemplo n.º 9
0
void mach5_detach(void)
{
    c64export_remove(&export_res);
    c64io_unregister(mach5_io1_list_item);
    c64io_unregister(mach5_io2_list_item);
    mach5_io1_list_item = NULL;
    mach5_io2_list_item = NULL;
}
Ejemplo n.º 10
0
void actionreplay2_detach(void)
{
    c64export_remove(&export_res);
    io_source_unregister(actionreplay2_io1_list_item);
    io_source_unregister(actionreplay2_io2_list_item);
    actionreplay2_io1_list_item = NULL;
    actionreplay2_io2_list_item = NULL;
}
Ejemplo n.º 11
0
Archivo: kcs.c Proyecto: AreaScout/vice
void kcs_detach(void)
{
    c64export_remove(&export_res_kcs);
    io_source_unregister(kcs_io1_list_item);
    io_source_unregister(kcs_io2_list_item);
    kcs_io1_list_item = NULL;
    kcs_io2_list_item = NULL;
}
Ejemplo n.º 12
0
void mikroass_detach(void)
{
    c64export_remove(&export_res);
    io_source_unregister(mikroass_io1_list_item);
    io_source_unregister(mikroass_io2_list_item);
    mikroass_io1_list_item = NULL;
    mikroass_io2_list_item = NULL;
}
Ejemplo n.º 13
0
void epyxfastload_detach(void)
{
    alarm_destroy(epyxrom_alarm);
    c64export_remove(&export_res_epyx);
    io_source_unregister(epyxfastload_io1_list_item);
    io_source_unregister(epyxfastload_io2_list_item);
    epyxfastload_io1_list_item = NULL;
    epyxfastload_io2_list_item = NULL;
}
Ejemplo n.º 14
0
static int set_tfe_enabled(int value, void *param)
{
    int val = value ? 1 : 0;

    if (!tfe_cannot_use) {
        if (!val) {
            /* TFE should be deactived */
            if (tfe_enabled) {
                tfe_enabled = 0;
                if (tfe_deactivate() < 0) {
                    DBG(("TFE: set disabled: error\n"));
                    return -1;
                }
                io_source_unregister(tfe_list_item);
                tfe_list_item = NULL;
                c64export_remove(&export_res);
            }
            return 0;
        } else {
            if (!tfe_enabled) {
                tfe_enabled = 1;
                if (tfe_activate() < 0) {
                    return -1;
                }
                export_res.io1 = tfe_current_device;
                if (c64export_add(&export_res) < 0) {
                    DBG(("TFE: set enabled: error\n"));
                    tfe_list_item = NULL;
                    tfe_enabled = 0;
                    return -1;
                }
                if (machine_class == VICE_MACHINE_VIC20) {
                    /* set correct addresses for masC=uerade */
                    if (tfe_io_swap) {
                        tfe_current_device->start_address = 0x9c00;
                        tfe_current_device->end_address = 0x9fff;
                    } else {
                        tfe_current_device->start_address = 0x9800;
                        tfe_current_device->end_address = 0x9bff;
                    }
                }
                tfe_list_item = io_source_register(tfe_current_device);
            }

            return 0;
        }
    }
    return 0;
}
Ejemplo n.º 15
0
void easyflash_detach(void)
{
    if (easyflash_crt_write) {
        easyflash_flush_image();
    }
    flash040core_shutdown(easyflash_state_low);
    flash040core_shutdown(easyflash_state_high);
    lib_free(easyflash_state_low);
    lib_free(easyflash_state_high);
    lib_free(easyflash_filename);
    easyflash_filename = NULL;
    io_source_unregister(easyflash_io1_list_item);
    io_source_unregister(easyflash_io2_list_item);
    easyflash_io1_list_item = NULL;
    easyflash_io2_list_item = NULL;
    c64export_remove(&export_res);
}
Ejemplo n.º 16
0
static int set_sfx_soundsampler_enabled(int val, void *param)
{
    if (sfx_soundsampler_enabled != val) {
        if (val) {
            if (c64export_add(&export_res) < 0) {
                return -1;
            }
            sfx_soundsampler_list_item = c64io_register(&sfx_soundsampler_device);
            sfx_soundsampler_enabled = 1;
        } else {
            c64export_remove(&export_res);
            c64io_unregister(sfx_soundsampler_list_item);
            sfx_soundsampler_list_item = NULL;
            sfx_soundsampler_enabled = 0;
        }
    }
    return 0;
}
Ejemplo n.º 17
0
void tfe_clockport_changed(void)
{
    if (!tfe_as_rr_net) {
        tfe_current_device = &tfe_io1_device;
    } else {
        tfe_current_device = &rrnet_io1_device;
        if (mmc64_cart_enabled() && (mmc64_hw_clockport == 0xde02) && mmc64_clockport_enabled) {
            tfe_current_device = &rrnet_io1_mmc64_device;
        }
        if (mmc64_cart_enabled() && (mmc64_hw_clockport == 0xdf12) && mmc64_clockport_enabled) {
            tfe_current_device = &rrnet_io2_mmc64_device;
        }
        if (retroreplay_cart_enabled() && rr_clockport_enabled) {
            tfe_current_device = &rrnet_io1_retroreplay_device;
        }
        if (mmcreplay_cart_enabled() && mmcr_clockport_enabled) {
            tfe_current_device = &rrnet_io1_mmcreplay_device;
        }
    }
    /* if adapter is already enabled then reset the LAN chip */
    if (tfe_enabled) {
        io_source_unregister(tfe_list_item);
        c64export_remove(&export_res);
        export_res.io1 = tfe_current_device;
        if (c64export_add(&export_res) < 0) {
            DBG(("TFE: set tfe_clockport_changed: error\n"));
            tfe_list_item = NULL;
            tfe_enabled = 0;
            return;
        }
        if (machine_class == VICE_MACHINE_VIC20) {
            /* set correct addresses for masC=uerade */
            if (tfe_io_swap) {
                tfe_current_device->start_address = 0x9c00;
                tfe_current_device->end_address = 0x9fff;
            } else {
                tfe_current_device->start_address = 0x9800;
                tfe_current_device->end_address = 0x9bff;
            }
        }
        tfe_list_item = io_source_register(tfe_current_device);
        tfe_reset();
    }
}
Ejemplo n.º 18
0
static int set_ds12c887rtc_enabled(int val, void *param)
{
    if (!ds12c887rtc_enabled && val) {
        if (c64export_add(&export_res) < 0) {
            return -1;
        }
        ds12c887rtc_list_item = io_source_register(&ds12c887rtc_device);
        ds12c887rtc_context = ds12c887_init((BYTE *)ds12c887rtc_ram, &ds12c887rtc_offset);
        ds12c887rtc_enabled = 1;
    } else if (ds12c887rtc_enabled && !val) {
        if (ds12c887rtc_list_item != NULL) {
            c64export_remove(&export_res);
            io_source_unregister(ds12c887rtc_list_item);
            ds12c887rtc_list_item = NULL;
            ds12c887_destroy(ds12c887rtc_context);
        }
        ds12c887rtc_enabled = 0;
    }
    return 0;
}
Ejemplo n.º 19
0
static int set_digimax_enabled(int value, void *param)
{
    int val = value ? 1 : 0;

    if (!digimax_sound_chip.chip_enabled && val) {
        if (!digimax_is_userport()) {
            if (c64export_add(&export_res) < 0) {
                return -1;
            }
            digimax_list_item = io_source_register(&digimax_device);
        }
        digimax_sound_chip.chip_enabled = 1;
    } else if (digimax_sound_chip.chip_enabled && !val) {
        if (digimax_list_item != NULL) {
            c64export_remove(&export_res);
            io_source_unregister(digimax_list_item);
            digimax_list_item = NULL;
        }
        digimax_sound_chip.chip_enabled = 0;
    }
    return 0;
}
Ejemplo n.º 20
0
void stardos_detach(void)
{
    stardos_remove_kernal();
    c64export_remove(&export_res);
}
Ejemplo n.º 21
0
void magicdesk_detach(void)
{
    c64export_remove(&export_res);
    io_source_unregister(magicdesk_list_item);
    magicdesk_list_item = NULL;
}
Ejemplo n.º 22
0
void dinamic_detach(void)
{
    io_source_unregister(dinamic_io1_list_item);
    dinamic_io1_list_item = NULL;
    c64export_remove(&export_res);
}
Ejemplo n.º 23
0
void delaep7x8_detach(void)
{
  c64export_remove(&export_res);
}
Ejemplo n.º 24
0
void simon_detach(void)
{
    c64export_remove(&export_res_simon);
    io_source_unregister(simon_list_item);
    simon_list_item = NULL;
}
Ejemplo n.º 25
0
void snapshot64_detach(void)
{
    c64export_remove(&export_res);
    io_source_unregister(ss64_io2_list_item);
    ss64_io2_list_item = NULL;
}
Ejemplo n.º 26
0
void dsm_detach(void)
{
    c64export_remove(&export_res);
    c64io_unregister(dsm_io1_list_item);
    dsm_io1_list_item = NULL;
}
Ejemplo n.º 27
0
void westermann_detach(void)
{
    c64export_remove(&export_res_westermann);
    c64io_unregister(westermann_list_item);
    westermann_list_item = NULL;
}
Ejemplo n.º 28
0
void ocean_detach(void)
{
    c64export_remove(&export_res);
    io_source_unregister(ocean_list_item);
    ocean_list_item = NULL;
}
Ejemplo n.º 29
0
void se5_detach(void)
{
    c64export_remove(&export_res);
    io_source_unregister(se5_io2_list_item);
    se5_io2_list_item = NULL;
}
Ejemplo n.º 30
0
void supergames_detach(void)
{
    c64export_remove(&export_res);
    c64io_unregister(supergames_list_item);
    supergames_list_item = NULL;
}