Commit Graph
100 Commits
Author SHA1 Message Date
kichikuou c3bd978f02 microui: Add keyboard navigation
ctx->focus is a transient "pressed with the mouse" state, so it cannot
serve as a keyboard focus. Add a persistent ctx->kb_focus alongside it.
Controls enter the focus cycle from mu_update_control(), which every
widget already calls, so this needs no per-widget code.

Tab and Down move the focus forward, Shift+Tab and Up backward, Enter or
Space activates the focused control, and Left/Right adjust a focused
slider. The focused control is outlined with the new MU_COLOR_FOCUSRING;
window chrome is excluded via MU_OPT_NOKBNAV.
2026-08-08 10:17:02 +09:00
kichikuou 50a6b17c5e Version 2.19.1 2026-08-02 12:41:18 +09:00
kichikuou 0d49619366 Fix unit map storage for 16-bit variables
Store unit map attributes as vmvar_t and derive VR/VW transfer sizes
from their element type. This prevents buffer overruns after vmvar_t
became uint16_t and fixes upward movement in Rance IV.

Add scenario coverage for both transfer directions and verify that
adjacent variables remain intact.
2026-08-02 12:34:40 +09:00
kichikuou da3cc5d900 ags: Consolidate display info accessors 2026-07-24 21:04:25 +09:00
kichikuou 1785e93fcc Refactor gfx API 2026-07-24 21:04:22 +09:00
kichikuou a77e849f82 Version 2.19.0 2026-07-19 12:53:09 +09:00
kichikuou 978dbdbc3b Tweak menu strings
Also, do not show "Mouse Movement" item on Android.
2026-07-19 12:46:03 +09:00
kichikuou e3c168c5a6 Android: Isolate game execution process
The launcher and GameActivity previously ran in the same process. Native
globals and library state therefore survived after returning to the
launcher, leaking static data from one game to the next game.

Run GameActivity in a private :game process and terminate it after SDL
shutdown completes, so every game starts with fresh native state. Keep
the launcher in the main process and refresh its game list from disk
when it resumes.
2026-07-19 09:09:21 +09:00
kichikuou 9f8c2af842 Emscripten: Fix ReferenceError for SE_VOLVAL_CH
EM_ASYNC_JS stringifies its function body without expanding macros. Pass
the BGM and sound-effect channel values through C wrapper functions so
the generated JavaScript receives numeric channel arguments.
2026-07-19 07:20:53 +09:00
kichikuou 5d8b1c5632 Change vmvar_t from int to uint16_t 2026-07-17 09:50:21 +09:00
kichikuou 30188c3a4f Match variable bounds with System 3.9
System 3.9 saturates compound addition and multiplication at 65535,
while an overflowing ascending loop stores the wrapped 16-bit result
after testing the wide value.

Update the scenario expectations and regenerated fixture to cover both
cases. The suite passes with xsystem35 and the original System39.exe.
2026-07-17 09:50:02 +09:00
kichikuou a627a8ea3d Add VM variable storage type
Define a dedicated `vmvar_t` type for values stored in variable pages
and propagate it through interfaces that expose those values. Keep the
type as int for now so this commit does not change runtime behavior.
This separates VM storage from ordinary int buffers and makes a later
conversion to 16-bit storage mechanically checkable.
2026-07-17 08:48:10 +09:00
kichikuou 0cf9c1fe8d Add variable semantics tests
Cover variable page allocation, array reference handling, and Shift-JIS
conversion in src_tests.

Extend the scenario suite with 16-bit boundary behavior for assignments,
loops, module results, and save/load round trips.
2026-07-17 08:11:01 +09:00
kichikuou 0887c44292 Run scenario tests headlessly
Register the existing scenario suite with CTest using SDL's dummy
video and audio drivers.
2026-07-16 20:53:19 +09:00
kichikuou 27a0c89a73 QNT: Add odd-size image test 2026-07-10 08:54:22 +09:00
kichikuou 5c827225ab QNT: Calculate decompression buffers exactly
Round image dimensions up to even values for QNT's 2x2 pixel blocks, and
use the resulting exact size for pixel and alpha decompression.

