CensoredUsername / unrpyc

A ren'py script decompiler
Other
824 stars 149 forks source link

Ren'Py 7.5.3.22090809: TypeError: 'RevertableDict' object does not support item assignment #166

Closed rapsys closed 4 months ago

rapsys commented 1 year ago

Thank's for your project, I am under mageia linux, python2 version: Python 2.7.18 (default, Oct 9 2022, 06:38:55) [GCC 10.4.0] on linux2

I tried master and dev branch, I tried maddy fork as well without success.

I tried to decompiles the following rpyc files to cheat in a game and got these errors:

Decompiling minigames/beats/BeatsMinigameLabel.rpyc to minigames/beats/BeatsMinigameLabel.rpy...
Error while decompiling minigames/beats/BeatsMinigameLabel.rpyc:
Traceback (most recent call last):
  File "unrpyc.py", line 202, in worker
    tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
  File "unrpyc.py", line 165, in decompile_rpyc
    ast = read_ast_from_file(in_file)
  File "unrpyc.py", line 138, in read_ast_from_file
    data, stmts = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"})
  File "unpack/unrpyc/decompiler/magic.py", line 599, in safe_loads
    encoding=encoding, errors=errors).load()
  File "/usr/lib64/python2.7/pickle.py", line 864, in load
    dispatch[key](self)
  File "/usr/lib64/python2.7/pickle.py", line 1139, in load_reduce
    value = func(*args)
  File "unpack/unrpyc/decompiler/magic.py", line 113, in __new__
    raise FakeUnpicklingError("{0} was instantiated with unexpected arguments {1}, {2}".format(cls, args, kwargs))
FakeUnpicklingError: <class 'set'> was instantiated with unexpected arguments ([],), {}

Decompilation of 1 file failed
Decompiling minigames/CardCombatDuel/combat.rpyc to minigames/CardCombatDuel/combat.rpy...
Error while decompiling minigames/CardCombatDuel/combat.rpyc:
Traceback (most recent call last):
  File "unrpyc.py", line 202, in worker
    tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
  File "unrpyc.py", line 165, in decompile_rpyc
    ast = read_ast_from_file(in_file)
  File "unrpyc.py", line 138, in read_ast_from_file
    data, stmts = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"})
  File "unpack/unrpyc/decompiler/magic.py", line 599, in safe_loads
    encoding=encoding, errors=errors).load()
  File "/usr/lib64/python2.7/pickle.py", line 864, in load
    dispatch[key](self)
  File "/usr/lib64/python2.7/pickle.py", line 1212, in load_setitems
    dict[stack[i]] = stack[i + 1]
TypeError: 'RevertableDict' object does not support item assignment

Decompilation of 1 file failed
Decompiling minigames/CardCombatDuel/deck_edit.rpyc to minigames/CardCombatDuel/deck_edit.rpy...
Error while decompiling minigames/CardCombatDuel/deck_edit.rpyc:
Traceback (most recent call last):
  File "unrpyc.py", line 202, in worker
    tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
  File "unrpyc.py", line 165, in decompile_rpyc
    ast = read_ast_from_file(in_file)
  File "unrpyc.py", line 138, in read_ast_from_file
    data, stmts = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"})
  File "unpack/unrpyc/decompiler/magic.py", line 599, in safe_loads
    encoding=encoding, errors=errors).load()
  File "/usr/lib64/python2.7/pickle.py", line 864, in load
    dispatch[key](self)
  File "/usr/lib64/python2.7/pickle.py", line 1139, in load_reduce
    value = func(*args)
  File "unpack/unrpyc/decompiler/magic.py", line 113, in __new__
    raise FakeUnpicklingError("{0} was instantiated with unexpected arguments {1}, {2}".format(cls, args, kwargs))
FakeUnpicklingError: <class 'set'> was instantiated with unexpected arguments ([],), {}

Decompilation of 1 file failed
Decompiling minigames/CardCombatDuel/script/screens/arena.rpyc to minigames/CardCombatDuel/script/screens/arena.rpy...
Error while decompiling minigames/CardCombatDuel/script/screens/arena.rpyc:
Traceback (most recent call last):
  File "unrpyc.py", line 202, in worker
    tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
  File "unrpyc.py", line 165, in decompile_rpyc
    ast = read_ast_from_file(in_file)
  File "unrpyc.py", line 138, in read_ast_from_file
 Decompilation of 1 file failed
