CensoredUsername / unrpyc

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

RevertableDict (Workaround - Fix?) #156

Closed MARLBORO-NEW closed 4 months ago

MARLBORO-NEW commented 1 year ago

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)

Mzyxptlk commented 1 year ago

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 commented 1 year ago

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

renkerenke commented 1 year ago

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 commented 1 year ago

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

MARLBORO-NEW commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Hi, ok. Just delete my message.Was trying to help as quiet a lot of posts already have the same report. Found a workaround and was just trying to help those still not able to use the tool.But if providing a workaround, referencing all the posts about the same topic so you don’t need to look for all of them is still not enough….go ahead.I do have a working solution.RegardsSent from my iPhoneOn 4 Dec 2022, at 21:47, CensoredUsername @.***> wrote: 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.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

MARLBORO-NEW commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 8 months ago

Thank you this works even in 2023 Oct

CensoredUsername commented 4 months ago

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