Verification against Only You Re Cross's QNT files confirmed that the
former 1164-byte discrepancy is odd-height padding, not extra zlib
output. Remove the obsolete fixed margin.
2026-07-10 08:54:19 +09:00
kichikuou bc37ba6256 Require SDL2 >=2.18.0 2026-07-09 09:50:44 +09:00
kichikuou ab4bc2d8d1 Move more modules into src_lib 2026-07-09 07:16:59 +09:00
kichikuou f26321c5e0 Android: Add some comments to CdImageReader 2026-07-05 16:34:16 +09:00
kichikuou 1d897c72d0 Android: Add CD image unit tests
Add synthetic ISO9660, CUE, CCD, and MDS fixtures for JVM unit tests.
Cover CD image sector mapping, audio extraction, install cleanup,
playlist generation, and output path validation.
2026-07-05 16:21:17 +09:00
kichikuou 172c76b4e2 Update android/README.md 2026-07-05 14:51:50 +09:00
kichikuou 100584f896 Android: Support CCD and MDS CD images
Extend the Android CD image reader to accept .bin/.img + .ccd and
.mdf/.mds pairs. CCD metadata is converted into the existing track
model, and MDS descriptors provide data and audio track offsets for
extraction.
2026-07-05 14:48:05 +09:00
kichikuou 975f618b53 Android: Support .img/.cue installs
Extend the Android CD image reader to parse .bin/.img + .cue images
and map MODE1 data tracks into the ISO9660 extractor. Audio tracks are
extracted as WAV files under GAMEDATA/cdda, and playlist.txt is
generated from the CUE track numbers.
2026-07-05 14:20:51 +09:00
kichikuou 0c8bab0c64 Android: Add ISO CD image installer
Add a CD image install path that accepts selected files from the
launcher and extracts GAMEDATA from ISO9660 images. The installer
reuses the existing install transaction cleanup and writes
game_directory.txt so installed games launch through the normal
GameActivity path.
2026-07-05 13:37:15 +09:00
kichikuou 0192fd3d8e Android: Split launcher storage and install logic
Move ZIP installation and file-store responsibilities out of Launcher.
Launcher now coordinates install state and delegates game scanning,
save-data operations, and ZIP extraction to focused helper classes.
2026-07-05 12:28:57 +09:00
kichikuou d69fc5c6a3 Android: Keep launcher install state in Launcher
Move ZIP install jobs from GlobalScope to a Launcher-owned coroutine
scope and store progress, success, and failure in InstallState. This
lets a recreated LauncherActivity render the current install state and
consume completed results once, even when observer callbacks happened
while the activity was absent.
2026-07-05 11:24:40 +09:00
kichikuou 68a39843e2 Android: Prevent ZIP path traversal in launcher 2026-07-05 10:16:48 +09:00
kichikuou e3d7b60785 Emscripten: Apply volume-valancer levels to the shell 2026-07-04 16:17:31 +09:00
kichikuou 2bb891ada8 Move WAI parser to audio_meta.c (renamed from bgi.c) 2026-07-04 16:17:28 +09:00
kichikuou f109fe11f5 Replace event_custom_handler with modal_handle_event 2026-07-01 17:57:14 +09:00
kichikuou 73b3377b77 Add option to mute audio while the window is unfocused
Disabled by default; enable via the mute_on_unfocus rc setting or the
-mute_on_unfocus flag.

