Пример #1
0
int kernel_main() {
    graphics_init();
    console_init();

    console_printf("video: %d x %d\n", video_xres, video_yres, video_xbytes);
    console_printf("kernel: %d bytes\n", kernel_size);

    memory_init();
    interrupt_init();
    rtc_init();
    clock_init();
    keyboard_init();

    /*
    process_init() is a big step.  This initializes the process table, but also gives us our own process structure, private stack, and enables paging.  Now we can do complex things like wait upon events.
    */
    process_init();

    mouse_init();
    ata_init();

    console_printf("\nNUNYA READY:\n");

    cmd_line_init();

    while(1) {
        cmd_line_show_prompt();
        cmd_line_attempt(keyboard_read_str());
    }

    return 0;
}
Пример #2
0
int main()
{


  char temp = 0;
  long temp2 = 0;
  printf("This program will display raw mouse codes.\n");
  printf("To exit hit the left mouse button.\n\n");
  printf("Grabbing mouse interrupt...\n");
  mouse_init();

  do{
  do {} while (temp==raw_code);   /*Isn't this weird! Raw_code doesn't get assigned
			by main or any function of main!  */

  temp2=(long)raw_code;
  //temp2 &= 0xFF;
  temp2 &= 0xFF;
  cprintf ("%2X",temp2);
  cprintf ("  ");

  temp = raw_code;
  }
  while (temp != 0x09);     /*left mouse button*/
    

  mouse_delete();
  printf ("\nWe have released the mouse interrupt.\n");
  printf ("Strike any key to quit.\n");
  getkey(); 

  return 0;
}
Пример #3
0
/* ×Ö·ûÉ豸³õʼ»¯ */
long chr_dev_init(long mem_start, long mem_end)
{
	if (register_chrdev(MEM_MAJOR,"mem",&memory_fops))
		printk("unable to get major %d for memory devs\n", MEM_MAJOR);
	mem_start = tty_init(mem_start);
#ifdef CONFIG_PRINTER
	mem_start = lp_init(mem_start);
#endif
#if defined (CONFIG_BUSMOUSE) || defined (CONFIG_82C710_MOUSE) || \
    defined (CONFIG_PSMOUSE) || defined (CONFIG_MS_BUSMOUSE) || \
    defined (CONFIG_ATIXL_BUSMOUSE)
	mem_start = mouse_init(mem_start);
#endif
#ifdef CONFIG_SOUND
	mem_start = soundcard_init(mem_start);
#endif
#if CONFIG_TAPE_QIC02
	mem_start = tape_qic02_init(mem_start);
#endif
/*
 *      Rude way to allocate kernel memory buffer for tape device
 */
#ifdef CONFIG_FTAPE
        /* allocate NR_FTAPE_BUFFERS 32Kb buffers at aligned address */
        ftape_big_buffer= (char*) ((mem_start + 0x7fff) & ~0x7fff);
        printk( "ftape: allocated %d buffers alligned at: %p\n",
               NR_FTAPE_BUFFERS, ftape_big_buffer);
        mem_start = (long) ftape_big_buffer + NR_FTAPE_BUFFERS * 0x8000;
#endif 
	return mem_start;
}
Пример #4
0
void term_reinit(int wait)             /* fixup after running other progs */
{
   struct text_info dat;

   gppconio_init();
   gettextinfo(&dat);

   if (dat.screenheight != screen_h) {
      _set_screen_lines(screen_h);
      gettextinfo(&dat);
      screen_h = dat.screenheight;
      screen_w = dat.screenwidth;
      mouse_init();
   }

   set_bright_backgrounds();

   if (wait) {
      clear_keybuf();
      gch();
   }

   __djgpp_set_ctrl_c(0);
   setcbrk(0);
}
Пример #5
0
Файл: wgl.c Проект: paud/d2x-xl
int wgl_game_activate(int active,int min){
	int i=0;//do_game_activate(active,min);
	if (!gameStates.ogl.bInitialized) return -1;
	//	printf("****** wgl_game_activate: %i %i,%i %i *******\n",GLPREF_windowed,active,min,vid_susp);
	if (!active){
		mouse_close();
		if (!GLPREF_windowed)
			if (!vid_susp){
				ChangeDisplaySettings(NULL,0);
				vid_susp=1;
			}
	}else{
		mouse_init(0);
		if (!GLPREF_windowed)
			if (vid_susp){
				ChangeDisplaySettings(&devmode,CDS_FULLSCREEN);
				ShowWindow(g_hWnd,SW_SHOWNORMAL);
				SetWindowPos(g_hWnd,HWND_TOPMOST,0,0,GLPREF_width,GLPREF_height,SWP_FRAMECHANGED);//if you don't set the pos, it comes up half off the screen, or just shows the desktop
				UpdateWindow(g_hWnd);
				wglMakeCurrent(NULL, NULL);
				wglMakeCurrent(hDC,GL_ResourceContext);//this seems to fix some glitches that appear when you alt-tab back in.
				vid_susp=0;
			}
	}
	//printf("****** -----------------: %i %i,%i %i *******\n",GLPREF_windowed,active,min,vid_susp);
	return i;
}
Пример #6
0
kmain() {
	terminal_init();

	setup_IDT_entry (&idt[0x08], 0x08, (dword)&_int_08_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x09], 0x08, (dword)&_int_09_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x74], 0x08, (dword)&_int_74_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x80], 0x08, (dword)&_int_80_hand, ACS_INT, 0);
	

	/* IDTR Setting */ 

	idtr.base = 0;  
	idtr.base +=(dword) &idt;
	idtr.limit = sizeof(idt)-1;
	
	_lidt(&idtr);

	/* Interrupt unmasking */
	
	_cli();

	_maskPIC1(0xF8);           /*0XF8*/
	_maskPIC2(0xEF);		/*0XEF*/
	
	_sti();

	video_init();
	timertick_init();
	rtc_init();
	mouse_init();
	shell_run();
}
Пример #7
0
void term_init(int screenheight)
{
   struct text_info dat;

   if (saved_lines <= 0) {
      gettextinfo(&dat);
      screen_h = saved_lines = dat.screenheight;
      screen_w = dat.screenwidth;
      norm_attrib = dat.normattr;
   }

   if (screen_h != screenheight) {
      _set_screen_lines(screenheight);
      gettextinfo(&dat);
      screen_h = dat.screenheight;
      screen_w = dat.screenwidth;
   }

   set_bright_backgrounds();

   n_vid();
   textattr(attrib);
   cls();

   mouse_init();

   errno = 0;
}
Пример #8
0
 //initialize mouse
