From bcb247dc1415b9b599743d051cad42902f694104 Mon Sep 17 00:00:00 2001 From: yamamama Date: Mon, 26 Jan 2026 13:40:16 -0500 Subject: [PATCH] Start a bit of work on input threads --- src/g_input.c | 3 ++- src/g_input.h | 5 ++++- src/k_runahead.hpp | 31 +++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 src/k_runahead.hpp diff --git a/src/g_input.c b/src/g_input.c index d972140e1..f0f0e186a 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -137,7 +137,8 @@ static void led_off_handle4(void) // current state of the keys // JOYAXISRANGE for fully pressed, 0 for not pressed -INT32 gamekeydown[MAXDEVICES][NUMINPUTS] = {}; +inputpoll_t gamekeydown = {}; +inputpoll_t gamekeydown_msec = {}; boolean deviceResponding[MAXDEVICES] = {false}; // several key codes (or virtual key) per game control diff --git a/src/g_input.h b/src/g_input.h index b43435988..39bba1eb8 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -104,7 +104,10 @@ extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS]; // current state of the keys: JOYAXISRANGE or 0 when boolean. // Or anything inbetween for analog values #define MAXDEVICES (MAXGAMEPADS + 1) // Gamepads + keyboard & mouse -extern INT32 gamekeydown[MAXDEVICES][NUMINPUTS]; + +typedef INT32 inputpoll_t[MAXDEVICES][NUMINPUTS]; +extern inputpoll_t gamekeydown, gamekeydown_msec; + extern boolean deviceResponding[MAXDEVICES]; // several key codes (or virtual key) per game control diff --git a/src/k_runahead.hpp b/src/k_runahead.hpp new file mode 100644 index 000000000..dab442f18 --- /dev/null +++ b/src/k_runahead.hpp @@ -0,0 +1,31 @@ +// BLANKART +//----------------------------------------------------------------------------- +// Copyright (C) 2018-2025 by Kart Krew. +// Copyright (C) 2026 by "yama". +// Copyright (C) 2026 Blankart Team. +// +// This program is free software distributed under the +// terms of the GNU General Public License, version 2. +// See the 'LICENSE' file for more details. +//----------------------------------------------------------------------------- +/// \file k_runahead.hpp +/// \brief Millisecond-level input polling + + + +#ifndef __K_RUNAHEAD__ +#define __K_RUNAHEAD__ + +#ifdef __cplusplus +extern "C" { +#endif + +struct inputpoll_t +{ +}; + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif \ No newline at end of file