From f2fe6b97240a317a1b1c9a4875d37e62ee9f1b66 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Fri, 9 Jan 2026 16:16:13 +0900 Subject: [PATCH] SACT: Ctrl key cancels SACT.Wait and SACT.TimerWait This fixes an issue where the roulette in Rance 5D could not be fast forwarded using the Ctrl key. --- modules/SACT/SACT.c | 14 +++++++------- src/input.c | 1 + src/input.h | 7 ++++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/modules/SACT/SACT.c b/modules/SACT/SACT.c index 67bcac2..9eadbf1 100644 --- a/modules/SACT/SACT.c +++ b/modules/SACT/SACT.c @@ -1613,10 +1613,10 @@ static void TimerWait() { int wTimerID = getCaliValue(); int wCount = getCaliValue(); - while (wCount > stimer_get(wTimerID) && !nact->is_quit) { - sys_keywait(10, KEYWAIT_NONCANCELABLE); - } - + int msec = (wCount - stimer_get(wTimerID)) * 10; + if (msec > 0) + sys_keywait(msec, KEYWAIT_CTRL_CANCELABLE); + TRACE("SACT.TimerWait %d,%d:", wTimerID, wCount); } @@ -1627,9 +1627,9 @@ static void TimerWait() { */ static void Wait() { int wCount = getCaliValue(); - - sys_keywait(wCount*10, KEYWAIT_NONCANCELABLE); - + + sys_keywait(wCount * 10, KEYWAIT_CTRL_CANCELABLE); + TRACE("SACT.Wait %d:", wCount); } diff --git a/src/input.c b/src/input.c index f750ff8..c29ffa8 100644 --- a/src/input.c +++ b/src/input.c @@ -112,6 +112,7 @@ int sys_keywait(int msec, unsigned flags) { key = sys_getInputInfo(); cancel_yield(); // We just yielded! if ((flags & KEYWAIT_CANCELABLE) && key) break; + if ((flags & KEYWAIT_CTRL_CANCELABLE) && RawKeyInfo[KEY_CTRL]) break; } return key; diff --git a/src/input.h b/src/input.h index 91f9c03..ee49c0e 100644 --- a/src/input.h +++ b/src/input.h @@ -38,9 +38,10 @@ struct SDL_Point; #define SYS35KEY_ESC 64 #define SYS35KEY_TAB 128 -#define KEYWAIT_NONCANCELABLE 0 -#define KEYWAIT_CANCELABLE 1 -#define KEYWAIT_SKIPPABLE 2 +#define KEYWAIT_NONCANCELABLE 0 +#define KEYWAIT_CANCELABLE 1 +#define KEYWAIT_SKIPPABLE 2 +#define KEYWAIT_CTRL_CANCELABLE 4 // System3.x key codes (IG command, etc.) // These are originated from Windows virtual key codes (VK_*).