Commit Graph
831 Commits
Author SHA1 Message Date
kichikuou ffdd362f35 Limit SDL2 SysWM header to Windows users 2026-09-23 07:24:01 +09:00
kichikuou 66d0636197 Port Windows menu integration to SDL3 2026-09-23 07:05:14 +09:00
kichikuou 6c8590f8d4 SDL: Fix screenshot and input compatibility 2026-09-23 06:46:02 +09:00
kichikuou 2f73abd486 Android: Migrate to SDL3
Use the official SDL 3.4.16 AAR through Prefab and build SDL_mixer
3.2.4 from fixed source. Remove the bundled SDL2 Java sources and make
Android an SDL3-only target.
2026-09-22 21:10:36 +09:00
kichikuou 5844226b2f Emscripten: Fix SDL3 compilation
Include the standard I/O declarations used by system.c directly and handle
SDL3's pointer-array locale API in the built-in NLS fallback.
2026-09-22 20:53:24 +09:00
kichikuou 87596c58c5 SDL: Keep mixer conversions simple
Remove the helper layer and unit tests added solely for simple gain and
time expressions. Keep these conversions directly in their SDL3_mixer
backends instead of shaping production code around testability.
2026-09-22 20:39:28 +09:00
kichikuou 212a7bf138 SDL: Test mixer time and volume conversions
Share SDL3_mixer gain and 10-millisecond time conversions across the
PCM, BGM, CD, and MIDI backends. Add SDL3 unit coverage for volume
clamping, combined gain, time units, and tick counter wraparound.
2026-09-22 20:34:26 +09:00
kichikuou 652724a9ab SDL: Keep MIDI decoder selection automatic
Do not force the Timidity decoder based on TIMIDITY_CFG. Leave decoder
selection to SDL3_mixer unless SDL_SOUNDFONTS requires FluidSynth for
SDL2_mixer-compatible SoundFont handling.
2026-09-22 16:05:19 +09:00
kichikuou 658debdcf3 SDL: Add SDL3 MIDI backend
Play MIDI through the shared SDL3_mixer music track while preserving
the existing loop, pause, volume, position, and fade behavior. Support
FluidSynth SoundFonts and Timidity selection through their established
environment variables.
2026-09-22 16:00:21 +09:00
kichikuou ed4fbc1f19 SDL: Add SDL3 CD audio backend
Load playlist tracks through SDL3_mixer and play them on the shared
owner-aware music track. Preserve the CD-specific loop convention,
volume valancer, and playback position reporting.
2026-09-22 15:51:54 +09:00
kichikuou c1910382f8 SDL: Add SDL3 BGM backend
Add an owner-aware music track shared by the SDL3 BGM, CD, and MIDI
backends. Use it to preserve exclusive music playback while moving BGM
loading, looping, fades, and volume control to SDL3_mixer.
2026-09-22 15:47:24 +09:00
kichikuou 495d6146f3 SDL: Add SDL3 PCM backend
Create shared SDL3_mixer device ownership and map the 129 PCM slots to
MIX_Track objects. Decode left/right WAV data through the public decoder
API before combining channels.
2026-09-22 15:41:00 +09:00
kichikuou 6f01734215 SDL: Add event and input compatibility
Map SDL2 and SDL3 event names, keyboard fields, touch queries, joystick
device identifiers, message boxes, and text input APIs through the common
interface.  Keep the deferred touch deadline on the millisecond clock so
SDL3's nanosecond event timestamps are not mixed with SDL_GetTicks().
2026-09-22 15:33:51 +09:00
kichikuou b55574c162 SDL: Add cursor compatibility
Map system cursor shapes to their SDL2 and SDL3 names and hide the
cursor destruction API difference.  Also include the allocation
declarations required by the SDL3 debug build.
2026-09-22 15:27:28 +09:00
kichikuou 9f92186905 SDL: Add display mode compatibility
Hide the SDL2 display index and SDL3 display ID and return-value
differences behind the compatibility layer.
2026-09-22 15:24:07 +09:00
kichikuou d80d82912a Build: Fix debug compilation errors
Include the standard allocation declarations where needed and use the
parsed command argument in TPC and TPS trace messages.
2026-09-22 15:23:45 +09:00
kichikuou eeb4953213 SDL: Add IO stream compatibility
Unify SDL2 RWops and SDL3 IOStream operations for files, memory,
font resources, and WAV decoding. Keep stream close ownership explicit
and cover memory stream reads in both SDL configurations.
2026-09-22 15:16:24 +09:00
kichikuou 5abc9e8177 SDL: Preserve blit destination updates
Emulate SDL2's clipped destination rectangle output when using SDL3.
Cover source clipping, destination clipping, and empty blits in the
SDL compatibility tests.
2026-09-22 15:10:05 +09:00
kichikuou 5d7ec418b1 SDL: Add renderer compatibility layer
Convert SDL2 integer render rectangles to SDL3 floating-point rectangles
inside the compatibility layer. Preserve logical presentation, integer
scaling, HiDPI sizing, texture filtering, and vertex color semantics.
2026-09-22 15:03:02 +09:00
kichikuou e488123345 SDL: Add thread primitive compatibility
Wrap mutexes, condition variables, and atomic integers with common SDL2
and SDL3 types and semantics.  Normalize timed condition waits to report
whether the condition was signaled.
2026-09-22 14:47:34 +09:00
kichikuou 5eea90c9a8 SDL: Add surface compatibility layer
Route surface formats, palettes, creation, conversion, and destruction
through SDL2/SDL3 compatibility helpers.  Preserve indexed-surface palette
ownership and adapt renamed fill, stretch, blit, and rectangle APIs.
2026-09-22 14:42:55 +09:00
kichikuou 677ecb5a0f Build: Add SDL version selection
Add the compile-time SDL major version option and propagate it through
interface targets. Route SDL includes through C99 compatibility headers
while keeping SDL2 as the desktop and Emscripten default.
2026-09-22 14:21:09 +09:00
kichikuou f033a507d3 ZZ2: Return platform name from SDL
Fixes #82.
2026-09-20 12:23:02 +09:00
kichikuou a2618319d9 SACT: MusicPlay() uses BGI music loop count 2026-09-11 08:58:26 +09:00
kichikuou 30fd5768da Avoid updating internal mouse position for System 3.8/3.9 games
Do not update the internal mouse position when cursor warping is
unavailable / disabled. System 3.8 and later can disable mouse automatic
cursor movement from the menubar, so no games for these versions are
designed with the assumption that this feature is available.
2026-09-11 07:57:00 +09:00
kichikuou 253de6adc8 Remove enable_zb option
Always enable ZB font weight handling and remove the enable_zb CLI and
profile configuration.
2026-09-06 16:12:19 +09:00
kichikuou a0daa3261c Font: Reduce synthetic bold strength at small sizes
Use half-pixel outline emboldening for font sizes up to 22 pixels to
better match GDI's synthetic bold rendering of MS Gothic and MS Mincho.
Keep the existing full-pixel strength for larger sizes.
2026-09-06 15:00:52 +09:00
kichikuou 98e9d8bcfb Debugger: Add cache statistics command
Add `info cache` command that reports cache usage and cumulative hit
rates for glyph, CG, and archive data.
2026-09-06 14:02:03 +09:00
kichikuou b7854aaec1 Generalize the glyph cache
Replace the old cache manager with a keyed LRU cache and use it for
glyph, CG, and archive data.
2026-09-06 14:02:03 +09:00
kichikuou 905eb34590 Font: Add glyph cache
Cache rendered glyph bitmaps by font properties with a 4 MiB LRU limit.
2026-09-06 14:02:03 +09:00
kichikuou 8f22566adb Add unit test for font.c 2026-09-06 14:02:00 +09:00
kichikuou 48ded43e2a Fix menu text being erased when removing selection highlights
Restore the saved area for opaque menus as well as translucent ones.
Painting over highlights with the background color could erase glyph
pixels in the selected row and the next row.