Decompiling minigames/CardCombatDuel/script/screens/combat_help_article.rpyc to minigames/CardCombatDuel/script/screens/combat_help_article.rpy...
Error while decompiling minigames/CardCombatDuel/script/screens/combat_help_article.rpyc:
Traceback (most recent call last):
  File "unrpyc.py", line 202, in worker
    tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
  File "unrpyc.py", line 165, in decompile_rpyc
    ast = read_ast_from_file(in_file)
  File "unrpyc.py", line 138, in read_ast_from_file
    data, stmts = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"})
  File "unpack/unrpyc/decompiler/magic.py", line 599, in safe_loads
    encoding=encoding, errors=errors).load()
  File "/usr/lib64/python2.7/pickle.py", line 864, in load
    dispatch[key](self)
  File "/usr/lib64/python2.7/pickle.py", line 1139, in load_reduce
    value = func(*args)
  File "unpack/unrpyc/decompiler/magic.py", line 113, in __new__
    raise FakeUnpicklingError("{0} was instantiated with unexpected arguments {1}, {2}".format(cls, args, kwargs))
FakeUnpicklingError: <class 'set'> was instantiated with unexpected arguments ([],), {}

Decompilation of 1 file failed
Decompiling minigames/Massage/Massage.rpyc to minigames/Massage/Massage.rpy...
Error while decompiling minigames/Massage/Massage.rpyc:
Traceback (most recent call last):
  File "unrpyc.py", line 202, in worker
    tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
  File "unrpyc.py", line 165, in decompile_rpyc
    ast = read_ast_from_file(in_file)
  File "unrpyc.py", line 138, in read_ast_from_file
    data, stmts = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"})
  File "unpack/unrpyc/decompiler/magic.py", line 599, in safe_loads
    encoding=encoding, errors=errors).load()
  File "/usr/lib64/python2.7/pickle.py", line 864, in load
    dispatch[key](self)
  File "/usr/lib64/python2.7/pickle.py", line 1139, in load_reduce
    value = func(*args)
  File "unpack/unrpyc/decompiler/magic.py", line 113, in __new__
    raise FakeUnpicklingError("{0} was instantiated with unexpected arguments {1}, {2}".format(cls, args, kwargs))
FakeUnpicklingError: <class 'set'> was instantiated with unexpected arguments ([],), {}

Decompilation of 1 file failed
Decompiling minigames/photoshoot/photoshoot.rpyc to minigames/photoshoot/photoshoot.rpy...
Error while decompiling minigames/photoshoot/photoshoot.rpyc:
Traceback (most recent call last):
  File "unrpyc.py", line 202, in worker
    tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
  File "unrpyc.py", line 165, in decompile_rpyc
    ast = read_ast_from_file(in_file)
  File "unrpyc.py", line 138, in read_ast_from_file
    data, stmts = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"})
  File "unpack/unrpyc/decompiler/magic.py", line 599, in safe_loads
    encoding=encoding, errors=errors).load()
  File "/usr/lib64/python2.7/pickle.py", line 864, in load
    dispatch[key](self)
  File "/usr/lib64/python2.7/pickle.py", line 1212, in load_setitems
    dict[stack[i]] = stack[i + 1]
TypeError: 'RevertableDict' object does not support item assignment

Decompilation of 1 file failed
Decompiling minigames/photoshoot_studio_minigame/photoshoot_studio_minigame.rpyc to minigames/photoshoot_studio_minigame/photoshoot_studio_minigame.rpy...
Error while decompiling minigames/photoshoot_studio_minigame/photoshoot_studio_minigame.rpyc:
Traceback (most recent call last):
  File "unrpyc.py", line 202, in worker
    tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
  File "unrpyc.py", line 165, in decompile_rpyc
    ast = read_ast_from_file(in_file)
  File "unrpyc.py", line 138, in read_ast_from_file
    data, stmts = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"})
  File "unpack/unrpyc/decompiler/magic.py", line 599, in safe_loads
    encoding=encoding, errors=errors).load()
  File "/usr/lib64/python2.7/pickle.py", line 864, in load
    dispatch[key](self)
  File "/usr/lib64/python2.7/pickle.py", line 1139, in load_reduce
    value = func(*args)
  File "unpack/unrpyc/decompiler/magic.py", line 113, in __new__
    raise FakeUnpicklingError("{0} was instantiated with unexpected arguments {1}, {2}".format(cls, args, kwargs))
FakeUnpicklingError: <class 'set'> was instantiated with unexpected arguments ([],), {}

Decompilation of 1 file failed
Decompiling minigames/SeXoniX/joystick.rpyc to minigames/SeXoniX/joystick.rpy...
Error while decompiling minigames/SeXoniX/joystick.rpyc:
Traceback (most recent call last):
  File "unrpyc.py", line 202, in worker
    tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
  File "unrpyc.py", line 165, in decompile_rpyc
    ast = read_ast_from_file(in_file)
  File "unrpyc.py", line 138, in read_ast_from_file
    data, stmts = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"})
  File "unpack/unrpyc/decompiler/magic.py", line 599, in safe_loads
    encoding=encoding, errors=errors).load()
  File "/usr/lib64/python2.7/pickle.py", line 864, in load
    dispatch[key](self)
  File "/usr/lib64/python2.7/pickle.py", line 1139, in load_reduce
    value = func(*args)
  File "unpack/unrpyc/decompiler/magic.py", line 113, in __new__
    raise FakeUnpicklingError("{0} was instantiated with unexpected arguments {1}, {2}".format(cls, args, kwargs))
