Esempio n. 1
0
static int ramcart_deactivate(void)
{
	if (ramcart_ram == NULL)
		return 0;

	if (!util_check_null_string(ramcart_filename))
	{
		if (util_file_save(ramcart_filename, ramcart_ram, ramcart_size) < 0)
		{
			#ifdef CELL_DEBUG
			printf("INFO: Writing RAMCART image %s failed.\n", ramcart_filename);
			#endif
			return -1;
		}
		#ifdef CELL_DEBUG
		printf("INFO: Writing RAMCART image %s.\n", ramcart_filename);
		#endif
	}

	lib_free(ramcart_ram);
	ramcart_ram = NULL;
	old_ramcart_ram_size = 0;

	return 0;
}
Esempio n. 2
0
static int plus60k_activate(void)
{
    plus60k_ram = (BYTE *)lib_realloc((void *)plus60k_ram, (size_t)0xf000);

    log_message(plus60k_log, "PLUS60K expansion installed.");

    if (!util_check_null_string(plus60k_filename)) {
        if (util_file_load(plus60k_filename, plus60k_ram, (size_t)0xf000,
                           UTIL_FILE_LOAD_RAW) < 0) {
            log_message(plus60k_log,
                        "Reading PLUS60K image %s failed.", plus60k_filename);
            if (util_file_save(plus60k_filename, plus60k_ram, 0xf000) < 0) {
                log_message(plus60k_log,
                            "Creating PLUS60K image %s failed.", plus60k_filename);
                return -1;
            }
            log_message(plus60k_log, "Creating PLUS60K image %s.", plus60k_filename);
            return 0;
        }
        log_message(plus60k_log, "Reading PLUS60K image %s.", plus60k_filename);
    }

    plus60k_reset();
    return 0;
}
Esempio n. 3
0
static int plus60k_deactivate(void)
{
    if (!util_check_null_string(plus60k_filename)) {
        if (util_file_save(plus60k_filename, plus60k_ram, 0xf000) < 0) {
            log_message(plus60k_log,
                        "Writing PLUS60K image %s failed.", plus60k_filename);
            return -1;
        }
        log_message(plus60k_log, "Writing PLUS60K image %s.", plus60k_filename);
    }
    lib_free(plus60k_ram);
    plus60k_ram = NULL;
    return 0;
}
Esempio n. 4
0
static int plus256k_deactivate(void)
{
    if (!util_check_null_string(plus256k_filename)) {
        if (util_file_save(plus256k_filename, plus256k_ram, 0x40000) < 0) {
            log_message(plus256k_log, "Writing PLUS256K image %s failed.", plus256k_filename);
            return -1;
        }
        log_message(plus256k_log, "Writing PLUS256K image %s.", plus256k_filename);
    }
    vicii_set_ram_base(mem_ram);
    lib_free(plus256k_ram);
    plus256k_ram = NULL;
    remove_cpu_lines_lock();
    return 0;
}
Esempio n. 5
0
static int plus60k_deactivate(void)
{
	if (!util_check_null_string(plus60k_filename))
	{
		if (util_file_save(plus60k_filename, plus60k_ram, 0xf000) < 0)
		{
			printf("INFO: Writing PLUS60K image %s failed.\n", plus60k_filename);
			return -1;
		}
		printf("INFO: Writing PLUS60K image %s.\n", plus60k_filename);
	}
	lib_free(plus60k_ram);
	plus60k_ram = NULL;
	remove_cpu_lines_lock();
	return 0;
}
Esempio n. 6
0
int ramcart_bin_save(const char *filename)
{
    if (ramcart_ram == NULL) {
        return -1;
    }

    if (filename == NULL) {
        return -1;
    }

    if (util_file_save(filename, ramcart_ram, ramcart_size) < 0) {
        log_message(ramcart_log, "Writing RAMCART image %s failed.", filename);
        return -1;
    }
    log_message(ramcart_log, "Writing RAMCART image %s.", filename);

    return 0;
}
Esempio n. 7
0
static int ramcart_activate(void)
{
	if (!ramcart_size)
		return 0;

	ramcart_ram = lib_realloc((void *)ramcart_ram, (size_t)ramcart_size);

	/* Clear newly allocated RAM.  */
	if (ramcart_size > old_ramcart_ram_size)
		memset(ramcart_ram, 0, (size_t)(ramcart_size - old_ramcart_ram_size));

	old_ramcart_ram_size = ramcart_size;

	#ifdef CELL_DEBUG
	printf("INFO: %dKB unit installed.\n", ramcart_size >> 10);
	#endif

	if (!util_check_null_string(ramcart_filename))
	{
		if (util_file_load(ramcart_filename, ramcart_ram, (size_t)ramcart_size, UTIL_FILE_LOAD_RAW) < 0)
		{
			#ifdef CELL_DEBUG
			printf("INFO: Reading RAMCART image %s failed.\n", ramcart_filename);
			#endif
			if (util_file_save(ramcart_filename, ramcart_ram, ramcart_size) < 0)
			{
				#ifdef CELL_DEBUG
				printf("INFO: Creating RAMCART image %s failed.\n", ramcart_filename);
				#endif
				return -1;
			}
			#ifdef CELL_DEBUG
			printf("INFO: Creating RAMCART image %s.\n", ramcart_filename);
			#endif
			return 0;
		}
		#ifdef CELL_DEBUG
		printf("INFO: Reading RAMCART image %s.\n", ramcart_filename);
		#endif
	}

	ramcart_reset();
	return 0;
}
Esempio n. 8
0
static int petdww_deactivate(void)
{
    if (petdww_ram == NULL) {
        return 0;
    }

    if (!util_check_null_string(petdww_filename)) {
        if (util_file_save(petdww_filename, petdww_ram, PET_DWW_RAM_SIZE) < 0) {
            log_message(petdww_log, "Writing PET DWW image %s failed.",
                        petdww_filename);
            return -1;
        }
        log_message(petdww_log, "Writing PET DWW image %s.", petdww_filename);
    }

    pia_reset();
    lib_free(petdww_ram);
    petdww_ram = NULL;

    return 0;
}
Esempio n. 9
0
static int petdww_activate(void)
{
    if (petres.IOSize < 2048) {
        log_message(petdww_log, "Cannot enable DWW: IOSize too small (%d but must be 2K)", petres.IOSize);
        return -1;
    }

    if (petres.superpet) {
        log_message(petdww_log, "Cannot enable DWW: not compatible with SuperPET");
        return -1;
    }

    petdww_ram = lib_realloc((void *)petdww_ram, (size_t)PET_DWW_RAM_SIZE);

    /* Clear newly allocated RAM.  */
    memset(petdww_ram, 0, (size_t)PET_DWW_RAM_SIZE);

    log_message(petdww_log, "%dKB of hi-res RAM installed.", PET_DWW_RAM_SIZE >> 10);

    if (!util_check_null_string(petdww_filename)) {
        if (util_file_load(petdww_filename, petdww_ram, (size_t)PET_DWW_RAM_SIZE,
            UTIL_FILE_LOAD_RAW) < 0) {
            log_message(petdww_log, "Reading PET DWW image %s failed.",
                        petdww_filename);
            if (util_file_save(petdww_filename, petdww_ram, PET_DWW_RAM_SIZE) < 0) {
                log_message(petdww_log, "Creating PET DWW image %s failed.",
                            petdww_filename);
                return -1;
            }
            log_message(petdww_log, "Creating PET DWW image %s.",
                        petdww_filename);
            return 0;
        }
        log_message(petdww_log, "Reading PET DWW image %s.", petdww_filename);
    }

    petdww_reset();
    return 0;
}
Esempio n. 10
0
static int plus256k_activate(void)
{
    plus256k_ram = lib_realloc((void *)plus256k_ram, (size_t)0x40000);

    log_message(plus256k_log, "PLUS256K hack installed.");

    if (!util_check_null_string(plus256k_filename)) {
        if (util_file_load(plus256k_filename, plus256k_ram, (size_t)0x40000, UTIL_FILE_LOAD_RAW) < 0) {
            log_message(plus256k_log, "Reading PLUS256K image %s failed.", plus256k_filename);
            if (util_file_save(plus256k_filename, plus256k_ram, 0x40000) < 0) {
                log_message(plus256k_log, "Creating PLUS256K image %s failed.", plus256k_filename);
                return -1;
            }
            log_message(plus256k_log, "Creating PLUS256K image %s.", plus256k_filename);
            return 0;
        }
        log_message(plus256k_log, "Reading PLUS256K image %s.", plus256k_filename);
    }
    plus256k_reset();
    set_cpu_lines_lock(CPU_LINES_PLUS256K, "PLUS256K");
    return 0;
}
Esempio n. 11
0
static int plus60k_activate(void)
{
	plus60k_ram = lib_realloc((void *)plus60k_ram, (size_t)0xf000);

#ifdef CELL_DEBUG
	printf("INFO: PLUS60K expansion installed.\n");
#endif

	if (!util_check_null_string(plus60k_filename))
	{
		if (util_file_load(plus60k_filename, plus60k_ram, (size_t)0xf000, UTIL_FILE_LOAD_RAW) < 0)
		{
			#ifdef CELL_DEBUG
			printf("INFO: Reading PLUS60K image %s failed.\n", plus60k_filename);
			#endif
			if (util_file_save(plus60k_filename, plus60k_ram, 0xf000) < 0)
			{
				#ifdef CELL_DEBUG
				printf("INFO: Creating PLUS60K image %s failed.\n", plus60k_filename);
				#endif
				return -1;
			}
			#ifdef CELL_DEBUG
			printf("INFO: Creating PLUS60K image %s.\n", plus60k_filename);
			#endif
			return 0;
		}
		#ifdef CELL_DEBUG
		printf("INFO: Reading PLUS60K image %s.\n", plus60k_filename);
		#endif
	}

	plus60k_reset();
	set_cpu_lines_lock(CPU_LINES_PLUS60K, "PLUS60K");
	return 0;
}
Esempio n. 12
0
static int ramcart_activate(void)
{
    if (!ramcart_size) {
        return 0;
    }

    ramcart_ram = lib_realloc((void *)ramcart_ram, (size_t)ramcart_size);

    /* Clear newly allocated RAM.  */
    if (ramcart_size > old_ramcart_ram_size) {
        memset(ramcart_ram, 0, (size_t)(ramcart_size - old_ramcart_ram_size));
    }

    old_ramcart_ram_size = ramcart_size;

    log_message(ramcart_log, "%dKB unit installed.", ramcart_size >> 10);

    if (!util_check_null_string(ramcart_filename)) {
        if (util_file_load(ramcart_filename, ramcart_ram, (size_t)ramcart_size, UTIL_FILE_LOAD_RAW) < 0) {
            log_error(ramcart_log, "Reading RAMCART image %s failed.", ramcart_filename);
            /* only create a new file if no file exists, so we dont accidently overwrite any files */
            if (!util_file_exists(ramcart_filename)) {
                if (util_file_save(ramcart_filename, ramcart_ram, ramcart_size) < 0) {
                    log_error(ramcart_log, "Creating RAMCART image %s failed.", ramcart_filename);
                    return -1;
                }
                log_message(ramcart_log, "Creating RAMCART image %s.", ramcart_filename);
                return 0;
            }
        }
        log_message(ramcart_log, "Reading RAMCART image %s.", ramcart_filename);
    }

    ramcart_reset();
    return 0;
}