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

RevertableDict (Workaround - Fix?) #156

Closed
MARLBORO-NEW opened this issue Oct 20, 2022 · 15 comments
Closed

RevertableDict (Workaround - Fix?) #156

MARLBORO-NEW opened this issue Oct 20, 2022 · 15 comments

Comments

@MARLBORO-NEW
Copy link

MARLBORO-NEW commented Oct 20, 2022

Tried a few things and was able to make it work with 4 changes:
unrpyc.py line 85 replace "renpy.python" with "renpy.revertable"
magic.py line 112 replace "if args or kwargs:" with "if (args or kwargs) and args != ([],) and kwargs != {}:"
util.py line 222 replace "if arginfo.extrapos:" with "if hasattr(arginfo,'extrapos') and arginfo.extrapos:"
util.py line 225 replace "if arginfo.extrakw:" with "if hasattr(arginfo,'extrakw') and arginfo.extrakw:"

I'm no qualified dev so use at your own risk. So far worked for every RPYC I tested (with python 2.7 on macos)

@MARLBORO-NEW MARLBORO-NEW changed the title RevertableDict (Workaround - Fix? RevertableDict (Workaround - Fix?) Oct 20, 2022
@Mzyxptlk
Copy link

Mzyxptlk commented Oct 26, 2022

I've used the same fix in unrpyc.py on lines 80 and 90, for RevertableList and RevertableSet, respectively. Unfortunately, while this fixes some games that fail to decompile with v1.1.8, it breaks some other games that work fine with v1.1.8, so YMMV.

@LordVenom
Copy link

Hello, someone would have un.rpy compile with the modification?

@renkerenke
Copy link

Thank you for the workaround! No idea what you used for testing but it works flawlessly with the current version of Tales from the Unending Void.

@CensoredUsername
Copy link
Owner

@MARLBORO-NEW could you please state what this is supposed to fix 😅

@MARLBORO-NEW
Copy link
Author

Lol, as stated in the title this should fix the RevertableDict error that shows up on most recent games. Same error reported on various other posts.

@CensoredUsername
Copy link
Owner

If you don't write down what game / ren'py version something occurs with I have a hard time trying to reproduce the error or fix ;) There's a reason there's a section on issue reporting in the README to keep this section somewhat organized. Honestly, I really want to just delete issues that do not even take the time to provide enough information. If you name your whole issue just the name of a type and then refuse to provide any information in the issue it costs me a lot more time to figure it out. I spent a lot of time on this tool and provided people it free of charge, so please understand that I'm not very amused if people cannot even take the time to actually write a full sentence on what the actual problem is, or keep making new issue threads for the same bug.

For reference, the correct approach would be to make an issue, put Ren'py version: TypeError: 'RevertableDict' object does not support item assignment in the title, provide the requested info in the issue comment and if you have one, provide the workaround you found in a comment. That way I can actually work on it if I find some time instead of having to trawl thought the absolute mess this issue tracker is right now.

@MARLBORO-NEW
Copy link
Author

MARLBORO-NEW commented Dec 4, 2022 via email

@MARLBORO-NEW
Copy link
Author

@CensoredUsername : Sorry previous reply was done while in rush and by reading it I realise it sounds rude.
English not my native language and being in a rush I expressed myself very poorly (yet does not not excuse it).
So really sorry.
What I meant to say it's that I tried to link all the other treads referring to the same issue. Thought by avoiding to repeat everything that was already said in this thread you would have less to read and merge.
Obviously it's not a good practice, sorry for that. It's my first post on Github and I'm not a IT professional so, excuse me for the noob way.
Will avoid repeating same errors.

@CensoredUsername
Copy link
Owner

Hey, no offense taken. I just get a lot of really bad issue requests so I've found I need to be really strict on it lest people just file stuff like "Doesn't work with game x" - "see title" or "doesn't work with python 3.10" where people clearly didn't even bother to read the readme. I do appreciate the contribution, it's just a bit nicer to keep it in the already existing issue thread and mark / close any other duplicates to link towards that one. Less threads to police that way.

@madeddy
Copy link
Contributor

madeddy commented Dec 8, 2022

@MARLBORO-NEW

  1. unrpyc.py line 85 replace "renpy.python" with "renpy.revertable"
  2. magic.py line 112 replace "if args or kwargs:" with "if (args or kwargs) and args != ([],) and kwargs != {}:"
  3. util.py
    a. line 222 replace "if arginfo.extrapos:" with "if hasattr(arginfo,'extrapos') and arginfo.extrapos:"
    b. line 225 replace "if arginfo.extrakw:" with "if hasattr(arginfo,'extrakw') and arginfo.extrakw:"

I used your code with some changes(especially item 1.; with help from user@VepsrP), added set to class factory and packed it together to a PR. The pull from sigio isn't enough to cover all new Ren'py incompatibility. So thanks for your share in this.

I you're interested check #161

@DoctorBooooom
Copy link

DoctorBooooom commented Jan 23, 2023

Got decompile error too (with latest version on unrpyc):

PS C:\Users\DB\Desktop\unrpyc-master> py -2 .\unrpyc.py .\location.rpyc
Decompiling .\location.rpyc to .\location.rpy...
Error while decompiling .\location.rpyc:
Traceback (most recent call last):
  File "C:\Users\DB\Desktop\unrpyc-master\unrpyc.py", line 202, in worker
    tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
  File "C:\Users\DB\Desktop\unrpyc-master\unrpyc.py", line 165, in decompile_rpyc
    ast = read_ast_from_file(in_file)
  File "C:\Users\DB\Desktop\unrpyc-master\unrpyc.py", line 138, in read_ast_from_file
    data, stmts = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"})
  File "C:\Users\DB\Desktop\unrpyc-master\decompiler\magic.py", line 599, in safe_loads
    encoding=encoding, errors=errors).load()
  File "C:\Python27\lib\pickle.py", line 864, in load
    dispatch[key](self)
  File "C:\Python27\lib\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

File: https://mega.nz/file/rCwlQbpZ#0_ssCNLbUtGZ3kN-h2tx1RsD7vApSO2ej1w2S8hW2DM

Windows-10-10.0.19041
Ren'Py 7.5.3.22090809

@madeddy
Copy link
Contributor

madeddy commented Jan 27, 2023

The actual official unrpyc is only compatible with RenPy below version 7.5 and the fixes posted here are regrettably incomplete.

If you`re somewhat proficient with python, you can try and play around with the fixed unrpyc versions in my fork. Especially the one based on last unrpyc 1.1.8 or the very adventurous 1.2.0 version.

@B01scout
Copy link

The actual official unrpyc is only compatible with RenPy below version 7.5 and the fixes posted here are regrettably incomplete.

If you`re somewhat proficient with python, you can try and play around with the fixed unrpyc versions in my fork. Especially the one based on last unrpyc 1.1.8 or the very adventurous 1.2.0 version.

Thanks for the pull request! Decompiling of 94 files worked.
image

@awcator
Copy link

awcator commented Oct 24, 2023

Thank you this works even in 2023 Oct

@CensoredUsername
Copy link
Owner

These issues should be properly fixed on dev now for ren'py 7.5

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

No branches or pull requests

9 participants