Fixes #37.
2026-07-01 17:36:58 +09:00
kichikuou 9400572502 Rename menu_render_overlay to modal_render_overlay 2026-07-01 17:26:04 +09:00
kichikuou a1e063c4b2 Enable the volume controller dialog on Emscripten
Export volume_dialog_open() so the web shell can open it, and add
modal_run to ASYNCIFY_ADD since it drives an async loop.
2026-07-01 17:21:49 +09:00
kichikuou 602c55a5e5 Enable UI translation on platforms without libintl
Compile po/ja.po into a built-in catalog and select it by locale via
SDL_GetPreferredLocales(), so translations work without libintl.
2026-07-01 13:53:18 +09:00
kichikuou 9624192a41 Provide native input/menu implementations directly on Windows
Let win/dialog.c and win/menubar.c define input_modal_string,
input_modal_number, menu_open and menu_init directly instead of
dispatching to them through wrappers.
2026-07-01 10:53:14 +09:00
kichikuou 5c7436e2b1 Factor out the confirmation dialog in menu.c 2026-07-01 10:24:52 +09:00
kichikuou 6c9844697f Merge menu_emscripten.c into menu.c
Consolidate the SDL and Emscripten menu backends into a single menu.c.
2026-07-01 10:11:32 +09:00
kichikuou 210c0a13e4 Reword the quit/restart confirmation dialogs 2026-07-01 09:23:44 +09:00
kichikuou 3ebb1faece Use the SDL popup menu on Android
The popup menu opens with a three-finger tap. Add touch support to the
modal framework: a tap is replayed as a multi-frame mouse
hover->press->release so microui registers the click, and the press is
held so sliders can be dragged. Fix a microui command-buffer alignment
bug that crashed on 32-bit ARM.
2026-07-01 09:23:38 +09:00
kichikuou 286f150510 Android/Emscripten: Move input dialogs into input_modal.c
Consolidate the Android and Emscripten implementations of the string/
number input dialogs into input_modal.c, and split the input-dialog API
out of menu.h into input_modal.h.
2026-07-01 08:22:14 +09:00
kichikuou a194cf10a6 Reimplement the windowless string input on the modal framework
Move edit_string into input_modal.c as an inline modal dialog, sharing the
IME buffer handling and event handler with menu_inputstring.
2026-07-01 08:22:09 +09:00
kichikuou 9587d350ec Split string/number input dialogs out of menu_sdl.c into input_modal.c 2026-06-30 14:17:44 +09:00
kichikuou 02f62d51bb Add Restart to the SDL popup menu
Also localize the quit/restart confirmation dialogs.
2026-06-30 12:34:14 +09:00
kichikuou 54b98ec3e4 Translate UI strings and guard the .pot against staleness
Translate the menu/dialog strings that were left untranslated. Add a CI
step that fails when po/xsystem35.pot is out of sync with the sources.

Also remove unused autotools gettext files.
2026-06-30 12:20:51 +09:00
kichikuou 8cde827ee6 modal: Reset input state when a modal dialog closes
The click (or keypress) that opened a modal dialog leaves its button
"down" in the engine, and the modal consumes the matching release, so
afterwards IK kept reporting a stuck mouse button (or key). Forget all
held keys/buttons when a modal closes.
2026-06-30 10:04:19 +09:00
kichikuou a5d67b067c Use System39.exe-compatible format for Volume.sav
Also, save Volume.sav when the volume dialog is closed.
2026-06-29 17:18:49 +09:00
kichikuou 5cb70110b9 Apply BGM_VOLVAL_CH to MIDI and CD playback
MIDI and CD are background music, so they should share the same volume
control as BGM. Route them through the BGM volume valancer channel.
2026-06-29 16:17:13 +09:00
kichikuou e3dcadd5dd Allow the volume dialog to work without VolumeValancer
When a game defines no VolumeValancer[], fall back to two generic
channels so BGM and sound effects can be adjusted independently.

Volume controls are now always available, so drop the conditional menu
handling.
2026-06-29 15:52:08 +09:00
kichikuou ff31d03153 Implement mus_vol_set_valance()
Apply the System39.ini volume valancer levels to audio output, so the
Volume controller dialog actually adjusts per-channel volumes. PCM scales
its chunk volume by the channel mapped via the .wai file, and BGM scales
its music volume by valancer channel 0.

