On Android, when the user enters "ら", "ん", "す" with the virtual
keyboard and converts it to "ランス", xsystem4 receives the following
events:
SDL_TEXTINPUT("ら")
SDL_TEXTINPUT("ん")
SDL_TEXTINPUT("す")
SDL_KEYDOWN(backspace)
SDL_KEYUP(backspace)
SDL_KEYDOWN(backspace)
SDL_KEYUP(backspace)
SDL_KEYDOWN(backspace)
SDL_KEYUP(backspace)
SDL_TEXTINPUT("ランス")
The backspace key events are generated by SDL to delete the unconverted
text. However, System4 games process the backspace key by polling, so
if the SDL_KEYDOWN and SDL_KEYUP events occur in close succession, the
game cannot detect that the backspace key has been pressed.
To solve this problem, this patch queues these consecutive input events
and processes them with an interval of at least 10ms.
Fixes https://github.com/kichikuou/xsystem4-android/issues/2.
This adds gestures that allow touch device users to emulate the
following mouse/keyboard actions:
- Right-click: touch outside the game's viewport
- Ctrl key: one-finger touch and hold (for one second)
- Mouse wheel: Swipe up / down with two fingers
A typical event loop in System4 game looks like this:
while (true) {
SACT2.Mouse_GetPos(x, y);
// Update the screen according to the mouse position (x, y)
...
SACT2.Update();
if (SACT2.Key_IsDown(VK_LBUTTON)) {
// A button was pressed at (x, y)
...
}
}
This works poorly with touch devices. Assume that a touch event occured
during SACT2.Update(). It updates internal mouse position and button
status. After SACT2.Update(), the game calls SACT2.Key_IsDown(VK_LBUTTON).
It returns true, but the game has not yet called SACT2.Mouse_GetPos()
after the touch event, so it assumes that the button was pressed where
the mouse pointer was before the touch.
In order to avoid this situation, this defers mouse button events
synthesized (by SDL) from touch. Such deferred events are processed when
SACT2.Mouse_GetPos() is called or after 50ms.
So far only basic debugging functionality is implemented (breakpoints,
stepping, stack traces/variables).
This is not tested against an established DAP client. My intention is to
create a custom GUI frontend and extend the protocol to support
xsystem4-specific features, such as inspecting the scene. (This work is
underway.)
Instruction references are hex-encoded address strings. Clients do not
need to obtain them from DAP requests. This is outside the spec, but it
is needed for a binary-only debugger.
Functions that write directly to stdout (e.g. printf) should generally
not be used any more. Instead, use either sys_message (which respects
sys_silent) or log_message (which will send the message to the debugger
if DAP is enabled). stderr can be used as normal.
It was a bug to call this function outside of sact_Update, because it
set scene_is_dirty to false without first rendering the scene. This can
cause the scene to not be rendered in a timely manner.
- Create separate directories for source and header files.
- Build code shared between xsystem4 and aindump as a static library.
- Create header dirs gfx/ system4/ and vm/
- Make CG.c/h usable without a running VM