Commit Graph
998 Commits
Author SHA1 Message Date
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
Nunuhara Cabbage d69bc33449 Don't create stubs for unimplemented HLL functions
hll_call() prints the same message as the old stub functions if no
implementation is provided. This makes the --audit option more accurate.
2020-08-26 17:30:22 -07:00
Nunuhara Cabbage 3ee8fff8ae Implement File.Delete 2020-08-25 19:39:49 -07:00
Nunuhara Cabbage 815dc7da92 Return correct year in File.GetTime
localtime returns year relative to 1900.
2020-08-25 17:47:59 -07:00
Nunuhara Cabbage b04b0c3018 Implement system.Reset 2020-08-25 17:47:45 -07:00
Nunuhara Cabbage fbd7e00604 Fix memory leaks in A_REALLOC and A_ERASE 2020-08-24 19:03:57 -07:00
Nunuhara Cabbage 05453e54c0 alice-tools 0.6.0 2020-08-23 13:45:48 -07:00
Nunuhara Cabbage 2813767648 Fix memory leaks in A_PUSHBACK and A_FILL 2020-08-23 12:52:19 -07:00
Nunuhara Cabbage b2d543aed6 Fix memory leak in S_MOD 2020-08-19 17:26:34 -07:00
Nunuhara Cabbage b9cfd47202 Fix memory leak in json_load_page
Need to unref initial values set by alloc_struct/alloc_array when
loading pages.
2020-08-19 17:10:25 -07:00
Nunuhara Cabbage c03cb519c4 alice-ar: support extracting Ogg from afa v3
Support extracting audio archives from Evenicle 2 and beyond.
2020-08-18 16:47:10 -07:00
Nunuhara Cabbage add47b1859 ain: don't read initval for AIN_STRUCT variables
Fixes issue with Evenicle 2 English trial version.
2020-08-18 15:20:57 -07:00
Nunuhara Cabbage 45fe648af0 Fix Array.Sort(NULL)
Do integer sort when NULL function is given.
2020-08-16 19:58:00 -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 92b58ad8a5 Implement MsgSkip HLL
Implemented as flat binary file.
2020-08-16 11:33:21 -07:00
Nunuhara Cabbage 16b0fb4830 Fix SACT2.SP_TextNewLine
Y-increment should be relative to current position, not home position.
2020-08-16 09:01:08 -07:00
Nunuhara Cabbage 45ebe96220 Handle explicitly set char spacing
Handle char spacing set up by SACT2.SP_SetTextCharSpace and
DrawGraph.SetFontSpace.
2020-08-15 10:33:23 -07:00
Nunuhara Cabbage 3be0133f21 Fix spacing in DrawGraph text API
Render each character individually so that we control the spacing.
2020-08-15 10:19:22 -07:00
Nunuhara Cabbage c621535b2f SACT2.SP_TextNewLine: add line spacing
Add line spacing (set by SACT2.SP_SetTextLineSpace).
2020-08-15 09:57:11 -07:00
Nunuhara Cabbage 76f7e21c95 Improve stack trace
Stack traces now list addresses in addition to function names.
Additionally, debugger stack traces number each frame, and the numbers
can be used together with the PRINT-LOCALS function to print the values
of local variables for any frame on the stack.
2020-08-10 15:51:33 -07:00
Nunuhara Cabbage 1a0a0e0c12 debugger: breakpoints
This is implemented by inserting special opcodes into the game's code.
When the breakpoint handler is finished, it returns the original opcode
so that execute_instruction can continue executing normally.

E.g.

* start xsystem4 with --debug option to drop into debugger immediately
* run (bp "game_main")
* ^d or \exit to close debugger REPL
* ...drop into a debugger REPL again at the game_main function
2020-08-09 12:41:33 -07:00
Nunuhara Cabbage bd8ad5583a Read configuration from .xsys4rc config file
global config in $XSYSTEM4_HOME/.xsys4rc (default ~/.xsys4rc)
game-specific config in <game-dir>/.xsys4rc

Supported options so far are "font-mincho" and "font-gothic". Syntax is
the same as System40.ini. E.g.

    font-mincho = "/home/user/.fonts/msmincho.ttc"
2020-08-07 19:12:51 -07:00
Nunuhara Cabbage 80f0e7b436 Allow specifying font paths on command line 2020-08-05 19:53:23 -07:00
Nunuhara Cabbage 6addc801d8 Force fixed-width font rendering.
MS Mincho/MS Gothic are have the nice property that latin characters are
exactly half the size of full-width characters. English translated games
depend on this to determine where line breaks are placed. We now force
text to be rendered with this spacing to prevent overflow issues.

Most open source mincho/gothic fonts do not even have fixed width latin
glyphs. The two fonts included in this commit are the closest I could
find, and the mincho font is still not quite good enough (there is a bit
of overlap on adjacent characters sometimes).
2020-08-05 19:20:07 -07:00