Commit Graph
371 Commits
Author SHA1 Message Date
Nunuhara Cabbage 1aaa7eec5a Handle incorrectly cased .acx file names
Fixes an issue in Tsuma Shibori (and probably other games) where .acx
file lookup fails because the actual file name contains characters which
differ in case from the name given in the code.
2021-04-21 20:53:48 -07:00
Nunuhara Cabbage 052ca908b3 Validate keycode in key_is_down 2021-04-19 20:56:42 -07:00
Nunuhara Cabbage 9bc8aa22af Merge pull request #18 from kichikuou/GlobalLoad
system.GlobalLoad() should not call destructors
2021-03-07 09:17:33 -08:00
kichikuou 843a8cf212 system.GlobalLoad() should not call destructors
Fixes #16.
2021-03-07 10:40:05 +09:00
Nunuhara Cabbage 4330d63516 Merge pull request #17 from kichikuou/mtrand
Use mt19937int in libsys4
2021-02-27 12:40:30 -08:00
Nunuhara Cabbage 5252eb079c Update libsys4 2021-02-27 12:38:52 -08:00
kichikuou 7fcffc9b34 Use mt19937int in libsys4 2021-02-27 17:23:25 +09:00
Nunuhara Cabbage 742e145dc0 Merge pull request #15 from kichikuou/voice
Fix voice playback issue in Daibanchou
2021-02-23 16:44:08 -08:00
kichikuou da11820bd5 Fix voice playback issue in Daibanchou
This fixes an issue where wav_unload_slot() stops playing ALL channels
if slot->channel == -1.
2021-02-23 18:32:58 +09:00
Nunuhara Cabbage bd4d0c27b5 Merge pull request #14 from kichikuou/gpx2plus
Gpx2Plus improvements
2021-02-21 08:25:42 -08:00
kichikuou 921502a284 Gpx2Plus: Implement more MsgDraw markup commands
And now it aligns text to bottom if a line has different sized fonts.
2021-02-21 21:14:01 +09:00
kichikuou 3d822bfb37 Gpx2Plus: Implement some basic visual effects
The effect IDs are common with SACT.

Unimplemented effects will fall back to crossfade.
2021-02-21 21:13:56 +09:00
Nunuhara Cabbage 851a19acc1 Work around for FFI heap reallocation bugs
ref types are currently passed to HLL functions as pointers into the
heap. If the HLL function itself needs to allocate memory from the heap,
it can cause the heap to be reallocated, rendering these heap pointers
invalid.

In order to work around this, hll_call now guarantees 64 slots are
available on the heap before calling any HLL function. This is not a
great solution, but it should work to the extent that HLL functions only
allocate a fixed number of heap slots < 64.

This bug could be easily triggered by scrolling up on the message log in
Sengoku Rance.
2021-02-20 20:41:05 -08:00
Nunuhara Cabbage 899e928128 Fix bug in MsgLogViewer 2021-02-20 20:36:39 -08:00
Nunuhara Cabbage bd4c368966 Implement KiwiSoundEngine HLL library
Used in SLC's (?) "media files" patch for the English translated version
of Daibanchou (enables .ogg playback).

This library is largely identical to the SACT2 audio interface.

Currently this doesn't loop .ogg music correctly. From what I remember
SDL_Mixer doesn't support setting custom loop points so this isn't easy
to fix.
2021-02-20 15:17:13 -08:00
Nunuhara Cabbage fabafeea8f Update libsys4
Fixes crash in Daibanchou when loading PMS8 CGs.
2021-02-20 10:23:12 -08:00
Nunuhara Cabbage 25ec470fa9 Merge pull request #13 from kichikuou/daibanchou
Implement the remaining HLLs for Big Bang Age
2021-02-20 10:06:36 -08:00
kichikuou 954d5090ed Implement the remaining HLLs for Big Bang Age
This adds the following HLL libraries:

- BanMisc
- Bitarray
- Confirm
- InputDevice
- MenuMsg
- PlayDemo
- Timer

Big Bang Age (Daibanchou) is mostly playable as of this commit.
2021-02-20 14:39:17 +09:00
Nunuhara Cabbage 77fe2b714d Merge pull request #12 from kichikuou/datafile
Implement DataFile HLL library
2021-02-19 21:05:42 -08:00
Nunuhara Cabbage 9b0dd6d0f1 Fix minor issues
Resolve signed comparison warnings and fix a couple OOB array reads.
2021-02-19 21:04:05 -08:00
kichikuou 89c9c9128e Implement DataFile HLL library
It provides access to data tables in *DA.ald, and is used in Big Bang Age.

mt19937int.c is the first standard version of Mersenne Twister,
downloaded from
http://www.math.sci.hiroshima-u.ac.jp/m-mat/MT/VERSIONS/C-LANG/ver980409.html.
2021-02-20 10:17:55 +09:00
Nunuhara Cabbage a8ab5a27bd Merge pull request #11 from kichikuou/gpx2plus
Implement Gpx2Plus HLL library
2021-02-14 09:15:42 -08:00
kichikuou 57d165fb05 Avoid strndup()
It doesn't compile in Windows.
2021-02-14 17:23:13 +09:00
kichikuou c6d354e22f Implement Gpx2Plus HLL library
Gpx2Plus is the graphics library used in Big Bang Age (which predates
SACT2). Fortunately the underlying graphics primitives are mostly in
common with SACT2, so many functions just call gfx counterparts.