Fixes #62.
2026-06-29 11:44:22 +09:00
kichikuou 63886d7d00 Make the volume dialog's close button functional 2026-06-29 11:44:21 +09:00
kichikuou c119c2f969 Enable the volume controller dialog on Windows
Rename s39init.{c,h} to volume.{c,h}, move the dialog code there behind
volume_dialog_open(), and add a "Sound Settings" item to the Windows
menu.
2026-06-29 11:44:18 +09:00
kichikuou fb63d42ec1 Remove popupmenu_opened flag
With the blocking modal_run(), the game's main loop is frozen while a
menu is open, so the flag's input-suppression and VM-pause checks are
unreachable. Quit requested during a modal is now handled by closing the
modal and letting it propagate through the main loop.
2026-06-28 13:27:39 +09:00
kichikuou 6f631d073d menu_sdl: Use a light color scheme
Override microui's dark default palette with a light scheme (light gray
windows, dark text) in init_context().
2026-06-28 13:27:39 +09:00
kichikuou 49dca57fbd Call setlocale() so menu translations work
gettext only honors LANG / LC_* once setlocale() has been called. This
used to happen inside gtk_init(); now that GTK is gone, call
setlocale(LC_ALL, "") ourselves before bindtextdomain(), otherwise the
locale stays "C" and the menu is always shown in English.
2026-06-28 13:27:39 +09:00
kichikuou c8987da470 menu: Remove GTK menu backend
Linux and macOS now both build the pure-SDL + microui menu. Remove GTK3
detection, the ENABLE_GTK build branches, and the GTK menu sources.

Decouple gettext NLS from ENABLE_GTK so menu labels stay translatable on all
desktop builds, and update i18n to the new sources (POTFILES.in, .pot, ja.po).
2026-06-28 13:27:35 +09:00
kichikuou 0dfb3eb378 menu_sdl: Implement volume controller panel
Rewrite s39init.c GTK-free: keep the System39.ini / Volume.sav loading,
saving and mus_vol_set_valance() logic, and expose the channel table via
s39ini_available() / s39ini_channels() instead of driving a GtkWidget.

Add a microui volume panel to menu_sdl.c, offered as a "Volume" item in
the popup menu when the game defines volume channels.
2026-06-28 13:08:25 +09:00
kichikuou 269132fede menu_sdl: Implement the string-input dialog
The text field is hand-drawn and IME-aware: SDL_TEXTINPUT /
SDL_TEXTEDITING / BACKSPACE are handled directly (mirroring editor.c)
instead of using a microui textbox.
2026-06-28 13:07:42 +09:00
kichikuou 651fc21a19 menu_sdl: Implement the number-input dialog 2026-06-28 09:49:22 +09:00
kichikuou 03f86bc4d7 menu: Add pure SDL popup menu using microui
Vendor microui 2.02 under src/microui/ and use it to draw an in-game
popup menu as an overlay.

modal.c provides generic modal infrastructure: a loop that pumps SDL
events into microui and renders the command list via SDL_Renderer,
hooked into gfx_updateScreen(). menu_sdl.c builds the concrete popup
menu on top of it.
2026-06-28 09:49:19 +09:00
kichikuou 4ffab8e4e9 Fix compiler warning in cg.c 2026-06-27 16:18:09 +09:00
kichikuou 1593452146 menu: Signal number-input cancellation via the return value
It was inconsistent across backends. Now: true = confirmed,
false = cancelled.
2026-06-25 13:25:29 +09:00
kichikuou 50d05e5b56 font: Replace stateful font_select() with explicit parameter
The font module kept a global "currently selected font" set by
font_select() and implicitly used when drawing. Make it stateless by
introducing a FontSpec {type, weight, size} that font_render_text() /
font_draw_text() and gfx_drawString() take directly.

Make FontWeight a two-valued enum and normalize the 1-9 weight to it
in commandZB().

Removes font_select(), ags_setFont() and ags_setFontWithWeight().
2026-06-24 16:11:49 +09:00
kichikuou c4026f9eb1 Version 2.18.0 2026-06-23 19:18:38 +09:00
kichikuou 3318bebf6c fonts: Replace mincho font with IPA Mincho
Switch the bundled mincho font from a Source Han Serif JP subset to a
subset of IPA Mincho, which has monospace ASCII glyphs.

IPA Mincho's hhea ascent/descent already match its OS/2 typo metrics, so
adjust_metrics.py is no longer needed. However, IPA Mincho is distributed
under the IPA Font License v1.0, under which a subset is a "Derived
Program"; Article 3.1(4) forbids the derived font's name from containing
the licensed program's name ("IPA"). Add rename_font.py to rewrite the
name table accordingly, and replace licenses/mincho.txt with the IPA Font
License.
2026-06-23 17:40:22 +09:00
kichikuou d4ad329583 game_compatibility.md: Fix typo 2026-06-18 07:34:45 +09:00
kichikuou 2e828710ca gtk: Fix popup menu on Wayland
gtk_menu_popup() is deprecated since GTK 3.22. Since no GdkEvent is
available at the call site, use gtk_menu_popup_at_rect() with the
current pointer position obtained via gdk_device_get_position().
2026-05-03 16:37:28 +09:00
kichikuou fad4236458 CI: Fix emscripten build failure 2026-04-12 22:43:27 +09:00
kichikuou 77d62c7c13 CI: Update GitHub Actions 2026-04-12 22:43:24 +09:00
kichikuou a726d577ef modules: Move SACT/sactcg.c to lib/ and use it from NIGHTDLL 2026-03-17 11:09:47 +09:00
kichikuou 4a5cd4a1c1 dDemo/tDemo: Fix .alk filename case sensitivity
Instead of hardcoding "dDEMO.alk" / "tDEMO.alk", use the actual filename
stored in nact->files.alk[0] from the directory scan. This fixes loading
failures on case-sensitive filesystems where the actual file may be
named "dDemo.alk" or "tDemo.alk".

Also update gameresource.c to store .alk files without a numeric suffix
at index 0 (these games have only one .alk file).
2026-03-15 11:13:08 +09:00
kichikuou 022d6af4f1 Implement dDemo HLL (Daiakuji intro demo) 2026-03-08 10:09:01 +09:00
kichikuou df816e3708 README.md: Specify supported audio formats (MP3, Ogg) 2026-01-17 07:32:26 +09:00
kichikuou 2c9079c875 Version 2.17.1 2026-01-10 16:13:16 +09:00
kichikuou 54b8d6c993 android/README.md: Add Obtainium installation instructions 2026-01-10 14:57:43 +09:00
kichikuou f2fe6b9724 SACT: Ctrl key cancels SACT.Wait and SACT.TimerWait
This fixes an issue where the roulette in Rance 5D could not be fast
forwarded using the Ctrl key.
2026-01-09 16:16:13 +09:00
kichikuou 38dc9a7b0b Refactor sacttimer.c 2026-01-09 13:14:48 +09:00
kichikuou d2ac3889b5 QE/LE: Handle for paths with subdirectories correctly
This resolves issues where saving to and loading from paths with
subdirectories (e.g., "Save\file.asd") would fail.

The original problems were:
 1. Writing failure: A path mismatch between directory creation in
    commandQE and file writing in fc_open.
 2. Loading failure: fc_search could not handle paths containing
    directory separators, preventing saved files in subdirectories from
    being found.

This commit addresses these issues with the following changes:
 - fc_open now automatically creates parent directories when writing a
   file.
 - fc_search is updated to support two modes:
     - It performs a case-insensitive search for simple filenames
       (preserving original behavior).
     - It performs a case-sensitive existence check for full paths.

