kichikuou c540eb9796 PartsEngine: Implement controller (layer) system
PartsEngine in Rance 9 manages multiple "controllers" (called "layers"
in game scripts) that provide part grouping, draw-order control, and
bulk release. This implements the core controller API:

  - AddController / RemoveController: push/pop a controller on the
    stack. RemoveController releases all parts belonging to the removed
    controller and returns their IDs in erase_number_list.
  - SetActiveLayer / GetActiveLayer / GetSystemOverlayLayer: control
    which controller newly created parts are assigned to. The system
    overlay controller is a special controller that always renders on
    top and survives ReleaseAllWithoutSystem.
  - ReleaseAllWithoutSystem: releases all parts except those in the
    system overlay controller and re-initializes the controller stack.

Controllers are identified by their position in the stack (0 = bottom).
Draw ordering uses the scene's two-level sprite sorting: sp.z is set to
the controller's stack index and sp.z2 to the part's Z value, so parts
in higher controllers always render above lower ones regardless of
individual Z values. When the parts_multi_controller flag (see below) is
false, the original Z ordering is preserved (allowing Z-interleaving
with non-parts scene sprites -- see #180) for compatibility with games
that do not use controllers.

Save/load of the controller stack and per-part controller_no is gated on
a parts_multi_controller flag (set at PreLink time when the game's HLL
exports AddController) rather than a save version bump. This keeps the
save format stable for games that do not use controllers, while allowing
the save format to evolve freely during development.
2026-04-12 12:09:17 +09:00
2025-11-15 14:03:13 -08:00
2025-10-21 18:58:39 -07:00
2020-09-04 20:33:47 -07:00
2023-04-05 19:28:30 -07:00
2026-04-09 12:59:52 +09:00
2022-03-20 14:35:49 +09:00
2019-10-06 19:35:36 -07:00
2020-08-10 15:51:33 -07:00
2025-09-08 07:59:08 -07:00
2025-09-08 07:59:08 -07:00
2023-01-01 13:25:45 +09:00
2025-09-28 11:52:02 -07:00

xsystem4

xsystem4 is an implementation of AliceSoft's System 4 game engine for unix-like operating systems.

Compatiblity

See the game compatibility table for a list of games that can be played on xsystem4.

Building

First install the dependencies (corresponding Debian package in parentheses):

  • chibi-scheme [optional, for debugger]
  • bison (bison)
  • cglm (libcglm-dev) [optional, fetched by meson if not available]
  • flex (flex)
  • freetype (libfreetype-dev)
  • glew (libglew-dev)
  • meson (meson)
  • libffi (libffi-dev)
  • libpng (libpng-dev)
  • libsndfile (libsndfile-dev)
  • libturbojpeg (libturbojpeg0-dev)
  • libwebp (libwebp-dev)
  • SDL2 (libsdl2-dev)
  • zlib (zlib1g-dev)

Then fetch the git submodules,

git submodule init
git submodule update

(Alternatively, pass --recurse-submodules when cloning this repository)

Then build the xsystem4 executable with meson,

mkdir build
meson build
ninja -C build

Finally install it to your system (optional),

ninja -C build install

Windows

xsystem4 can be built on Windows using MSYS2.

First install MSYS2, and then open the MINGW64 shell and run the following command,

pacman -S make flex bison \
    mingw-w64-x86_64-gcc \
    mingw-w64-x86_64-meson \
    mingw-w64-x86_64-pkg-config \
    mingw-w64-x86_64-SDL2 \
    mingw-w64-x86_64-freetype \
    mingw-w64-x86_64-libjpeg-turbo \
    mingw-w64-x86_64-libwebp \
    mingw-w64-x86_64-libsndfile \
    mingw-w64-x86_64-glew \
    mingw-w64-x86_64-nasm \
    mingw-w64-x86_64-diffutils

To build with FFmpeg support, you must compile FFmpeg as a static library:

git clone https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg
git checkout n7.1.2
./configure --disable-everything \
    --enable-decoder=mpegvideo \
    --enable-decoder=mpeg1video \
    --enable-decoder=mpeg2video \
    --enable-decoder=mp2 \
    --enable-parser=mpegaudio \
    --enable-parser=mpegvideo \
    --enable-demuxer=mpegps \
    --enable-demuxer=mpegts \
    --enable-demuxer=mpegtsraw \
    --enable-demuxer=mpegvideo \
    --enable-decoder=vc1 \
    --enable-decoder=wmapro \
    --enable-parser=vc1 \
    --enable-hwaccel=vc1_d3d11va \
    --enable-hwaccel=vc1_d3d11va2 \
    --enable-hwaccel=vc1_dxva2 \
    --enable-demuxer=asf \
    --enable-protocol=file \
    --enable-filter=scale \
    --enable-static \
    --disable-shared \
    --extra-libs=-static \
    --extra-cflags=--static
make
make install
cd ..
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"

Then build the xsystem4 executable with meson,

mkdir build
meson build
ninja -C build

To create a portable executable, it is neccessary to copy some DLLs into the same directory as xsystem4.exe. You can determine the required DLLs with the following command,

ldd build/src/xsystem4.exe | grep mingw64

The fonts and shaders directories must also be shipped together with xsystem4.exe.

Installing

If building from source, run:

ninja -C build install

to install xsystem4 on your system.

Windows

The recommended way to install on Windows is to copy the xsystem4 directory into the game directory. E.g. if Sengoku Rance is installed at C:\Games\AliceSoft\Sengoku Rance, then your filesystem should look something like this:

C:\
    Games\
        AliceSoft\
            Sengoku Rance\
                System40.ini
                xsystem4\
                    xsystem4.exe
                    ...
                ...

Running

You can run a game by passing the path to its game directory to the xsystem4 executable,

build/src/xsystem4 /path/to/game_directory

Alternatively, run xsystem4 from within the game directory,

cd /path/to/game_directory
xsystem4

Windows

If you've installed xsystem4 into the game directory as described above, simply double-click xsystem4.exe to run the game.

S
Description
No description provided
Readme
23 MiB
Languages
C 96.5%
GLSL 2.7%
Meson 0.3%
CMake 0.2%
Scheme 0.2%