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

5.00 star(s) 3 Votes

Madeddy

Active Member
Dec 17, 2017
838
487
I prefer the idea of full integration with the engine...
I think both ways have pros and contras. In the end its probably a question of taste of the developer with which dis-/advantages he wants to deal.
In general, I figured out the byte classes and properties. ... in the dev branch.
I will take a look.
Edit: Huh? I cannot even get your unrpyc to run... without inside a batch etc... I placed it in the games root or he would have bitched about not finding renpy for imports.

Bash:
$ python2 unrpyc.py --clobber /home/olli/.xlib/RPG/_TRY_OUT/_test/Raptus_RedStarStudios-rec/game
Traceback (most recent call last):
File "unrpyc.py", line 36, in <module>
import renpy.object
File "/home/olli/.xlib/RPG/_TRY_OUT/_test/Raptus_RedStarStudios-rec/renpy/__init__.py", line 54, in <module>
from renpy.compat import PY2, basestring, bchr, bord, chr, open, pystr, range, round, str, tobytes, unicode # *
File "/home/olli/.xlib/RPG/_TRY_OUT/_test/Raptus_RedStarStudios-rec/renpy/compat/__init__.py", line 61, in <module>
import future.standard_library
ImportError: No module named future.standard_library
Question: Do you know of any renpy 7.5 games good for testing unrpyc? They're harder to come by as one thinks. Not too big if possible.
 
Last edited:

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,384
I think both ways have pros and contras. In the end its probably a question of taste of the developer with which dis-/advantages he wants to deal.
I will take a look. Edit: Huh? I cannot even get your unrpyc to run... without inside a batch etc... I placed it in the games root or he would have bitched about not finding renpy for imports.

Bash:
$ python2 unrpyc.py --clobber /home/olli/.xlib/RPG/_TRY_OUT/_test/Raptus_RedStarStudios-rec/game
Traceback (most recent call last):
File "unrpyc.py", line 36, in <module>
import renpy.object
File "/home/olli/.xlib/RPG/_TRY_OUT/_test/Raptus_RedStarStudios-rec/renpy/__init__.py", line 54, in <module>
from renpy.compat import PY2, basestring, bchr, bord, chr, open, pystr, range, round, str, tobytes, unicode # *
File "/home/olli/.xlib/RPG/_TRY_OUT/_test/Raptus_RedStarStudios-rec/renpy/compat/__init__.py", line 61, in <module>
import future.standard_library
ImportError: No module named future.standard_library
Question: Do you know of any renpy 7.5 games good for testing unrpyc? They're harder to come by as one thinks. Not too big if possible.
CorruptedLove, ToBeAKing, DarkMagic. As for the root of the game - I have everything built around it: Batch, PowerShell script and import in python.:BootyTime:
 

Madeddy

Active Member
Dec 17, 2017
838
487
As for the root of the game - I have everything built around it: Batch, PowerShell script and import in python.:BootyTime:
:eek:

Hell... o_O I need to run this really completely in Renp'ys python? That's a bad idea. Gah! OK, whatever.

Anyway, i think you uploaded a modified version for some game, because there are some places where he try's to load some "YVANeusEX" stuff. I cannot run it like this.
Python:
try:
    from renpy.loader import YVANeusEX
except:
    pass
from renpy import script
if(hasattr(script, 'RPYC2_HEADER')):
    RPYC_Header = script.RPYC2_HEADER
    ...
raw_contents = YVANeusEX.encrypt(bytearray(raw_contents[1]), YVANeusEX.cipherkey, True) + YVANeusEX.encrypt(
    bytearray(raw_contents[2]), YVANeusEX.cipherkey, True)
Edit: Forget it. I edited everything of this stuff out.

I got it running to the point where the SLscreen error and the one for RevertableDict happens like in your tests. I test it with the version from your main branch (without fixes -yes). I wanted to see if i find another source for the SLscreen error, but i didn't. I guess this comes from running it through renpy and this isnt exactly planed for unrpyc. I get this error not in my version...
CorruptedLove, ToBeAKing, DarkMagic.
Ah, thanks. Will look.
 
