CensoredUsername / unrpyc

A ren'py script decompiler
Other
864 stars 157 forks source link

Codegen doesn't make line numbers match #41

Closed jackmcbarn closed 9 years ago

jackmcbarn commented 9 years ago

When decompiling SL1 screens, python blocks' linenumbers are wrong, since codegen doesn't respect the Python AST's line numbers when generating source code.

CensoredUsername commented 9 years ago

The innards for this have been added in codegen, it now has an option to try to keep lineno's matching (this won't be perfect if the ast is broken though, but it'll try its hardest.). It should however guarantee that the result is valid python.

jackmcbarn commented 9 years ago

Due to some more bugs in Ren'Py I found while finishing up implementing this, it looks like I need one more feature. Can you make codegen give some indication of whether its output is all one logical line (i.e. is compatible with "$" and not just "python:")?

CensoredUsername commented 9 years ago

Considering what ren'py thinks what's a logical line vs what is actually a logical line, I'd say just run the result through util.split_logical_lines. (or for performance make a variant which just detects if there are multiple logical lines in something)