Beispiel #1
0
machine_info::machine_info(running_machine &machine)
	: m_machine(machine)
{
	// calculate "has..." values
	m_has_configs = false;
	m_has_analog = false;
	m_has_dips = false;
	m_has_bioses = false;

	// scan the input port array to see what options we need to enable
	for (auto &port : machine.ioport().ports())
		for (ioport_field &field : port.second->fields())
		{
			if (field.type() == IPT_DIPSWITCH)
				m_has_dips = true;
			if (field.type() == IPT_CONFIG)
				m_has_configs = true;
			if (field.is_analog())
				m_has_analog = true;
		}

	for (device_t &device : device_iterator(machine.root_device()))
		for (const rom_entry &rom : device.rom_region_vector())
			if (ROMENTRY_ISSYSTEM_BIOS(&rom)) { m_has_bioses = true; break; }
}
Beispiel #2
0
void ui_input_frame_update(running_machine &machine)
{
    ui_input_private *uidata = machine.ui_input_data;

    /* update the state of all the UI keys */
    for (ioport_type code = ioport_type(IPT_UI_FIRST + 1); code < IPT_UI_LAST; ++code)
    {
        bool pressed = machine.ioport().type_pressed(code);
        if (!pressed || uidata->seqpressed[code] != SEQ_PRESSED_RESET)
            uidata->seqpressed[code] = pressed;
    }
}
Beispiel #3
0
void crosshair_init(running_machine &machine)
{
	/* request a callback upon exiting */
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(crosshair_exit), &machine));

	/* clear all the globals */
	memset(&global, 0, sizeof(global));

	/* setup the default auto visibility time */
	global.auto_time = CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT;

	/* determine who needs crosshairs */
	for (ioport_port *port = machine.ioport().first_port(); port != NULL; port = port->next())
		for (ioport_field *field = port->first_field(); field != NULL; field = field->next())
			if (field->crosshair_axis() != CROSSHAIR_AXIS_NONE)
			{
				int player = field->player();

				assert(player < MAX_PLAYERS);

				/* mark as used and set the default visibility and mode */
				global.usage = TRUE;
				global.used[player] = TRUE;
				global.mode[player] = CROSSHAIR_VISIBILITY_DEFAULT;
				global.visible[player] = (CROSSHAIR_VISIBILITY_DEFAULT == CROSSHAIR_VISIBILITY_OFF) ? FALSE : TRUE;

				/* for now, use the main screen */
				global.screen[player] = machine.primary_screen;

				create_bitmap(machine, player);
			}

	/* register callbacks for when we load/save configurations */
	if (global.usage)
		config_register(machine, "crosshairs", config_saveload_delegate(FUNC(crosshair_load), &machine), config_saveload_delegate(FUNC(crosshair_save), &machine));

	/* register the animation callback */
	if (machine.primary_screen != NULL)
		machine.primary_screen->register_vblank_callback(vblank_state_delegate(FUNC(animate), &machine));
}
Beispiel #4
0
crosshair_manager::crosshair_manager(running_machine &machine)
	: m_machine(machine)
{
	/* request a callback upon exiting */
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(crosshair_manager::exit), this));

	/* setup the default auto visibility time */
	m_auto_time = CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT;

	/* determine who needs crosshairs */
	for (auto &port : machine.ioport().ports())
		for (ioport_field &field : port.second->fields())
			if (field.crosshair_axis() != CROSSHAIR_AXIS_NONE)
			{
				int player = field.player();

				assert(player < MAX_PLAYERS);

				/* mark as used and set the default visibility and mode */
				m_usage = TRUE;
				m_used[player] = TRUE;
				m_mode[player] = CROSSHAIR_VISIBILITY_DEFAULT;
				m_visible[player] = (CROSSHAIR_VISIBILITY_DEFAULT == CROSSHAIR_VISIBILITY_OFF) ? FALSE : TRUE;

				/* for now, use the main screen */
				m_screen[player] = machine.first_screen();

				create_bitmap(player);
			}

	/* register callbacks for when we load/save configurations */
	if (m_usage)
		machine.configuration().config_register("crosshairs", config_saveload_delegate(FUNC(crosshair_manager::config_load), this), config_saveload_delegate(FUNC(crosshair_manager::config_save), this));

	/* register the animation callback */
	if (machine.first_screen() != nullptr)
		machine.first_screen()->register_vblank_callback(vblank_state_delegate(FUNC(crosshair_manager::animate), this));
}
Beispiel #5
0
crosshair_manager::crosshair_manager(running_machine &machine)
	: m_machine(machine)
	, m_usage(false)
	, m_animation_counter(0)
	, m_auto_time(CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT)
{
	/* request a callback upon exiting */
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&crosshair_manager::exit, this));

	for (int player = 0; player < MAX_PLAYERS; player++)
		m_crosshair[player] = std::make_unique<render_crosshair>(machine, player);

	/* determine who needs crosshairs */
	for (auto &port : machine.ioport().ports())
		for (ioport_field &field : port.second->fields())
			if (field.crosshair_axis() != CROSSHAIR_AXIS_NONE)
			{
				int player = field.player();

				assert(player < MAX_PLAYERS);

				/* mark as used and set the default visibility and mode */
				m_usage = true;
				m_crosshair[player]->set_used(true);
				m_crosshair[player]->set_mode(CROSSHAIR_VISIBILITY_DEFAULT);
				m_crosshair[player]->set_visible(CROSSHAIR_VISIBILITY_DEFAULT != CROSSHAIR_VISIBILITY_OFF);
				m_crosshair[player]->set_default_bitmap();
			}

	/* register callbacks for when we load/save configurations */
	if (m_usage)
		machine.configuration().config_register("crosshairs", config_saveload_delegate(&crosshair_manager::config_load, this), config_saveload_delegate(&crosshair_manager::config_save, this));

	/* register the animation callback */
	if (machine.first_screen() != nullptr)
		machine.first_screen()->register_vblank_callback(vblank_state_delegate(&crosshair_manager::animate, this));
}