Last edited:

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,384
:eek:

Hell... o_O I need to run this really completely in Renp'ys python? That's a bad idea. Gah! OK, whatever.

Anyway, i think you uploaded a modified version for some game, because there are some places where he try's to load some "YVANeusEX" stuff. I cannot run it like this.
Python:
try:
    from renpy.loader import YVANeusEX
except:
    pass
from renpy import script
if(hasattr(script, 'RPYC2_HEADER')):
    RPYC_Header = script.RPYC2_HEADER
    ...
raw_contents = YVANeusEX.encrypt(bytearray(raw_contents[1]), YVANeusEX.cipherkey, True) + YVANeusEX.encrypt(
    bytearray(raw_contents[2]), YVANeusEX.cipherkey, True)
Edit: Forget it. I edited everything of this stuff out.

I got it running to the point where the SLscreen error and the one for RevertableDict happens like in your tests. I test it with the version from your main branch (without fixes -yes). I wanted to see if i find another source for the SLscreen error, but i didn't. I guess this comes from running it through renpy and this isnt exactly planed for unrpyc. I get this error not in my version...
Ah, thanks. Will look.
I suggest you inserting print(asp.__dict__) for the mapscreens.rpyc file in the sl2decompiler file before the 60th line and see what is output.
 

Madeddy

Active Member
Dec 17, 2017
838
487
I suggest you inserting print(asp.__dict__) for the mapscreens.rpyc file in the sl2decompiler file before the 60th line and see what is output.
1. I did already different try's yesterday but got just shit. A dict conversion didn come to mind... :p But how helpful can this be, if the structure of a AST different is? (How is a AST even structured? :unsure:)

Anyway, i noticed "location" is sometimes missing and thats what bangs in your unrpyc version. Should'n skipping it if location is missing be enough?

2. Your revertable fix in dev does still throw errors here in the test. I think your commits from 13. Nov. did break it again, the first solution from 12. Nov did work for me.
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,384
1. I did already different try's yesterday but got just shit. A dict conversion didn come to mind... :p But how helpful can this be, if the structure of a AST different is? (How is a AST even structured? :unsure:)

Anyway, i noticed "location" is sometimes missing and thats what bangs in your unrpyc version. Should'n skipping it if location is missing be enough?

2. Your revertable fix in dev does still throw errors here in the test. I think your commits from 13. Nov. did break it again, the first solution from 12. Nov did work for me.
You don't have permission to view the spoiler content. Log in or register now.
As you can see from the screenshot, everything is decompiling perfectly, although I haven't checked in the game, errors may pop up there. On account of __dict__ - it outputs the attributes of the object. Any ast in python is a simple object.
Edit: can you create a separate branch with the implemented changes? I'll download it and check it myself.
Edit2: The game has started, but whether there are problems in breaking the logic is unknown, but in theory there should not be.
 
Last edited:

Madeddy

Active Member
Dec 17, 2017
838
487
Edit: can you create a separate branch with the implemented changes? I'll download it and check it myself.
Which version? Yours of unrpyc or mine?
I tested with your dev version from 13. Nov. Only change was to outcomment the import of YVANeurEX, because its nowwhere in my test-games.
Now i tested the current dev version from your GH; without any changes:
You don't have permission to view the spoiler content. Log in or register now.
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,384
Which version? Yours of unrpyc or mine?
I tested with your dev version from 13. Nov. Only change was to outcomment the import of YVANeurEX, because its nowwhere in my test-games.
Now i tested the current dev version from your GH; without any changes:
It's strange, in theory, the commit from 13 was supposed to solve the problem, not create it. I thought you took the changes and added them to your code instead of using mine entirely. Write print(class_factory.__dict__) before line 597 in magic.py and show what is output in problem areas. :unsure:
 

Madeddy

