示例#1
0
文件: mmc64.c 项目: peterled/vice
static int mmc64_deactivate(void)
{
    int ret;

    mmc_close_card_image();

    if (mmc64_bios_changed && mmc64_bios_write) {
        if (mmc64_bios_type == CARTRIDGE_FILETYPE_CRT) {
            ret = mmc64_crt_save(mmc64_bios_filename);
        } else {
            ret = mmc64_bin_save(mmc64_bios_filename);
        }
        if (ret <= 0) {
            return 0; /* FIXME */
        }
    }
    return 0;
}
示例#2
0
int mmc_open_card_image(char *name, int rw)
{
    char *mmc_image_filename = name;

    spi_mmc_set_card_inserted(MMC_CARD_NOTINSERTED);

    if (mmc_image_filename == NULL) {
        LOG(("sd card image name not set"));
        return 1;
    }

    if (mmc_image_file != NULL) {
        mmc_close_card_image();
    }

    if (rw) {
        mmc_image_file = fopen(mmc_image_filename, "rb+");
    }

    if (mmc_image_file == NULL) {
        mmc_image_file = fopen(mmc_image_filename, "rb");

        if (mmc_image_file == NULL) {
            LOG(("could not open sd card image: %s", mmc_image_filename));
            return 1;
        } else {
            /* FIXME */
            spi_mmc_set_card_inserted(MMC_CARD_INSERTED);
            LOG(("opened sd card image (ro): %s", mmc_image_filename));
            /* mmc_image_file_readonly = 1; */
            /* mmcreplay_hw_writeprotect = 1; */
            /* mmcreplay_writeprotect = MMC_WRITEPROT; */
        }
    } else {
        /* mmc_image_file_readonly = 0; */
        spi_mmc_set_card_inserted(MMC_CARD_INSERTED);
        LOG(("opened sd card image (rw): %s", mmc_image_filename));
    }
    mmc_card_rw = rw;
    return 0;
}