int ImouseIni( int xmin, int ymin, int xmax, int ymax,
		int xstart, int ystart)
{
#ifdef GGI
 xg_mouserange_xmin=xmin;
 xg_mouserange_xmax=xmax;
 xg_mouserange_ymin=ymin;
 xg_mouserange_ymax=ymax;
 return 1;
#else
 mouse_init("/dev/mouse",vga_getmousetype(),10);

 {
  int mscale=60;
  char *ptr=configvariable(&ARACHNEcfg,"SVGAlib_MouseScale",NULL);
  if(ptr)
   mscale=atoi(ptr);
  mouse_setscale(mscale);
 }

 mouse_setxrange(xmin,xmax);
 mouse_setyrange(ymin,ymax);
 mouse_setposition(xstart,ystart);
 return 1;
#endif
}
Пример #9
0
int start() {
	unsigned short character = 0x00;
	int ipc_status;
	message msg;
	int irq_set_kb = kb_subscribe_int();
	int irq_set_timer = timer_subscribe_int();
	int irq_set_mouse = mouse_subscribe_int();
	int r;
	unsigned char packet[3];
	unsigned short counter = 0;

	space_invaders_font = font_init("spaceinvader_font_transparent.bmp");
	srand(1);
	options_load();
	mouse_init();
	init_state();
	highscore_load();
	vg_init(VBE_VIDEO_MODE);

	while (1) { //TODO change condition
		/* Get a request message. */
		if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) {
			printf("driver_receive failed with: %d", r);
			continue;
		}
		if (is_ipc_notify(ipc_status)) { /* received notification */
			switch (_ENDPOINT_P(msg.m_source)) {
			case HARDWARE: /* hardware interrupt notification */
				if (msg.NOTIFY_ARG & irq_set_kb) { /* keyboard interrupt */
					character = kb_int_handler();
					if (character != KB_2BYTE_SCODE)
						kb_event_handler(character);
				}
				if (msg.NOTIFY_ARG & irq_set_mouse){ /* mouse interrupt */
					mouse_int_handler(counter, packet);
					if(packet[0] != MOUSE_ACK && (packet[0] & BIT(3)))
						counter++;
					if(counter == 3){
						counter = 0;
						mouse_event_handler(packet);
					}

				}
				if (msg.NOTIFY_ARG & irq_set_timer){ /* timer interrupt */
					timer_int_handler();
				}
				break;
			default:
				break; /* no other notifications expected: do nothing */
			}
		}
		else { /* received a standard message, not a notification */
			/* no standard messages expected: do nothing */
		}
	}

	return 0;
}
Пример #10
0
HRESULT __stdcall ddraw_SetCooperativeLevel(IDirectDrawImpl *This, HWND hWnd, DWORD dwFlags)
{
    PIXELFORMATDESCRIPTOR pfd;

    printf("DirectDraw::SetCooperativeLevel(This=%p, hWnd=0x%08X, dwFlags=0x%08X)\n", This, (unsigned int)hWnd, (unsigned int)dwFlags);

    /* Red Alert for some weird reason does this on Windows XP */
    if(hWnd == NULL)
    {
        return DDERR_INVALIDPARAMS;
    }

    if (This->hWnd == NULL)
    {
        This->hWnd = hWnd;
    }

    mouse_init(hWnd);

    This->WndProc = (LRESULT CALLBACK (*)(HWND, UINT, WPARAM, LPARAM))GetWindowLong(hWnd, GWL_WNDPROC);

    if (This->renderer == render_dummy_main)
    {
        This->render.hDC = GetDC(This->hWnd);
        SetWindowLong(hWnd, GWL_WNDPROC, (LONG)dummy_WndProc);
        ShowWindow(hWnd, SW_HIDE);
        PostMessage(hWnd, WM_ACTIVATEAPP, TRUE, TRUE);
        PostMessage(This->hWnd, WM_USER, 0, (LPARAM)hWnd);
        return DD_OK;
    }

    SetWindowLong(This->hWnd, GWL_WNDPROC, (LONG)WndProc);

    if(!This->render.hDC)
    {
        This->render.hDC = GetDC(This->hWnd);

        memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
        pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
        pfd.nVersion = 1;
        pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER | (This->renderer == render_main ? PFD_SUPPORT_OPENGL : 0);
        pfd.iPixelType = PFD_TYPE_RGBA;
        pfd.cColorBits = ddraw->render.bpp ? ddraw->render.bpp : ddraw->mode.dmBitsPerPel;
        pfd.iLayerType = PFD_MAIN_PLANE;
        SetPixelFormat( This->render.hDC, ChoosePixelFormat( This->render.hDC, &pfd ), &pfd );
    }

    SetCursor(LoadCursor(NULL, IDC_ARROW));

    GetWindowText(This->hWnd, (LPTSTR)&This->title, sizeof(This->title));

	if (!strcmp(This->title, "Red Alert"))
	{
		ddraw->isredalert = 1;
	}

    return DD_OK;
}
Пример #11
0
// when the mouse moves slow enough it can detect 1000 points per 10cm, so 10000 = 1m
void mouseinitial()
{
  _DBG_("I'm starting");
  mouse_init(cb, attach, detach);
	coord_x =0;
	coord_y =0;
	theta =0;
  _DBG_("I've set up the mouse");
}
Пример #12
0
void arch_init()
{
	//SetPriorityClass (GetCurrentProcess(),HIGH_PRIORITY_CLASS);

	timer_init ();
	key_init();
	mouse_init();

	//printf("arch_init successfully completed\n");
}
Пример #13
0
int main(int argc, char *argv[])
{
	//>>>>>>>>>>  carregament da codepage  <<<<<<<<<<
	load_char_table(codepage);
	
	
	//>>>>>>>>>>  init kbc  <<<<<<<<<
	Bool mouse_detected = kbc_init(0);
	
	
	//>>>>>>>>>>  init kbd  <<<<<<<<<<
	kbd_init();
	
	
	//>>>>>>>>>>  init mouse  <<<<<<<<<<
	if (mouse_detected == true)
		mouse_init((int) 0);
	
	
	//>>>>>>>>>>  init rtc  <<<<<<<<<<
	rtc_init();
	drawDate();
	drawTime();
	drawCounter();
	
	
	//>>>>>>>>>>  init timer  <<<<<<<<<<
	timer0_init();
	timer_init(TIMER_2, LSBMSB | MODE3);

	
//#################
	menu_start();
//#################		
	
	
	
	//>>>>>>>>>>  restore kbd isr <<<<<<<<<<
	restore_keyboard_isr();
	
	
	//>>>>>>>>>>  restore mouse isr <<<<<<<<<<
	if (mouse_detected == true)
		restore_mouse_isr();
	
	
	//>>>>>>>>>>  restore rtc isr <<<<<<<<<<
	restore_rtc_isr();
	
	//>>>>>>>>>>  init timer isr <<<<<<<<<<
	restore_timer0();
	
	
	return 0;
}
Пример #14
0
OSErr
Initialize( void )
{
	SetDateTime( OSI_GetTime() );

	NewGestalt( MOL_GESTALT_SELECTOR, 
		    NewSelectorFunctionProc(mol_gestalt_selector));

	mouse_init();
	return noErr;
}
Пример #15
0
void  drv_load(void)
{
  if (argc < 2)
      printf("No driver inserted or bad usage! Type %s --help for the usage.\n", argv[0]);
  
  else
  { 
      if ( (_kstrncmp (argv[1], "-r", 2) == 0) ) 
	  { 
		  if ( ( argv[2] != NULL ) ) 
		  {
			  if (_kstrncmp (argv[2], "mouse", 5) == 0)  { 
		 	 	 printf("Disattivamento %s in corso..\n", argv[2]);
		 	  	 mouse_dead();
			  }
      		  else 
				  printf("FATAL: Driver %s not found.\n", argv[2]); 
		  }
		  else 
			  printf("Warning, no driver name inserted!\n"); 
	  }
      // per ora lo impostiamo così, static,
      // tanto non abbiamo nessun altro modulo, per ora..
      else if (_kstrncmp (argv[1], "mouse", 5) == 0)
      {
	 	 // enabling mouse
	  	 mouse_init();
      }

      else if ( (_kstrncmp (argv[1], "--help", 6) == 0) || (_kstrncmp (argv[1], "-h", 2) == 0) )
      {
	  printf("---------------------------------------------------\n"
		 "Driver tool to load and kill driver\n"
		 "Simple to use, just type:\n"
		 "\n"
		 "Usage: %s -<options> driver_name\n"
		 "\t-> %s module_name     - to load driver\n"
		 "\t-> %s -r module_name  - to kill driver\n"
		  "---------------------------------------------------\n"
		  , argv[0], argv[0], argv[0]);
      }

     else
	{
	 	if ( (_kstrncmp (argv[1], "-r", 2) == 0) && (_kstrncmp (argv[2], "mouse", 5) == -1) )
	 	   printf("FATAL: Driver %s not found.\n", argv[2]); 
	
		 else
	    	 printf("FATAL: Driver %s not found.\n", argv[1]);
	 }

   }
	
}
Пример #16
0
void
adb_init( void )
{
	kbd_init();
	mouse_init();

	/* Export mouse/keyboard interface */
	if( !gPE.adb_key_event )
		gPE.adb_key_event = adb_key;
	if( !gPE.mouse_event )
		gPE.mouse_event = adb_mouse_event;

	session_save_proc( NULL, prepare_save, kDynamicChunk );
}
Пример #17
0
void
game_init (const char *name)
{
  if (true == initialized)
    {
      LOG_FATAL ("already initialized");
    }

  conf_init ();

  log_set_name (name);
  log_set_verbose (conf_get_verbose ());

  filepath_init (conf_get_root ());
  video_init (conf_get_ratio (), conf_get_center ());
  keyboard_init ();

  char * const music_root = xmalloc (PATH_MAX);
  xsnprintf (music_root, PATH_MAX, "%s%cmusic", conf_get_root (),
             FILEPATH_SEPARATOR);
  audio_init (music_root);
  free (music_root);

  if (false == conf_get_music ())
    {
      audio_music_mute ();
    }
  if (false == conf_get_sound ())
    {
      audio_sound_mute ();
    }

  mouse_init ();

  pit_isr_is_installed = false;

  if (conf_get_fast ())
    {
      game_set_fps_high ();
    }
  else
    {
      game_set_fps_low ();
    }

  exit_clear ();

  initialized = true;
}
Пример #18
0
static int post_enter_graphics (void)
{
    vga_setmousesupport (1);
    mouse_init("/dev/mouse", vga_getmousetype (), 10);
    if (keyboard_init() != 0) {
	leave_graphics_mode ();
	write_log ("Are you sure you have a keyboard??\n");
	return 0;
    }
    keyboard_seteventhandler (my_kbd_handlerx);
    keyboard_translatekeys (DONT_CATCH_CTRLC);

    mouse_setxrange (-1000, 1000);
    mouse_setyrange (-1000, 1000);
    mouse_setposition (0, 0);

    return 1;
}
Пример #19
0
void I_InitGraphics(void)
{
	int i;

	// make sure that signals bring us back into text mode
	signal(SIGINT, (void(*)(int))I_Quit);
	signal(SIGQUIT, (void(*)(int))I_Quit);
	signal(SIGHUP, (void(*)(int))I_Quit);
	signal(SIGTERM, (void(*)(int))I_Quit);

	// init VGA card
	if (vga_init() != 0)
		I_Error("Could not initialize graphics console\n");
	if (vga_setmode(G320x200x256) != 0)
		I_Error("Could not switch to graphics mode\n");

	// init keyboard
	keyboard_init();
	keyboard_seteventhandler(keyboard_events);

	// init mouse
	if (usemouse)
	{
		mouse_type = MOUSE_NONE;
		for (i = 0; mousetypes[i].name != NULL; i++)
		{
			if (!strcmp(mousetype, mousetypes[i].name))
				mouse_type = mousetypes[i].type;
		}

		mouse_init(mousedev, mouse_type, MOUSE_DEFAULTSAMPLERATE);
		mouse_setxrange(0, SCREENWIDTH - 1);
		mouse_setyrange(0, SCREENHEIGHT - 1);
		mouse_setwrap(MOUSE_NOWRAP);
		mouse_seteventhandler(mouse_events);
	}

#ifdef USE_JOYSTICK
	// init joystick
	if (usejoystick)
		I_InitJoystick();
#endif
}
int main()
{
	initTimers();
	initVideo();
	sound_initAC97();
	mouse_init();
	initInterrupts();
	isNewGame = true;
	initGameScreen();

	PIT_startRecurringTimer(XPAR_PIT_0_BASEADDR, CLOCK_FREQ_HZ / INTERRUPTS_PER_SECOND);

	while(1) // Program never ends.
		if(low_priority_intc_status != 0)
			lowPriorityInterruptHandler();

	cleanup_platform();
	return 0;
}
Пример #21
0
void mouse_event_handle(AGI_EVENT *event)
{
	POS pos;
	int id;
	
	switch (c_game_mouse)
	{
		case M_BRIAN:
			mstack_push(event->data, event->x, event->y);
			break;
		
		case M_SIERRA_V2:
			if ( (picbuff_prev != state.window_row_min) ||
				(status_prev != state.status_line_row) )
				mouse_init();
			pos.x = event->x;
			pos.y = event->y;
			id = mouse_area_check(&pos);
			//printf("Mouse Button! x=%d y=%d\n", pos.x, pos.y);
			pos.x = pos.x / c_vid_scale / rend_drv->scale_x;
			pos.y = pos.y / c_vid_scale / rend_drv->scale_y;
			switch (id)
			{
				case 0:	// status bar
					menu_input();
					break;
				case 1:	// picture buffer
					ego_move(pos.x, pos.y);
					break;
				case 2:	// lower area
					ego_move(pos.x, 169);	// 1 pixel past
					break;
			}
			break;
		
		case M_SIERRA_V3:
		case M_NICK:
		default:
			break;
	}
	
}
Пример #22
0
/**
 * @brief 输入事件模块初始化
 *
 * @param keybd_device_path 鼠标路径
 * @param mouse_device_path 键盘路径
 * @param double_click_delay 双击时间间隔
 *
 * @return 成功返回0 否则返回-1
 **/
