The "SaveFolder" key in System40.ini gives the name of the save
directory. Earlier versions of system 4 treated this as a relative path
in the game directory, while later versions treated it as a path
relative to "$USER\My Documents\AliceSoft\$GAME_NAME". I've chosen the
latter approach, but using a xsystem4-specific directory to avoid
reading/overwriting saves created by System40.exe.
system.GlobalSave
system.GlobalLoad
system.GroupSave
system.GroupLoad
Save files are uncompressed JSON objects for now. Compatibility with
System40.exe saves would be nice, but the format appears to be
encrypted.
Minifying & compressing the JSON should be done at some point but for
debugging purposes I've left it totally uncompressed.
This commit also fixes a bunch of undefined behavior when assigning to
'heap[...]' with an rvalue that could initiate a realloc of the heap.
5 functions:
SACT2.SP_SetDrawMethod
DrawGraph.CopyStretch
DrawGraph.CopyStretchAmap
DrawGraph.CopyReduce
DrawGraph.CopyReduceAmap
SP_SetDrawMethod is not pixel-perfect to System40.exe, but its pretty
close.
I'm not sure what the difference between the Stretch/Reduce functions is
supposed to be. They seem to do the same thing.
Also, the ugly macros in sdl_draw.c are replaced by higher-order
functions.
With this commit, Sengoku Rance runs up to the menu without exiting due
to unimplemented HLL functions.
Sprites are now rendered directly, rather than being blitted to a master
surface which is then copied to a texture. Every sprite now carries an
SDL_Texture in addition to an SDL_Surface (we need both, since
SDL_Texture doesn't give read-access to the pixel data).
All of the image-manipulation code is now in sdl_draw.c, and the
DrawGraph_* functions are now wrappers. Some games (Daibanchou at least)
use an API other than SACT2/DrawGraph, so these operations should be
generic to avoid duplication.
Also implement a feature to track leaked heap memory (DEBUG_HEAP).
With this, it is now possible to hold CTRL through the entire Rance II
digest version without crashing.
Implement all of the simple copy functions, with the exception of
DrawGraph.CopyColorReverse, which is undocumented and appears to be dead
code (at least in the version of SACT2 that shipped with the SDK).
Really lazy implementation for now, just draws all sprites every frame.
In the future should implement proper compositing with damage tracking.
All CG types other than QNT are removed. From what I've seen, System 4
games use QNT, PNG, AJP (encrypted JPEG) and DCF (seems to be a format
for partial CG updates). QNT is by far the most common format.