Use the correct argument types for all instructions, with the exception
of SH_REF_LOCAL_ASSIGN_STRUCTREF2 which I could find an example of.
List all system calls.
v11 ain files have 3 new instructions, and 3 modified instructions. It
looks like they decided to break compatibility with this release by
adding arguments to some instructions.
v12 adds one instruction.
The 'lint' type in system 4 is NOT a 64-bit integer type. It is actually
a signed 32-bit integer type that is clamped between 0 and INT32_MAX.
Negative numbers can be assigned to a lint using SH_LOCALASSIGN (or at
least, the unofficial compiler emits such code) but LI_* instructions
always produce a positive result.
I'm guessing System40.exe converts lints to 64-bit integers for doing
arithmetic, and then clamps the result to the 32-bit integer range
before writing back to a variable.
This fixes a bug in Sengoku Rance where units would become invincible in
commander battles after their HP fell below zero.
Replace many instruction arguments with names/values (strings/messages,
local/global variables, structs, functions, etc.) and add labels to jump
targets.
- Create separate directories for source and header files.
- Build code shared between xsystem4 and aindump as a static library.
- Create header dirs gfx/ system4/ and vm/
- Make CG.c/h usable without a running VM
This covers enough of the music/sound functions to get the few games I
tried working.
Looping is not properly implemented here. Unfortunately, loop offsets
are stored in a "bgi" file which appears to be encypted. There are two
options for fixing this: (1) the proper solution, crack the bgi
encryption and read the offsets from that file, or (2) read the loop
offsets from the "smpl" chunk in the wav file. (2) is easier but it will
only work for wav files (not ogg).
Swap order of arguments in call to qsort.
Also modify array_* interfaces so that they do not take pointers into
the heap. Passing around pointers into the heap is dangerous since it
can be reallocated at unexpected times.
Array rank can't be inferred from JSON data since arrays and structs are
indistinguishable. So we get it from the ain file instead.
Sengoku Rance is mostly playable as of this commit.
Sprites are now rendered to an off-screen texture which is then rendered
to the screen in gfx_swap. The sprite table in sact_graphics is set up
so that sprites[-1] provides access to this off-screen texture.
Sengoku Rance uses 1400 and 1700 for FW_NORMAL and FW_BOLD rather that
400 and 700.
Text surfaces now have a transparent white background instead of a
transparent black background. This looks better in SR since it uses a
lot of white text/white outlines. The underlying problem is that the
color value of completely transparent pixels is blended with the glyph
color when blitting to the text surface.
If Chibi-Scheme is installed, enable a debugger which can be used to
inspect the state of the VM when an error occurs.
So far only supports printing local/global variables. E.g.
dbg> (print-variable "g_theSactMenu")
...
dbg> (print-locals)
...