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

fix let* format, new on stack guessing case, type failure, handle casts #1860

Merged
merged 3 commits into from
Sep 8, 2022

Conversation

water111
Copy link
Collaborator

@water111 water111 commented Sep 8, 2022

Fixes #1821 by adding a special case for new method calls where the argument with type symbol is actually an address to uninitialized structure on the stack.

Fixes #1849 (or at least the cause of the issue Vaser gave in chat, and one random one I found in debug-sphere)

Fixes #1853

Fixes #1857 by moving the cast into the cond if the body is a single form and the destination type is a bitfield/enum which is likely to work well. Seems to work on the examples we could find in jak 1 and jak 2.

Also fixes an issue with casts on the result of handle->process (a common place to use casts)

the output of process->handle is a plain process. Most of the time, you end up casting this to a more specific. If you add a cast on every use of the variable, the decompiler will decide to change the type of that variable to the more specific type, and this breaks the handle cast.

so previously it was impossible to get code like

    (let* ((s2-0 (the-as swingpole (handle->process (-> self control hack))))
           (gp-0 (-> s2-0 dir))
           )

But now it will work

@water111 water111 merged commit f3c63f2 into master Sep 8, 2022
@water111 water111 deleted the w/j2-decompiler-fixes branch September 8, 2022 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant