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

Suggested changes from #146 / Support renpy 7.5.0 #154

Closed
wants to merge 2 commits into from

Conversation

sigio
Copy link

@sigio sigio commented Sep 3, 2022

No description provided.

@sigio
Copy link
Author

sigio commented Sep 3, 2022

With these fixes I could unrpyc all files from AMomentOfBliss 2.1 and 2.2

@sigio sigio changed the title Suggested changes from #146 Suggested changes from #146 / Support renpy 7.5.0 Sep 3, 2022
@sigio sigio mentioned this pull request Sep 3, 2022
@NWPlayer123
Copy link

The main thing is making sure that pre-7.5.0 still works with these fixes, I haven't had a chance to test yet.

@sigio
Copy link
Author

sigio commented Sep 4, 2022

I'll try some older games that I did without these patches and report back later

@sigio
Copy link
Author

sigio commented Sep 4, 2022

Testing on a set of 3288 rpyc files from various games:
develop branch decompiles: 3214
renpy750 branch decompiles: 74 that develop branch didn't, but
starting from scratch the renpy750 branch only decompiles: 1856

So it's not backwards compatible as is...

@sigio sigio marked this pull request as draft September 4, 2022 13:53
@sigio
Copy link
Author

sigio commented Sep 4, 2022

On a bigger corpus (26972) of files:
25991 files from various games decompile fine:

current 'master/develop' branch has issues with 47 rpyc files from various renpy 7 games
All of these then do decompile with this renpy750 branch

and 110 files from various renpy 8 games ( 580 out of 690 files decompiled)
and all of these also decompile with this branch...

But starting with this branch shows lots of files not decompiling, so it works for everything I have that fails on 'master', but is not backwards compatible.

@Bexa2
Copy link

Bexa2 commented Oct 7, 2022

For some reason the game 'High School Days' fails with renpy.python and works with renpy.revertable
but 'SexNote-0.19.5a-pc' fails with renpy.revertable and works with renpy.python
Is there any way to use both?

Error is the same File "C:\Users\Bexa\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 1829, in load_setitems dict[items[i]] = items[i + 1] TypeError: 'RevertableDict' object does not support item assignment

@MARLBORO-NEW
Copy link

This might help: #156 (comment)

@madeddy
Copy link
Contributor

madeddy commented Nov 9, 2022

Thanks @sigio and @MARLBORO-NEW. Great work! I tested it and so far its mostly error free.

  1. I noticed the pull req has one change from RevertableDict (Workaround - Fix?) #156 missing: magic.py line 112 replace "if args or kwargs:" with "if (args or kwargs) and args != ([],) and kwargs != {}:" Is it unneeded? Update: to my knowledge a change in this place is needed. I use currently if not (any([(), ([], )]) in args) and kwargs != {}: instead of the other code variant.

  2. With every code change of your PR and the one from above, I get a additional error:

Error while decompiling /home/olli/.xlib/RPG/_TRY_OUT/_test/Raptus_RedStarStudios-pc/game/mapscreens.rpyc:
Traceback (most recent call last):
File "/home/olli/Code/Git/unrpyc/unrpyc.py", line 203, in worker
return decompile_rpyc(filename, args.clobber, args.dump, decompile_python=args.decompile_python,
File "/home/olli/Code/Git/unrpyc/unrpyc.py", line 167, in decompile_rpyc
ast = read_ast_from_file(in_file)
File "/home/olli/Code/Git/unrpyc/unrpyc.py", line 140, in read_ast_from_file
data, stmts = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"})
File "/home/olli/Code/Git/unrpyc/decompiler/magic.py", line 604, in safe_loads
encoding=encoding, errors=errors).load()
File "/usr/lib/python3.10/pickle.py", line 1213, in load
dispatch[key[0]](self)
File "/usr/lib/python3.10/pickle.py", line 1698, in load_setitems
dict[items[i]] = items[i + 1]
TypeError: 'RevertableDict' object does not support item assignment
  1. Renpy removed frozenset from its code (see renpy/renpy@8f8b57b), so i decided to try to do the same in unrpyc and it works so far. This is based on v1.1.8, in py3 and with your pull changes included. Its present in https://github.com/madeddy/unrpyc/tree/py3_v1.1.8

Greets

@CensoredUsername
Copy link
Owner

I've made these changes in a backwards compatible manner in f5f973f and 964032f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants