示例#1
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{
		MouseInit(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;
}
示例#2
0
void EventReset(EventHandlers *handlers, Pic *mouseCursor, Pic *mouseTrail)
{
	KeyInit(&handlers->keyboard);
	JoyReset(&handlers->joysticks);
	MouseInit(
		&handlers->mouse, mouseCursor, mouseTrail, handlers->mouse.hideMouse);
}
示例#3
0
static void Init() {
  KeyboardInit();
  MouseInit(0, 0, WIDTH - 1, HEIGHT - 1);

  CopListActivate(cp);
  custom->dmacon = DMAF_SETCLR | DMAF_RASTER | DMAF_SPRITE;
}
//****************************************************************************
//
// This is the main loop that runs the application.
//
//****************************************************************************
int
main(void)
{
    //
    // Set the clocking to run from the PLL at 50MHz.
    //
    ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
                       SYSCTL_XTAL_16MHZ);

    //
    // Set the system tick to fire 100 times per second.
    //
    ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND);
    ROM_SysTickIntEnable();
    ROM_SysTickEnable();

    //
    // Pass the USB library our device information, initialize the USB
    // controller and connect the device to the bus.
    //
    g_psCompDevices[0].pvInstance =
        USBDHIDMouseCompositeInit(0, (tUSBDHIDMouseDevice *)&g_sMouseDevice);
    g_psCompDevices[1].pvInstance =
        USBDCDCCompositeInit(0, (tUSBDCDCDevice *)&g_sCDCDevice);

    //
    // Set the USB stack mode to Device mode with VBUS monitoring.
    //
    USBStackModeSet(0, USB_MODE_DEVICE, 0);

    //
    // Pass the device information to the USB library and place the device
    // on the bus.
    //
    USBDCompositeInit(0, &g_sCompDevice, DESCRIPTOR_DATA_SIZE,
                      g_pucDescriptorData);

    //
    // Initialize the mouse and serial devices.
    //
    MouseInit();
    SerialInit();

    //
    // Drop into the main loop.
    //
    while(1)
    {
        //
        // Allow the main mouse routine to run.
        //
        MouseMain();

        //
        // Allow the main serial routine to run.
        //
        SerialMain();
    }
}
示例#5
0
void EventInit(
	EventHandlers *handlers, Pic *mouseCursor, Pic *mouseTrail,
	const bool hideMouse)
{
	memset(handlers, 0, sizeof *handlers);
	KeyInit(&handlers->keyboard);
	JoyInit(&handlers->joysticks);
	MouseInit(&handlers->mouse, mouseCursor, mouseTrail, hideMouse);
}
示例#6
0
void __cdecl kshell()
{
	VolInit();
	StorageProbe();
	VolList();
	KbdInit();
	VideoInit();
	WindowsInit();
	MouseInit();
}
示例#7
0
GLFWEngine::GLFWEngine(WindowSettings& w) : BasicEngine(new GLFWTimerProvider()),
	currentSettings(new WindowSettings()),
	Window(*currentSettings)
{
	if (!InitWindow(w))
		printf("Could not open window");

	KeyInit();
	MouseInit();
	InitListen();
}
示例#8
0
int main(int argc, char *argv[])
{
	MiscAppInit();
	if (SDL_Init(SDL_INIT_VIDEO) < 0) 
	{
		MiscTrace("Couldn't initialize SDL: %s\n",SDL_GetError());
		return 1;
	}
	MainFrameSetTitle(SSS_TITLE);
	s_screen = CanvasInit();
	MouseInit();
	KeyboardInit();
	s_screenArea.x = 0;
	s_screenArea.y = 0;
	s_screenArea.w = WINDOW_WIDTH;
	s_screenArea.h = WINDOW_HEIGHT;
	s_done = 0;
#if 0
	while (1) 
	{
		if(MainFrameGetMsg())
		{
			break;
		}
		{
			int k = 0;
			int width = WINDOW_WIDTH;
			int height = WINDOW_HEIGHT;
			CanvasLock();
			CanvasSetColor(CanvasRGB(0xff, 0, 0));
			CanvasMoveTo(0, 0);
			CanvasLineTo(width * 2, height * 2);
			for (k = height / 4; k < height / 2; k++)
			{
				CanvasSetPixel(width / 2, k, 
					CanvasRGB(0xff, 0, 0xff));
			}
			CanvasDrawLine(-width, height * 2, width * 2, -height, 
				CanvasRGB(0, 0, 0xff));
			CanvasUnlock();
			MainFrameRefresh();
		}
	}
#else
	ScriptRun();
#endif
	KeyboardRelease();
	MouseRelease();
	CanvasRelease();
	SDL_Quit();
	return 0;
}
//----------------------------------------------------------------------------------------------------------------------------
//
// ÄÚºËÖ÷Èë¿Ú
//
//----------------------------------------------------------------------------------------------------------------------------
void k_main(void) 
{
	unsigned long  base_mm;
	
	PageDirInit();
	KernelGraphicInit();
	ConsoleInit(0,0xFFFFFF);

  ConsolePrintf("Enable The Page");
	ConsolePrintOK();

	ConsoleMsg("  The Kernel Page    Dir   at %08x The Page0 at %08x\n",PG_DIR_ADDR,PG_TABLE_ADDR);
	ConsoleMsg("  The VESA   Mapping Page  at %08x\n",VESA_PTE);

	ConsolePrintf("Load The boot Infomation");
	ConsolePrintOK();

	GetGrubVersion(GrubBootInfo);
	GetGrubBoot(GrubBootInfo,(int*)&BootParameters.bp_bootdev);
	GetGrubMemInfo(GrubBootInfo,&base_mm,&BootParameters.bp_ramsize);
	GetGrubAPM(GrubBootInfo);

	BootMemInit();
	KnlMesQueInit();

	PageManagerInit(BootParameters.bp_ramsize);
	VMemInit(BootParameters.bp_ramsize,0xC0000000-BootParameters.bp_ramsize);

	TrapInit();
	TimerInit();
	KeyboardInit();
	MouseInit();
	//FloppyInit();
	HardDiskInit();
  //Fat12_Init();
	Fat32_Init();
	ProcessInit();
	SystemCallInit();

	__asm__("sti");

	ExecInitProc("SHELLER ");

  SetSwitching(0);
  while(1);   
}
示例#10
0
文件: descent.cpp 项目: paud/d2x-xl
static int InitializePoll (CMenu& menu, int& key, int nCurItem, int nState)
{
if (nState)
	return nCurItem;

paletteManager.LoadEffect ();
switch (loadOp) {
	case 0:
		/*---*/PrintLog ("Creating default tracker list\n");
		tracker.CreateList ();
		break;
	case 1:
		/*---*/PrintLog ("Loading ban list\n");
		banList.Load ();
		break;
	case 2:
		/*---*/PrintLog ("Initializing control types\n");
		SetControlType ();
		break;
	case 3:
		/*---*/PrintLog ("Initializing keyboard\n");
		KeyInit ();
		break;
	case 4:
		/*---*/PrintLog ("Initializing joystick\n");
		DoJoystickInit ();
		break;
	case 5:
		int i;
		if ((i = FindArg ("-xcontrol")) > 0)
			externalControls.Init (strtol (pszArgList [i+1], NULL, 0), strtol (pszArgList [i+2], NULL, 0));
		break;
	case 6:
		/*---*/PrintLog ("Initializing movies\n");
		if (FindArg ("-nohires") || FindArg ("-nohighres") || !GrVideoModeOK (MENU_HIRES_MODE))
			gameOpts->movies.bHires = 
			gameStates.menus.bHires = 
			gameStates.menus.bHiresAvailable = 0;
		else
			gameStates.menus.bHires = gameStates.menus.bHiresAvailable = 1;
		movieManager.InitLibs ();		//init movie libraries
		break;
	case 7:
		BMInit ();
		break;
	case 8:
		/*---*/PrintLog ("Initializing sound\n");
		audio.Setup (1);
		break;
	case 9:
		/*---*/PrintLog ("Loading hoard data\n");
		LoadHoardData ();
		break;
	case 10:
		error_init (ShowInGameWarning, NULL);
		break;
	case 11:
		break;
		g3_init ();
	case 12:
		/*---*/PrintLog ("Initializing texture merge buffer\n");
		TexMergeInit (100); // 100 cache bitmaps
		break;
	case 13:
		InitPowerupTables ();
		break;
	case 14:
		LoadGameBackground ();
		atexit (CloseGame);
		break;
	case 15:
		InitThreads ();
		break;
	case 16:
		PiggyInitMemory ();
		break;
	case 17:
		if (!FindArg ("-nomouse"))
			MouseInit ();
		break;
	case 18:
		/*---*/PrintLog ("Enabling TrackIR support\n");
		TIRLoad ();
		break;
	}
loadOp++;
if (gameStates.app.bProgressBars && gameOpts->menus.nStyle) {
	if (loadOp == InitGaugeSize ())
		key = -2;
	else {
		menu [0].m_value++;
		menu [0].m_bRebuild = 1;
		key = 0;
		}
	}
paletteManager.LoadEffect ();
return nCurItem;
}
示例#11
0
/*
 * ----------------------------------------------------------------------------
 *
 * DevGraphicsInit --
 *
 *	Initialize the mouse and the screen.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The world is initialized.
 *
 * ----------------------------------------------------------------------------
 */
void
DevGraphicsInit()
{
    Time		time;
    int			i;
    int			slot;
    Mach_SlotInfo	slotInfo;
    ReturnStatus	status;
    char		*slotAddr;
    DisplayInfo		*displayInfoPtr = (DisplayInfo *) NIL;

    Sync_SemInitDynamic(&graphicsMutex, "graphicsMutex");
    for (i = 0; i < numConfigDisplays; i++) {
	displayInfoPtr = &configDisplays[i];
	for (slot = 0; slot < 3; slot++) {
	    slotAddr = (char *) MACH_IO_SLOT_ADDR(slot);
	    status = Mach_GetSlotInfo(slotAddr + displayInfoPtr->romOffset, 
			&slotInfo);
	    if (status == SUCCESS) {
		if ((!strcmp(slotInfo.vendor, displayInfoPtr->vendor)) && 
		    (!strcmp(slotInfo.module, displayInfoPtr->module))) {
		    displayType = displayInfoPtr->type;
		    break;
		}
	    }
	}
	if (displayType != UNKNOWN) {
	    break;
	}
    }
    switch (displayType) {
	case UNKNOWN :
	    Mach_MonPrintf(
		"Assuming you have one of those fancy graphics displays.\n");
	    displayType = PMAGDA;
	    break;
	case PMAGBA:
	    Mach_MonPrintf("Color frame buffer in slot %d, (%s %s %s %s)\n",
			slot, slotInfo.module, slotInfo.vendor,
			slotInfo.revision, slotInfo.type);
	    break;
    }
    if (displayType == PMAGBA) {
	ramdac.addrLowPtr = (unsigned char *) (slotAddr + PMAGBA_RAMDAC_OFFSET);
	ramdac.addrHighPtr = (unsigned char *) 
				(slotAddr + PMAGBA_RAMDAC_OFFSET + 0x4);
	ramdac.regPtr = (unsigned char *) 
				(slotAddr + PMAGBA_RAMDAC_OFFSET + 0x8);
	ramdac.colorMap = (unsigned char *) 
				(slotAddr + PMAGBA_RAMDAC_OFFSET + 0xc);

	/*
	 * Initialize screen info.
	 */
	scrInfoPtr = (DevScreenInfo *) MACH_UNCACHED_ADDR(&scrInfoCached);
	events = (DevEvent *) MACH_UNCACHED_ADDR(eventsCached);
	tcs = (DevTimeCoord *)  MACH_UNCACHED_ADDR(tcsCached);

	InitScreenDefaults(scrInfoPtr);
	scrInfoPtr->eventQueue.events = events;
	scrInfoPtr->eventQueue.tcs = tcs;
	frameBuffer = (char *) (slotAddr + PMAGBA_BUFFER_OFFSET);
	scrInfoPtr->bitmap = (char *) frameBuffer;
	scrInfoPtr->cursorBits = (short *)(cursorBits);
	Timer_GetRealTimeOfDay(&time, (int *) NIL, (Boolean *) NIL);
	scrInfoPtr->eventQueue.timestampMS = TO_MS(time);
	scrInfoPtr->eventQueue.eSize = DEV_MAXEVQ;
	scrInfoPtr->eventQueue.eHead = scrInfoPtr->eventQueue.eTail = 0;
	scrInfoPtr->eventQueue.tcSize = MOTION_BUFFER_SIZE;
	scrInfoPtr->eventQueue.tcNext = 0;

	/*
	 * Initialize the color map, and the screen, and the mouse.
	 */
	InitColorMap();
	ScreenInit();
    }
    MouseInit();
    Scroll();

    /*
     * Init the "latest mouse report" structure
     */
    lastRep.state = 0;
    lastRep.dx = 0;
    lastRep.dy = 0;
    lastRep.byteCount = 0;


    /*
     * Reset the keyboard.
     */
    if(!inKBDReset) {
	KBDReset();
    }

    if (displayType == PMAGBA) {
	/*
	 * Clear any pending video interrupts.
	 */

	* ((int *) (slotAddr + PMAGBA_IREQ_OFFSET)) = 1;
    }

    initialized = TRUE;

    bzero((char *) debugArray, sizeof(debugArray));
}    
示例#12
0
文件: wgl.c 项目: paud/d2x-xl
void win32_create_window(int x,int y)
{
	int flags;

	WNDCLASS wcDescentClass;

	if (!hInst)
		Error("hInst=NULL\n");


	wcDescentClass.lpszClassName = "WinD1X";
	wcDescentClass.hInstance     = hInst;
	wcDescentClass.lpfnWndProc   = DescentWndProc;
	wcDescentClass.hCursor       = LoadCursor(NULL, IDC_ARROW);
	//wcDescentClass.hIcon         = LoadIcon(NULL, IDI_WINLOGO);
	wcDescentClass.hIcon         = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MAIN_ICON);
	wcDescentClass.lpszMenuName  = NULL;
	wcDescentClass.hbrBackground = NULL;
	wcDescentClass.style         = CS_OWNDC;
	wcDescentClass.cbClsExtra    = 0;
	wcDescentClass.cbWndExtra    = 0;
	
	// Register the class
	if (!RegisterClass(&wcDescentClass)){
//		//printf("RegisterClass==0?\n");
		//always seems to return 0 after the first time, yet if you remove the call, it crashes. Heh.
	}

	if (gameStates.ogl.bFullScreen)
		flags=WS_POPUP;//uh.. don't remember if removing sysmenu did anything or not.. but it works.
		//flags=WS_POPUP | WS_SYSMENU;
	else
		flags=WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;//let us minimize it.
		//flags=WS_OVERLAPPED | WS_BORDER | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;

	if (!gameStates.ogl.bFullScreen){
		x+=get_win_x_bs();y+=get_win_y_bs();
	}else{
		if (FindArg("-gl_test2")){
			x=GetSystemMetrics(SM_CXSCREEN);
			y=GetSystemMetrics(SM_CYSCREEN);
		}
	}
	g_hWnd = CreateWindowEx(0,
			"WinD1X",
			"Descent",
			flags,
			0, 0,
			x,y,
			NULL,
			NULL,
			hInst,
			NULL
						   );

	if (!g_hWnd) Error("no window?\n");
	ShowWindow(g_hWnd,SW_SHOWNORMAL);
	UpdateWindow(g_hWnd);

	OpenGL_Initialize();

	if (gameStates.ogl.bFullScreen){
        ShowCursor(FALSE);
        mouse_hidden = 1;
	}

	KeyInit();
	MouseInit(0);
	joy_init(JOYSTICKID1);
	if (!FindArg( "-nosound" ))
		DigiInit();
	gameStates.ogl.bInitialized=1;
}
示例#13
0
main()
{
 int X,Y,m_state,y,a,b,i,j;


  Initgr();                        /* BGI初始化 */

  setcolor(WHITE);

 setwritemode(XOR_PUT);      /* 设定输入模式为异或模式 */
 MouseInit(0,X_max,0,Y_max);  /* 初始化鼠标 */
 a=X_max;b=Y_max;
 m_state=0;                   /* 初始化鼠标状态为移动状态 */
 DrawCursor(a,b);
 while(m_state!=2)             /* 如果没有点击右键 */
 {
   MouseState(&X,&Y,&m_state);     /* 获取鼠标当前状态与坐标值 */
   DrawCursor(a,b);                /* 通过异或输入模式删除之前的鼠标指针 */
   if(m_state==1)                   /* 如果鼠标左键点击 */
    {
       LineDrawFlag=TRUE;            /* 将跟随鼠标画线标志置为真 */
       if(0==PointNum)               /* 如果是第一次点击左键 */
         {
          x_Origin=a; y_Origin=b;
          x_Old=a;    y_Old=b;
          x_New=a;    y_New=b;
         }
         else                         /* 如果不是第一次点击鼠标左键 */
         {
          x_Old=x_New;
          y_Old=y_New;
          x_New=a;
          y_New=b;
          }


         PointNum++;               /* 记录鼠标左键点击次数,以便确定是否要跟随鼠标画线 */

         if((x_Origin-x_New) > -10 && (x_Origin-x_New) < 10 && (y_Origin-y_New) > -10
          && (y_Origin-y_New) < 10 &&  ((x_Origin-x_New)!=0 || (y_Origin-y_New)!=0))
           {                      /* 如果线画到离初始点足够近的地方 */

             LineDrawFlag=FALSE;     /* 将跟随鼠标画线标志置为假 */
             PointNum=0;              /* 鼠标点击次数清零 */
             x_New=x_Origin; y_New=y_Origin;    /* 将初始点的坐标值赋给当前点 */
           }

           setwritemode(OR_PUT);
           line(x_Old,y_Old,x_New,y_New);       /*  从前一点到当前点画线 */
           setwritemode(XOR_PUT);
    }

   DrawCursor(X,Y);   /* 在当前位置画鼠标指针 */
   a=X;
   b=Y;
}

  DrawCursor(X,Y);
  ScanlineSeedFill(X,Y,WHITE,12);

 getch();
closegraph();
}
示例#14
0
文件: emulator.c 项目: staring/RosFE
BOOLEAN EmulatorInitialize(HANDLE ConsoleInput, HANDLE ConsoleOutput)
{
    /* Allocate memory for the 16-bit address space */
    BaseAddress = HeapAlloc(GetProcessHeap(), /*HEAP_ZERO_MEMORY*/ 0, MAX_ADDRESS);
    if (BaseAddress == NULL)
    {
        wprintf(L"FATAL: Failed to allocate VDM memory.\n");
        return FALSE;
    }
    /*
     * For diagnostics purposes, we fill the memory with INT 0x03 codes
     * so that if a program wants to execute random code in memory, we can
     * retrieve the exact CS:IP where the problem happens.
     */
    RtlFillMemory(BaseAddress, MAX_ADDRESS, 0xCC);

    /* Initialize I/O ports */
    /* Initialize RAM */

    /* Initialize the CPU */

    /* Initialize the internal clock */
    if (!ClockInitialize())
    {
        wprintf(L"FATAL: Failed to initialize the clock\n");
        return FALSE;
    }

    /* Initialize the CPU */
    CpuInitialize();
    // Fast486Initialize(&EmulatorContext,
                      // EmulatorReadMemory,
                      // EmulatorWriteMemory,
                      // EmulatorReadIo,
                      // EmulatorWriteIo,
                      // NULL,
                      // EmulatorBiosOperation,
                      // EmulatorIntAcknowledge,
                      // NULL /* TODO: Use a TLB */);

    /* Initialize DMA */

    /* Initialize the PIC, the PIT, the CMOS and the PC Speaker */
    PicInitialize();
    PitInitialize();
    CmosInitialize();
    SpeakerInitialize();

    /* Set output functions */
    PitSetOutFunction(0, NULL, PitChan0Out);
    PitSetOutFunction(1, NULL, PitChan1Out);
    PitSetOutFunction(2, NULL, PitChan2Out);

    /* Register the I/O Ports */
    RegisterIoPort(CONTROL_SYSTEM_PORT61H, Port61hRead, Port61hWrite);

    /* Set the console input mode */
    // FIXME: Activate ENABLE_WINDOW_INPUT when we will want to perform actions
    // upon console window events (screen buffer resize, ...).
    SetConsoleMode(ConsoleInput, ENABLE_PROCESSED_INPUT /* | ENABLE_WINDOW_INPUT */);
    // SetConsoleMode(ConsoleOutput, ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);

    /**/EnableExtraHardware(ConsoleInput);/**/

    /* Initialize the PS/2 port */
    PS2Initialize();

    /* Initialize the keyboard and mouse and connect them to their PS/2 ports */
    KeyboardInit(0);
    MouseInit(1);

    /**************** ATTACH INPUT WITH CONSOLE *****************/
    /* Start the input thread */
    InputThread = CreateThread(NULL, 0, &PumpConsoleInput, ConsoleInput, 0, NULL);
    if (InputThread == NULL)
    {
        DisplayMessage(L"Failed to create the console input thread.");
        return FALSE;
    }
    /************************************************************/

    /* Initialize the VGA */
    if (!VgaInitialize(ConsoleOutput))
    {
        DisplayMessage(L"Failed to initialize VGA support.");
        return FALSE;
    }

    /* Initialize the software callback system and register the emulator BOPs */
    InitializeInt32();
    RegisterBop(BOP_DEBUGGER  , EmulatorDebugBreakBop);
    // RegisterBop(BOP_UNSIMULATE, CpuUnsimulateBop);

    /* Initialize VDD support */
    VDDSupInitialize();

    return TRUE;
}
示例#15
0
LRESULT CALLBACK WndProc(HWND hWnd, 
	UINT message, 
	WPARAM wParam, 
	LPARAM lParam)
{
	HDC hdc;
	switch(message)
	{
	case WM_COMMAND:
		{
			int wmId = LOWORD(wParam);
			/* int wmEvent = HIWORD(wParam); */
			switch (wmId)
			{
			default:
				return DefWindowProc(hWnd, message, wParam, lParam);
			}
		}
		break;

	case WM_CREATE:
		s_hAppWnd = hWnd;
		SetWindowPos(hWnd, NULL, 0, 0, -1, -1, SWP_NOSIZE);
		s_hCanvas = CanvasInit(hWnd);
		MouseInit();
		KeyboardInit();
		break;
	
	case WM_DESTROY:
		KeyboardRelease();
		MouseRelease();
		CanvasRelease();
		PostQuitMessage(0);
		break;

	case WM_PAINT:
		{
			PAINTSTRUCT ps;
			hdc = BeginPaint(hWnd, &ps);
			BitBlt(hdc,
				ps.rcPaint.left, ps.rcPaint.top,
				ps.rcPaint.right - ps.rcPaint.left, 
				ps.rcPaint.bottom - ps.rcPaint.top,
				s_hCanvas, 
				ps.rcPaint.left, ps.rcPaint.top, 
				SRCCOPY);
			EndPaint(hWnd, &ps);
		}
		break;

	case WM_KEYDOWN:
		{
			switch(wParam)
			{
			case VK_CONTROL:
				break;
			
			case VK_ESCAPE:
				break;
			}
		}
		break;

	case WM_CHAR:
		{
			int Key = (UINT)wParam;
			MiscTrace("WM_CHAR: %d\n", Key);
			KeyboardChar(Key);
		}
		break;

	case WM_MOUSEMOVE:
		{
			POINT point;
			point.x = LOWORD(lParam);
			point.y = HIWORD(lParam);
			//MiscTrace("WM_MOUSEMOVE: %d, %d\n", point.x, point.y);
			MouseMove(point.x, point.y);
		}
		break;

	case WM_LBUTTONDOWN:
		{
			POINT point;
			point.x = LOWORD(lParam);
			point.y = HIWORD(lParam);
			MiscTrace("WM_LBUTTONDOWN: %d, %d\n", point.x, point.y);
			MouseLButtonDown(point.x, point.y);
		}
		break;

	case WM_LBUTTONUP:
		{
			POINT point;
			point.x = LOWORD(lParam);
			point.y = HIWORD(lParam);
			MiscTrace("WM_LBUTTONUP: %d, %d\n", point.x, point.y);
			MouseLButtonUp(point.x, point.y);
		}
		break;

	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
示例#16
0
CLIPPER MInit()      { MouseInit( _parl( 1 ) ); }
示例#17
0
文件: emulator.c 项目: GYGit/reactos
BOOLEAN EmulatorInitialize(HANDLE ConsoleInput, HANDLE ConsoleOutput)
{
    USHORT i;

    /* Initialize memory */
    if (!MemInitialize())
    {
        wprintf(L"Memory initialization failed.\n");
        return FALSE;
    }

    /* Initialize I/O ports */
    /* Initialize RAM */

    /* Initialize the CPU */

    /* Initialize the internal clock */
    if (!ClockInitialize())
    {
        wprintf(L"FATAL: Failed to initialize the clock\n");
        EmulatorCleanup();
        return FALSE;
    }

    /* Initialize the CPU */
    CpuInitialize();

    /* Initialize DMA */
    DmaInitialize();

    /* Initialize PIC, PIT, CMOS, PC Speaker and PS/2 */
    PicInitialize();

    PitInitialize();
    PitSetOutFunction(0, NULL, PitChan0Out);
    PitSetOutFunction(1, NULL, PitChan1Out);
    PitSetOutFunction(2, NULL, PitChan2Out);

    CmosInitialize();
    SpeakerInitialize();
    PpiInitialize();

    PS2Initialize();

    /* Initialize the keyboard and mouse and connect them to their PS/2 ports */
    KeyboardInit(0);
    MouseInit(1);

    /**************** ATTACH INPUT WITH CONSOLE *****************/
    /* Create the task event */
    VdmTaskEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
    ASSERT(VdmTaskEvent != NULL);

    /* Start the input thread */
    InputThread = CreateThread(NULL, 0, &ConsoleEventThread, ConsoleInput, 0, NULL);
    if (InputThread == NULL)
    {
        wprintf(L"FATAL: Failed to create the console input thread.\n");
        EmulatorCleanup();
        return FALSE;
    }
    ResumeEventThread();
    /************************************************************/

    /* Initialize the VGA */
    if (!VgaInitialize(ConsoleOutput))
    {
        wprintf(L"FATAL: Failed to initialize VGA support.\n");
        EmulatorCleanup();
        return FALSE;
    }

    /* Initialize the disk controller */
    if (!DiskCtrlInitialize())
    {
        wprintf(L"FATAL: Failed to completely initialize the disk controller.\n");
        EmulatorCleanup();
        return FALSE;
    }

    /* Mount the available floppy disks */
    for (i = 0; i < ARRAYSIZE(GlobalSettings.FloppyDisks); ++i)
    {
        if (GlobalSettings.FloppyDisks[i].Length != 0 &&
            GlobalSettings.FloppyDisks[i].Buffer      &&
            GlobalSettings.FloppyDisks[i].Buffer != '\0')
        {
            if (!MountDisk(FLOPPY_DISK, i, GlobalSettings.FloppyDisks[i].Buffer, FALSE))
            {
                DPRINT1("Failed to mount floppy disk file '%wZ'.\n", &GlobalSettings.FloppyDisks[i]);
                RtlFreeUnicodeString(&GlobalSettings.FloppyDisks[i]);
                RtlInitEmptyUnicodeString(&GlobalSettings.FloppyDisks[i], NULL, 0);
            }
        }
    }

    /*
     * Mount the available hard disks. Contrary to floppies, failing
     * mounting a hard disk is considered as an unrecoverable error.
     */
    for (i = 0; i < ARRAYSIZE(GlobalSettings.HardDisks); ++i)
    {
        if (GlobalSettings.HardDisks[i].Length != 0 &&
            GlobalSettings.HardDisks[i].Buffer      &&
            GlobalSettings.HardDisks[i].Buffer != L'\0')
        {
            if (!MountDisk(HARD_DISK, i, GlobalSettings.HardDisks[i].Buffer, FALSE))
            {
                wprintf(L"FATAL: Failed to mount hard disk file '%wZ'.\n", &GlobalSettings.HardDisks[i]);
                EmulatorCleanup();
                return FALSE;
            }
        }
    }

    /* Refresh the menu state */
    UpdateVdmMenuDisks();

    /* Initialize the software callback system and register the emulator BOPs */
    InitializeInt32();
    RegisterBop(BOP_DEBUGGER  , EmulatorDebugBreakBop);
    // RegisterBop(BOP_UNSIMULATE, CpuUnsimulateBop);

    /* Initialize VDD support */
    VDDSupInitialize();

    return TRUE;
}