add option idlecheckpoint

New experimental option

This requires platform support to be useful. Currently an
implementation for Windows TTY console is included.

A Unix TTY implementation should be achievable I would think,
but I haven't pursued that, at least not yet (contributions welcome).
I'm not sure whether Qt or X11 interfaces offer a similar
timeout capability..

How it works:

When idlecheckpoint in on, if the wait for a new input is idle for
10 seconds (length of time to waite is controlled by
IDLECHECKPOINT_WAIT_TIME #define in hack.h), save_currentstate() is
called to bring everything up-to-date should a hangup or crash occur.
The input wait then continues/resumes.

The save_currentstate() call is only executed once per input request.
This commit is contained in:
nhmall
2026-04-27 19:22:04 -04:00
parent b7f66f9723
commit a090ba90a1
8 changed files with 92 additions and 33 deletions
+3
View File
@@ -387,6 +387,9 @@ static int optfn_##a(int, int, boolean, char *, char *);
Yes, Yes, No, No, NoAlias,
"load IBMGraphics display symbols into symset")
#endif
NHOPTB(idlecheckpoint, Advanced, 0, opt_in, set_in_game,
Off, Yes, No, No, NoAlias, &iflags.idlecheckpoint, Term_Off,
"update checkpoint file if input is idle for 10 seconds")
#ifndef MAC
NHOPTB(ignintr, Advanced, 0, opt_in, set_in_game,
Off, Yes, No, No, NoAlias, &flags.ignintr, Term_False,