Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore original loop syntax in ECLs #26

Open
ghost opened this issue Aug 21, 2017 · 4 comments
Open

Restore original loop syntax in ECLs #26

ghost opened this issue Aug 21, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Aug 21, 2017

Looking at the NHK World interview with ZUN, you can get a glimpse of what the ecl scripts look like when ZUN is working on them himself. I was able to find a similar piece of code in the final game.

In ZUN's engine loops work in a very simple and straightforward manor

Times(iterations)
{
inner code
}

In the ecl disassembly it looks like

$variable = iterations;
goto endofloop;

startofloop:
inner code

endofloop:
decrement $variable
is the result greater than 0? goto beginofloop;

I was wondering if the original syntax can be restored? It might conflict with if statements as there doesn't seem to be any instruction specifically for these instructions and the compiler ZUN uses just generates the logic for them.

Maybe some mechanic that can peek ahead and do some pattern matching to figure out what is and is not a loop? I see some things that resemble while() loops as well but I am not entirely sure about that.

@ManDude
Copy link
Collaborator

ManDude commented Aug 21, 2017

This is being worked on right now, actually. The ECL scrips will have while(true) loops, for loops, ifs, elses, etc. (I think) to get rid of gotos.

@ghost
Copy link
Author

ghost commented Aug 21, 2017

I see, well this is great news then so I'll be on the look out for updates.

@32th-System
Copy link
Member

The described has been implemented in thtk 12 https://github.com/thpatch/thtk/releases/tag/12

@ManDude
Copy link
Collaborator

ManDude commented Jan 12, 2020

Keeping this open because decompilation does not restore the syntax.

@ManDude ManDude reopened this Jan 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants