Ejemplo n.º 1
0
Archivo: save.c Proyecto: opicron/mame
save_error save_manager::write_file(emu_file &file)
{
	// if we have illegal registrations, return an error
	if (m_illegal_regs > 0)
		return STATERR_ILLEGAL_REGISTRATIONS;

	// generate the header
	UINT8 header[HEADER_SIZE];
	memcpy(&header[0], emulator_info::get_state_magic_num(), 8);
	header[8] = SAVE_VERSION;
	header[9] = NATIVE_ENDIAN_VALUE_LE_BE(0, SS_MSB_FIRST);
	strncpy((char *)&header[0x0a], machine().system().name, 0x1c - 0x0a);
	UINT32 sig = signature();
	*(UINT32 *)&header[0x1c] = LITTLE_ENDIANIZE_INT32(sig);

	// write the header and turn on compression for the rest of the file
	file.compress(FCOMPRESS_NONE);
	file.seek(0, SEEK_SET);
	if (file.write(header, sizeof(header)) != sizeof(header))
		return STATERR_WRITE_ERROR;
	file.compress(FCOMPRESS_MEDIUM);

	// call the pre-save functions
	for (state_callback *func = m_presave_list.first(); func != NULL; func = func->next())
		func->m_func();

	// then write all the data
	for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next())
	{
		UINT32 totalsize = entry->m_typesize * entry->m_typecount;
		if (file.write(entry->m_data, totalsize) != totalsize)
			return STATERR_WRITE_ERROR;
	}
	return STATERR_NONE;
}
Ejemplo n.º 2
0
void ds1204_device::nvram_write( emu_file &file )
{
	file.write( m_unique_pattern, sizeof( m_unique_pattern ) );
	file.write( m_identification, sizeof( m_identification ) );
	file.write( m_security_match, sizeof( m_security_match ) );
	file.write( m_secure_memory, sizeof( m_secure_memory ) );
}
Ejemplo n.º 3
0
void intelfsh_device::nvram_write(emu_file &file)
{
	dynamic_buffer buffer(m_size);
	for (int byte = 0; byte < m_size; byte++)
		buffer[byte] = space(AS_PROGRAM).read_byte(byte);
	file.write(&buffer[0], m_size);
}
Ejemplo n.º 4
0
void at29x_device::nvram_write(emu_file &file)
{
	// If we don't write (because there were no changes), the file will be wiped
	if (TRACE_PRG) logerror("%s: Write to NVRAM file\n", tag());
	m_eememory[0] = m_version;
	file.write(m_eememory.get(), m_memory_size+2);
}
Ejemplo n.º 5
0
void er2055_device::nvram_write(emu_file &file)
{
	UINT8 buffer[SIZE_DATA];
	for (int byte = 0; byte < SIZE_DATA; byte++)
		buffer[byte] = m_addrspace[0]->read_byte(byte);
	file.write(buffer, sizeof(buffer));
}
Ejemplo n.º 6
0
void er2055_device::nvram_write(emu_file &file)
{
	UINT8 buffer[SIZE_DATA];
	for (int byte = 0; byte < SIZE_DATA; byte++)
		buffer[byte] = space(AS_PROGRAM).read_byte(byte);
	file.write(buffer, sizeof(buffer));
}
Ejemplo n.º 7
0
void intelfsh_device::nvram_write(emu_file &file)
{
	dynamic_buffer buffer(m_size);
	for (int byte = 0; byte < m_size; byte++)
		buffer[byte] = m_addrspace[0]->read_byte(byte);
	file.write(&buffer[0], m_size);
}
Ejemplo n.º 8
0
void eeprom_base_device::nvram_write(emu_file &file)
{
	uint32_t eeprom_length = 1 << m_address_bits;
	uint32_t eeprom_bytes = eeprom_length * m_data_bits / 8;

	file.write(&m_data[0], eeprom_bytes);
}
Ejemplo n.º 9
0
void serflash_device::nvram_write(emu_file &file)
{
	if (m_length % FLASH_PAGE_SIZE) return; // region size must be multiple of flash page size
	int size = m_length /= FLASH_PAGE_SIZE;

	UINT32 page = 0;
	while (page < size)
	{
		if (m_flashwritemap[page])
		{
			file.write(&page, 4);
			file.write(m_region + page * FLASH_PAGE_SIZE, FLASH_PAGE_SIZE);
		}
		page++;
	}
	file.write(&page, 4);
}
Ejemplo n.º 10
0
void intelfsh_device::nvram_write(emu_file &file)
{
	UINT8 *buffer = global_alloc_array(UINT8, m_size);
	for (int byte = 0; byte < m_size; byte++)
		buffer[byte] = m_addrspace[0]->read_byte(byte);
	file.write(buffer, m_size);
	global_free(buffer);
}
Ejemplo n.º 11
0
void eeprom_base_device::nvram_write(emu_file &file)
{
	UINT32 eeprom_length = 1 << m_address_bits;
	UINT32 eeprom_bytes = eeprom_length * m_data_bits / 8;

	dynamic_buffer buffer(eeprom_bytes);
	for (offs_t offs = 0; offs < eeprom_bytes; offs++)
		buffer[offs] = m_addrspace[0]->read_byte(offs);
	file.write(&buffer[0], eeprom_bytes);
}
Ejemplo n.º 12
0
void horizon_ramdisk_device::nvram_write(emu_file &file)
{
	int nvramsize = 2097152*(1 << ioport("HORIZONSIZE")->read());

	uint8_t* buffer = global_alloc_array_clear<uint8_t>(nvramsize + ROSSIZE);
	memcpy(buffer, m_nvram->pointer(), nvramsize);
	memcpy(buffer + nvramsize, m_ros->pointer(), ROSSIZE);

	file.write(buffer, nvramsize + ROSSIZE);
}
Ejemplo n.º 13
0
void eeprom_device::nvram_write(emu_file &file)
{
	UINT32 eeprom_length = 1 << m_address_bits;
	UINT32 eeprom_bytes = eeprom_length * m_data_bits / 8;

	UINT8 *buffer = auto_alloc_array(machine(), UINT8, eeprom_bytes);
	for (offs_t offs = 0; offs < eeprom_bytes; offs++)
		buffer[offs] = m_addrspace[0]->read_byte(offs);
	file.write(buffer, eeprom_bytes);
	auto_free(machine(), buffer);
}
Ejemplo n.º 14
0
void at28c16_device::nvram_write( emu_file &file )
{
	std::vector<uint8_t> buffer ( AT28C16_TOTAL_BYTES );

	for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ )
	{
		buffer[ offs ] = space(AS_PROGRAM).read_byte( offs );
	}

	file.write( &buffer[0], AT28C16_TOTAL_BYTES );
}
Ejemplo n.º 15
0
void x2212_device::nvram_write(emu_file &file)
{
	// auto-save causes an implicit store prior to exiting (writing)
	if (m_auto_save)
		store();

	UINT8 *buffer = (UINT8 *) alloca(SIZE_DATA);
	for (int byte = 0; byte < SIZE_DATA; byte++)
		buffer[byte] = m_e2prom->read_byte(byte);
	file.write(buffer, SIZE_DATA);
}
Ejemplo n.º 16
0
void at28c16_device::nvram_write( emu_file &file )
{
	dynamic_buffer buffer ( AT28C16_TOTAL_BYTES );

	for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ )
	{
		buffer[ offs ] = m_addrspace[ 0 ]->read_byte( offs );
	}

	file.write( &buffer[0], AT28C16_TOTAL_BYTES );
}
Ejemplo n.º 17
0
void i2cmem_device::nvram_write( emu_file &file )
{
	int i2cmem_bytes = m_data_size;
	dynamic_buffer buffer ( i2cmem_bytes );

	for( offs_t offs = 0; offs < i2cmem_bytes; offs++ )
	{
		buffer[ offs ] = space(AS_PROGRAM).read_byte( offs );
	}

	file.write( &buffer[0], i2cmem_bytes );
}
Ejemplo n.º 18
0
void at28c16_device::nvram_write( emu_file &file )
{
	UINT8 *buffer = auto_alloc_array( &m_machine, UINT8, AT28C16_TOTAL_BYTES );

	for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ )
	{
		buffer[ offs ] = m_addrspace[ 0 ]->read_byte( offs );
	}

	file.write( buffer, AT28C16_TOTAL_BYTES );

	auto_free( &m_machine, buffer );
}
Ejemplo n.º 19
0
void a2bus_cffa2_6502_device::nvram_write(emu_file &file)
{
	file.write(m_eeprom, 0x1000);
}
Ejemplo n.º 20
0
void mc146818_device::nvram_write(emu_file &file)
{
	file.write(m_data, sizeof(m_data));
}
Ejemplo n.º 21
0
void atari_vg_earom_device::nvram_write(emu_file &file)
{
	file.write(m_rom,EAROM_SIZE);
}
Ejemplo n.º 22
0
void rp5c01_device::nvram_write(emu_file &file)
{
	if (m_battery_backed)
		file.write(m_ram, RAM_SIZE);
}
Ejemplo n.º 23
0
void mccs1850_device::nvram_write(emu_file &file)
{
	file.write(m_ram, RAM_SIZE);
}
Ejemplo n.º 24
0
void horizon_ramdisk_device::nvram_write(emu_file &file)
{
	int size = get_size();
	file.write(m_nvram, size);
}
Ejemplo n.º 25
0
void ngp_state::nvram_write(emu_file &file)
{
	file.write(m_mainram, 0x3000);
}
Ejemplo n.º 26
0
void m6m80011ap_device::nvram_write(emu_file &file)
{
	file.write(m_eeprom_data, 0x100);
}
Ejemplo n.º 27
0
void rtc9701_device::nvram_write(emu_file &file)
{
	file.write(rtc9701_data, 0x200);
}
Ejemplo n.º 28
0
void snug_enhanced_video_device::nvram_write(emu_file &file)
{
	file.write(m_novram.get(), NOVRAM_SIZE);
}
Ejemplo n.º 29
0
void mc146818_device::nvram_write(emu_file &file)
{
	file.write(m_data, data_size());
}
Ejemplo n.º 30
0
void nmc9306_device::nvram_write(emu_file &file)
{
	file.write(m_register, RAM_SIZE);
}