예제 #1
0
파일: output.cpp 프로젝트: ursine/mame
void output_set_value(const char *outname, INT32 value)
{
	output_item *item = find_item(outname);
	INT32 oldval;

	/* if no item of that name, create a new one and send the item's state */
	if (item == nullptr)
	{
		item = create_new_item(outname, value);
		oldval = value + 1;
	}

	else
	{
		/* set the new value */
		oldval = item->value;
		item->value = value;
	}

	/* if the value is different, signal the notifier */
	if (oldval != value)
	{
		/* call the local notifiers first */
		for (output_notify *notify = item->notifylist.first(); notify != nullptr; notify = notify->next())
			(*notify->m_notifier)(outname, value, notify->m_param);

		/* call the global notifiers next */
		for (output_notify *notify = global_notifylist.first(); notify != nullptr; notify = notify->next())
			(*notify->m_notifier)(outname, value, notify->m_param);
	}
}
예제 #2
0
파일: output.cpp 프로젝트: ursine/mame
void output_init(running_machine &machine)
{
	/* add pause callback */
	machine.add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(FUNC(output_pause), &machine));
	machine.add_notifier(MACHINE_NOTIFY_RESUME, machine_notify_delegate(FUNC(output_resume), &machine));

	/* get a callback when done */
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(output_exit), &machine));

	/* reset the lists */
	memset(itemtable, 0, sizeof(itemtable));
	global_notifylist.reset();
}
예제 #3
0
파일: output.cpp 프로젝트: ursine/mame
void output_set_notifier(const char *outname, output_notifier_func callback, void *param)
{
	/* if an item is specified, find it */
	if (outname != nullptr)
	{
		output_item *item = find_item(outname);

		/* if no item of that name, create a new one */
		if (item == nullptr)
			item = create_new_item(outname, 0);
		item->notifylist.append(*global_alloc(output_notify(callback, param)));
	}
	else
		global_notifylist.append(*global_alloc(output_notify(callback, param)));
}
예제 #4
0
파일: output.cpp 프로젝트: ursine/mame
static void output_exit(running_machine &machine)
{
	output_item *item;
	int hash;

	/* remove all items */
	for (hash = 0; hash < HASH_SIZE; hash++)
		for (item = itemtable[hash]; item != nullptr; )
		{
			output_item *next = item->next;

			/* free the name and the item */
			global_free(item);
			item = next;
		}

	/* remove all global notifiers */
	global_notifylist.reset();
}
예제 #5
0
void sdl_osd_interface::customize_input_type_list(simple_list<input_type_entry> &typelist)
{
	input_item_id mameid_code;
	input_code ui_code;
	input_type_entry *entry;
	const char* uimode;
	char fullmode[64];

	// loop over the defaults
	for (entry = typelist.first(); entry != NULL; entry = entry->next())
	{
		switch (entry->type())
		{
			// configurable UI mode switch
		case IPT_UI_TOGGLE_UI:
			uimode = options().ui_mode_key();
			if (!strcmp(uimode, "auto"))
			{
#if defined(__APPLE__) && defined(__MACH__)
				mameid_code = keyboard_trans_table::instance().lookup_mame_code("ITEM_ID_INSERT");
#else
				mameid_code = keyboard_trans_table::instance().lookup_mame_code("ITEM_ID_SCRLOCK");
#endif
			}
			else
			{
				snprintf(fullmode, 63, "ITEM_ID_%s", uimode);
				mameid_code = keyboard_trans_table::instance().lookup_mame_code(fullmode);
			}
			ui_code = input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, input_item_id(mameid_code));
			entry->defseq(SEQ_TYPE_STANDARD).set(ui_code);
			break;
			// alt-enter for fullscreen
		case IPT_OSD_1:
			entry->configure_osd("TOGGLE_FULLSCREEN", "Toggle Fullscreen");
			entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_ENTER, KEYCODE_LALT);
			break;

			// disable UI_SELECT when LALT is down, this stops selecting
			// things in the menu when toggling fullscreen with LALT+ENTER
			/*          case IPT_UI_SELECT:
			entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_ENTER, input_seq::not_code, KEYCODE_LALT);
			break;*/

			// page down for fastforward (must be OSD_3 as per src/emu/ui.c)
		case IPT_UI_FAST_FORWARD:
			entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_PGDN);
			break;

			// OSD hotkeys use LCTRL and start at F3, they start at
			// F3 because F1-F2 are hardcoded into many drivers to
			// various dipswitches, and pressing them together with
			// LCTRL will still press/toggle these dipswitches.

			// LCTRL-F3 to toggle fullstretch
		case IPT_OSD_2:
			entry->configure_osd("TOGGLE_FULLSTRETCH", "Toggle Uneven stretch");
			entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F3, KEYCODE_LCONTROL);
			break;
			// add a Not lcrtl condition to the reset key
		case IPT_UI_SOFT_RESET:
			entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F3, input_seq::not_code, KEYCODE_LCONTROL, input_seq::not_code, KEYCODE_LSHIFT);
			break;

			// LCTRL-F4 to toggle keep aspect
		case IPT_OSD_4:
			entry->configure_osd("TOGGLE_KEEP_ASPECT", "Toggle Keepaspect");
			entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F4, KEYCODE_LCONTROL);
			break;
			// add a Not lcrtl condition to the show gfx key
		case IPT_UI_SHOW_GFX:
			entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F4, input_seq::not_code, KEYCODE_LCONTROL);
			break;

			// LCTRL-F5 to toggle OpenGL filtering
		case IPT_OSD_5:
			entry->configure_osd("TOGGLE_FILTER", "Toggle Filter");
			entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F5, KEYCODE_LCONTROL);
			break;
			// add a Not lcrtl condition to the toggle debug key
		case IPT_UI_TOGGLE_DEBUG:
			entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F5, input_seq::not_code, KEYCODE_LCONTROL);
			break;

			// LCTRL-F6 to decrease OpenGL prescaling
		case IPT_OSD_6:
			entry->configure_osd("DECREASE_PRESCALE", "Decrease Prescaling");
			entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F6, KEYCODE_LCONTROL);
			break;
			// add a Not lcrtl condition to the toggle cheat key
		case IPT_UI_TOGGLE_CHEAT:
			entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F6, input_seq::not_code, KEYCODE_LCONTROL);
			break;

			// LCTRL-F7 to increase OpenGL prescaling
		case IPT_OSD_7:
			entry->configure_osd("INCREASE_PRESCALE", "Increase Prescaling");
			entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F7, KEYCODE_LCONTROL);
			break;
			// add a Not lcrtl condition to the load state key
		case IPT_UI_LOAD_STATE:
			entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F7, input_seq::not_code, KEYCODE_LCONTROL, input_seq::not_code, KEYCODE_LSHIFT);
			break;

			// add a Not lcrtl condition to the throttle key
		case IPT_UI_THROTTLE:
			entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F10, input_seq::not_code, KEYCODE_LCONTROL);
			break;

			// disable the config menu if the ALT key is down
			// (allows ALT-TAB to switch between apps)
		case IPT_UI_CONFIGURE:
			entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_TAB, input_seq::not_code, KEYCODE_LALT, input_seq::not_code, KEYCODE_RALT);
			break;

			// leave everything else alone
		default:
			break;
		}
	}
}