Пример #1
0
int config_load_settings(running_machine &machine)
{
	const char *controller = machine.options().ctrlr();
	config_type *type;
	int loaded = 0;

	/* loop over all registrants and call their init function */
	for (type = typelist; type; type = type->next)
		type->load(CONFIG_TYPE_INIT, NULL);

	/* now load the controller file */
	if (controller[0] != 0)
	{
		/* open the config file */
		emu_file file(machine.options().ctrlr_path(), OPEN_FLAG_READ);
		file_error filerr = file.open(controller, ".cfg");

		if (filerr != FILERR_NONE)
			throw emu_fatalerror("Could not load controller file %s.cfg", controller);

		/* load the XML */
		if (!config_load_xml(machine, file, CONFIG_TYPE_CONTROLLER))
			throw emu_fatalerror("Could not load controller file %s.cfg", controller);
	}

	/* next load the defaults file */
	emu_file file(machine.options().cfg_directory(), OPEN_FLAG_READ);
	file_error filerr = file.open("default.cfg");
	if (filerr == FILERR_NONE)
		config_load_xml(machine, file, CONFIG_TYPE_DEFAULT);

	/* finally, load the game-specific file */
	filerr = file.open(machine.basename(), ".cfg");
	if (filerr == FILERR_NONE)
		loaded = config_load_xml(machine, file, CONFIG_TYPE_GAME);

	/* loop over all registrants and call their final function */
	for (type = typelist; type; type = type->next)
		type->load(CONFIG_TYPE_FINAL, NULL);

	/* if we didn't find a saved config, return 0 so the main core knows that it */
	/* is the first time the game is run and it should diplay the disclaimer. */
	return loaded;
}
Пример #2
0
void mm5837_device::device_reset()
{
	// initialize with something
	m_shift = 123456;

	if (m_vdd < 16)
		m_timer->adjust(attotime::zero, 0, attotime::from_hz(m_frequency[m_vdd]));
	else
		throw emu_fatalerror("%s: Invalid voltage: %d\n", tag(), m_vdd);
}
Пример #3
0
device_slot_option *device_slot_interface::static_option(device_t &device, const char *name)
{
	device_slot_interface &intf = dynamic_cast<device_slot_interface &>(device);
	device_slot_option *option = intf.option(name);

	if (option == NULL)
		throw emu_fatalerror("slot '%s' has no option '%s\n", device.tag(), name);

	return option;
}
Пример #4
0
void device_config_sound_interface::static_reset_routes(device_config *device)
{
	// find our sound interface
	device_config_sound_interface *sound = dynamic_cast<device_config_sound_interface *>(device);
	if (sound == NULL)
		throw emu_fatalerror("MCFG_SOUND_ROUTES_RESET called on device '%s' with no sound interface", device->tag());

	// reset the routine list
	sound->m_route_list.reset();
}
Пример #5
0
void device_slot_interface::static_set_slot_info(device_t &device, const slot_interface *slots_info, const char *default_card, bool fixed)
{
	device_slot_interface *slot;
	if (!device.interface(slot))
		throw emu_fatalerror("set_default_slot_card called on device '%s' with no slot interface", device.tag());

	slot->m_slot_interfaces = slots_info;
	slot->m_default_card = default_card;
	slot->m_fixed = fixed;
}
Пример #6
0
int configuration_manager::load_settings()
{
	const char *controller = machine().options().ctrlr();
	int loaded = 0;

	/* loop over all registrants and call their init function */
	for (auto type : m_typelist)
		type.load(config_type::INIT, nullptr);

	/* now load the controller file */
	if (controller[0] != 0)
	{
		/* open the config file */
		emu_file file(machine().options().ctrlr_path(), OPEN_FLAG_READ);
		osd_file::error filerr = file.open(controller, ".cfg");

		if (filerr != osd_file::error::NONE)
			throw emu_fatalerror("Could not load controller file %s.cfg", controller);

		/* load the XML */
		if (!load_xml(file, config_type::CONTROLLER))
			throw emu_fatalerror("Could not load controller file %s.cfg", controller);
	}

	/* next load the defaults file */
	emu_file file(machine().options().cfg_directory(), OPEN_FLAG_READ);
	osd_file::error filerr = file.open("default.cfg");
	if (filerr == osd_file::error::NONE)
		load_xml(file, config_type::DEFAULT);

	/* finally, load the game-specific file */
	filerr = file.open(machine().basename(), ".cfg");
	if (filerr == osd_file::error::NONE)
		loaded = load_xml(file, config_type::GAME);

	/* loop over all registrants and call their final function */
	for (auto type : m_typelist)
		type.load(config_type::FINAL, nullptr);

	/* if we didn't find a saved config, return 0 so the main core knows that it */
	/* is the first time the game is run and it should diplay the disclaimer. */
	return loaded;
}
Пример #7
0
void device_config_sound_interface::static_add_route(device_config *device, UINT32 output, const char *target, double gain, UINT32 input)
{
	// find our sound interface
	device_config_sound_interface *sound = dynamic_cast<device_config_sound_interface *>(device);
	if (sound == NULL)
		throw emu_fatalerror("MCFG_SOUND_ROUTE called on device '%s' with no sound interface", device->tag());

	// append a new route to the list
	sound->m_route_list.append(*global_alloc(sound_route(output, input, gain, target)));
}
Пример #8
0
void device_slot_interface::static_option_add(device_t &device, const char *name, const device_type &devtype)
{
	device_slot_interface &intf = dynamic_cast<device_slot_interface &>(device);
	device_slot_option *option = intf.option(name);

	if (option != nullptr)
		throw emu_fatalerror("slot '%s' duplicate option '%s'\n", device.tag(), name);
	if (intf.m_options.count(name) != 0) throw tag_add_exception(name);
	intf.m_options.emplace(std::make_pair(name, std::make_unique<device_slot_option>(name, devtype)));
}
Пример #9
0
void device_slot_interface::static_option_add(device_t &device, const char *name, const device_type &devtype)
{
	device_slot_interface &intf = dynamic_cast<device_slot_interface &>(device);
	device_slot_option *option = intf.option(name);

	if (option != NULL)
		throw emu_fatalerror("slot '%s' duplicate option '%s\n", device.tag(), name);

	intf.m_options.append(name, *global_alloc(device_slot_option(name, devtype)));
}
Пример #10
0
void device_config_sound_interface::static_add_route(device_config *device, UINT32 output, const char *target, double gain, UINT32 input)
{
	device_config_sound_interface *sound = dynamic_cast<device_config_sound_interface *>(device);
	if (sound == NULL)
		throw emu_fatalerror("MCFG_SOUND_ROUTE called on device '%s' with no sound interface", device->tag());

	sound_route **routeptr;
	for (routeptr = &sound->m_route_list; *routeptr != NULL; routeptr = &(*routeptr)->m_next) ;
	*routeptr = global_alloc(sound_route(output, input, gain, target));
}
Пример #11
0
device_sound_interface::sound_route &device_sound_interface::static_add_route(device_t &device, UINT32 output, const char *target, double gain, UINT32 input, UINT32 mixoutput)
{
	// find our sound interface
	device_sound_interface *sound;
	if (!device.get_interface(sound))
		throw emu_fatalerror("MCFG_SOUND_ROUTE called on device '%s' with no sound interface", device.tag());

	// append a new route to the list
	return sound->m_route_list.append(*global_alloc(sound_route(output, input, gain, target, mixoutput)));
}
Пример #12
0
address_space *devcb_resolver::resolve_space(int index, const char *tag, device_t &current)
{
	// find our target device
	device_t *targetdev = current.siblingdevice(tag);
	if (targetdev == NULL)
		throw emu_fatalerror("Unable to resolve device '%s' (requested by %s '%s')", tag, current.name(), current.tag());

	// make sure the target device has a memory interface
	device_memory_interface *memory;
	if (!targetdev->interface(memory))
		throw emu_fatalerror("Device '%s' (requested by %s '%s') has no memory interface", tag, current.name(), current.tag());

	// set the real target and function, then prime a delegate
	address_space *result = memory->space(index);
	if (result == NULL)
		throw emu_fatalerror("Unable to find device '%s' space %d (requested by %s '%s')", tag, index, current.name(), current.tag());

	return result;
}
Пример #13
0
void device_sound_interface::static_reset_routes(device_t &device)
{
	// find our sound interface
	device_sound_interface *sound;
	if (!device.dev_interface(sound))
		throw emu_fatalerror("MCFG_SOUND_ROUTES_RESET called on device '%s' with no sound interface", device.tag());

	// reset the routine list
	sound->m_route_list.reset();
}
Пример #14
0
void tcp_connection::write(const uint8_t* data, size_t len)
{
	if (m_is_closing)
		return;

	if (len == 0)
		return;

	uv_buf_t buffer;
	int written;
	int err;

	// First try uv_try_write(). In case it can not directly write all the given
	// data then build a uv_req_t and use uv_write().

	buffer = uv_buf_init((char*)data, len);
	written = uv_try_write((uv_stream_t*)m_uv_handle, &buffer, 1);

	// All the data was written. Done.
	if (written == (int)len)
	{
		return;
	}
	// Cannot write any data at first time. Use uv_write().
	else if (written == UV_EAGAIN || written == UV_ENOSYS)
	{
		// Set written to 0 so pending_len can be properly calculated.
		written = 0;
	}
	// Error. Should not happen.
	else if (written < 0)
	{
		osd_printf_warning("uv_try_write() failed, closing the connection: %s\n", uv_strerror(written));

		close();
		return;
	}

	// osd_printf_info("could just write %zu bytes (%zu given) at first time, using uv_write() now", (size_t)written, len);

	size_t pending_len = len - written;

	// Allocate a special UvWriteData struct pointer.
	tcp_uv_write_data* write_data = (tcp_uv_write_data*)std::malloc(sizeof(tcp_uv_write_data) + pending_len);

	write_data->connection = this;
	std::memcpy(write_data->store, data + written, pending_len);
	write_data->req.data = (void*)write_data;

	buffer = uv_buf_init((char*)write_data->store, pending_len);

	err = uv_write(&write_data->req, (uv_stream_t*)m_uv_handle, &buffer, 1, (uv_write_cb)on_write);
	if (err)
		throw emu_fatalerror("uv_write() failed: %s", uv_strerror(err));
}
Пример #15
0
machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
	: m_minimum_quantum(attotime::zero),
		m_default_layout(nullptr),
		m_gamedrv(gamedrv),
		m_options(options)
{
	// construct the config
	(*gamedrv.machine_config)(*this, nullptr, nullptr);

	bool is_selected_driver = core_stricmp(gamedrv.name,options.system_name())==0;
	// intialize slot devices - make sure that any required devices have been allocated

	for (device_slot_interface &slot : slot_interface_iterator(root_device()))
	{
		device_t &owner = slot.device();
		std::string selval;
		bool isdefault = (options.priority(owner.tag()+1)==OPTION_PRIORITY_DEFAULT);
		if (is_selected_driver && options.exists(owner.tag()+1))
			selval = options.main_value(owner.tag()+1);
		else if (slot.default_option() != nullptr)
			selval.assign(slot.default_option());

		if (!selval.empty())
		{
			const device_slot_option *option = slot.option(selval.c_str());

			if (option && (isdefault || option->selectable()))
			{
				device_t *new_dev = device_add(&owner, option->name(), option->devtype(), option->clock());

				const char *default_bios = option->default_bios();
				if (default_bios != nullptr)
					device_t::static_set_default_bios_tag(*new_dev, default_bios);

				machine_config_constructor additions = option->machine_config();
				if (additions != nullptr)
					(*additions)(const_cast<machine_config &>(*this), new_dev, new_dev);

				const input_device_default *input_device_defaults = option->input_device_defaults();
				if (input_device_defaults)
					device_t::static_set_input_default(*new_dev, input_device_defaults);
			}
			else
				throw emu_fatalerror("Unknown slot option '%s' in slot '%s'", selval.c_str(), owner.tag()+1);
		}
	}

	// when finished, set the game driver
	driver_device::static_set_game(*m_root_device, gamedrv);

	// then notify all devices that their configuration is complete
	for (device_t &device : device_iterator(root_device()))
		if (!device.configured())
			device.config_complete();
}
Пример #16
0
bool g64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
	UINT64 size = io_generic_size(io);
	UINT8 *img = global_alloc_array(UINT8, size);
	io_generic_read(io, img, 0, size);

	if (img[VERSION]) {
		throw emu_fatalerror("g64_format: Unsupported version %u", img[VERSION]);
	}

	int track_count = img[TRACK_COUNT];
	int head = 0;

	for (int track = 0; track < track_count; track++)
	{
		offs_t track_offset = pick_integer_le(img, TRACK_OFFSET + (track * 4), 4);
		
		if (!track_offset)
			continue;

		if (track_offset > size)
			throw emu_fatalerror("g64_format: Track %u offset %06x out of bounds", track, track_offset);

		offs_t speed_zone = pick_integer_le(img, SPEED_ZONE + (track * 4), 4);

		if (speed_zone > 3)
			throw emu_fatalerror("g64_format: Unsupported variable speed zones on track %d", track);

		UINT16 track_bytes = pick_integer_le(img, track_offset, 2);
		int track_size = track_bytes * 8;
		
		LOG_FORMATS("track %u size %u cell %ld\n", track, track_size, 200000000L/track_size);

		generate_track_from_bitstream(track, head, &img[track_offset+2], track_size, image);
	}

	global_free(img);

	image->set_variant(floppy_image::SSSD);

	return true;
}
Пример #17
0
nscsi_full_device::control *nscsi_full_device::buf_control_pop()
{
	if(buf_control_rpos == buf_control_wpos)
		throw emu_fatalerror("%s: buf_control underflow\n", tag());

	control *c = buf_control + buf_control_rpos;
	buf_control_rpos++;
	if(buf_control_rpos == buf_control_wpos)
		buf_control_rpos = buf_control_wpos = 0;
	return c;
}
Пример #18
0
Файл: exp.cpp Проект: f205v/mame
void spectrum_expansion_slot_device::device_start()
{
	device_t *const card_device(get_card_device());
	m_card = dynamic_cast<device_spectrum_expansion_interface *>(card_device);
	if (card_device && !m_card)
		throw emu_fatalerror("spectrum_expansion_slot_device: card device %s (%s) does not implement device_spectrum_expansion_interface\n", card_device->tag(), card_device->name());

	// resolve callbacks
	m_irq_handler.resolve_safe();
	m_nmi_handler.resolve_safe();
}
Пример #19
0
void sony_ldp1450_device::set_new_player_bcd(UINT8 data)
{
	printf("Frame data BCD %02x\n",data);

	m_internal_bcd[m_index_state] = data;
	m_index_state ++;
	if(m_index_state >= FIFO_MAX)
		throw emu_fatalerror("FIFO MAX reached");

	m_status = LDP_STAT_ACK;
}
Пример #20
0
device_t *machine_config::device_find(device_t *owner, const char *tag)
{
	// find the original device by relative tag (must exist)
	assert(owner != nullptr);
	device_t *device = owner->subdevice(tag);
	if (device == nullptr)
		throw emu_fatalerror("Unable to find device '%s'\n", tag);

	// return the device
	return device;
}
Пример #21
0
bool g64_format::save(io_generic *io, floppy_image *image)
{
	UINT8 header[] = { 'G', 'C', 'R', '-', '1', '5', '4', '1', 0x00, 0x54, TRACK_LENGTH & 0xff, TRACK_LENGTH >> 8 };

	io_generic_write(io, header, SIGNATURE, sizeof(header));
	
	int head = 0;
	int tracks_written = 0;

	for (int track = 0; track < 84; track++) {
		offs_t tpos = TRACK_OFFSET + track * 4;
		offs_t spos = SPEED_ZONE + track * 4;
		offs_t dpos = TRACK_DATA + tracks_written * TRACK_LENGTH;

		io_generic_write_filler(io, 0x00, tpos, 4);
		io_generic_write_filler(io, 0x00, spos, 4);

		if (image->get_track_size(track, head) <= 1)
			continue;

		UINT8 *trackbuf = global_alloc_array(UINT8, TRACK_LENGTH-2);
		int track_size;
		int speed_zone;

		// figure out the cell size and speed zone from the track data
		if ((speed_zone = generate_bitstream(track, head, 3, trackbuf, track_size, image)) == -1)
			if ((speed_zone = generate_bitstream(track, head, 2, trackbuf, track_size, image)) == -1)
				if ((speed_zone = generate_bitstream(track, head, 1, trackbuf, track_size, image)) == -1)
					if ((speed_zone = generate_bitstream(track, head, 0, trackbuf, track_size, image)) == -1)
						throw emu_fatalerror("g64_format: Cannot determine speed zone for track %u", track);

		LOG_FORMATS("track %u size %u cell %u\n", track, track_size, c1541_cell_size[speed_zone]);

		UINT8 track_offset[4];
		UINT8 speed_offset[4];
		UINT8 track_length[2];

		place_integer_le(track_offset, 0, 4, dpos);
		place_integer_le(speed_offset, 0, 4, speed_zone);
		place_integer_le(track_length, 0, 2, track_size/8);

		io_generic_write(io, track_offset, tpos, 4);
		io_generic_write(io, speed_offset, spos, 4);
		io_generic_write_filler(io, 0xff, dpos, TRACK_LENGTH);
		io_generic_write(io, track_length, dpos, 2);
		io_generic_write(io, trackbuf, dpos + 2, track_size);
		
		tracks_written++;

		global_free(trackbuf);
	}

	return true;
}
Пример #22
0
bool upd765_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
	int type = find_size(io, form_factor);
	if(type == -1)
		return false;

	// format shouldn't exceed image geometry
	const format &f = formats[type];
	int img_tracks, img_heads;
	image->get_maximal_geometry(img_tracks, img_heads);
	if (f.track_count > img_tracks || f.head_count > img_heads)
		return false;

	floppy_image_format_t::desc_e *desc;
	int current_size;
	int end_gap_index;

	switch (f.encoding)
	{
	case floppy_image::FM:
		desc = get_desc_fm(f, current_size, end_gap_index);
		break;
	case floppy_image::MFM:
	default:
		desc = get_desc_mfm(f, current_size, end_gap_index);
		break;
	}

	int total_size = 200000000/f.cell_size;
	int remaining_size = total_size - current_size;
	if(remaining_size < 0)
		throw emu_fatalerror("upd765_format: Incorrect track layout, max_size=%d, current_size=%d", total_size, current_size);

	// Fixup the end gap
	desc[end_gap_index].p2 = remaining_size / 16;
	desc[end_gap_index + 1].p2 = remaining_size & 15;
	desc[end_gap_index + 1].p1 >>= 16-(remaining_size & 15);

	int track_size = compute_track_size(f);

	uint8_t sectdata[40*512];
	desc_s sectors[40];

	for(int track=0; track < f.track_count; track++)
		for(int head=0; head < f.head_count; head++) {
			build_sector_description(f, sectdata, sectors, track, head);
			io_generic_read(io, sectdata, (track*f.head_count + head)*track_size, track_size);
			generate_track(desc, track, head, sectors, f.sector_count, total_size, image);
		}

	image->set_variant(f.variant);

	return true;
}
Пример #23
0
device_t *machine_config::device_find(device_t *owner, const char *tag)
{
	// find the original device by this name (must exist)
	assert(owner != NULL);
	device_t *device = owner->subdevice(tag);
	assert(device != NULL);
	if (device == NULL)
		throw emu_fatalerror("Unable to find device '%s'\n", tag);

	// return the device
	return device;
}
Пример #24
0
void goupil_g1_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_SCANLINE:
		m_ef9364->update_scanline((uint16_t)m_screen->vpos());
		m_scanline_timer->adjust(m_screen->time_until_pos(m_screen->vpos() + 10));
		break;
	default:
		throw emu_fatalerror("Unknown id in goupil_g1_state::device_timer");
	}
}
Пример #25
0
void device_sound_interface::static_add_route(device_t &device, UINT32 output, const char *target, double gain, UINT32 input)
{
	// find our sound interface
	device_sound_interface *sound;
	if (!device.dev_interface(sound))
		throw emu_fatalerror("MCFG_SOUND_ROUTE called on device '%s' with no sound interface", device.tag());

	// append a new route to the list
	astring devtag;
	device.siblingtag(devtag, target);
	sound->m_route_list.append(*global_alloc(sound_route(output, input, gain, core_strdup(devtag.cstr()))));
}
Пример #26
0
void sgi_keyboard_port_device::device_start()
{
	if (get_card_device() && !m_dev)
	{
		throw emu_fatalerror("Card device %s (%s) does not implement device_sgi_keyboard_port_interface\n", get_card_device()->tag(), get_card_device()->name());
	}

	save_item(NAME(m_rxd));

	m_rxd = 1;
	m_rxd_handler(m_rxd);
}
Пример #27
0
bool wd177x_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
	int type = find_size(io, form_factor);
	if(type == -1)
		return false;

	const format &f = formats[type];
	floppy_image_format_t::desc_e *desc;
	int current_size;
	int end_gap_index;

	switch (f.encoding)
	{
	case floppy_image::FM:
		desc = get_desc_fm(f, current_size, end_gap_index);
		break;
	case floppy_image::MFM:
	default:
		desc = get_desc_mfm(f, current_size, end_gap_index);
		break;
	}

	int total_size = 200000000/f.cell_size;
	int remaining_size = total_size - current_size;
	if(remaining_size < 0)
		throw emu_fatalerror("wd177x_format: Incorrect track layout, max_size=%d, current_size=%d", total_size, current_size);

	// Fixup the end gap
	desc[end_gap_index].p2 = remaining_size / 16;
	desc[end_gap_index + 1].p2 = remaining_size & 15;
	desc[end_gap_index + 1].p1 >>= 16-(remaining_size & 15);

	int track_size = compute_track_size(f);

	UINT8 sectdata[40*512];
	desc_s sectors[40];
	build_sector_description(f, sectdata, sectors);

	for(int track=0; track < f.track_count; track++)
		for(int head=0; head < f.head_count; head++) {
			if (f.encoding == floppy_image::FM)
				desc[14].p1 = get_track_dam_fm(f, head, track);
			else
				desc[16].p1 = get_track_dam_mfm(f, head, track);

			io_generic_read(io, sectdata, get_image_offset(f, head, track), track_size);
			generate_track(desc, track, head, sectors, f.sector_count, total_size, image);
		}

	image->set_variant(f.variant);

	return true;
}
Пример #28
0
	// timer callback; used to wrest control of the system
	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
	{
		static const UINT32 sample_instructions[] =
		{
			0x3d40f900,     // li r10,0xf9000000
			0x394af000,     // addi r10,r10,-0x1000
			0x38600146,     // li r3,0x00000146
			0x38800004,     // li r4,0x00000004
			0x7c64572c,     // sthbrx r3,r4,r10
			0x38600000,     // li r3,0x00000000
			0x986a0070      // stb r3,0x0070(r10)
		};

		// iterate over instructions
		for (int instnum = 0; instnum < ARRAY_LENGTH(sample_instructions); instnum++)
		{
			// write the instruction to execute, followed by a BLR which will terminate the
			// basic block in the DRC
			m_space->write_dword(RAM_BASE, sample_instructions[instnum]);
			m_space->write_dword(RAM_BASE + 4, 0x4e800020);

			// initialize the register state
			m_cpu->set_state_int(PPC_PC, RAM_BASE);
			for (int regnum = 0; regnum < 32; regnum++)
				m_cpu->set_state_int(PPC_R0 + regnum, regnum | (regnum << 8) | (regnum << 16) | (regnum << 24));
			m_cpu->set_state_int(PPC_CR, 0);
			m_cpu->set_state_int(PPC_LR, 0x12345678);
			m_cpu->set_state_int(PPC_CTR, 0x1000);
			m_cpu->set_state_int(PPC_XER, 0);
			for (int regnum = 0; regnum < 32; regnum++)
			{
				double value = double(regnum | (regnum << 8) | (regnum << 16) | (regnum << 24));
				m_cpu->set_state_int(PPC_F0 + regnum, d2u(value));
			}

			// output initial state
			printf("==================================================\n");
			printf("Initial state:\n");
			dump_state(true);

			// execute one instruction
			*m_cpu->m_icountptr = 0;
			m_cpu->run();

			// dump the final register state
			printf("Final state:\n");
			dump_state(false);
		}

		// all done; just bail
		throw emu_fatalerror(0, "All done");
	}