static si_t event_init(char* keybd_device_path, char* mouse_device_path, si_t double_click_delay)
{
	struct input_device device;

	/**
	 * 初始化输入设备数组
	 **/
	vector_init(&global_wm.input_device_vector);

	/**
	 * 初始化键盘输入设备
	 **/
	if(keybd_init(&device, keybd_device_path) < 0)
	{
		EGUI_PRINT_ERROR("failed to init keybd device");
		return -1;
	}
	/**
	 * 将键盘输入设备添加到输入设备队列中
	 **/
	vector_push_back(&global_wm.input_device_vector, &device, sizeof(device));

	/**
	 * 初始化鼠标输入设备
	 **/
	if(mouse_init(&device, mouse_device_path, double_click_delay) < 0)
	{
		EGUI_PRINT_ERROR("failed to init mouse device");
		return -1;
	}
	/**
	 * 将键盘输入设备添加到输入设备队列中
	 **/
	vector_push_back(&global_wm.input_device_vector, &device, sizeof(device));

	/**
	 * 初始化消息队列
	 **/
	list_init(&global_wm.message_list);

	return 0;
}
Пример #23
0
void RW_IN_Init(in_state_t *in_state_p)
{
	int mtype;
	int i;

	in_state = in_state_p;

	// mouse variables
	m_filter = ri.Cvar_Get ("m_filter", "0", 0);
    in_mouse = ri.Cvar_Get ("in_mouse", "1", CVAR_ARCHIVE);
	freelook = ri.Cvar_Get( "freelook", "0", 0 );
	lookstrafe = ri.Cvar_Get ("lookstrafe", "0", 0);
	sensitivity = ri.Cvar_Get ("sensitivity", "3", 0);
	m_pitch = ri.Cvar_Get ("m_pitch", "0.022", 0);
	m_yaw = ri.Cvar_Get ("m_yaw", "0.022", 0);
	m_forward = ri.Cvar_Get ("m_forward", "1", 0);
	m_side = ri.Cvar_Get ("m_side", "0.8", 0);

	ri.Cmd_AddCommand ("+mlook", RW_IN_MLookDown);
	ri.Cmd_AddCommand ("-mlook", RW_IN_MLookUp);

	ri.Cmd_AddCommand ("force_centerview", Force_CenterView_f);

	mouse_buttons = 3;

	mtype = vga_getmousetype();

	mdev = ri.Cvar_Get ("mdev", "/dev/mouse", 0);
	mrate = ri.Cvar_Get ("mrate", "1200", 0);

//		printf("Mouse: dev=%s,type=%s,speed=%d\n",
//			mousedev, mice[mtype].name, mouserate);

	if (mouse_init(mdev->string, mtype, (int)mrate->value))
	{
		ri.Con_Printf(PRINT_ALL, "No mouse found\n");
		UseMouse = false;
	}
	else
		mouse_seteventhandler(mousehandler);
}
Пример #24
0
static void
IN_init_mouse ( void )
{
	int mtype;
	char *mousedev;
	int mouserate = MOUSE_DEFAULTSAMPLERATE;

	mouse_button_commands[0] = Cvar_Get ("mouse1","+attack",0,"None");
	mouse_button_commands[1] = Cvar_Get ("mouse2","+strafe",0,"None");
	mouse_button_commands[2] = Cvar_Get ("mouse2","+forward",0,"None");
	m_filter = Cvar_Get ("m_filter","0",0,"None");
	Cmd_AddCommand("force_centerview", Force_CenterView_f);

	mouse_buttons = 3;

	mtype = vga_getmousetype();

	mousedev = "/dev/mouse";
	if (getenv("MOUSEDEV")) mousedev = getenv("MOUSEDEV");
	if (COM_CheckParm("-mdev")) {
		mousedev = com_argv[COM_CheckParm("-mdev")+1];
	}

	if (getenv("MOUSERATE")) mouserate = atoi(getenv("MOUSERATE"));
	if (COM_CheckParm("-mrate")) {
		mouserate = atoi(com_argv[COM_CheckParm("-mrate")+1]);
	}

#if 0
	printf("Mouse: dev=%s,type=%s,speed=%d\n",
		mousedev, mice[mtype].name, mouserate);
#endif
	if (mouse_init(mousedev, mtype, mouserate)) {
		Con_Printf("No mouse found\n");
		UseMouse = 0;
	} else{
		mouse_seteventhandler((void*)mousehandler);
	}
}
Пример #25
0
int mouse_request_code(int mode)
{
  union mou_msg msg;
  int r;

  if(mou_queid==0) {
    r=mouse_init();
    if(r<0)
      return r;
  }

  if(mou_requested) {
    return 0;
  }

  msg.req.h.size=sizeof(union mou_msg);
  msg.req.h.service=MOU_SRV_MOUSE;
  msg.req.h.command=MOU_CMD_GETCODE;
  if(mode)
    msg.req.queid=mou_clientq;
  else
    msg.req.queid=0;

/*
int2dec(msg.req.queid,s);
display_puts(s);
*/
  r=message_send(mou_queid, &msg);
  if(r<0) {	
    display_puts("getcode sndcmd=");
    long2hex(-r,s);
    display_puts(s);
    display_puts("\n");
    return r;
  }

  mou_requested=1;
  return 0;
}
Пример #26
0
void
interface_init(void)
{
    // Running at new code address - do code relocation fixups
    malloc_init();

    // Setup romfile items.
    qemu_cfg_init();
    coreboot_cbfs_init();

    // Setup ivt/bda/ebda
    ivt_init();
    bda_init();

    // Other interfaces
    boot_init();
    bios32_init();
    pmm_init();
    pnp_init();
    kbd_init();
    mouse_init();
}
Пример #27
0
void arch_init(void)
{
	int t;

	if (SDL_Init(SDL_INIT_VIDEO) < 0)
		Error("SDL library initialisation failed: %s.",SDL_GetError());

	key_init();

	digi_select_system( GameArg.SndDisableSdlMixer ? SDLAUDIO_SYSTEM : SDLMIXER_SYSTEM );

	if (!GameArg.SndNoSound)
		digi_init();

	mouse_init();

	if (!GameArg.CtlNoJoystick)
		joy_init();

	if ((t = gr_init(0)) != 0)
		Error("Graphics initialization failed: %u",t);

	atexit(arch_close);
}
Пример #28
0
void initpc()
{
    char *p;
//        allegro_init();
    get_executable_name(pcempath,511);
    pclog("executable_name = %s\n", pcempath);
    p=get_filename(pcempath);
    *p=0;
    pclog("path = %s\n", pcempath);

    fdd_init();
    keyboard_init();
    mouse_init();
    joystick_init();
    midi_init();

    loadconfig(NULL);
    pclog("Config loaded\n");

    loadfont("mda.rom", 0, cga_fontdat, cga_fontdatm);
    loadfont("roms/pc1512/40078.ic127", 0, pc1512_fontdat, pc1512_fontdatm);
    loadfont("roms/pc200/40109.bin", 0, pc200_fontdat, pc200_fontdatm);

    codegen_init();

    cpuspeed2=(AT)?2:1;
//        cpuspeed2=cpuspeed;
    atfullspeed=0;

    device_init();

    initvideo();
    mem_init();
    loadbios();
    mem_add_bios();

    timer_reset();
    sound_reset();
    fdc_init();
// #ifdef USE_NETWORKING
    vlan_reset();	//NETWORK
    network_card_init(network_card_current);
// #endif

    loaddisc(0,discfns[0]);
    loaddisc(1,discfns[1]);

    //loadfont();
    loadnvr();
    sound_init();
    resetide();
#if __unix
    if (cdrom_drive == -1)
        cdrom_null_open(cdrom_drive);
    else
#endif
        ioctl_open(cdrom_drive);

    pit_reset();
    /*        if (romset==ROM_AMI386 || romset==ROM_AMI486) */fullspeed();
    ali1429_reset();
//        CPUID=(is486 && (cpuspeed==7 || cpuspeed>=9));
//        pclog("Init - CPUID %i %i\n",CPUID,cpuspeed);
    shadowbios=0;

#if __unix
    if (cdrom_drive == -1)
        cdrom_null_reset();
    else
#endif
        ioctl_reset();
}
Пример #29
0
// application entry point
void main(int argc,char *argv[])
{
  int system_time=0;
  int frame_counter=0;
  int time0;
  char s[20]="";

  if (argc<2) {
    printusage();
    return;
  }

  // parses command line parameters
  parsecmdline(argc-2,argv+2);

  // initializes the video mode and geometry module
  int mode=-1;
  if (vbe_init()) {
    mode=vbe_findmode(scrwidth,scrheight,8);
    if (!mode) mode=-1;
  }
  if (mode==-1) vbe_done();
  if (!vbe_setmode(mode,backbuffl)) goto err;
  setscreensize(vbe_width,vbe_height);
  scr_cols=vbe_width;
  scr_bpp=vbe_bpp;

  // initializes the keyboard
  kbd_init();

  // initializes the timer
  timer_init();

  // initializes the mouse
  mouse_init();

  // reads the map
  if (!map_init(argv[1])) goto err;
  vbe_setpal((Tcolor *)palette,0,256);

  // main loop
  time0=timer_clocks;
  while(player_idle(timer_clocks)) {
    // draws the current frame
    draw_init(vbe_backbuffer,vbe_width,vbe_height);
    map_draw();

    // calculates the frame rate
    frame_counter++;
    int dt=timer_clocks-time0;
    if (dt>500) {
      float fps = (frame_counter*1000.)/dt;
      sprintf(s,"%.1f FPS",fps);
      time0 = timer_clocks;
      frame_counter = 0;
    }
    textout(vbe_backbuffer,0,0,s,255);

    // flips the video pages
    vbe_flip(waitfl);

    // applies the mouse movement
    if (player_keys & kRUN) player_rotate(-mousedy*0.01,0,-mousedx*0.01);
    else player_rotate(-mousedy*0.005,0,-mousedx*0.005);
    mousedx=0;mousedy=0;

    // clears the keyboard queue
    while (kbhit()) getch();
  }
 err:
  vbe_done();
  vbe_settext();
}
Пример #30
0
/* C64-specific initialization.  */
int machine_specific_init(void)
{
    int delay;

    scpu64_log = log_open("SCPU64");

    if (mem_load() < 0) {
        return -1;
    }

    event_init();

    /* Setup trap handling.  */
    traps_init();

    if (!video_disabled_mode) {
        joystick_init();
    }

    gfxoutput_init();

    /* Initialize serial traps.  */
    if (serial_init(scpu64_serial_traps) < 0) {
        return -1;
    }

    serial_trap_init(0xa4);
    serial_iec_bus_init();

    /* Initialize RS232 handler.  */
    rs232drv_init();
    c64_rsuser_init();

    /* Initialize print devices.  */
    printer_init();

    /* Fire up the hardware-level drive emulation.  */
    drive_init();

    disk_image_init();

    resources_get_int("AutostartDelay", &delay);
    if (delay == 0) {
        delay = 3; /* default */
    }

    /* Initialize autostart.  */
    autostart_init((CLOCK)(delay * SCPU64_PAL_RFSH_PER_SEC * SCPU64_PAL_CYCLES_PER_RFSH), 1, 0xcc, 0xd1, 0xd3, 0xd5);

#ifdef USE_BEOS_UI
    /* Pre-init C64-specific parts of the menus before vicii_init()
       creates a canvas window with a menubar at the top. This could
       also be used by other ports, e.g. GTK+...  */
    if (!console_mode) {
        scpu64ui_init_early();
    }
#endif

    if (vicii_init(VICII_STANDARD) == NULL && !video_disabled_mode) {
        return -1;
    }

    scpu64_mem_init();

    cia1_init(machine_context.cia1);
    cia2_init(machine_context.cia2);

#ifndef COMMON_KBD
    /* Initialize the keyboard.  */
    if (c64_kbd_init() < 0) {
        return -1;
    }
#endif
    c64keyboard_init();

    scpu64_monitor_init();

    /* Initialize vsync and register our hook function.  */
    vsync_init(machine_vsync_hook);
    vsync_set_machine_parameter(machine_timing.rfsh_per_sec, machine_timing.cycles_per_sec);

    /* Initialize native sound chip */
    sid_sound_chip_init();

    /* Initialize cartridge based sound chips */
    cartridge_sound_chip_init();

    /* Initialize userport based sound chips */
    userport_dac_sound_chip_init();

    drive_sound_init();
    video_sound_init();

    /* Initialize sound.  Notice that this does not really open the audio
       device yet.  */
    sound_init(machine_timing.cycles_per_sec, machine_timing.cycles_per_rfsh);

    /* Initialize keyboard buffer.  */
    kbdbuf_init(631, 198, 10, (CLOCK)(machine_timing.rfsh_per_sec * machine_timing.cycles_per_rfsh));

    /* Initialize the C64-specific I/O */
    c64io_init();

    /* Initialize the C64-specific part of the UI.  */
    if (!console_mode) {
        scpu64ui_init();
    }

    /* Initialize glue logic.  */
    scpu64_glue_init();

#ifdef HAVE_MOUSE
    /* Initialize mouse support (if present).  */
    mouse_init();

#ifdef HAVE_LIGHTPEN
    /* Initialize lightpen support and register VICII callbacks */
    lightpen_init();
    lightpen_register_timing_callback(vicii_lightpen_timing, 0);
    lightpen_register_trigger_callback(vicii_trigger_light_pen);
#endif
#endif
    c64iec_init();
    c64fastiec_init();

    cartridge_init();

    machine_drive_stub();
#if defined (USE_XF86_EXTENSIONS) && (defined(USE_XF86_VIDMODE_EXT) || defined (HAVE_XRANDR))
    {
        /* set fullscreen if user used `-fullscreen' on cmdline */
        int fs;
        resources_get_int("UseFullscreen", &fs);
        if (fs) {
            resources_set_int("VICIIFullscreen", 1);
        }
    }
#endif

    return 0;
}