- // --- Check for Kernel Magic Combos
- if(gbaKB_States[KEY_LSHIFT] && gbaKB_States[KEY_RSHIFT])
- {
- switch(ch)
- {
- case 'D': __asm__ __volatile__ ("xchg %bx, %bx"); break;
- }
- }
-
- if(gKB_Callback) gKB_Callback(ch);
-}
-
-/**
- * \fn void KB_AddBuffer(char ch)
- * \brief Add to the keyboard ring buffer
- */
-void KB_AddBuffer(char ch)
-{
- // Add to buffer
- gaKB_Buffer[ giKB_InsertPoint++ ] = ch;
- // - Wrap
- if( giKB_InsertPoint == KB_BUFFER_SIZE ) giKB_InsertPoint = 0;
- // - Force increment read pointer
- if( giKB_InsertPoint == giKB_ReadPoint ) giKB_ReadPoint ++;
-}
-
-/**
- * \fn Uint64 KB_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Dest)
- * \brief Read from the ring buffer
- * \param Node Unused
- * \param Offset Unused (Character Device)
- * \param Length Number of bytes to read
- * \param Dest Destination
- */
-Uint64 KB_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Dest)
-{
- int pos = 0;
- char *dstbuf = Dest;
-
- if(giKB_InUse) return -1;
- giKB_InUse = 1;
-
- while(giKB_ReadPoint != giKB_InsertPoint && pos < Length)
- {
- dstbuf[pos++] = gaKB_Buffer[ giKB_ReadPoint++ ];
- if( giKB_ReadPoint == KB_BUFFER_SIZE ) giKB_InsertPoint = 0;
- }
-
- giKB_InUse = 0;
-
- return Length;