Пример #29
0
cheat_script::script_entry::output_argument::output_argument(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const &argnode)
	: m_expression(&symbols),
		m_count(0)
{
	// first extract attributes
	m_count = argnode.get_attribute_int("count", 1);

	// read the expression
	const char *expression = argnode.get_value();
	if (expression == nullptr || expression[0] == 0)
		throw emu_fatalerror("%s.xml(%d): missing expression in argument tag\n", filename, argnode.line);

	// parse it
	try
	{
		m_expression.parse(expression);
	}
	catch (expression_error &err)
	{
		throw emu_fatalerror("%s.xml(%d): error parsing cheat expression \"%s\" (%s)\n", filename, argnode.line, expression, err.code_string());
	}
}
Пример #30
0
void legacy_device_base::static_set_inline32(device_t &device, UINT32 offset, UINT32 size, UINT32 value)
{
	legacy_device_base &legacy = downcast<legacy_device_base &>(device);
	void *dest = reinterpret_cast<UINT8 *>(legacy.m_inline_config) + offset;
	if (size == 1)
		*reinterpret_cast<UINT8 *>(dest) = value;
	else if (size == 2)
		*reinterpret_cast<UINT16 *>(dest) = value;
	else if (size == 4)
		*reinterpret_cast<UINT32 *>(dest) = value;
	else
		throw emu_fatalerror("Unexpected size %d in legacy_device_base::static_set_inline32", size);
}