return last keycode if buffer is empty
This commit is contained in:
parent
32e31201ff
commit
50b24b5644
|
@ -325,6 +325,14 @@ namespace vkvm {
|
|||
if (reg->keyboardBuffer_index_read >= keyboardBufferSize) {
|
||||
reg->keyboardBuffer_index_read = 0;
|
||||
}
|
||||
}else{
|
||||
if(reg->keyboardBuffer_index_read == 0){
|
||||
auto code = reg->keyboardBuffer[keyboardBufferSize - 1];
|
||||
keyCode = KeyCode(code);
|
||||
}else{
|
||||
auto code = reg->keyboardBuffer[reg->keyboardBuffer_index_read - 1];
|
||||
keyCode = KeyCode(code);
|
||||
}
|
||||
}
|
||||
unlockSharedMemory();
|
||||
return keyCode;
|
||||
|
|
Loading…
Reference in New Issue