示例#1
0
/**
 * Debounce any PC key held down if running with key repeat disabled.
 * This is called each ST frame, so keys get held down for one VBL which
 * is enough for 68000 code to scan.
 */
void Keymap_DebounceAllKeys(void)
{
	uint8_t nScanCode;

	/* Return if we aren't in fast forward or have not disabled key repeat */
	if ((ConfigureParams.System.bFastForward == false)
	        || (!ConfigureParams.Keyboard.bDisableKeyRepeat))
	{
		return;
	}

	/* Now run through each key looking for ones held down */
	for (nScanCode = 1; nScanCode <= KBD_MAX_SCANCODE; nScanCode++)
	{
		/* Is key held? */
		if (Keyboard.KeyStates[nScanCode])
		{
			/* Does this require de-bouncing? */
			if (Keymap_DebounceSTKey(nScanCode))
			{
				IKBD_PressSTKey(nScanCode, false);
				Keyboard.KeyStates[nScanCode] = false;
			}
		}
	}

}
示例#2
0
/**
 * Debounce any PC key held down if running with key repeat disabled.
 * This is called each ST frame, so keys get held down for one VBL which
 * is enough for 68000 code to scan.
 */
void Keymap_DebounceAllKeys(void)
{
	SDLKey key;
	char STScanCode;
	SDL_keysym tmpKeySym;

	/* Return if we aren't in fast forward or have not disabled key repeat */
	if ((ConfigureParams.System.bFastForward == false)
	        || (!ConfigureParams.Keyboard.bDisableKeyRepeat))
	{
		return;
	}

	tmpKeySym.mod = KMOD_NONE;

	/* Now run through each PC key looking for ones held down */
	for (key = SDLK_FIRST; key < SDLK_LAST; key++)
	{
		/* Is key held? */
		if (Keyboard.KeyStates[key])
		{
			tmpKeySym.sym = key;
			tmpKeySym.scancode = 0;

			/* Get scan code */
			STScanCode = Keymap_RemapKeyToSTScanCode(&tmpKeySym);
			if (STScanCode != (char)-1)
			{
				/* Does this require de-bouncing? */
				if (Keymap_DebounceSTKey(STScanCode))
					Keymap_KeyUp(&tmpKeySym);
			}
		}
	}

}