Active Member
Dec 17, 2017
838
487
... I thought you took the changes and added them to your code instead of using mine entirely...
My version runs completely without errors so far. Without renpy dependence, in native py3.10 and with v7.5 AND v8 games. Like already explained i did the Revertable a bit different, but overall in the same direction you did. Its here:
It should run with every py from v3.6+

I was simply curious what all the changes in your version do and why you get errors with your version i did not see with mine(SLscreen error). So i encountered the RevertableDict-error again, although you said its fixed. Curious thing.

print(class_factory.__dict__)
You don't have permission to view the spoiler content. Log in or register now.
 
Last edited:

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,384
My version runs completely without errors so far. Without renpy dependence, in native py3.10 and with v7.5 AND v8 games. Like already explained i did the Revertable a bit different, but overall in the same direction you did. Its here:
It should run with every py from v3.6+

I was simply curious what all the changes in your version do and why you get errors with your version i did not see with mine(SLscreen error). So i encountered the RevertableDict-error again, although you said its fixed. Curious thing.

Outcome of this:

If you don't mind asking, in which timezone do you live? I wondered at which times you hang up here etc., in case there is some error to talk about or other interesting thing. I'm in "MEZ" or "CET" in the english term.
python.Revertable for some reason is not in its place, but in some separate module, which is full for the first time, and empty for the second time. From somewhere, Label and Understatement appeared, which, together with Revertable, are in some kind of cache and not in special_cases, as it should be. a rather strange initial state of the class_factory variable. :unsure:
I have class_cache going ahead and it's just empty in this place, and for some reason some of your classes have gone there, including those that should not be in theory.
My TimeZone is UTC+5.
 

Madeddy

Active Member
Dec 17, 2017
838
487
My TimeZone is ...
Thanks. Yeah i thought so. I think we talked a year back or so already about the zones. Four hours ahead, so its aleady late for you. Need to remember. Btw. you can remove the info if you want.
python.Revertable for some reason is not in its place,...
I corrected the other post and added the full error output. For some reason i posted accidentally just one block.
Yeah, its strange if it works for you and here not. I thought just it could be important. Maybe beacause i'm sitting in Linux? Sometimes a few things react different... In the end, if your version works in Windows and in your Unren, then you do not need to break a sweat because of the error i get here.
 
Last edited:

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,384
Thanks. Yeah i thought so. I think we talked a year back or so already about the zones. Four hours ahead, so its aleady late for you. Need to remember. Btw. you can remove the info if you want.
I corrected the other post and added the full error output. For some reason i posted accidentally just one block.
Yeah, its strange if it works for you and here not. I thought just it could be important. Maybe beacause i'm sitting in Linux? Sometimes a few things react different... In the end, if your version works in Windows and in your Unren, then you do not need to break a sweat because the error i get here.
I really wonder where this difference comes from and where class_cache comes from, which in theory should be empty. I was also thinking about Linux. Unless it has to do with how the code is run. I assume that not using a batch file. :unsure:
 

Madeddy

Active Member
Dec 17, 2017
838
487
I really wonder where this difference comes from and where class_cache comes from, which in theory should be empty....
As you said cache, i got a idea: I erased just now the __PyCache__ dir which is made by Python alongside the unrpyc scripts, but another run did give no better result. Again the errors... I thought maybe the cache was not updated.

Another idea: Did you try with the game i test here? Name is in the debug to see.
... I was also thinking about Linux. Unless it has to do with how the code is run. I assume that not using a batch file. :unsure:
Did you tr to run your version naked? I mean, without batch or QT stuff. Just unrpyc.py deobfuccate.py and the full decompiler dir...

Another crazy thing i did just now was to run my unrpyc version through Ren'pys python and it worked! Without issue. :oops: I'm surprised.
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,384
Another crazy thing i did just now was to run my unrpyc version through Ren'pys python and it worked! Without issue. :oops: I'm surprised.
This is logical, given that if the Renpy version does not match, then there may be problems during decompilation, I am generally silent about python. :HideThePain:
Edit: As for the version of the tool that works from an external python, I have not yet transferred new solutions there, and I don't even remember when I launched pure unrpyc. :unsure:
 

