unrpyc icon indicating copy to clipboard operation
unrpyc copied to clipboard

Suggested changes from #146 / Support renpy 7.5.0

Open sigio opened this issue 3 years ago • 7 comments

sigio avatar Sep 03 '22 14:09 sigio

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

sigio avatar Sep 03 '22 14:09 sigio

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.

NWPlayer123 avatar Sep 03 '22 18:09 NWPlayer123

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

sigio avatar Sep 04 '22 13:09 sigio

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 avatar Sep 04 '22 13:09 sigio

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.

sigio avatar Sep 04 '22 14:09 sigio

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

Bexa2 avatar Oct 07 '22 22:10 Bexa2

This might help: https://github.com/CensoredUsername/unrpyc/issues/156#issue-1416743346

MARLBORO-NEW avatar Oct 25 '22 08:10 MARLBORO-NEW

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 #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 https://github.com/renpy/renpy/pull/3414/commits/8f8b57bd3eeb28bfec24e9693a42c75d84981278), 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

madeddy avatar Nov 09 '22 00:11 madeddy

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

CensoredUsername avatar Feb 12 '24 03:02 CensoredUsername