FakeUnpicklingError: <class 'set'> was instantiated with unexpected arguments ([],), {}

Decompilation of 1 file failed
Decompiling minigames/SeXoniX/sexonix.rpyc to minigames/SeXoniX/sexonix.rpy...
Error while decompiling minigames/SeXoniX/sexonix.rpyc:
Traceback (most recent call last):
  File "unrpyc.py", line 202, in worker
    tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
  File "unrpyc.py", line 165, in decompile_rpyc
    ast = read_ast_from_file(in_file)
  File "unrpyc.py", line 138, in read_ast_from_file
    data, stmts = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"})
  File "unpack/unrpyc/decompiler/magic.py", line 599, in safe_loads
    encoding=encoding, errors=errors).load()
  File "/usr/lib64/python2.7/pickle.py", line 864, in load
    dispatch[key](self)
  File "/usr/lib64/python2.7/pickle.py", line 1139, in load_reduce
    value = func(*args)
  File "unpack/unrpyc/decompiler/magic.py", line 113, in __new__
    raise FakeUnpicklingError("{0} was instantiated with unexpected arguments {1}, {2}".format(cls, args, kwargs))
FakeUnpicklingError: <class 'set'> was instantiated with unexpected arguments ([],), {}

Decompilation of 1 file failed
Decompiling minigames/webcam_cat_game/webcam_cat_game.rpyc to minigames/webcam_cat_game/webcam_cat_game.rpy...
Error while decompiling minigames/webcam_cat_game/webcam_cat_game.rpyc:
Traceback (most recent call last):
  File "unrpyc.py", line 202, in worker
    tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
  File "unrpyc.py", line 165, in decompile_rpyc
    ast = read_ast_from_file(in_file)
  File "unrpyc.py", line 138, in read_ast_from_file
    data, stmts = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"})
  File "unpack/unrpyc/decompiler/magic.py", line 599, in safe_loads
    encoding=encoding, errors=errors).load()
  File "/usr/lib64/python2.7/pickle.py", line 864, in load
    dispatch[key](self)
  File "/usr/lib64/python2.7/pickle.py", line 1139, in load_reduce
    value = func(*args)
  File "unpack/unrpyc/decompiler/magic.py", line 113, in __new__
    raise FakeUnpicklingError("{0} was instantiated with unexpected arguments {1}, {2}".format(cls, args, kwargs))
FakeUnpicklingError: <class 'set'> was instantiated with unexpected arguments ([],), {}

Decompilation of 1 file failed
rapsys commented 1 year ago

I placed the archive as zip as github don't fucking want tgz, 7z and tar.xz formats !!! minigames.zip

rapsys commented 1 year ago

Files extracted from MCR2-0.7.12192extra

madeddy commented 1 year ago

Thanks for reporting. However:

  1. Current official Unrpyc doesn't support RenPy versions 7.5 and higher.
  2. This issue is already known (#149 and #146) and resolved. Solutions can be viewed in nonofficial forks(like mine) or in the pull requests section.

Greets

rapsys commented 1 year ago

@madeddy Ok, I understood better by looking at pull request https://github.com/CensoredUsername/unrpyc/pull/161

For a simple user like me with basic knowledge and some developper background (no python sadly), it's too complicated to find that information and sorry it would never have crossed my mind to go look in a pull request for a working solution...

Woudn't it be possible to ask @CensoredUsername to create a special branch Renpy_7x_8x_unsupported where all pull request are merged and document at the base README.md to try that branch when using renpy 7.x and 8.x with a collection of often encountered errors (set, reversestuff, etc) ?

Or document where to find the forks + branch to use to try our luck in that README.md ?

People will not cherrypick git commits until they may convert the .rpyc to .rpy to change, cheat or understand something, but pull a git branch is easy, report it through a documented guideline:

This way people would still get a chance at getting what they want and you would be able to spend time on real problems, not waste it on useless non existing after service which will grow only exponentialy as more and more renpy developper (if you may call them that) will migrate their game to the latest versions.

Best regards

CensoredUsername commented 8 months ago

Woudn't it be possible to ask @CensoredUsername to create a special branch Renpy_7x_8x_unsupported where all pull request are merged and document at the base README.md to try that branch when using renpy 7.x and 8.x with a collection of often

If I had the time for that I'd've just fixed it to begin with. Hopefully I can get back to it soon. It's a bit more complicated than just keeping track of all things due to various backwards compatability hazards.

Thank you for the thorough bug report and test files.

CensoredUsername commented 4 months ago

Your files now decompile without errors on the dev branch. There might still be some 7.5 features that aren't implemented yet that are missing, I'll investigate those soon.

CensoredUsername commented 4 months ago

Should be fixed in the current release, please reopen if it isn't.