Beispiel #1
0
int main(int argc, char **argv) {

	argp_parse (&argp, argc, argv, 0, 0, 0);

	if (command.compare("controller") == 0) {
		handle_controller();
	}

	return 0;
}
void Control_socket_manager::handle_connection(int fd) {

	request_fd = fd;
	if (fd == listener) {
		handle_listener();
	} else {
		handle_controller();
	}

}
void capiconn_inject(unsigned applid, unsigned char *msg)
{
	capiconn_context *ctx = find_context(applid);

	if (!ctx)
		return;

	capi_message2cmsg(&s_cmsg, msg);
	if (s_cmsg.Command == CAPI_DATA_B3 && s_cmsg.Subcommand == CAPI_IND) {
		handle_data(ctx, &s_cmsg);
		ctx->nrecvdatapkt++;
		return;
	} 
	if ((s_cmsg.adr.adrController & 0xffffff00) == 0)
		handle_controller(ctx, &s_cmsg);
	else if ((s_cmsg.adr.adrPLCI & 0xffff0000) == 0)
		handle_plci(ctx, &s_cmsg);
	else
		handle_ncci(ctx, &s_cmsg);
	ctx->nrecvctlpkt++;
}
Beispiel #4
0
/* If main_cycle returns false, don't process more events! */
int main_cycle() {
	unsigned int key, kascii;
	struct vt_entry *v = &game.view_table[0];

	poll_timer();		/* msdos driver -> does nothing */
	update_timer();

	if (game.ver == 0) {
		_text->message_box("Warning: game CRC not listed, assuming AGI version 2.917.");
		game.ver = -1;
	}

	key = do_poll_keyboard();

	/* In AGI Mouse emulation mode we must update the mouse-related
	 * vars in every interpreter cycle.
	 */
	if (opt.agimouse) {
		game.vars[28] = mouse.x / 2;
		game.vars[29] = mouse.y;
	}

	if (key == KEY_PRIORITY) {
		_sprites->erase_both();
		debug_.priority = !debug_.priority;
		show_pic();
		_sprites->blit_both();
		_sprites->commit_both();
		key = 0;
	}

	if (key == KEY_STATUSLN) {
		debug_.statusline = !debug_.statusline;
		_text->write_status();
		key = 0;
	}

	/* Click-to-walk mouse interface */
	if (game.player_control && v->flags & ADJ_EGO_XY) {
		v->direction = get_direction(v->x_pos, v->y_pos, v->parm1, v->parm2, v->step_size);

		if (v->direction == 0)
			in_destination(v);
	}

	kascii = KEY_ASCII(key);

	if (kascii)
		setvar(V_key, kascii);
	process_key:
	switch (game.input_mode) {
	case INPUT_NORMAL:
		if (!handle_controller(key)) {
			if (key == 0 || !game.input_enabled)
				break;
			handle_keys(key);

			/* if ESC pressed, activate menu before
			 * accept.input from the interpreter cycle
			 * sets the input mode to normal again
			 * (closes: #540856)
			 */
			if (key == KEY_ESCAPE) {
				key = 0;
				goto process_key;
			}

			/* commented out to close bug #438872
			 * if (key) game.keypress = key;
			 */
		}
		break;
	case INPUT_GETSTRING:
		handle_controller(key);
		handle_getstring(key);
		setvar(V_key, 0);	/* clear ENTER key */
		break;
	case INPUT_MENU:
		menu->keyhandler(key);
		do_update();
		return false;
	case INPUT_NONE:
		handle_controller(key);
		if (key)
			game.keypress = key;
		break;
	}

	do_update();

	if (game.msg_box_ticks > 0)
		game.msg_box_ticks--;

	return true;
}