Commit Graph
329 Commits
Author SHA1 Message Date
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
Nunuhara Cabbage 3f91d84005 Add acxdump and acxbuild tools
Tools for dumping .acx files to csv format and rebuilding them.
2020-08-05 18:59:28 -07:00
Nunuhara Cabbage 6a84c8f802 Fix system.GetTime() and SACT2.Timer_Get()
Fixes slow animations in Sengoku Rance (and presumably other games).
2020-08-02 21:04:35 -07:00
Nunuhara Cabbage 4afd54bb89 ACXLoader: implement GetDataString
Strings are embedded in the rows, making them variable length. So we now
deserialize the whole ACX file in ACXLoader.Load and store them such
that they can be indexed by row/col in constant time.
2020-08-02 14:28:23 -07:00
Nunuhara Cabbage 3d70c81404 ainedit: support reading HLL declarations 2020-08-01 22:19:00 -07:00
Nunuhara Cabbage 3eeb18f7bf ainedit: support Hentai Labyrinth 2020-07-31 21:27:07 -07:00
Nunuhara Cabbage 44802acb48 aindump: support Hentai Labyrinth
Even though this game is still ain v14, it makes an incompatible change
to the file format: struct definitions now contain a list of functions
at the end (I believe this is a listing of the struct's vtable).

There is now a system for tracking the minor version of the ain file
format. This is a made up value, determined by the file name of the ain
file.

This commit also fixes an issue where the empty string was being added
as a new string to the string table when rebuilding ain files with
ainedit.
2020-07-31 20:42:08 -07:00
Nunuhara Cabbage 5b962886be aindump: don't print indices when dumping messages 2020-07-30 20:56:26 -07:00
Nunuhara Cabbage c2aae50dca Various improvements to SengokuRanceFont/fnl 2020-07-30 20:55:17 -07:00
Nunuhara Cabbage a8b2e91053 alice-ar: fix bug when extracting linked webp
Need to pass the archive as an argument so that base CGs can be
retrieved.
2020-07-30 20:41:24 -07:00
Nunuhara Cabbage 86568bc610 Merge branch 'master' of https://github.com/nunuhara/xsystem4 2020-07-12 16:11:28 -07:00
Nunuhara Cabbage 81a947d74d Partial InputString hll implementation
Not implemented: display of intermediate results.
2020-07-12 16:10:10 -07:00
Nunuhara Cabbage bbd57b9f23 Fix A_ALLOC on ref array types 2020-07-12 15:46:13 -07:00
Nunuhara Cabbage 3e9dd0474b Fix memcpy overlap in string_erase 2020-07-12 15:45:13 -07:00
Nunuhara Cabbage 0e4e52a25d Refactor audio to enable bgm looping
SDL_mixer reads loop information from WAV files if you use the Mix_Music
interface, but NOT the Mix_Chunk interface. So bgm now uses the
Mix_Music interface to get proper looping.

There's also some code here for reading bgi files (taken from xsystem35)
but it's not actually used. There doesn't seem to be a simple way to set
up custom loops with SDL_mixer.
2020-07-12 12:07:40 -07:00
Nunuhara Cabbage 58da6dc167 Refactor system4.h
Move xsystem4-specific declarations to xsystem4.h.
2020-07-12 09:17:52 -07:00
Nunuhara Cabbage 5f28db91dd alice-tools 0.5.1 2020-07-12 06:23:46 -07:00
Nunuhara Cabbage 98aa213f41 ainedit: fix bugs identified in #2
Treat CR characters as whitespace and remove redundant/buggy string hash
table from asm.c.
2020-07-12 06:19:38 -07:00
Nunuhara Cabbage f9eaef7717 Fix encoding issue with macro generation
Fixes #2.

The problem here was that init_member_functions assumed ASCII or SJIS
encoding of function/struct names in the ain file. Now it will convert
to UTF-8 when analyzing member functions.

This commit also removes the --ain-encoding option to ainedit.
--output-encoding should always match the encoding of the input ain
file. --transcode can be used to change the encoding before running
running further ainedit commands.
2020-07-11 11:10:18 -07:00
Nunuhara Cabbage 0113e34eaa jaf: refactor declarations
struct definitions are now a type of declaration, instead of being part
of a type specifier. They can only be declared at top-level, and
variables can no longer be attached to the declaration.
2020-07-10 17:25:36 -07:00