This fixes a nasty interaction between the intro sequence and the
demoplayer introduced in 3ff62045. The cutscene tries to suspend the
demoplayer for its duration and then resume it later. When the
suspension counter hits 0, the demoplayer event handlers are installed
globally. And then AFTER that happens, the demoplayer is actually
initialized, resetting the suspension counter and installing the event
handlers AGAIN. When the demoplayer is then suspended (e.g. by starting
the actual demo playback), only one set of those handlers is removed,
which has the effect of the demoplayer remaining active even in-game.
Eventually, it tries to play a demo while a game is already running,
at which point all hell breaks loose.
Fix this by making suspend and resume no-ops until the demoplayer has
been properly initialized.
Fixes #371
* Use correctly scaled radial deadzones instead of naive per-axis
deadzones
* Option to adjust the "maximum zone" (upper deadzone)
* Option to remap square input into circular. Unfortunately there's no
nice way to detect which type the controller reports. We assume
circular by default.
* A more sensible sensitivity setting
* Use a larger minimum deadzone when emulating key presses (e.g. in
menus)
* Adjusted key repeat to be less aggressive
Introduces wrappers around memory allocation functions in `memory.h`
that should be used instead of the standard C ones.
These never return NULL and, with the exception of `mem_realloc()`,
zero-initialize the allocated memory like `calloc()` does.
All allocations made with the memory.h API must be deallocated with
`mem_free()`. Although standard `free()` will work on some platforms,
it's not portable (currently it won't work on Windows). Likewise,
`mem_free()` must not be used to free foreign allocations.
The standard C allocation functions are now diagnosed as deprecated.
They are, however, available with the `libc_` prefix in case interfacing
with foreign APIs is required. So far they are only used to implement
`memory.h`.
Perhaps the most important change is the introduction of the `ALLOC()`,
`ALLOC_ARRAY()`, and `ALLOC_FLEX()` macros. They take a type as a
parameter, and allocate enough memory with the correct alignment for
that type. That includes overaligned types as well. In most
circumstances you should prefer to use these macros. See the `memory.h`
header for some usage examples.
* Split replay.c into multiple files under replay/; improve logical
separation of replay-related code.
* Separate replay playback state from data.
* Get rid of global static replay struct and avoid unnecessary replay
copying.
* Replay playback and recording are now independent and may occur
simultaneously, although this functionality is not yet exposed. This
enables replay "re-recording" while synthesizing new desync check
events, possibly at a different rate from the original replay.
* Rate of recorded desync check events can now be controlled with the
TAISEI_REPLAY_DESYNC_CHECK_FREQUENCY environment variable. The default
value is 300 as before.
* Probably other stuff I forgot about.