Fixes #74.
2026-01-09 08:31:40 +09:00
kichikuou 0342141358 Add is_available function to CD-ROM devices
Now `SI 2` command returns zero if no audio track is available.
2025-11-28 10:45:24 +09:00
kichikuou 8806bc9545 Version 2.17.0 2025-11-09 22:27:45 +09:00
kichikuou 5e62405f17 Move patch/ to misc/patch/ 2025-11-09 22:26:15 +09:00
kichikuou 714c7d44b5 Android: Update SDL to 2.32.10 2025-11-09 22:08:54 +09:00
kichikuou 0f6d4e2343 Add Streamer Mode with -censor option
This introduces "Streamer Mode" to mosaic specified NSFW images, making
the game suitable for streaming or public viewing. This feature is
enabled via the '-censor <file>' command-line option, which takes a file
containing a list of image numbers to be filtered.
2025-11-09 11:47:13 +09:00
kichikuou f1536a801a QE/LE: Handle backslashes in filenames
Rance 5D uses filename `Save\\Rance5dSystem.asd`. This caused issues:

- On Windows, saving would fail if the `Save` directory did not exist.
- On other platforms, files were created with literal backslashes in
  their names.

This change addresses these problems by:

- In commandQE, normalizing backslashes to forward slashes in the path
  and ensuring that the target directory exists by calling mkdir_p().
- In commandLE, first attempting to load files with normalized forward
  slashes. If that fails, it retries with the original path (containing
  backslashes) for compatibility with older saves.
2025-11-06 11:05:23 +09:00
kichikuou ab372b7873 Unify old and new command implementations
Consolidate logic for parsing string arguments by introducing a
parameter to handle different terminators.
2025-11-06 09:39:51 +09:00
kichikuou 2c02f40dc4 Move uppercase commands from cmd2F.c to cmd<first_letter>.c 2025-11-06 09:39:46 +09:00
kichikuou a395366cf8 Version 2.16.1 2025-08-28 13:00:30 +09:00
kichikuou e416fc20d3 CI: Disable portmidi on mingw32
mingw-w64-i686-portmidi is no longer provided.
2025-08-28 12:47:02 +09:00
kichikuou 7d03fc6757 sactlog: Hold log text in UTF-8 2025-08-28 12:24:49 +09:00
kichikuou e3b8c90611 sactlog: Draw text using gfx_drawString()
This fixes #71. It was a regression by commit ec071d4.
2025-08-28 11:41:51 +09:00
kichikuou 361ca89016 Windows: #undef min / max in portab.h 2025-06-20 08:11:35 +09:00
kichikuou 5bd4622031 Version 2.16.0 2025-06-13 17:20:47 +09:00
kichikuou c7c0f69ec4 Split sdl_core.h to event.h and editor.h
And rename sdl_event.c to event.c, sdl_input.c to editor.c.
2025-06-11 10:12:25 +09:00
kichikuou f38a3eda5c Merge sdl_cursor.c to cursor.c 2025-06-11 10:12:22 +09:00
kichikuou dc17b78365 Move miscellaneous low-level functions to system.[ch] 2025-06-11 09:23:44 +09:00
kichikuou b9f68eedd3 Move joystick initialization code to sdl_event.c 2025-06-11 09:23:44 +09:00
kichikuou adf362ea57 Rename sdl_effect_* to effect_* 2025-06-11 09:23:44 +09:00
kichikuou b5bf439b8e Remove graphics.h 2025-06-11 09:23:42 +09:00
kichikuou 9a01d28075 Move gfx_* functions from sdl_core.h to gfx.h 2025-06-11 09:22:36 +09:00
kichikuou 945dbd7722 Rename graphics functions from sdl_* to gfx_*
And rename sdl_{video,draw,image}.c to gfx_{video,draw,image}.c.
2025-06-10 15:00:27 +09:00
kichikuou 1c54487041 cmake: Use new policies up to CMake 4.0 2025-06-10 13:58:40 +09:00