示例#1
0
        private void processKey(KeyboardEventArgs k, bool skipMapCheck)
        {
            if (!skipMapCheck)
            {
                JoystickFunction jf = checkMap(1, k.Key);

                if (jf != JoystickFunction.None)
                {
                    processJoy(1, jf, k.Down);
                    return;
                }

                jf = checkMap(2, k.Key);

                if (jf != JoystickFunction.None)
                {
                    processJoy(2, jf, k.Down);
                    return;
                }
            }

            if (C64.network.IsClient)
            {
                sendNetKey(k);
            }
            else
            {
                C64Key key = KeyboardMatrix.GetC64Key(k);

                if (key.KeyValue > 0)
                {
                    if (k.Down)
                    {
                        keyboardMatrix[key.KeyColumn] &= (byte)(~key.KeyValue);

                        if (key.Shift == ShiftStatus.Enable)
                        {
                            keyboardMatrix[1] &= 0x7F;
                        }
                        else if (key.Shift == ShiftStatus.Disable)
                        {
                            keyboardMatrix[1] |= 0x80;
                            keyboardMatrix[6] |= 0x10;
                        }
                    }
                    else
                    {
                        keyboardMatrix[key.KeyColumn] |= key.KeyValue;

                        if (key.Shift == ShiftStatus.Enable)
                        {
                            keyboardMatrix[1] |= 0x80;
                        }
                    }
                }
            }
        }
示例#2
0
 private void sendNetKey(KeyboardEventArgs k)
 {
     C64.network.Send(
         NetCommands.KeyEvent,
         new byte[]
     {
         (byte)k.Key,
         (byte)(KeyboardMatrix.shiftPressed(k) ? 1 : 0),
         (byte)(k.Down ? 1 : 0)
     }
         );
 }