Also match the original engine's menu item text position.
2026-09-06 13:48:07 +09:00
kichikuou 571bec63a2 Windows: Use msgothic.ttc / msmincho.ttc by default
Fall back to the bundled fonts when these fonts are unavailable.
2026-09-06 13:46:46 +09:00
kichikuou 345c017c22 Render text with FreeType instead of SDL_ttf
SDL_ttf's synthetic bold is too thick. Implement a custom bolding
algorithm that approximates GDI's synthetic bold.
2026-09-06 13:13:09 +09:00
kichikuou 205004086b Move drawing text to the screen out of font.c
This makes font.c unit-testable.
2026-09-06 13:10:20 +09:00
kichikuou 6820bcfcb8 Derive default patchEC value from scenario signature
The EC bug exists only in System 3.8 and later. System 3.5 / 3.6 games
(e.g. Atlach=Nacha) need the patched behavior.

This deviates from System39.exe, which has the buggy behavior for older
scenarios too.
2026-09-06 13:03:51 +09:00
kichikuou 5ce1494b59 Match the original engine's patchEC behavior
The patchEC flag is default off, and EC 0 goes through the same
width/height adjustment as EC with a registered rectangle.
2026-09-05 12:23:09 +09:00
kichikuou dd45e566f6 Emscripten: Remove xsystem35.shell.quit() call in sys_exit()
sys_exit() is unreachable in emscripten build.
2026-08-31 16:37:15 +09:00
kichikuou 1ccc7630c1 QNT: Fix alpha decoding of 1-pixel-wide images 2026-08-31 07:02:44 +09:00
kichikuou 6456f59c37 emscripten: Add JSPI build option 2026-08-21 08:54:34 +09:00
reiicheru f748e8f678 android: Hide android status bar when app is resumed (#81) 2026-08-10 09:44:56 +09:00
kichikuou a9e23508b7 Reimplement the string input dialog with a microui textbox
The dialog edited and drew its field by hand because microui's textbox
cannot display IME composition text.

Teach microui about compositions instead, and split mu_textbox_raw()
into input and drawing halves so the MJ inline editor can share the
input path while keeping the game's own appearance.
2026-08-08 13:03:31 +09:00
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 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 978dbdbc3b Tweak menu strings
Also, do not show "Mouse Movement" item on Android.
2026-07-19 12:46:03 +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