Exemple #1
0
        public override void Run()
        {
            System.DebugStub.Init();
            System.DebugStub.Print("InitThread@" + Kernel.CurrentThread + ". ");
            System.VTable.Initialize();
            System.DebugStub.Print("Static initializers done. ");

            Kernel.kernel.NewThread(new IoThread());

            Semaphore[]    semaphores     = new Semaphore[2];
            KeyboardDriver keyboardDriver = new KeyboardDriver(Kernel.kernel, semaphores);

            semaphores[0] = Kernel.kernel.NewSemaphore(0);
            semaphores[1] = Kernel.kernel.NewSemaphore(0);

            for (int i = 0; i < semaphores.Length; i++)
            {
                Semaphore s = Kernel.kernel.NewSemaphore(0);
                semaphores[i] = s;
                Kernel.kernel.NewThread(
                    new Shell(
                        keyboardDriver,
                        s,
                        (uint)(80 * 41 + 80 * 4 * i),
                        (uint)(80 * 41 + 80 * 4 * i + 80 * 3),
                        (uint)(0x2000 + 0x1000 * i + 0x0f00)
                        ));
            }

            Kernel.kernel.NewThread(keyboardDriver);

            System.DebugStub.Print("InitThread done. ");
            Kernel.kernel.NewSemaphore(0).Wait();
        }
Exemple #2
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         KeyboardDriver?.Dispose();
         GamepadDriver?.Dispose();
     }
 }
Exemple #3
0
        private Button AddKey(XNA.Keys key)
        {
            var driver = new KeyboardDriver(key);
            var k      = new Button(driver);

            keys[key] = k;
            keylist.Add(key);
            allKeys.Add(k);

            return(k);
        }
Exemple #4
0
 public Shell(KeyboardDriver keyboardDriver, Semaphore keyboardWaiter, uint offsetLo, uint offsetHi, uint backgroundColor)
 {
     this.keyboardDriver  = keyboardDriver;
     this.keyboardWaiter  = keyboardWaiter;
     this.offsetLo        = offsetLo;
     this.offsetHi        = offsetHi;
     this.offset          = offsetLo;
     this.backgroundColor = backgroundColor;
     for (uint i = offsetLo; i < offsetHi; i++)
     {
         INucleusCalls.VgaTextWrite(i, backgroundColor);
     }
 }
Exemple #5
0
        internal void ConnectRawInput()
        {
            IntPtr formHandle = view.FormHandle;

            keyboardDriver = new KeyboardDriver(formHandle);
            EnumerateDevices();

            // Register for device notifications.
            devNotifyHandle = IntPtr.Zero;
            BroadcastDeviceInterface bdi = new BroadcastDeviceInterface();

            bdi.Size = Marshal.SizeOf(bdi);
            bdi.BroadcastDeviceType = BroadcastDeviceType.DBT_DEVTYP_DEVICEINTERFACE;
            bdi.ClassGuid           = deviceInterfaceHid;

            IntPtr mem = IntPtr.Zero;

            try
            {
                mem = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(BroadcastDeviceInterface)));
                Marshal.StructureToPtr(bdi, mem, false);
                devNotifyHandle = Win32.RegisterDeviceNotification(formHandle, mem, DeviceNotification.DEVICE_NOTIFY_WINDOW_HANDLE);
            }
            catch (Exception e)
            {
                Debug.Print("Registration for device notifications Failed. Error: {0}", Marshal.GetLastWin32Error());
                Debug.Print(e.StackTrace);
            }
            finally
            {
                Marshal.FreeHGlobal(mem);
            }

            if (devNotifyHandle == IntPtr.Zero)
            {
                Debug.Print("Registration for device notifications Failed. Error: {0}", Marshal.GetLastWin32Error());
            }

            // Adding a message filter will cause keypresses to be handled.
            if (preMessageFilter == null)
            {
                preMessageFilter = new PreMessageFilter();
                Application.AddMessageFilter(preMessageFilter);
            }

            keyboardDriver.KeyPressed += OnKeyPressed;
            foreach (KeyPressEvent device in keyboardDriver.DeviceList.Values)
            {
                view.AddComboBoxItem(device);
            }
        }
Exemple #6
0
        protected override void BeforeRun()
        {
            Console.WriteLine("Cosmos booted sucessfully, now starting Kernel");
            display = new BufferedDisplayDriver();
            display.init();

            f  = new BasicFont();
            fr = new FontRenderer(display, f, 0);

            second = time.Second();

            keyboard = new KeyboardDriver();

            // mouse = new MouseDriver(display.getHeight(), display.getWidth());
            // mr = new MouseRenderer(mouse, display, 63);
        }
Exemple #7
0
 public void SetUp()
 {
     _window = new TestWindowAdapter(TimeoutMillis);
     _window.Show();
     _driver = new KeyboardDriver(WindowsMessagingKeyboard(), new KeyCodeMapper());
 }
 public void SetUp()
 {
     _window = new TestWindowAdapter(TimeoutMillis);
     _window.Show();
     _driver = new KeyboardDriver(WindowsMessagingKeyboard(), new KeyCodeMapper());
 }
 public void SetUp()
 {
     Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
     _keyboardMock = new Mock <IKeyboard>();
     _driver       = new KeyboardDriver(_keyboardMock.Object, new KeyCodeMapper());
 }
Exemple #10
0
 // ReSharper disable once RedundantAssignment
 private void OnThreadFilterMessage(ref MSG msg, ref bool handled)
 {
     handled = KeyboardDriver.HandleMessage(msg.message, msg.wParam, msg.lParam);
 }
Exemple #11
0
 private IntPtr Hook(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam, ref bool handled)
 {
     KeyboardDriver.HandleMessage(msg, wparam, lparam);
     return(IntPtr.Zero);
 }
 public void SetUp()
 {
     Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
     _keyboardMock = new Mock<IKeyboard>();
     _driver = new KeyboardDriver(_keyboardMock.Object, new KeyCodeMapper());
 }