Example #1
0
void ShortLocater::customEvent(QEvent *e){
    qDebug()<<"SL Custom Event";
    if(e->type() == ((QEvent::Type)1234)){
        qDebug()<<"Embedded Probe";
        ProbeFunction();
    }
    if(e->type() == ((QEvent::Type)5678)){
        qDebug()<<"PT Keypad:-"<<m_nPTKeyCode;
        KeyFunction();
    }
    else
        qDebug()<<"Unknown Event";
    QEvent(e->type());
}
Example #2
0
	Yep32u _yepLibrary_ProbeInstruction(Yep32u (*ProbeFunction)()) {
		struct kernel_sigaction oldSigillAction;
		struct kernel_sigaction probeSigillAction;
		memset(&probeSigillAction, 0, sizeof(probeSigillAction));
		probeSigillAction.sa_sigaction = &_yepLibrary_ProbeSignalHandler;
		// Needs Linux >= 2.2
		probeSigillAction.sa_flags = SA_ONSTACK | SA_RESTART | SA_SIGINFO;
		int sigactionResult = yepSyscall_rt_sigaction(SIGILL, &probeSigillAction, &oldSigillAction, KERNEL_NSIG / 8);
		if (sigactionResult == 0) {
			const Yep32u probeResult = ProbeFunction();
			yepSyscall_rt_sigaction(SIGILL, &oldSigillAction, NULL, KERNEL_NSIG / 8);
			return probeResult;
		} else {
			return 2;
		}
	}
static void
ProbeInfo (RESPONSE_REF R)
{
	BYTE i, LastStack, InfoLeft;
	RESPONSE_REF pStr[3];

	LastStack = 0;
	pStr[0] = pStr[1] = pStr[2] = 0;
	if (PLAYER_SAID (R, what_are_probes))
	{
		NPCPhrase (PROBES_ARE);

		SET_GAME_STATE (SLYLANDRO_STACK5, 1);
	}
	else if (PLAYER_SAID (R, know_more_probe))
		NPCPhrase (OK_WHAT_MORE_PROBE);
	else if (PLAYER_SAID (R, why_probe_always_attack))
	{
		NPCPhrase (ONLY_DEFEND);

		SET_GAME_STATE (SLYLANDRO_STACK6, 1);
	}
	else if (PLAYER_SAID (R, talk_more_probe_attack))
	{
		ProbeFunction (R);
		return;
	}
	else if (PLAYER_SAID (R, where_probes_from))
	{
		NPCPhrase (PROBES_FROM_MELNORME);

		LastStack = 1;
		SET_GAME_STATE (SLYLANDRO_STACK7, 1);
	}
	else if (PLAYER_SAID (R, why_sell))
	{
		NPCPhrase (SELL_FOR_INFO);

		LastStack = 1;
		SET_GAME_STATE (SLYLANDRO_STACK7, 2);
	}
	else if (PLAYER_SAID (R, how_long_ago))
	{
		NPCPhrase (FIFTY_THOUSAND_ROTATIONS);

		SET_GAME_STATE (SLYLANDRO_STACK7, 3);
	}
	else if (PLAYER_SAID (R, whats_probes_mission))
	{
		NPCPhrase (SEEK_OUT_NEW_LIFE);

		LastStack = 2;
		SET_GAME_STATE (SLYLANDRO_STACK8, 1);
	}
	else if (PLAYER_SAID (R, if_only_one))
	{
		NPCPhrase (THEY_REPLICATE);

		SET_GAME_STATE (SLYLANDRO_STACK8, 2);
	}
	else if (PLAYER_SAID (R, enough_problem))
		NPCPhrase (OK_ENOUGH_PROBLEM);

	if (!GET_GAME_STATE (SLYLANDRO_KNOW_BROKEN)
			&& GET_GAME_STATE (PROBE_EXHIBITED_BUG))
	{
		switch (GET_GAME_STATE (SLYLANDRO_STACK6))
		{
			case 0:
				pStr[0] = why_probe_always_attack;
				break;
			case 1:
				pStr[0] = talk_more_probe_attack;
				break;
		}
	}
	switch (GET_GAME_STATE (SLYLANDRO_STACK7))
	{
		case 0:
			pStr[1] = where_probes_from;
			break;
		case 1:
			pStr[1] = why_sell;
			break;
		case 2:
			pStr[1] = how_long_ago;
			break;
	}
	switch (GET_GAME_STATE (SLYLANDRO_STACK8))
	{
		case 0:
			pStr[2] = whats_probes_mission;
			break;
		case 1:
			pStr[2] = if_only_one;
			break;
	}

	InfoLeft = FALSE;
	if (pStr[LastStack])
	{
		InfoLeft = TRUE;
		Response (pStr[LastStack], ProbeInfo);
	}
	for (i = 0; i < 3; ++i)
	{
		if (i != LastStack && pStr[i])
		{
			InfoLeft = TRUE;
			Response (pStr[i], ProbeInfo);
		}
	}

	Response (enough_probe, HomeWorld);
	if (!InfoLeft)
	{
		DISABLE_PHRASE (know_more_probe);
	}
}