~ fixed keyboard buffer error
This commit is contained in:
parent
868682e9d9
commit
128951d856
|
@ -74,10 +74,10 @@ namespace vkvm {
|
|||
auto buttonPressed(KeyCode keyCode) -> void {
|
||||
lockSharedMemory();
|
||||
auto reg = getRegisters();
|
||||
if (reg->keyboardBuffer_index_write >= sizeof(reg->keyboardBuffer)) {
|
||||
reg->keyboardBuffer[reg->keyboardBuffer_index_write++] = keyCode;
|
||||
if (reg->keyboardBuffer_index_write >= keyboardBufferSize) {
|
||||
reg->keyboardBuffer_index_write = 0;
|
||||
}
|
||||
reg->keyboardBuffer[reg->keyboardBuffer_index_write++] = keyCode;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
|
|
|
@ -326,7 +326,7 @@ namespace vkvm {
|
|||
auto reg = getRegisters();
|
||||
if (reg->keyboardBuffer_index_read != reg->keyboardBuffer_index_write) {
|
||||
keyCode = static_cast<KeyCode>(reg->keyboardBuffer[reg->keyboardBuffer_index_read++]);
|
||||
if (reg->keyboardBuffer_index_read >= sizeof(reg->keyboardBuffer)) {
|
||||
if (reg->keyboardBuffer_index_read >= keyboardBufferSize) {
|
||||
reg->keyboardBuffer_index_read = 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue