truth
truth copied to clipboard
Olde ECL
Olde ECL Tracking issue
- [x] Timeline arg0 comp and decomp
- [x] EoSD args
- [x] split
cmp
/jmp
- [x] split intrinsic decompilation and compilation
- [x]
offsetof
andtimeof
compilation - [x]
offsetof
andtimeof
decompilation - [ ]
goto label @ timeof(label)
should probably be allowed (does not parse currently)
- [x] broken
if
decompilation - [x] add rest of intrinsics for EoSD
- [x] test register allocation in EoSD
- [x] compile AssignOp syntax
- [ ] decompile AssignOp syntax?
- [x] find nicer difficulty flag syntax
- [x] difficulty switches
- [x] compile simple
- [x] compile complex
- [x] decide on semantics in abstract tree. Most importantly, are mismatched lengths allowed within an expression?
- [x] support difficulty in AST VM so that
expr_compile
tests can be written - [x] write
expr_compile
tests - [x] decompile
- [x] maybe find out what the four upper bits do in IN where it does funny things for familiars, idfk
- from dai: bits 5 and 6 in the difficulty mask in IN are for focused/unfocused respectively. It's how Keine's attacks change depending whether you're focusing or unfocused
- [x] Look into behavior of unused flags:
- ALL games use 0xFF for most instructions
- EOSD, PCB use just 0x01 for easy, 0x02 for normal (unused flags get cleared)
- IN onwards use 0xF1 for easy, 0xF2 for normal (unused flags stay active)
- in TD, two more bits become "used" for extra and overdrive
- [x] fix the way that the first
difficulty
label in a difficulty switch tends to end up outside of a decompiled block - [x] Bring back warning on blob len not divisible by 4 but be lenient to decompiled EoSD somehow, idfk
- [x] Fix the error when printing a null span from a core mapfile (
cargo test --test=integration_suite -- --ignored
) - [ ] fix lack of round-tripping
$REG[-10009] = 240 / 6;
- [ ] idea for capabilities: something like
(10 & ($I2 + 3))
should produce an error with two spans, "$I2 is not const" and "const required because no instruction exists for&
"
- [ ] idea for capabilities: something like
- [ ] possibly want intrinsics for
--x
and++x
. (EoSD opcodes 18, 19) - [x] call syntax :NotLikeAlice:
- [x] ~~allow high-level
Signature
s to have params that expect const args~~ - [x] warn on footgunny usage of I0 and F0 inside a function body with a named parameter in EoSD
- [x] similar for
ARG_
in PCB. Important becauseARG_{A,B,R,S}
may be modified by code that usesRAND_RANGE
- [x] ~~allow high-level
- [x] PCB
RAND
variables behave differently for int and float so_f($RAND)
compiling into%RAND
is not cool- [ ] zero mentions variables only readable as a single type is similar
- [ ] zero mentions variables only readable as a single type is similar
- [x] EoSD doesn't cast. Add warnings on cast operators. There isn't much you can do about mismatched sigils though...? (they DO happen)
- [x] th07
- [x] calls
- [x] th08
- [x] th09
- [x] th095
- [x] benchmark!!!!! especially with all that intrinsic stuff
- [ ] see below, intrinsic stuff needs work
- [x] loops are apparently semantically equivalent to
if (--X > 0) goto label;
- [x] this has some serious implications for roundtrippability...
- [x] helpful error messages will be needed when using the wrong syntax for the current language
- [ ] Finish local stash with tests. There's an unfortunate bit where a trick used to simplify alias analysis ends up ruining the suggestions.
- [x] if you decompile a sub number that's out of range it shouldn't add the
Sub
prefix. This goes in hand with the decision not to validate raw sub indices during compilation. - [x]
break
- [x] add to AST, probably by making
ast::StmtGoto
an enum - [x] compilation
- [x] nested loops are dangerous!!
- [x] add to AST, probably by making
- [x] IN has no timeline arg0 and EoSD timelines have no difficulty
- [x] IN timeline signatures shouldn't error when there's no
T(_)
- [x] IN Difficulty switches don't decompile due to contiguous flags check; instead, the default-enabled flags should be checked to match and they should be present on the pulled-out instruction
- [ ] warn when using
offsetof(label)
in a time argument or vice versa. I've made this mistake numerous times myself... - [x]
--no-diff-switches
- [x] IN core signatures
- [ ] ~~conditional call syntax. Or not. Not is definitely an option.~~
- [ ] Double check names of
F
andU
difficulty flags by looking at things that depend on them - [ ]
{"-F"}
evaluating to having no ENHL flags seems like a bad footgun... - [ ] importing ANM files
- [ ] might want syntax for different sub types
Weird idea, but could it possibly make sense to split up the current concept of a "function"? It seems like a lot of the potential ECL sub jank is mutually exclusive depending on how the sub is used:
- Only regular calls and new engine asyncs can have arguments.
- Only regular calls and interrupts can use return without breaking horribly.
- Only regular calls can return values.
- Only callbacks and old engine asyncs can reuse the current context in a different sub.
- Only subs used with enemy_create can inherit register values from a parent enemy.
Because of how little overlap there is between the different types of sub, it seems like a good idea to error/warn if the types are mismatched in certain ways.
- [ ] change timelines to use
script
and give them an SclScriptenum
Bench results (OLD = 57e0528c2969, NEW = d780f5d01b497dd3), 23.1GB free on SSD
./update-dumps.py --anm --game 095:18 --noverify
OLD 1 OLD 2 NEW 1 NEW 2
anm-compile 72.209 72.112 73.333 73.357
anm-decompile 127.906 128.097 128.076 128.371
Not the best benchmark because it includes the time of copying uncompressed bitmaps (which often won't be the case for users), but the difference seems "measurable."
Original issue contents
.....yeah. I guess I've been putting ECL off for long enough, huh?