From a1ae482174f73744d02f31a1a70104c356f0f05b Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 15 Jun 2026 14:48:21 +0200 Subject: [PATCH] handle interrupt signals during CONS_Error also move stuff into smol inline function --- src/console.c | 2 ++ src/d_clisrv.c | 5 +---- src/d_main.c | 5 +---- src/f_wipe.c | 5 +---- src/i_system.h | 5 +++++ 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/console.c b/src/console.c index f6581069f..3ee6e1c22 100644 --- a/src/console.c +++ b/src/console.c @@ -1437,6 +1437,8 @@ void CONS_Error(const char *msg) // dirty quick hack, but for the good cause while (I_GetKey() != KEY_ENTER) { + I_HandleInterrupt(); + // Sleep so we don't take too much of cpu usage I_Sleep(1.f/TICRATE*1000); diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 9dc1175f4..6cc63efaa 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2858,10 +2858,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic { INT32 key; - if (I_Interrupted()) - { - I_Quit(); - } + I_HandleInterrupt(); I_OsPolling(); diff --git a/src/d_main.c b/src/d_main.c index 3470bc5d7..3663c76c3 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -855,10 +855,7 @@ void D_SRB2Loop(void) enterprecise = I_GetPreciseTime(); - if (I_Interrupted()) - { - I_Quit(); - } + I_HandleInterrupt(); memset(&g_dc, 0, sizeof(g_dc)); Z_Frame_Reset(); diff --git a/src/f_wipe.c b/src/f_wipe.c index cc04a71d7..f68be538c 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -361,10 +361,7 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu) // on for fade-to-black for (;;) { - if (I_Interrupted()) - { - I_Quit(); - } + I_HandleInterrupt(); // get fademask first so we can tell if it exists or not fmask = F_GetFadeMask(wipetype, wipeframe++); diff --git a/src/i_system.h b/src/i_system.h index 5f375a7fb..7f97557be 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -207,6 +207,11 @@ void I_ShutdownSystem(void); /** \brief To check if a Interrupt or Terminate Signal was fired */ boolean I_Interrupted(void); +static inline void I_HandleInterrupt(void) +{ + if (I_Interrupted()) + I_Quit(); +} /** \brief The I_GetDiskFreeSpace function