This implementation covers all Gpx2Plus functions used in Big Bang Age.

Caveats:
- Gpx2Plus.EffectCopy() does not apply any effect yet.
- Some markup commands for Gpx2Plus.Msg*() are not implemented yet.
2021-02-14 16:46:46 +09:00
Nunuhara Cabbage 97778403ab Merge pull request #10 from kichikuou/math
Math: Implement RandF, RandTableInit and RandTable
2021-02-13 20:32:21 -08:00
kichikuou bd61781fde Math: Implement RandF, RandTableInit and RandTable
These are used in Big Bang Age.
2021-02-14 12:26:59 +09:00
Nunuhara Cabbage 0aa0f8f249 Update libsys4 2021-02-13 13:22:57 -08:00
Nunuhara Cabbage 6c80e986bf Merge pull request #9 from kichikuou/string
Add tests for #8
2021-02-13 13:21:10 -08:00
kichikuou f54cc239a5 Add tests for #8 2021-02-13 17:44:12 +09:00
Nunuhara Cabbage cf31524092 Update libsys4 2020-12-13 12:36:55 -08:00
Nunuhara Cabbage 75cc1b38b5 Merge branch 'kichikuou-win-fix' into master 2020-12-13 07:43:00 -08:00
kichikuou 61d4f98341 Fix use-after-free in audio.c when mmap is not available
SDL_RWFromConstMem does not copy the memory buffer, so archive_data must
be kept alive until the slot is unloaded.
2020-12-13 22:12:20 +09:00
Nunuhara Cabbage 6874f32589 Fix crash when SDL_VIDEODRIVER=wayland
glewInit returns an error when using the SDL wayland backend because
distro-provided packages are built for GLX instead of EGL.
2020-09-06 11:25:26 -07:00
Nunuhara Cabbage 2bda2b0ea8 SACT2: only render when scene changes
Track dirty status of scene. This cuts the CPU usage roughly in half at
idle. Could be improved further with damage tracking.
2020-09-06 11:06:43 -07:00
Nunuhara Cabbage 678a9a96f0 Fix buffer overflow when recieving high keycodes 2020-09-05 22:12:51 -07:00
Nunuhara Cabbage b5b5fdd8a2 Allow running with no arguments
xsystem4 can now be run from within a game directory with no arguments.
Alternatively, the game directory can be passed instead of the path to
System40.ini.
2020-09-05 10:05:33 -07:00
Nunuhara Cabbage fe0a2aefd7 Fix typo in README 2020-09-05 08:39:13 -07:00
Nunuhara Cabbage 4adb452490 Convert save filenames to UTF-8
Fixes #6
2020-09-05 08:34:56 -07:00
Nunuhara Cabbage c432d8fa2d Provide fallback for missing fonts
If the user-provided font can't be loaded, try to load the default font.
If the default font can't be loaded (e.g. xsystem4 isn't installed), try
to load the default font from the project directory.
2020-09-04 20:54:35 -07:00
Nunuhara Cabbage d30689a8fd Add install target
Also allow running from outside of the source directory once installed.
2020-09-04 20:33:47 -07:00
Nunuhara Cabbage 5d4dfeffb1 Merge branch 'kichikuou-mac-compile' into master 2020-09-04 16:43:37 -07:00
kichikuou db7181ea02 Fix compile error on Mac
Adds `#include <limits.h>` for PATH_MAX.
2020-09-04 22:27:15 +09:00
Nunuhara Cabbage ac0f2eaa13 Merge branch 'kichikuou-mac-opengl' into master 2020-09-03 10:39:31 -07:00
Nunuhara Cabbage 7a5db00085 Merge branch 'mac-opengl' of https://github.com/kichikuou/xsystem4 into kichikuou-mac-opengl 2020-09-03 10:18:43 -07:00
Nunuhara Cabbage a901404d3c Declare global variables extern in headers
Recent versions of gcc seem to emit symbols for unadorned declarations,
leading to linker errors.
2020-09-03 10:15:25 -07:00
kichikuou 7fcacb3c16 Fix OpenGL issues on MacOS
MacOS does not support OpenGL compatibility profile, so the following
changes had to be made:

- Replaced deprecated texture2D() with texture() in shaders
- Renamed `texture` uniform variable to `tex`, to avoid name conflict
- Use VAO, which is mandatory in OpenGL 3 core profile
2020-09-03 23:16:08 +09:00
Nunuhara Cabbage 44706506eb Remove alice-tools
Moved to https://github.com/nunuhara/alice-tools
2020-08-29 11:05:47 -07:00
Nunuhara Cabbage 80b8eacab2 Move libsys4 into separate repository
To allow pulling xsystem4 and alice-tools apart.
2020-08-28 21:32:18 -07:00
Nunuhara Cabbage 300f85db72 Clean up ain_get/ain_add functions
These functions should NEVER return a pointer into the ain object, since
its storage can be realloc'd. Now all get/add functions return an index
which can safely be stored for later use.
2020-08-28 19:28:06 -07:00
Nunuhara Cabbage d9e50ab809 Implement DrawGraph.blend 2020-08-27 17:22:03 -07:00