Commit Graph
30 Commits
Author SHA1 Message Date
BromBrom d6b5bde80c SystemService: fullscreen control 2025-11-15 13:42:20 +01:00
kichikuou 998ab23dab Fix build error when debugger is disabled
This fixes "call to undeclared function 'screenshot_save'" error when
xsystem4.h is not included by debugger.h.
2025-10-05 18:54:14 +09:00
Nunuhara Cabbage dc8342cbab Merge pull request #287 from kichikuou/android-fullscreen
Android: Do not use SDL_WINDOW_FULLSCREEN
2025-10-04 22:30:48 -07:00
kichikuou 8d9eb931f6 Redraw screen on SDL_APP_DIDENTERFOREGROUND
Without this, the screen remains blank after resuming the app on
Android.
2025-10-04 16:06:36 +09:00
Nunuhara Cabbage 6f661fb370 Add Alt+S keybinding to save screenshot
Not implemented on android or windows (yet). Zenity must be installed
for file picker dialog.
2025-09-27 11:18:55 -07:00
Nunuhara Cabbage 57a73cd924 Add F11 keybinding to toggle fullscreen 2025-09-26 17:50:21 -07:00
kichikuou 46469e8732 Implement SACT2.Key_ClearFlagNoCtrl
Used in Pastel Chime Continue.

It clears key status except for VK_CONTROL.
2025-08-23 07:08:40 +09:00
Nunuhara Cabbage a13bd155dc dap: send correct reason for stopped event 2024-08-10 18:52:08 -07:00
Nunuhara Cabbage cf3fe0e852 dbg: allow middle-click break in DAP debugger 2024-08-04 09:10:01 -07:00
Nunuhara Cabbage 79ebe443f5 dbg: handle window events while waiting for input
Keep the screen updated while in the debugger.
2024-08-03 09:34:59 -07:00
kichikuou f0f84a05ce Android: Fix text input issue
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.
2024-03-16 13:36:57 +09:00
kichikuou 18a71960e8 Add touch gestures
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
2024-03-16 13:35:12 +09:00
kichikuou 5e80c96587 Defer mouse button events synthesized from touch events
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.
2024-03-16 13:26:29 +09:00
Nunuhara Cabbage d4e06db8e2 Initial DAP implementation
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.
2023-04-29 10:32:50 -07:00
kichikuou 64a92a2ffa Enter debugger REPL on middle-button click
This is effective only if --debug command line flag is specified.
2023-01-02 21:10:58 +09:00
Nunuhara Cabbage 2e23554162 Implement SACT2.Joypad_GetAnalogStickStatus 2022-07-09 17:35:07 -07:00
Nunuhara Cabbage da12d6183e Remove "invalid keycode" warnings
Some games (e.g. Rance VI) just scan through all all keys up to 256 when
waiting for input.
2022-04-18 07:19:32 -07:00
Nunuhara Cabbage 951834fb57 Improve joypad input mapping
Implement buttons 1-4 as left analog stick directions (with cooldown) to
match SACT2.

Other buttons are also remapped to match the SACT2 mapping.
2022-04-11 17:45:21 -07:00
Nunuhara Cabbage e88ae62c08 Remove scene_flip function
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.
2022-04-05 19:31:13 -07:00
kichikuou a76948244e Implement two SystemService.dll functions
For Widenyo.
2022-03-24 22:00:35 +09:00
kichikuou 5a5916fbd5 Make the window resizable
We don't use SDL's rendering functions, so we have to scale the screen
and translate the mouse positions ourselves.
2022-01-08 11:31:37 +09:00
Nunuhara Cabbage cd34311c62 Call scene_flip() on SDL_WINDOWEVENT_EXPOSED
Fixes issue where the screen is not redrawn when the game is in an input
wait loop.
2021-12-14 19:57:38 -08:00
Nunuhara Cabbage 2046fded88 Use scene_dirty() on SDL_WINDEVENT_EXPOSED 2021-12-11 12:45:58 -08:00
Nunuhara Cabbage ab5c86b1fa Implement joypad support 2021-09-19 20:28:51 -07:00
Nunuhara Cabbage 052ca908b3 Validate keycode in key_is_down 2021-04-19 20:56:42 -07:00
Nunuhara Cabbage 678a9a96f0 Fix buffer overflow when recieving high keycodes 2020-09-05 22:12:51 -07:00
Nunuhara Cabbage d9d8a201e8 Implement miscellaneous HLL functions
Reduce console spam by implementing some commonly used functions.

DrawGraph.SetFontName
SACT2.Mouse_SetPos
SACT2.Sound_ReverseLR
2020-08-16 19:57:46 -07:00
Nunuhara Cabbage 81a947d74d Partial InputString hll implementation
Not implemented: display of intermediate results.
2020-07-12 16:10:10 -07:00
Nunuhara Cabbage 0d74a3b686 Partial MsgLogManager/MsgLogViewer implementation
Enough to get the message log in Sengoku Rance working.
2020-03-08 17:19:19 -07:00
Nunuhara Cabbage 5d6f148e1b Reorganize project file structure
- 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
2019-12-31 17:50:40 -08:00