Пример #1
0
void input_menu()
{
	thread_lockinputmutex();

	input_reset();
	input_update();

	thread_unlockinputmutex();
}
Пример #2
0
void neogeo_reset(void)
{
	timer_reset();
	input_reset();

	neogeo_driver_reset();
	neogeo_video_reset();

	sound_reset();
	blit_clear_all_sprite();	

	Loop = LOOP_EXEC;
}
Пример #3
0
void input_init(Input *input, Window *window, float x, float y, float z, float h_angle, float v_angle)
{
	input->window = window;
	input->stable = 0;
	input->lastTime = 0;
	input->speed = 0.1f;
	input->x = x;
	input->y = y;
	input->z = z;
	input->h_angle = h_angle;
	input->v_angle = v_angle;

	input_reset(input);
}
Пример #4
0
enum cmd_retval
cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq)
{
	struct args		*args = self->args;
	struct mouse_event	*m = &cmdq->item->mouse;
	struct window_pane	*wp;
	struct session		*s;
	const char		*str;
	int			 i, key;

	if (args_has(args, 'M')) {
		wp = cmd_mouse_pane(m, &s, NULL);
		if (wp == NULL) {
			cmdq_error(cmdq, "no mouse target");
			return (CMD_RETURN_ERROR);
		}
		window_pane_key(wp, NULL, s, m->key, m);
		return (CMD_RETURN_NORMAL);
	}

	if (cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp) == NULL)
		return (CMD_RETURN_ERROR);

	if (self->entry == &cmd_send_prefix_entry) {
		if (args_has(args, '2'))
			key = options_get_number(&s->options, "prefix2");
		else
			key = options_get_number(&s->options, "prefix");
		window_pane_key(wp, NULL, s, key, NULL);
		return (CMD_RETURN_NORMAL);
	}

	if (args_has(args, 'R'))
		input_reset(wp);

	for (i = 0; i < args->argc; i++) {
		str = args->argv[i];

		if (!args_has(args, 'l') &&
		    (key = key_string_lookup_string(str)) != KEYC_NONE) {
			window_pane_key(wp, NULL, s, key, NULL);
		} else {
			for (; *str != '\0'; str++)
				window_pane_key(wp, NULL, s, *str, NULL);
		}
	}

	return (CMD_RETURN_NORMAL);
}
Пример #5
0
static int neogeo_init(void)
{
	video_set_mode(16);

	memset(memory_region_cpu1, 0, 0x200000);
	memset(memory_region_cpu2, 0, 0x10000);

	neogeo_driver_init();
	neogeo_video_init();
	input_reset();

	cpu_reset_flag = 0;

	swab(startup_bin, memory_region_cpu1 + 0x10f300, 0xd00);
	m68000_write_memory_32(0x120002, 0xffffffff);
	m68000_write_memory_32(0x11c808, 0xc0c760);	// load screen setup function
	m68000_write_memory_32(0x11c80c, 0xc0c814);	// load screen progress function
	m68000_write_memory_32(0x11c810, 0xc190e2);	// load screen default anime data

	if (!neogeo_boot_bios)
	{
		neogeo_driver_reset();
		neogeo_video_reset();

		if (!cdrom_process_ipl())
		{
			if (!fatal_error)
			{
				fatalerror(TEXT(ERROR_WHILE_PROCESSING_IPL_TXT));
			}
			return 0;
		}

		if (NGH_NUMBER(0x0085))
		{
			UINT16 *mem16 = (UINT16 *)memory_region_cpu1;

			mem16[0x132020 >> 1] = 0x4ef9;
			mem16[0x132022 >> 1] = 0x00c0;
			mem16[0x132024 >> 1] = 0xdb60;

			mem16[0x132026 >> 1] = 0x4ef9;
			mem16[0x132028 >> 1] = 0x00c0;
			mem16[0x13202a >> 1] = 0xdb6a;
		}
Пример #6
0
Файл: mvs.c Проект: AMSMM/NJEMU
static void neogeo_reset(void)
{
	video_set_mode(16);

	video_clear_screen();

	timer_reset();
	input_reset();

	neogeo_driver_reset();
	neogeo_video_reset();

	sound_reset();
	blit_clear_all_sprite();
	autoframeskip_reset();

	Loop = LOOP_EXEC;
}
Пример #7
0
void io_reset(void)
{
  /* Reset I/O registers */
  io_reg[0x00] = region_code | 0x20 | (config.tmss & 1);
  io_reg[0x01] = 0x00;
  io_reg[0x02] = 0x00;
  io_reg[0x03] = 0x00;
  io_reg[0x04] = 0x00;
  io_reg[0x05] = 0x00;
  io_reg[0x06] = 0x00;
  io_reg[0x07] = 0xFF;
  io_reg[0x08] = 0x00;
  io_reg[0x09] = 0x00;
  io_reg[0x0A] = 0xFF;
  io_reg[0x0B] = 0x00;
  io_reg[0x0C] = 0x00;
  io_reg[0x0D] = 0xFB;
  io_reg[0x0E] = 0x00;
  io_reg[0x0F] = 0x00;
  
  /* Reset connected input devices */
  input_reset();
}
Пример #8
0
void input_get_data(Input *input, Vec3 *position, Vec3 *direction, Vec3 *right)
{
	Window *window = input->window;
	double xpos, ypos;
	double currentTime = glfwGetTime();
	double delta = (float)currentTime - input->lastTime;
	input->lastTime = currentTime;

	glfwGetCursorPos(window->handle, &xpos, &ypos);
	input_reset(input);

	int h_diff = window->width/2 - (int)xpos;
	int v_diff = window->height/2 - (int)ypos;

	if(!input->stable) {
		if(
			h_diff < 0.001 && h_diff > -0.001 &&
			v_diff < 0.001 && v_diff > -0.001
		) {
			input->stable = 1;
		} else {
			h_diff = 0;
			v_diff = 0;
		}
	}

	float dh_angle = input->speed * delta * (float)h_diff;
	float dv_angle = -input->speed * delta * (float)v_diff;
	
	input->h_angle += dh_angle;
	input->v_angle += dv_angle;

	(*direction)[0] = cos(input->v_angle) * sin(input->h_angle);
	(*direction)[1] = sin(input->v_angle);
	(*direction)[2] = cos(input->v_angle) * cos(input->h_angle);

	(*right)[0] = sin(input->h_angle - 3.14f/2.0f);
	(*right)[1] = 0;
	(*right)[2] = cos(input->h_angle - 3.14f/2.0f);

	float speed = input->speed*10;

	if (glfwGetKey(window->handle, GLFW_KEY_UP) == GLFW_PRESS){
		input->x += (*direction)[0] * delta * speed;
		input->y += (*direction)[1] * delta * speed;
		input->z += (*direction)[2] * delta * speed;
	}
	if (glfwGetKey(window->handle, GLFW_KEY_DOWN) == GLFW_PRESS){
		input->x -= (*direction)[0] * delta * speed;
		input->y -= (*direction)[1] * delta * speed;
		input->z -= (*direction)[2] * delta * speed;
	}
	if (glfwGetKey(window->handle, GLFW_KEY_RIGHT) == GLFW_PRESS){
		input->x -= (*right)[0] * delta * speed;
		input->y -= (*right)[1] * delta * speed;
		input->z -= (*right)[2] * delta * speed;
	}
	if (glfwGetKey(window->handle, GLFW_KEY_LEFT) == GLFW_PRESS){
		input->x += (*right)[0] * delta * speed;
		input->y += (*right)[1] * delta * speed;
		input->z += (*right)[2] * delta * speed;
	}

	(*position)[0] = input->x;
	(*position)[1] = input->y;
	(*position)[2] = input->z;

}
Пример #9
0
gint snoop()
{
	switch(in_state)
	{
	case STATE_CMD:
		if((cmd_in_cnt < 3 && cmd_in_cnt > 0 && cmd_in_need) || cmd_in_cnt == 0)
		{
			/*
			  modifiers set here
			*/

			cmd_in_buf[cmd_in_cnt].keyval = key_event->keyval;
			cmd_in_buf[cmd_in_cnt].keyval_type = KT_SINGLE;

			int found;
			found = shortcut_find(cmd_in_buf);

			cmd_in_cnt++;

			if(found >= 0)
			{
				/* this is not parameter */
				if(!cmd_current)
				{
					/* function does not have any parameters */
					if(commands[found]->param_type==PT_NONE)
					{
						func_call(commands[found],cmd_repeat_cnt,NULL);
					}
					/* this cmd is parameter for function */
					else
					{
						in_state = commands[found]->param_type;
						cmd_current = commands[found];
					}
				}
				/* this is a parameter */
				else
				{
					cmd_param_data = malloc(sizeof(emacs_keybinding));
					*cmd_param_data = commands[found];

					func_call(commands[found],cmd_repeat_cnt,cmd_param_data);
				}

				input_reset();
				return TRUE;
			}
			else if(found == -2) //maybe found
			{
				cmd_in_need = TRUE;
				return TRUE;
			}
			else if(found == -1) //not found
			{
				input_reset();
				return FALSE;
			}
		}//if(cmd_in_cmd < 3 && ...
		break;

	case STATE_KEY:
		emacs_hotkey cur_key;
		cur_key.keyval = event->keyval;
		//k.alt = ...
		/* modifiers set here */

		cmd_param_data = malloc(sizeof(emacs_hotkey));
		*cmd_param_data = cur_key;

		func_call(cmd_current,cmd_repeat_cnt,cmd_param_data);
		input_reset();
		break;

	case STATE_INT:
		if(!cmd_param_data)
		{
			cmd_param_data = malloc(sizeof(int));
			*cmd_param_data = 0;
		}

		param_in_cnt++;

		gint data = *cmd_param_data;
		data  = keyval2int(event->keyval)*pow(param_in_cnt,10) + data;
		*cmd_param_data = data;

		break;
	case STATE_STR:
		if(!cmd_param_data)
		{
			cmd_param_data  = malloc(sizeof(gchar)*PARAM_STR_MAX);
		}

		param_in_cnt++;

		gchar data = cmd_param_data[param_in_cnt];
		data = keyval2char(event->keyval);
		cmd_param_data[param_in_cnt];
		break;

	}
}
Пример #10
0
inputdatabattle input_battle() // Runs during battle gamephase
{
	// Temp Variables
	inputdatabattle d;
	static int lastcx;
	static int lastcy;

	// Lock Mutex
	thread_lockinputmutex();

	// Update Input Variables
	input_update();


	// Booleans
	d.forward = in_keyhold[SDLK_w];
	d.back = in_keyhold[SDLK_s];
	d.left = in_keyhold[SDLK_a];
	d.right = in_keyhold[SDLK_d];
	d.up = in_keyhold[SDLK_SPACE];
	d.down = in_keyhold[SDLK_c];
	d.triggerpress = in_leftmousepress;
	d.triggerhold = in_leftmousehold;

	// Weapon Change
	d.gunchange = -1;
	if(in_keypress[SDLK_5]) d.gunchange = 4;
	if(in_keypress[SDLK_4]) d.gunchange = 3;
	if(in_keypress[SDLK_3]) d.gunchange = 2;
	if(in_keypress[SDLK_2]) d.gunchange = 1;
	if(in_keypress[SDLK_1]) d.gunchange = 0;

	// Ammo Change
	d.ammochange = in_deltamousewheel;

	// Cam/chasis Rotate
	//if(in_keyhold[SDLK_f])
	if(in_rightmousehold)
	{
		// dx/y : percentage of a half windowsquare that the mouse has moved
		intv dx = (in_cursorx-lastcx)*UPM/(g_windowsquare/2);
		intv dy = (in_cursory-lastcy)*UPM/(g_windowsquare/2);
		d.rotatex=VMV(VMV(2*UMV(dx,g_viewangletangent),-PI2),ROTATEMOD);
		d.rotatey=VMV(VMV(2*UMV(dy,g_viewangletangent),-PI2),ROTATEMOD);
	}
	else
	{
		d.rotatex = 0;
		d.rotatey = 0;
	}

	// Aim Vector (in relation to cam/chasis)
	d.aimx = (in_cursorx-g_windowwidth/2)*UPM/(g_windowsquare/2);
	d.aimy = (g_windowheight/2-in_cursory)*UPM/(g_windowsquare/2);
	d.aimz = 1*UPM;
	d.aimlx = (lastcx-g_windowwidth/2)*UPM/(g_windowsquare/2);
	d.aimly = (g_windowheight/2-lastcy)*UPM/(g_windowsquare/2);

	lastcx = in_cursorx;
	lastcy = in_cursory;

	// Test
	d.testpress = in_keypress[SDLK_t];
	d.testpress2 = in_keypress[SDLK_y];
	if(d.testpress2) DEBUGON^=1;

	// Reset Press Variables
	input_reset();

	// Unlock Mutex
	thread_unlockinputmutex();


	return d;
}