Commit Graph
998 Commits
Author SHA1 Message Date
Nunuhara Cabbage e618017e78 ainedit: support parsing .jaf functions 2020-06-13 13:36:39 -07:00
Nunuhara Cabbage 897cbde39c ainedit: initial .jaf support
Initial support for compiling .jaf (System 4 language) files. So far
this is limited to adding struct definitions and declaring new globals.
The actual bytecode compilation is not yet implemented.

This Bison grammar is based on a C grammar and should cover 95% of the
System 4 language syntax already, though many AST nodes are not yet
implemented.
2020-06-10 21:23:00 -07:00
Nunuhara Cabbage 7b270e5325 alice-tools version 0.5.0 2020-05-30 14:13:40 -07:00
Nunuhara Cabbage 5b2307f2f2 aindump/ainedit: rename macros
.S_LOCALASSIGN is now named .STACK_LOCALASSIGN
.STRING_LOCALASSIGN is now named .S_LOCALASSIGN

.S_PUSH is removed (redundant)

This is a breaking change.
2020-05-30 13:54:50 -07:00
Nunuhara Cabbage e49a666eaa aindump/ainedit: inline strings
Remove the --inline-strings option and implement this behavior as the
default (removing the old behavior). This is done for string only;
messages are still given as integers.

This implementation is a bit different than the broken implementation it
replaces: instead of trying to completely rebuild the string table from
scratch, we simply leave the string table as-is and do a hash-table
lookup to get the corresponding index for all string arguments. If the
string cannot be found, then it is added at the end of the table.

This is NOT implemented for messages because the message table can
contain many duplicate strings and the message index actually matters
for the purpose of tracking previously read messages.

This is a breaking change.
2020-05-30 13:31:32 -07:00
Nunuhara Cabbage 59eb85245f aindump/ainedit: various macros
.LOCALINC2/.LOCALDEC2 are semantically identical to .LOCALINC/.LOCALDEC
except that they represent an uglier instruction sequence which is
frequently used in Rance 10.

.LOCALPLUSA/.LOCALMINUSA and .STRING_LOCALASSIGN do what you would
expect.
2020-05-29 18:54:32 -07:00
Nunuhara Cabbage b5a1de3559 Merge branch 'master' of https://github.com/nunuhara/xsystem4 2020-05-24 19:24:14 -07:00
Nunuhara Cabbage 1306372a56 exbuild: handle include paths correctly
chdir to directory when including files, so that relative paths are
resolved correctly.
2020-05-24 19:13:35 -07:00
Nunuhara Cabbage 767e2afd57 alice-tools 0.4.0
Fix some Windows-specific issues for alice-ar and update READMEs.
2020-05-23 17:46:00 -07:00
Nunuhara Cabbage 1b48941f66 Merge branch 'master' of https://github.com/nunuhara/xsystem4 2020-05-23 12:41:55 -07:00
Nunuhara Cabbage 8f38b6141e alice-ar: various improvements
* Can now extract files from .afa version 3 archives
* Can now extract files from .flat files
  * Includes recursively extracting .flat files contained in other
    archive formats
* Added option to extract images only
* Now converts images to PNG format by default
  * WebP format also supported

Because the table of contents is encrypted in .afa version 3 archives,
the support is a bit limited. Only known file types can be extracted and
they do not retain their original filenames (they are given numbered
filenames instead).
2020-05-23 12:33:40 -07:00
Nunuhara Cabbage 9ab13af34e DCF CG support
For alice-ar. This is a wrapper format for QNT CGs. I have no idea what
the additional metadata is for.
2020-05-21 16:30:12 -07:00
Nunuhara Cabbage 940fcb6931 Support zlib compressed AJP mask 2020-05-18 19:37:00 -07:00
Nunuhara Cabbage 7ff6128686 alice-tools: update README for version 0.3.0 2020-05-18 11:50:10 -07:00
Nunuhara Cabbage 96dcdea7ce Fix various issues with Windows build 2020-05-18 11:49:48 -07:00
Nunuhara Cabbage 05d998886f exdump/exbuild: fix issues with Evenicle2EX.ex
Evenicle2EX.ex uses the previously unknown field data in a different way
that what was assumed. Thanks to that, the unknown data is now more or
less understood:
  * uk0 indicates whether there is a value associated with the field
  * uk1 indicates whether the field is an index
  * uk2 is the value associated with the field, which can be an integer,
    float or string (so far, at least...)

Previously it was assumed that uk2 was a single 32-bit integer, but it
can actually store strings as well. Evenicle 2 is the first game to use
a field with a string value other than the empty string, which breaks
this assumption (the empty string is a 32-bit zero, which is why the old
approach worked).

There is now a new syntax for specifying this data. E.g., a field may
now look like this:
    indexed string s = ""
where it would previously have looked like this:
    string s[1,1,0]

The old syntax is still supported in ainbuild for backwards
compatibility, but is no longer emitted by aindump.

This commit also adds the tool "excmp" which compares two ex files to
see if they are equivalent.
2020-05-18 10:34:43 -07:00
Nunuhara Cabbage 8b77cff70a Add aincmp tool
Tool for comparing ain files. This is used by the script rtt.sh to
ensure that disassembling and then reassembling an ain file produces an
equivalent result.
2020-05-17 17:39:08 -07:00
Nunuhara Cabbage b617449178 aindump/ainedit: initial ain v14 support
Support for Evenicle 2 and Haha Ranman.

There are a few changes in v14:
* a number of new instructions (semantics yet unknown)
* HLL function arguments and return values can now be complex types
  (e.g. arrays, enums)
* support for nested arrays (this isn't necessarily new, but it doesn't
  occur in Rance X at all)
2020-05-17 13:21:37 -07:00
Nunuhara Cabbage 43818e636a ainedit: .S_PUSH/.MSG assembler ops
Assembler ops which add a new string/message to the ain file and emit an
S_PUSH/MSG instruction. E.g. to display a message box in Rance 10:

    .S_PUSH "test"
    CALLHLL system MsgBox -1
    DELETE

The .STR and (old) .MSG ops are renamed to .SETSTR and .SETMSG.
This is a breaking change.
2020-05-06 17:23:38 -07:00
Nunuhara Cabbage 3f57ed1b74 aindump/ainedit: F_STRUCTASSIGN macro
Instruction sequence to assign a float to a struct member.
2020-05-05 16:42:11 -07:00
Nunuhara Cabbage 7c9ad0e69e aindump/ainedit: F_GLOBALASSIGN macro
Instruction sequence for assigning to a global float variable.
2020-05-05 16:36:43 -07:00
Nunuhara Cabbage 3625f53b26 aindump/ainedit: F_LOCALASSIGN macro
Instruction sequence for assigning to a local float variable.
2020-05-04 17:44:55 -07:00
Nunuhara Cabbage 758ac2b505 aindump/ainedit: add S_LOCALASSIGN macro
Instruction sequence for assigning to a local struct variable.
2020-05-04 17:03:14 -07:00
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