Madeddy

Active Member
Dec 17, 2017
838
487
Hm. OK. But you should try it pure before you pack it. I think its better to see it first running outside, but thats just my view on things. :whistle:

I encountered in a test of your version with the game Sister in Law a new bug. Its a v7.4.4 game:
Bash:
$ ./SisterinLaw-.04.06-pc/lib/linux-x86_64/python /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/unrpyc.py --clobber /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/
Decompiling /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/tl/None/common.rpymc to /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/tl/None/common.rpym...
Decompiling /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/silscreens.rpyc to /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/silscreens.rpy...
Decompiling /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/script.rpyc to /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/script.rpy...
Error while decompiling /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/script.rpyc:
Traceback (most recent call last):
File "/home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/unrpyc.py", line 266, in worker
tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
File "/home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/unrpyc.py", line 217, in decompile_rpyc
data, ast = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"})
UnboundLocalError: local variable 'raw_contents' referenced before assignment

Decompiling /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/screens.rpyc to /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/screens.rpy...
Decompiling /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/options.rpyc to /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/options.rpy...
Decompiling /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/gui.rpyc to /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/gui.rpy...
Decompilation of 5 files successful, but decompilation of 1 file failed
I think it could be, because you reinstantiate the global instance class_factory localy anew inside a function. A Nonlocal to global. If you look at my version, thats the reason i do the instancing of the two versions of class_factory at the beginning.
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,384
Hm. OK. But you should try it pure before you pack it. I think its better to see it first running outside, but thats just my view on things. :whistle:

I encountered in a test of your version with the game Sister in Law a new bug. Its a v7.4.4 game:
Bash:
$ ./SisterinLaw-.04.06-pc/lib/linux-x86_64/python /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/unrpyc.py --clobber /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/
Decompiling /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/tl/None/common.rpymc to /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/tl/None/common.rpym...
Decompiling /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/silscreens.rpyc to /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/silscreens.rpy...
Decompiling /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/script.rpyc to /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/script.rpy...
Error while decompiling /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/script.rpyc:
Traceback (most recent call last):
File "/home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/unrpyc.py", line 266, in worker
tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
File "/home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/unrpyc.py", line 217, in decompile_rpyc
data, ast = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"})
UnboundLocalError: local variable 'raw_contents' referenced before assignment

Decompiling /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/screens.rpyc to /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/screens.rpy...
Decompiling /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/options.rpyc to /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/options.rpy...
Decompiling /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/gui.rpyc to /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/gui.rpy...
Decompilation of 5 files successful, but decompilation of 1 file failed
I think it could be, because you reinstantiate the global instance class_factory localy anew inside a function. A Nonlocal to global. If you look at my version, thats the reason i do the instancing of the two versions of class_factory at the beginning.
I had exactly the same problem but already in your code when I tried to run it through batch. But already with the data variable in def revertable_switch(raw_dat). I even started trying to fix it, but then I realized that the game is not on that version of the engine.

I understood why there is a problem. The correction in this block should be in another function, now I will rewrite this section.

And by the way, I just remembered. What is the problem with the YVANeusEX module? I have it overlaid with try except, so there shouldn't be a problem. Except the one I got, I'm trying to import it without a dot at the beginning. For some reason without it (although still in the error handler) the code stopped executing at all and even without any messages. :unsure:
Edit: Updated the code. Already in the repository.
 
Last edited:

Madeddy

Active Member
Dec 17, 2017
838
487
...revertable_switch(raw_dat). ... now I will rewrite this section.
...
You can copy my code if it works in your version and if you want. I have now problem with it. :coffee:
And by the way, I just remembered. What is the problem with the YVANeusEX module? I have it overlaid with try except, so there shouldn't be a problem. ...
Don't ask me whats going on there. Its a enigma. Really
At the beginning it banged a few times as i did test your version, then i edited all of "IVAN" out. Later i tested a newer version from you and forgot to edit it out. I remember just later and noticed it didn error on it. Why is in the dark.
The import of script did also one time "bang" and then never again. Another strange voodoo thingy.
shrug.gif

