Tool Ren'Py UnRenGUI, UnRen-forall(v9.4), UnRen-Powershell-forall(v9.4), UnRen-old

5.00 star(s) 3 Votes

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,368
VepsrP,
I tried Unren v7.5.0 v1 today with Love & Sex: Second Base and I think there is a little issue (there's no error while decompiling, but some of the arguments are missing an asterisk) with reconstruct_arginfo.
extrapos and extrakw are deprecated and I see you've added a check for that, but the ArgumentInfo now has starred_indexes and doublestarred_indexes instead ( )
I changed in the util.py
Code:
def reconstruct_arginfo(arginfo):
    if arginfo is None:
        return ""

    rv = ["("]
    sep = First("", ", ")
    for (name, val) in arginfo.arguments:
        rv.append(sep())
        if name is not None:
            rv.append("%s=" % name)
        rv.append(val)
    if hasattr(arginfo, 'extrapos') and arginfo.extrapos:
        rv.append(sep())
        rv.append("*%s" % arginfo.extrapos)
    if hasattr(arginfo, 'extrakw') and arginfo.extrakw:
        rv.append(sep())
        rv.append("**%s" % arginfo.extrakw)
    rv.append(")")

    return "".join(rv)
to
Code:
def reconstruct_arginfo(arginfo):
    if arginfo is None:
        return ""

    rv = ["("]
    sep = First("", ", ")
    for i, (name, val) in enumerate(arginfo.arguments):
        rv.append(sep())
        if i in arginfo.starred_indexes:
            rv.append("*%s" % val)
        elif i in arginfo.doublestarred_indexes:
            rv.append("**%s" % val)
        elif name is not None:
            rv.append("{}={}".format(name, val))
        else:
            rv.append(val)
    if hasattr(arginfo, 'extrapos') and arginfo.extrapos:
        rv.append(sep())
        rv.append("*%s" % arginfo.extrapos)
    if hasattr(arginfo, 'extrakw') and arginfo.extrakw:
        rv.append(sep())
        rv.append("**%s" % arginfo.extrakw)
    rv.append(")")

    return "".join(rv)
and now it works fine. (attached you can find my util.py)
Also wouldn't it make sense to add set as parameter to line 111 in unrpyc.rpy like this?
class_factory = magic.FakeClassFactory((frozenset, PyExpr, PyCode, RevertableList, RevertableDict, RevertableSet, Sentinel, set), magic.FakeStrict)
This way the check if there's an unpickling error in magic.rpy should work without uncommenting it.

Thanks for looking into it. :)
Everything works fine. (y) No more errors are raised. What can not be said about the 8th version of the engine. Which is strange, since I even made a comparison and there are no changes in the code compared to version 7.5. But this is the hint, depending on the version, only the part of the code associated with this version is executed. I'm going to see what is being done on the 8th engine.
 

gnadudu

Well-Known Member
Aug 31, 2018
1,845
2,730
Everything works fine. (y) No more errors are raised. What can not be said about the 8th version of the engine. Which is strange, since I even made a comparison and there are no changes in the code compared to version 7.5. But this is the hint, depending on the version, only the part of the code associated with this version is executed. I'm going to see what is being done on the 8th engine.
Hmm, do you have a list of example games which run with RenPy 8.x and got decomp problems? I could try having a look, maybe I can find something (I think I don't have a game on my regular to play list which updated yet... ^^)
Can't of course promise anything.
 

gnadudu

Well-Known Member
Aug 31, 2018
1,845
2,730
So what can be done?
explain I am still inexperienced
Hmm, need to investigate it a bit further, 79 scripts decompiled without error and 2 failed.
Also the new renpy.ast.RPY and renpy.display.layout.NearRect is used which is new stuff, so there's definitely some coding work necessary.
renpy.ast.RPY should be easy, maybe adding something like the following (not tested) to __init__.py should do the trick:
Code:
    @dispatch(renpy.ast.RPY)
    def print_rpy(self, ast):
        self.indent()
        self.write("rpy {} {}".format(ast.rest[0], ast.rest[1]))
Haven't used NearRect myself nor seen it anywhere, so definitely need todo some code digging for that one...
For the two failed scripts I need to do some debugging, can't say what's wrong on the first glance.
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,368
Hmm, need to investigate it a bit further, 79 scripts decompiled without error and 2 failed.
Also the new renpy.ast.RPY and renpy.display.layout.NearRect is used which is new stuff, so there's definitely some coding work necessary.
renpy.ast.RPY should be easy, maybe adding something like the following (not tested) to __init__.py should do the trick:
Code:
    @dispatch(renpy.ast.RPY)
    def print_rpy(self, ast):
        self.indent()
        self.write("rpy {} {}".format(ast.rest[0], ast.rest[1]))
Haven't used NearRect myself nor seen it anywhere, so definitely need todo some code digging for that one...
For the two failed scripts I need to do some debugging, can't say what's wrong on the first glance.
I managed with RPY. Not as beautiful as you, but it outputs the same thing. renpy.display.layout.NearRect I didn't even notice somehow. So far, only the problem with __builtin__.set.
 
Last edited:

gnadudu

Well-Known Member
Aug 31, 2018
1,845
2,730
I managed with RPY. Not as beautiful as you, but it outputs the same thing. renpy.display.layout.NearRect I didn't even notice somehow. So far, only the problem with __builtin__.set.
Yeah I totally don't get why python3 puts out __builtin__ at that point (The __builtin__ module was moved to builtins in python3)
I tried the python2 version of unrpyc and had no issues to decompile the scripts from IWH and I made a hacky workaround version of unrypc for python3 (see the attached files) but it will definitely need some more work to use it productively... ^^
NearRect is still missing, but I need a break after 4 hours trying to figure out why it works fine in the python2 version but not in the python3 version...

I ask again, are there more example games which use renpy 8 (maybe some where the dev/s don't actively work against people who try to modify their game... :D)
 

"CJ"

Conversation Conqueror
Mar 6, 2021
6,629
69,892

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,368
Yeah I totally don't get why python3 puts out __builtin__ at that point (The __builtin__ module was moved to builtins in python3)
I tried the python2 version of unrpyc and had no issues to decompile the scripts from IWH and I made a hacky workaround version of unrypc for python3 (see the attached files) but it will definitely need some more work to use it productively... ^^
NearRect is still missing, but I need a break after 4 hours trying to figure out why it works fine in the python2 version but not in the python3 version...

I ask again, are there more example games which use renpy 8 (maybe some where the dev/s don't actively work against people who try to modify their game... :D)
You can forget about Nearrect. I overcame it. It turned out to be quite simple. I just added the necessary line to displayable_names in the sl2decompiler file. The game even started working. However, given the protection, it will not bring much benefit for commoner in the game about wife Hana. But at least finally, I can be calm for the version of the tool for the 8 engine. The update will be a little later.
 
May 13, 2020
4,542
36,054
You can forget about Nearrect. I overcame it. It turned out to be quite simple. I just added the necessary line to displayable_names in the sl2decompiler file. The game even started working. However, given the protection, it will not bring much benefit for commoner in the game about wife Hana. But at least finally, I can be calm for the version of the tool for the 8 engine. The update will be a little later.
so now unpack?
 

gnadudu

Well-Known Member
Aug 31, 2018
1,845
2,730
You can forget about Nearrect. I overcame it. It turned out to be quite simple. I just added the necessary line to displayable_names in the sl2decompiler file. The game even started working. However, given the protection, it will not bring much benefit for commoner in the game about wife Hana. But at least finally, I can be calm for the version of the tool for the 8 engine. The update will be a little later.
Hmm, I guess we have to look a bit further into it. Tested it with all the games listed above your post and all of them use RPYC2_HEADER, so far only IWH uses RPYC3_HEADER...
RoveringToSussex also throws some errors/warnings about <class 'renpy.ast.PostUserStatement'> and <class 'renpy.display.transform.Transform'>

I cant extract the archive rpa https://f95zone.to/threads/project-x-v0-1-gecko.124929/
the game using Ren'Py 8.0.1 module error
compressed
The game was made with renpy 7.5.1 (which uses still python2), but the compressed version comes only with python3 executables (the normal version works fine with unren v7.5.0 v2)
Whoever made the compressed version did something wrong here...
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,368
Hmm, I guess we have to look a bit further into it. Tested it with all the games listed above your post and all of them use RPYC2_HEADER, so far only IWH uses RPYC3_HEADER...
RoveringToSussex also throws some errors/warnings about <class 'renpy.ast.PostUserStatement'> and <class 'renpy.display.transform.Transform'>



The game was made with renpy 7.5.1 (which uses still python2), but the compressed version comes only with python3 executables (the normal version works fine with unren v7.5.0 v2)
Whoever made the compressed version did something wrong here...
Okay, I'll see what's up with the other games. At the expense of the header, I also already thought that the variable name seemed to have been different earlier. I'll add an existence check later. As for other problems, I'll have to download the games first. If it's not difficult, can you throw me the archives with the code so that all the games don't download?
 

gnadudu

Well-Known Member
Aug 31, 2018
1,845
2,730
Okay, I'll see what's up with the other games. At the expense of the header, I also already thought that the variable name seemed to have been different earlier. I'll add an existence check later. As for other problems, I'll have to download the games first. If it's not difficult, can you throw me the archives with the code so that all the games don't download?
Sure, here are the scripts which throw warnings. I will have a look at them in the evening myself...
 
  • Like
Reactions: VepsrP
5.00 star(s) 3 Votes