From 35169a505788ad414f831fd707fffd0b6d025477 Mon Sep 17 00:00:00 2001 From: Gl0w1amp Date: Mon, 9 Mar 2026 16:33:23 +0000 Subject: [PATCH] Remove global Sleep(1) from uart_handle_read (#6) This removes the global Sleep(1) workaround that was originally added to prevent memory leaks caused by tight polling loops. While it helped with the mai2 memory leak, introducing artificial latency here negatively impacts other UART devices (e.g., breaking slider inputs in chusan). The proper fix has now been implemented downstream in `segatools` by rate-limiting the specific `led15070` board instead. Therefore, this global hack is no longer needed and can be safely removed. Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/capnhook/pulls/6 Co-authored-by: Gl0w1amp Co-committed-by: Gl0w1amp --- hooklib/uart.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/hooklib/uart.c b/hooklib/uart.c index 7c6ecaf..93380c1 100644 --- a/hooklib/uart.c +++ b/hooklib/uart.c @@ -200,9 +200,6 @@ static HRESULT uart_handle_read(struct uart *uart, struct irp *irp) int requested = irp->read.nbytes; if (uart->readable.pos < requested && uart->readable.pos == 0) { - /* Avoid a tight polling loop which causes performance issues - and massive memory leaks. Simulate hardware I/O latency. */ - Sleep(1); return E_PENDING; }