For some reason without it (although still in the error handler) the code stopped executing at all and even without any messages. :unsure:
Oh yeah. Welcome in my world. :LOL: Maybe you forgot a part of it somewhere. Happens to me all the time...
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,384
You can copy my code if it works in your version and if you want. I have now problem with it. :coffee:
Yes, I'm going to do something similar to get rid of code duplication, maybe I'll take it in whole or in part.
Oh yeah. Welcome in my world. :LOL: Maybe you forgot a part of it somewhere. Happens to me all the time...
Well, when I was working with a game that needed this piece of code, it worked fine, and then I didn't touch the code for about half a month. And now, when I had to check the games, the text from the python script stopped displaying.
I have sinned on everything that is possible, up to the new cross-platform Powershell and problems in the operating system itself.
As a result, I found this piece of code, after which the python stopped working normally. And only the presence a dot at the beginning of the import path helped with the solution. Why it does not import without a dot and does not issue errors is not clear, as well as it is not clear why the interception did not work.
After the release of the release version, I will test in search of a possible problem.
 

Madeddy

Active Member
Dec 17, 2017
838
487
Yes, I'm going to do something similar to get rid of code duplication, maybe I'll take it in whole or in part.
Oh yeah. I noticed your edit yesterday evening made IMHO a bigger mess as the code before. :p

And only the presence a dot at the beginning of the import path helped with the solution. Why it does not import without a dot and does not issue errors is not clear, as well as it is not clear why the interception did not work.
Thats the fun and the big honking trap called relative imports in python. You should read up on it. It will clear some mystery's up for you(and creates new mystery's at the same time :LOL:).

I encountered one of these jjust today: Try to import from a file in the directory above your py file with the import statement. So basically from .. import some-file or import ..some-file.my-class. This will beautifully bang with this:
Bash:
$ python3 /home/olli/Code/Git/unrpyc/unrpyc.py --clobber /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/
Traceback (most recent call last):
File "/home/olli/Code/Git/unrpyc/unrpyc.py", line 54, in <module>
import decompiler
File "/home/olli/Code/Git/unrpyc/decompiler/__init__.py", line 40, in <module>
from .. import _unrpyc_ver  # noqa
ImportError: attempted relative import beyond top-level package
What fun! Some things are not really possible in python. And hard to understand whats going on.
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,384
Oh yeah. I noticed your edit yesterday evening made IMHO a bigger mess as the code before. :p

Thats the fun and the big honking trap called relative imports in python. You should read up on it. It will clear some mystery's up for you(and creates new mystery's at the same time :LOL:).

I encountered one of these jjust today: Try to import from a file in the directory above your py file with the import statement. So basically from .. import some-file or import ..some-file.my-class. This will beautifully bang with this:
Bash:
$ python3 /home/olli/Code/Git/unrpyc/unrpyc.py --clobber /home/olli/.xlib/RPG/_TRY_OUT/SisterinLaw-.04.06-pc/game/
Traceback (most recent call last):
File "/home/olli/Code/Git/unrpyc/unrpyc.py", line 54, in <module>
import decompiler
File "/home/olli/Code/Git/unrpyc/decompiler/__init__.py", line 40, in <module>
from .. import _unrpyc_ver  # noqa
ImportError: attempted relative import beyond top-level package
What fun! Some things are not really possible in python. And hard to understand whats going on.
Well, at least you got an error, and I was left without any messages at all. But with the dot, he calmly reported that the import failed and went on to act. Why he decided to close himself in without a dot is a very interesting question, but for now I decided to skip it. :HideThePain:
By the way, I solved the problem with the byte properties of the object (hopefully). The problem was in the wrong version of python and Renpy. As soon as I used the ones that go with the game, the need for crutches disappeared.
As always, I messed up with the simplest task - to always use exactly the engine that comes with the game, even if the versions coincide with the other.:HideThePain:
 
5.00 star(s) 3 Votes