Custom engine actions are a new type of event the Keymapper can produce.
When an engine declares its keymap, it can declare it wants to receive
custom action events when the corresponding key is pressed, instead of
the originating hardware input events.
This system allows:
* Key bindings to be specified only once when declaring the keymap,
instead of twice (when handling the events).
* To truly rebind keys in the keymaps dialog. When using traditional
event mapping, the keymapper remaps the user keypress to the keypress
expected by the game engine to perform the action. However, the engine
still accepts the original keys.
The new concept of 'standard actions' defines a set of engine actions
that are commonly available in the games supported by ScummVM. Backends
can define default bindings for the standard actions to hardware
specific input devices.
DefaultEventManager registers a keymapper that is supposed to be
auto-freed. However, the event recorder then sets itself as a new
keymapper, but because the autofree flag is already set,
registerMapper() ends up deleting the event recorder itself. Setting
the autofree flag before actually freeing the mapper fixes the issue
and prevents ScummVM from crashing on startup
It was badly broken after refactoring into EventObserver.
Fitst, deinit() method was never called which lead to bad record
files. Then, the concept of counting pollEvent() calls was ignored.
Introduced dispatchPoll() method of EventObserver which is implemented
in EventRecorder. It counts calls so is able to inject events at
more proper time.
Additionally now event times are recorded.