Add tool for extracting bitmap fonts from .fnl files (font archives).
This is mainly for testing the underlying .fnl reading code, which is
needed for proper font rendering in the MangaGamer version of Sengoku
Rance. In the future this tool could be updated to support rebuilding
font archives, which would allow adding special glyphs, using condensed
fonts, etc.
Credit to CookieWukk for reverse engineering the .fnl file format.
For the MangaGamer version of Sengoku Rance. This makes libwebp a
dependency.
These webp files have a non-standard metadata block appended to them
which specifies the base CG that should be used for unfilled pixels,
where "unfilled" means any pixels with a pure magenta color (255,0,255).
This is not really a standard ini file, so a custom parser is needed to
access all of the information stored in it (specifically, lists like
"LoadDLL").
This commit also makes flex/bison a hard dependency.
Need to use libiconv on Windows. libiconv doesn't accept all of the same
encoding names as the glibc iconv. In particular, CP932 needs to be used
instead of SJIS-WIN.
Use iconv instead of utfsjis.h so that text encodings other than UTF-8
and SJIS can be used. For three reasons:
* to allow using other encodings for dumped files (e.g. UTF-16, SJIS)
* to support existing Chinese translations, which use GBK-encoded text
* to support theoretical translations to other languages that can't be
represented in SJIS
Very incomplete implementation. Capable of reading the file table and
not much else.
Also add the "alice-ar" utility for testing. Eventually this tool should
support modifying ald and afa archives. For now only supports dumping
the afa file table.
The -s,--split option to exdump can be used to split the dump into
multiple files (one per top-level data structure). The output file when
using the split option contains #include directives to stitch the full
dump back together when given to exbuild.
Tool for reading and rebuilding dumped .ex files. Currently this only
reads a file on stdin then redumps it to stdout.
Also, move tools code into src/tools/
Add tool for dumping the contents of .ex files, which contain various
structured data used by the game (tables, lists, trees).
The dump format uses a C-like syntax which should be relatively easy to
parse back in.
Use enums for long option values, and run dumps in the order they're
specified on the command line. Also, --no-strings mode is made the
default and a --inline-strings option is added to get the old (broken)
behavior.
Add -t,--text option to read files produced by 'aindump -t ...'.
The workflow here is:
* dump the text with 'aindump -t -o <outfile> ...'
* $EDITOR <outfile>
* locate the text you want to edit, remove the leading semicolon (i.e.
uncomment it) and edit the string as desired.
* reinsert the modified text with 'ainedit -t <outfile> ...'
If the filenames section isn't present, try to guess the filenames from
the functions defined in the file. This works pretty well for most of
the core engine files but gives pretty crappy results for scenario
files.
This feature is primarily intended to be used when dumping the code
section to multiple files (not yet implemented).
Add a pseudo instruction to represent switch case labels, along with the
infrastructure to support pseudo instructions in general. .CASE takes
two arguments: a switch:case index (e.g. "12:8") and the value to match
against.
Also, add a --no-strings option to both programs to allow modifying the
code without changing the string/message tables. This is needed for now
since rebuilding the string/message tables (as currently implemented)
causes serious bugs in Rance X (and probably other games).
Running the following command should produce an ain file that is almost
bit-for-bit identical to the input file (the only difference being minor
drift in floating point constants):
aindump -c --no-strings in.ain | ainedit -c - --no-strings -o
out.ain in.ain
The ainedit utility is a tool capable of modifying AIN files up to
version 12 (Rance X). As far as I know, this is the first publicly
released tool that can handle AIN files above version 7.
The basic mode of operation is as follows:
* dump the CODE section with aindump
* edit the disassembled bytecode
* assemble & insert the edited bytebode back into the original AIN file
using ainedit
E.g.
aindump -c -o out.jam /path/to/Rance10.ain
$EDITOR out.jam
ainedit -c out.jam -o out.ain /path/to/Rance10.ain
mv /path/to/Rance10.ain /path/to/Rance10.ain.backup
mv out.ain /path/to/Rance10.ain
ainedit is also capable of editing declarations (structures, functions,
etc.) using the JSON (-j) output from aindump.
There is currently one major deficiency in this tool: it does not
rebuild the AIN file's switch table (SWI0 section). This means that you
can't insert or delete instructions, as it would render the addresses
stored in the switch table invalid. I hope to fix this soon.
A number of changes have also been made to the aindump utility, since
these tools need to work together.
Don't generate SJIS with initial byte 0x80. I'm guessing that sjis2utf
handles initial byte 0x80 the way it does for compatibility reasons, but
there is no reason for utf2sjis to generate this coding.
Dump everything except the code to a JSON file.
With both the disassembled code and this JSON file in hand, it should be
possible to reconstruct the original AIN file.
Keep a stack of functions which gets pushed/popped on FUNC and ENDFUNC
instructions, respectively. Since methods do not get an ENDFUNC (for
whatever reason), this stack has to be a fixed size and discard the
oldest value when pushed to (otherwise it would grow indefinitely).
This fixes a bug when dumping the code of Ixseal, where a lambda's
ENDFUNC would clear dasm->func while the parent function was still being
disassembled. Interestingly, this doesn't become an issue in Rance X
because the code is more indirect in how it accesses local variables (no
SH_LOCAL* instructions).