feat: Symmetric Multiprocessing, text editor improvements, merge doom libc, implement math functions
This commit is contained in:
@@ -197,6 +197,19 @@ namespace Drivers::PS2::Mouse {
|
||||
g_MaxY = maxY;
|
||||
}
|
||||
|
||||
void FlushState() {
|
||||
g_PacketIndex = 0;
|
||||
|
||||
// Drain any stale bytes from the PS/2 controller data port
|
||||
constexpr uint16_t StatusPort = 0x64;
|
||||
constexpr uint16_t DataPort_ = 0x60;
|
||||
for (int i = 0; i < 32; i++) {
|
||||
uint8_t status = Io::In8(StatusPort);
|
||||
if (!(status & 0x01)) break; // output buffer empty
|
||||
Io::In8(DataPort_); // discard byte
|
||||
}
|
||||
}
|
||||
|
||||
void InjectMouseReport(uint8_t buttons, int8_t deltaX, int8_t deltaY, int8_t scroll) {
|
||||
g_StateLock.Acquire();
|
||||
|
||||
|
||||
@@ -34,6 +34,11 @@ namespace Drivers::PS2::Mouse {
|
||||
|
||||
void SetBounds(int32_t maxX, int32_t maxY);
|
||||
|
||||
// Reset packet assembly state and drain pending PS/2 data.
|
||||
// Call after boot to ensure clean mouse state regardless of
|
||||
// any bytes lost during interrupt-heavy boot sequence.
|
||||
void FlushState();
|
||||
|
||||
// Inject a mouse report from an external source (e.g., USB HID mouse)
|
||||
void InjectMouseReport(uint8_t buttons, int8_t deltaX, int8_t deltaY, int8_t scroll);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user