示例#1
0
void timekeeper_device::nvram_write(emu_file &file)
{
	file.write( &m_data[0], m_size );
}
示例#2
0
void atari_vg_earom_device::nvram_read(emu_file &file)
{
	file.read(m_rom,EAROM_SIZE);
}
示例#3
0
文件: cheat.cpp 项目: bmunger/mame
void cheat_script::script_entry::save(emu_file &cheatfile) const
{
	// output an action
	if (m_format.empty())
	{
		cheatfile.printf("\t\t\t<action");
		if (!m_condition.is_empty())
			cheatfile.printf(" condition=\"%s\"", cheat_manager::quote_expression(m_condition).c_str());
		cheatfile.printf(">%s</action>\n", cheat_manager::quote_expression(m_expression).c_str());
	}

	// output an output
	else
	{
		cheatfile.printf("\t\t\t<output format=\"%s\"", m_format.c_str());
		if (!m_condition.is_empty())
			cheatfile.printf(" condition=\"%s\"", cheat_manager::quote_expression(m_condition).c_str());
		if (m_line != 0)
			cheatfile.printf(" line=\"%d\"", m_line);
		if (m_justify == ui::text_layout::CENTER)
			cheatfile.printf(" align=\"center\"");
		else if (m_justify == ui::text_layout::RIGHT)
			cheatfile.printf(" align=\"right\"");
		if (m_arglist.size() == 0)
			cheatfile.printf(" />\n");

		// output arguments
		else
		{
			cheatfile.printf(">\n");
			for (auto &curarg : m_arglist)
				curarg->save(cheatfile);
			cheatfile.printf("\t\t\t</output>\n");
		}
	}
}
示例#4
0
void timekeeper_device::nvram_read(emu_file &file)
{
	file.read( &m_data[0], m_size );

	counters_to_ram();
}
示例#5
0
void pcf8593_device::nvram_read(emu_file &file)
{
	file.read(m_data, sizeof(m_data));
}
示例#6
0
文件: at29040a.c 项目: LeWoY/MAMEHub
void at29040a_device::nvram_read(emu_file &file)
{
	file.read(m_eememory, FEEPROM_SIZE+2);
}
示例#7
0
void mccs1850_device::nvram_write(emu_file &file)
{
	file.write(m_ram, RAM_SIZE);
}
示例#8
0
文件: nvram.cpp 项目: Chintiger/mame
void nvram_device::nvram_write(emu_file &file)
{
	file.write(m_base, m_length);
}
示例#9
0
文件: video.cpp 项目: Tauwasser/mame
osd_file::error video_manager::open_next(emu_file &file, const char *extension)
{
	u32 origflags = file.openflags();

	// handle defaults
	const char *snapname = machine().options().snap_name();

	if (snapname == nullptr || snapname[0] == 0)
		snapname = "%g/%i";
	std::string snapstr(snapname);

	// strip any extension in the provided name
	int index = snapstr.find_last_of('.');
	if (index != -1)
		snapstr = snapstr.substr(0, index);

	// handle %d in the template (for image devices)
	std::string snapdev("%d_");
	int pos = snapstr.find(snapdev);

	if (pos != -1)
	{
		// if more %d are found, revert to default and ignore them all
		if (snapstr.find(snapdev.c_str(), pos + 3) != -1)
			snapstr.assign("%g/%i");
		// else if there is a single %d, try to create the correct snapname
		else
		{
			int name_found = 0;

			// find length of the device name
			int end1 = snapstr.find("/", pos + 3);
			int end2 = snapstr.find("%", pos + 3);
			int end;

			if ((end1 != -1) && (end2 != -1))
				end = std::min(end1, end2);
			else if (end1 != -1)
				end = end1;
			else if (end2 != -1)
				end = end2;
			else
				end = snapstr.length();

			if (end - pos < 3)
				fatalerror("Something very wrong is going on!!!\n");

			// copy the device name to an std::string
			std::string snapdevname;
			snapdevname.assign(snapstr.substr(pos + 3, end - pos - 3));
			//printf("check template: %s\n", snapdevname.c_str());

			// verify that there is such a device for this system
			for (device_image_interface &image : image_interface_iterator(machine().root_device()))
			{
				// get the device name
				std::string tempdevname(image.brief_instance_name());
				//printf("check device: %s\n", tempdevname.c_str());

				if (snapdevname.compare(tempdevname) == 0)
				{
					// verify that such a device has an image mounted
					if (image.basename() != nullptr)
					{
						std::string filename(image.basename());

						// strip extension
						filename = filename.substr(0, filename.find_last_of('.'));

						// setup snapname and remove the %d_
						strreplace(snapstr, snapdevname.c_str(), filename.c_str());
						snapstr.erase(pos, 3);
						//printf("check image: %s\n", filename.c_str());

						name_found = 1;
					}
				}
			}

			// or fallback to default
			if (name_found == 0)
				snapstr.assign("%g/%i");
		}
	}

	// add our own extension
	snapstr.append(".").append(extension);

	// substitute path and gamename up front
	strreplace(snapstr, "/", PATH_SEPARATOR);
	strreplace(snapstr, "%g", machine().basename());

	// determine if the template has an index; if not, we always use the same name
	std::string fname;
	if (snapstr.find("%i") == -1)
		fname.assign(snapstr);

	// otherwise, we scan for the next available filename
	else
	{
		// try until we succeed
		file.set_openflags(OPEN_FLAG_READ);
		for (int seq = 0; ; seq++)
		{
			// build up the filename
			fname.assign(snapstr);
			strreplace(fname, "%i", string_format("%04d", seq).c_str());

			// try to open the file; stop when we fail
			osd_file::error filerr = file.open(fname.c_str());
			if (filerr != osd_file::error::NONE)
				break;
		}
	}

	// create the final file
	file.set_openflags(origflags);
	return file.open(fname.c_str());
}
示例#10
0
void mccs1850_device::nvram_read(emu_file &file)
{
	file.read(m_ram, RAM_SIZE);
}
示例#11
0
void msx_s1985_device::nvram_write(emu_file &file)
{
	file.write(m_backup_ram, sizeof(m_backup_ram));
}
示例#12
0
void msx_s1985_device::nvram_read(emu_file &file)
{
	file.read(m_backup_ram, sizeof(m_backup_ram));
}
示例#13
0
文件: at29040a.c 项目: LeWoY/MAMEHub
void at29040a_device::nvram_write(emu_file &file)
{
	m_eememory[0] = VERSION;
	file.write(m_eememory, FEEPROM_SIZE+2);
}
示例#14
0
void atari_vg_earom_device::nvram_write(emu_file &file)
{
	file.write(m_rom,EAROM_SIZE);
}
示例#15
0
void mc146818_device::nvram_write(emu_file &file)
{
    file.write(&m_data[0], data_size());
}
示例#16
0
file_error video_manager::open_next(emu_file &file, const char *extension)
{
	UINT32 origflags = file.openflags();

	// handle defaults
	const char *snapname = machine().options().snap_name();

	if (snapname == NULL || snapname[0] == 0)
		snapname = "%g/%i";
	astring snapstr(snapname);

	// strip any extension in the provided name
	int index = snapstr.rchr(0, '.');
	if (index != -1)
		snapstr.substr(0, index);

	// handle %d in the template (for image devices)
	astring snapdev("%d_");
	int pos = snapstr.find(0, snapdev);

	if (pos != -1)
	{
		// if more %d are found, revert to default and ignore them all
		if (snapstr.find(pos + 3, snapdev) != -1)
			snapstr.cpy("%g/%i");
		// else if there is a single %d, try to create the correct snapname
		else
		{
			int name_found = 0;

			// find length of the device name
			int end1 = snapstr.find(pos + 3, "/");
			int end2 = snapstr.find(pos + 3, "%");
			int end = -1;

			if ((end1 != -1) && (end2 != -1))
				end = MIN(end1, end2);
			else if (end1 != -1)
				end = end1;
			else if (end2 != -1)
				end = end2;
			else
				end = snapstr.len();

			if (end - pos < 3)
				fatalerror("Something very wrong is going on!!!");

			// copy the device name to an astring
			astring snapdevname;
			snapdevname.cpysubstr(snapstr, pos + 3, end - pos - 3);
			//printf("check template: %s\n", snapdevname.cstr());

			// verify that there is such a device for this system
			device_image_interface *image = NULL;
			for (bool gotone = machine().devicelist().first(image); gotone; gotone = image->next(image))
			{
				// get the device name
				astring tempdevname(image->brief_instance_name());
				//printf("check device: %s\n", tempdevname.cstr());

				if (snapdevname.cmp(tempdevname) == 0)
				{
					// verify that such a device has an image mounted
					if (image->basename() != NULL)
					{
						astring filename(image->basename());

						// strip extension
						filename.substr(0, filename.rchr(0, '.'));

						// setup snapname and remove the %d_
						snapstr.replace(0, snapdevname, filename);
						snapstr.del(pos, 3);
						//printf("check image: %s\n", filename.cstr());

						name_found = 1;
					}
				}
			}

			// or fallback to default
			if (name_found == 0)
				snapstr.cpy("%g/%i");
		}
	}

	// add our own extension
	snapstr.cat(".").cat(extension);

	// substitute path and gamename up front
	snapstr.replace(0, "/", PATH_SEPARATOR);
	snapstr.replace(0, "%g", machine().basename());

	// determine if the template has an index; if not, we always use the same name
	astring fname;
	if (snapstr.find(0, "%i") == -1)
		fname.cpy(snapstr);

	// otherwise, we scan for the next available filename
	else
	{
		// try until we succeed
		astring seqtext;
		file.set_openflags(OPEN_FLAG_READ);
		for (int seq = 0; ; seq++)
		{
			// build up the filename
			fname.cpy(snapstr).replace(0, "%i", seqtext.format("%04d", seq).cstr());

			// try to open the file; stop when we fail
			file_error filerr = file.open(fname);
			if (filerr != FILERR_NONE)
				break;
		}
	}

	// create the final file
	file.set_openflags(origflags);
    return file.open(fname);
}
示例#17
0
文件: mc146818.c 项目: Ilgrim/MAMEHub
void mc146818_device::nvram_read(emu_file &file)
{
	file.read(m_data, sizeof(m_data));
	set_base_datetime();
}
示例#18
0
void horizon_ramdisk_device::nvram_write(emu_file &file)
{
	int size = get_size();
	file.write(m_nvram, size);
}
示例#19
0
文件: mc146818.c 项目: Ilgrim/MAMEHub
void mc146818_device::nvram_write(emu_file &file)
{
	file.write(m_data, sizeof(m_data));
}
示例#20
0
void pcf8593_device::nvram_write(emu_file &file)
{
	file.write(m_data, sizeof(m_data));
}
示例#21
0
void cheat_script::script_entry::save(emu_file &cheatfile) const
{
	astring tempstring;

	// output an action
	if (!m_format)
	{
		cheatfile.printf("\t\t\t<action");
		if (!m_condition.is_empty())
			cheatfile.printf(" condition=\"%s\"", cheat_manager::quote_expression(tempstring, m_condition));
		cheatfile.printf(">%s</action>\n", cheat_manager::quote_expression(tempstring, m_expression));
	}

	// output an output
	else
	{
		cheatfile.printf("\t\t\t<output format=\"%s\"", m_format.cstr());
		if (!m_condition.is_empty())
			cheatfile.printf(" condition=\"%s\"", cheat_manager::quote_expression(tempstring, m_condition));
		if (m_line != 0)
			cheatfile.printf(" line=\"%d\"", m_line);
		if (m_justify == JUSTIFY_CENTER)
			cheatfile.printf(" align=\"center\"");
		else if (m_justify == JUSTIFY_RIGHT)
			cheatfile.printf(" align=\"right\"");
		if (m_arglist.count() == 0)
			cheatfile.printf(" />\n");

		// output arguments
		else
		{
			cheatfile.printf(">\n");
			for (const output_argument *curarg = m_arglist.first(); curarg != NULL; curarg = curarg->next())
				curarg->save(cheatfile);
			cheatfile.printf("\t\t\t</output>\n");
		}
	}
}