Commit Graph
225 Commits
Author SHA1 Message Date
Nunuhara Cabbage 1bf8eb3897 aindump: generic macro matcher
Implement a generic system for matching and emitting macros.
2020-05-03 15:23:34 -07:00
Nunuhara Cabbage 34950cda38 aindump/ainedit: .LOCALASSIGN2 macro
This macro represents the instruction sequence to assign a value on the
stack to a local variable.
2020-05-03 09:20:42 -07:00
Nunuhara Cabbage 09ab45d6ea aindump/ainedit: .PUSHVMETHOD macro
This macro represents the instruction sequence to load a virtual method
number from the currect struct page's vtable onto the stack.
2020-05-03 08:49:03 -07:00
Nunuhara Cabbage bf9ce85079 exdump: fix for broken table in Rance 03
Rance03.ex has a broken table in which a field type does not match the
type of the data in the corresponding column. So rather than aborting
with an error, exdump will now print a warning when dumping this file.
2020-05-01 17:55:55 -07:00
Nunuhara Cabbage 6694eeb683 aindump/ainedit: add POP to *ASSIGN macros
Add the final POP after the ASSIGN to the LOCALASSIGN, GLOBALASSIGN and
STRUCTASSIGN macros. This makes the macros stack-clean.
2020-05-01 16:48:14 -07:00
Nunuhara Cabbage 094ce848b9 aindump/ainedit: STRUCTREF, etc. macros
Same idea as LOCALREF/GLOBALREF, etc. except for accessing struct
members inside of a member function. This is a bit trickier since it
requires knowing which functions belong to which structs, which isn't
directly encoded in the AIN format.
2020-05-01 16:31:12 -07:00
Nunuhara Cabbage cb085f6c5c tools: improve error messages
Add line numbers to error messages
2020-04-28 21:07:40 -07:00
Nunuhara Cabbage 38edfe8a98 aindump/ainedit: more macros
.LOCALINC
.LOCALDEC
.LOCALASSIGN
.LOCALDELETE
.LOCALCREATE
.GLOBALINC
.GLOBALDEC
.GLOBALASSIGN
2020-04-27 22:34:23 -07:00
Nunuhara Cabbage 583daa6e69 exbuild: add note about --old to README 2020-04-27 21:36:16 -07:00
Nunuhara Cabbage dc5fc03f63 exbuild: fix double free
Fix double free when subtables are used. This affected Rance IX and
probably other games.
2020-04-27 18:55:19 -07:00
Nunuhara Cabbage 42923082dc sjis2utf: guard against invalid inputs
Check for invalid byte sequences and replace with '?'.
2020-04-27 18:53:12 -07:00
Nunuhara Cabbage 166854f2c3 aindump/ainedit: .LOCALREF/.GLOBALREF macros
Use macros for some common instruction sequences. E.g.

    PUSHLOCALPAGE
    PUSH <varno>
    REF

becomes,

    .LOCALREF <varname>
2020-04-26 20:58:49 -07:00
Nunuhara Cabbage ac520c8c66 Reduce console message spam 2020-04-25 08:26:14 -07:00
Nunuhara Cabbage f164480f35 Initial fnl (bitmap) font rendering implementation
Enough to get text on the screen, but it isn't pretty. No antialiasing,
kerning, vertical placement isn't correct, probably the size isn't even
quite correct, etc.
2020-04-25 08:09:13 -07:00
Nunuhara Cabbage 99b375acce alice-ar: support extracting ALD and AFA files
Support whole archive, by-index and by-name extraction of files from ALD
and AFA archives.
2020-04-24 22:49:42 -07:00
Nunuhara Cabbage 15ef8caa91 Add fnldump utility
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.
2020-04-08 20:08:45 -07:00
Nunuhara Cabbage 40ce6e2e82 Add webp CG support
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).
2020-04-07 18:41:01 -07:00
Nunuhara Cabbage 9e0ae18a05 Add stubs for SengokuRanceFont.dll
And enough implementation to run up to the intro without crashing.
2020-04-05 19:36:42 -07:00
Nunuhara Cabbage 15cdb10ee0 Implement NEW instruction 2020-04-05 13:44:37 -07:00
Nunuhara Cabbage e2f7adeed8 SACT2: allow SP_Create with unallocated sprite nr
MangaGamer version of Sengoku Rance does this.
2020-04-05 13:18:04 -07:00
Nunuhara Cabbage 576703d141 ini: combine 'var[n] = val' assignments into lists
Create INI_LIST entries from _INI_LIST_ENTRY entries. E.g.

    VolumeValancer[0] = "BGM"
    VolumeValancer[1] = "Sounds"

is equivalent to,

    VolumeValancer = {
        "BGM",
        "Sounds",
    }
