Skip to content

v0.5.0-pre1

Pre-release
Pre-release
Compare
Choose a tag to compare
@ExpHP ExpHP released this 19 Dec 00:46
· 129 commits to main since this release

This prerelease contains a highly experimental and extremely early version of truecl with support for TH06-TH095. (N.B. Th095 is missing signatures)

Disclaimer:
There are many things that may yet still change about the syntax, so it is not advised to use this for developing your own patches yet.

There is no binary for truecl yet!! To use it, you must call truth-core truecl instead of truecl.

# decompile
truth-core truecl d -mmap/any.eclm th06/ecldata1.ecl > ecldata1.ecl.spec

# recompile
truth-core truecl c -mmap/any.eclm ecldata1.ecl.spec -o ecldata1.ecl

A list of known issues with truecl can be found here: #36

Here is the current working copy of the release notes:

Release notes (working copy)

Added

Commands

  • truecl (!!!!) is available in prototype status, but the way to invoke it is a well guarded secret truth-core truecl. TH06-TH095 are supported.
  • Multiple -m args can now be provided.

New language features in support of ECL

  • Function definition syntax for exported subs. void Sub0(int x) {}
  • Natural call syntax for exported subs. Sub0(10, 20.4);
  • Difficulty switches. I0 = A + (3:4:4:5);
  • Difficulty flags. {"ENH"}: ins_10();
  • INF, NAN, PI constants.
  • break keyword. This exits the nearest surrounding loop.
  • offsetof(label) and timeof(label) expressions. You can use these if you want to write a jump using ins_ syntax or the instruction alias. They'll also show up in contrived cases when decompiling an EoSD ECL file that uses conditional jumps in a funny way.
  • @arg0 pseudo-arg. This will be used together with @blob when decompiling timelines with unknown signatures in TH06 and TH07.

Improvements to decompilation

  • Allow detection of if/elseif chains that have no else block.
  • Many improvements to detection of if/elses and loops in general.
  • Decompiling intrinsics will fall back to instruction syntax if the intrinsic cannot be decompiled. (e.g. PCB stage 7 ECL has a set_int instruction that tries to assign to an immediate)
  • Decompiling sub/script/sprite names will fall back to raw integers if the corresponding items don't exist.

Additions to mapfiles

Mapfiles can now define the following additional sections:

  • Difficulty flag names. (!difficulty_flags) The prepackaged maps do this.
  • Intrinsic mappings. (!ins_intrinsics) For instance, a patch which adds a jump intrinsic to MSG could also provide a mapfile which tells trumsg about this intrinsic:
    !msgmap
    !ins_instrinsics
    100 Jmp()
    !ins_signatures
    100 ot
    
    and then you would be able to write loop { }s in MSG!

Internal changes

  • The order of arguments to intrinsics is no longer hardcoded by game/format, but rather inferred from the mapfile signature (meaning it can be defined by the user).
  • Time labels are now internally stored as statements. This drastically simplifies parsing and some aspects of loop compilation/decompilation.

Compatibility notes

  • Using registers (e.g. $REG[8]) in a format without registers such as STD is now detected as an error.
  • If e.g. X is an alias for $REG[3], then using both X and REG[3] in the same function body will now generate a warning. Similarly, using two different aliases (e.g. X and Y) for the same register will also warn.
    • This is done in order to call attention to accidental usage of EoSD's I0 or PCB's "param" registers in subs where these registers are already implicitly in use by function parameters.
  • Previously, using -m mapfile.eclm during decompilation would disable lookup from TRUTH_MAP_PATH. Now that multiple -m are supported, this behavior now seems surprising, so TRUTH_MAP_PATH is now always searched during decompilation.