2020-03-11 20:36:19 -07:00
Nunuhara Cabbage e4a2e965df Use custom parser for System40.ini
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.
2020-03-10 21:36:28 -07:00
Nunuhara Cabbage 0d74a3b686 Partial MsgLogManager/MsgLogViewer implementation
Enough to get the message log in Sengoku Rance working.
2020-03-08 17:19:19 -07:00
Nunuhara Cabbage 3e1919e17c AJP alpha channel support
Add PMS decoder from xsystem35 for AJP alpha mask.
2020-03-08 10:53:23 -07:00
Nunuhara Cabbage 2d1b8dad3a Partial AJP CG support
Support for AJP without alpha channel.
2020-03-07 21:47:09 -08:00
Nunuhara Cabbage ad7501f962 Implement system.MsgBoxOkCancel 2020-03-06 22:43:42 -08:00
Nunuhara Cabbage 529c7024c2 Move --audit from aindump to xsystem4
Move --audit option from aindump to xsystem4 proper, and implement
auditing of HLL functions.
2020-03-06 21:14:02 -08:00
Nunuhara Cabbage 7f5e155f3e Implement system.OpenWeb 2020-03-05 19:05:10 -08:00
Nunuhara Cabbage 4826686953 Update ex lexer source file 2020-02-29 22:54:51 -08:00
Nunuhara Cabbage cd2280f28f exbuild: use read_file_utf8 for included files 2020-02-29 17:30:20 -08:00
Nunuhara Cabbage 4242882671 tools: Update README for v0.2.1 2020-02-29 17:16:10 -08:00
Nunuhara Cabbage 09dcdb3d14 tools: fix iconv issues on Windows
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.
2020-02-29 16:49:26 -08:00
Nunuhara Cabbage 2be530b65f ainedit: add --transcode option
Add option to change text encoding of an ain file. E.g.

    ainedit --transcode GBK//TRANSLIT -o out.ain in.ain
2020-02-29 15:07:01 -08:00
Nunuhara Cabbage b7c12b1ce0 tools: allow changing input/output text encoding
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
2020-02-28 20:18:28 -08:00
Nunuhara Cabbage 40b67ed7f6 Initial afa archive support
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.
2020-02-25 20:34:51 -08:00
Nunuhara Cabbage be1b5ecc8f Use abstract archive interface for ALD files
In preparation for AFA support in libsystem4.
2020-02-23 18:49:51 -08:00
Nunuhara Cabbage 6e29fee7ed exdump: fix garbled filenames on Windows
Convert filenames to UTF-16 and use _wfopen().
2020-02-23 14:18:52 -08:00
Nunuhara Cabbage 35a88b8669 Add alice-tools README 2020-02-23 11:22:14 -08:00
Nunuhara Cabbage 46243cc795 aindump: prefix files with block index
Workaround for garbled filenames on Windows.
2020-02-23 10:21:31 -08:00
Nunuhara Cabbage 159774a629 exbuild: add --old option
For building pre-Evenicle .ex files, where the table row/column
quantities are reversed.
2020-02-23 09:47:56 -08:00
Nunuhara Cabbage 00f25d698a exdump/exbuild: multiple files support
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.
2020-02-23 08:51:49 -08:00
Nunuhara Cabbage 9576a97e05 exbuild: write (binary) ex file to disk
It is now possible to modify .ex files using exdump and exbuild. E.g.

    exdump -o out.x Rance10EX.ex
    $EDITOR out.x
    exbuild -o Rance10EX.ex out.x
2020-02-22 23:06:32 -08:00
Nunuhara Cabbage c58af1c17f exdump: add -d,--decrypt option
For debugging/reversing purposes.
2020-02-22 22:04:47 -08:00
Nunuhara Cabbage 4a9b928500 Add ainbuild utility
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/
2020-02-20 21:14:13 -08:00
Nunuhara Cabbage 38048ea9e6 Add exdump utility
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.
2020-02-17 19:51:25 -08:00
Nunuhara Cabbage c9dcf6e104 ainedit: convert .MSG/.STR text to shift-jis 2020-02-15 11:55:22 -08:00
Nunuhara Cabbage b8c9072acf ainedit: convert text back to shift-jis 2020-02-15 09:42:16 -08:00
Nunuhara Cabbage 4429bd0990 Fix NEW instruction args in ain v8 and below
NEW was changed in ain v11 to accept 2 arguments.
2020-02-14 22:16:20 -08:00
Nunuhara Cabbage 608aedb500 Fix various issues with MSYS2/mingw build 2020-02-14 16:29:44 -08:00
Nunuhara Cabbage 623f8c8ebf aindump/ainedit: clean up command line arguments
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.
2020-02-14 12:11:01 -08:00