CREATE YOUR AI CUM SLUT ON CANDY.AI TRY FOR FREE
x

Tool Ren'Py UnRen.bat v1.0.11d - RPA Extractor, RPYC Decompiler, Console/Developer Menu Enabler

5.00 star(s) 9 Votes

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,385
Since you have a separate thread for your fork + original GUI take on UnRen, I'll add a link to that in this OP and you can handle its progress and fixes there.

It's fine to mention here to be helpful and exchange ideas of course, but I'd also like to keep bug reports/updates distinct where possible. Thanks.
To be more precise, it's not really a separate fork. In fact, it is a continuation of the original instrument. Since no one has updated it for quite some time, I took it into my own hands. But in the absence of the ability to update the original topic, I had to create my own thread. For more than a year and a half, but not all people are aware of it yet and therefore write about errors here.
 

fried

Almost
Moderator
Donor
Nov 11, 2017
2,313
6,101
To be more precise, it's not really a separate fork. In fact, it is a continuation of the original instrument. Since no one has updated it for quite some time, I took it into my own hands. But in the absence of the ability to update the original topic, I had to create my own thread. For more than a year and a half, but not all people are aware of it yet and therefore write about errors here.
I understand the history of your version and appreciate your work - you might remember I had a presence here rather briefly to make the 0.91 minor update, which is when I first saw your activity. Then we got more busy with the site's needs and haven't been back here until now.

That is, I recently got some free cycles (i.e., our site moderation staff has grown), and Sam allowed me to take a deeper look into the version here because he's still taken up, as always.

Of course I knew of your version and didn't want to interrupt that work, so have been tearing this one apart for a few scattered nights, trying to see if it makes sense to evolve vs rewrite (or adopt other ideas, such as your changes.) For example, I've been finding lots of issues in the adopted UNRPYC codebase for some potentially irregular .rpyc files, but am experiencing early breakthroughs in recent testing with my temporary hacks and that gives me hope it can offer more coverage of weird cases in the soon timeframe.

Generally, I like social coding to help bring in good ideas from various places and Sam previously placed the early code in Github (also linked in the OP), so that might be a decent idea to revisit for at least this version.

Since you have been working on versions/variants for some time, it might make sense to chat offline about whether we keep multiple versions of the "traditional" UnRen or let them stay diverged, share ideas, etc. We don't mind either way, but again it's better to formally open this up for community updates and make that an easy process, as one goal I have here.

We can take the rest of this discussion to DM.
 

fulcrum

Engaged Member
Feb 2, 2018
3,495
2,034
Code:
set "currentdir=%~dp0%"
if exist %1 set "currentdir=%~dp1%"
%~dp0% is the directory of the file or .lnk the batch is called up from.
%1 is the first parameter passed to or a file dropped on the batch on call up.
%~dp1% is the path to the file dropped on a .lnk or the actual batch file.

Code:
if exist %currentdir%lib for /f "tokens=4" %%A in ('dir %currentdir%lib\*windows* ^|find "windows"') do set "pythondir=%currentdir%lib\%%A\"
grabs the python directory ignoring all that py2 py3 i386 x86_64 mumbojumbo

if exist %currentdir%lib
when "lib" is found

for /f "tokens=4" %%Z in ('dir %currentdir%lib\*windows* ^|find "windows"')
runs "dir %currentdir%lib\*windows*" | find "windows"
passes the 4th token of the find result, the directory name returned by dir, to the temp_variable_A

do set "pythondir=%currentdir%lib\%%A\"
sets pythondir to %currentdfir%lib\temp_variable_A\

that stack of attempts at locating the renpy.exe infuriated me with the prior iterations of unren the most, and if they add yet another variant in the future, it gets even more convoluted.

Code:
set "currentdir=%~dp0%"
if exist %1 set "currentdir=%~dp1%"
if exist" %currentdir%renpy" set "renpydir=%currentdir%renpy\"
if exist "%currentdir%game" set "gamedir=%currentdir%game\"
if exist "%currentdir%lib" for /f "tokens=4" %%A in ('dir "%currentdir%lib\*windows*" ^|find "windows"') do set "pythondir=%currentdir%lib\%%A\"
final block. easy (somewhat). clean!
 
Last edited:

OhWee

Forum Fanatic
Modder
Game Developer
Jun 17, 2017
5,911
30,053
OK, there have been several games recently that UnRen-master.bat can't find the python directory, even though it's right there...

I know that's not the same tool as the one that is linked in the OP of this thread, but it's worked on pretty much every Ren'Py build I've wanted to extract and enable the console on until now, which is why I've still been using that tool.

Anyways, it looks like others are having the same issue (not finding Python directory). For me, one game that I came across this issue with was A Moment of Bliss:
https://f95zone.to/threads/a-moment-of-bliss-v2-2-1-lockheart.113727/

The 1.05 tool that is included in the OP of this thread does seem to work on this one, and at least one other game where I encountered this issue.

Just wanted to note this, for anyone else that might still be using the UnRen-master.bat tool and is encountering this issue. If the 1.05 tool isn't working either for some game, of course your best bet here will be to note which game you are having an issue with, and which tool you are using, so that whomever is working on Unren can take note.
 

fried

Almost
Moderator
Donor
Nov 11, 2017
2,313
6,101
OK, there have been several games recently that UnRen-master.bat can't find the python directory, even though it's right there...

I know that's not the same tool as the one that is linked in the OP of this thread, but it's worked on pretty much every Ren'Py build I've wanted to extract and enable the console on until now, which is why I've still been using that tool.

Anyways, it looks like others are having the same issue (not finding Python directory). For me, one game that I came across this issue with was A Moment of Bliss:
https://f95zone.to/threads/a-moment-of-bliss-v2-2-1-lockheart.113727/

The 1.05 tool that is included in the OP of this thread does seem to work on this one, and at least one other game where I encountered this issue.

Just wanted to note this, for anyone else that might still be using the UnRen-master.bat tool and is encountering this issue. If the 1.05 tool isn't working either for some game, of course your best bet here will be to note which game you are having an issue with, and which tool you are using, so that whomever is working on Unren can take note.
Thanks for your report.

A new v1.0.7 has been updated with added Python level sensitivity - among other things, it tested fine with v2.2.1 of "A Moment of Bliss," if you'd like to give it a try.

Doesnt work on game https://f95zone.to/threads/ravenous-v0-083-preview-lament-entertainment.125534/
I've tried all the builds of Unrepy on the game with version 0.0.5b / Renpy 8.0.0

Any help?
Thanks for your report - v1.0.7 is working with this game level, if you'd like to try it out.

UnRen 1.0.2 (or any other) didn't decompile rpyc for a Ren'Py 7.5.2 game (A Moment Of Bliss 2.2.1). It decompiled some, but not all rpyc files. When I put it in the game/ folder, it decompiles all of them just fine. That's weird... Previous unrens also worked from the game's main dir.
Thanks - the v1.0.7 works from the main directory for that game level, if you'd like to try again.

Hey, you guys are the best. Problem solved. Everything works correctly. Thank you.
Only point 1 works. When decompiling .pryc files, the same error. (1.05)
(Windows7 system, Russian language, paths are spelled out everywhere in Windows)
Thanks for that update - I was able to recreate with a different scenario, but same effect.

If you don't mind, perhaps try v1.0.7 on your system, please? I was testing with that game all week and found some holes in how we handled Python 3 vs 2.7, so am hoping it's been cleared up on your end - it works fine on my US-English Windows 10 system now.

If there are continued issues, I might install a Russian localized Windows VM and try it there, but am hoping the latest changes to add some pathname robustness might have helped your situation.
 

fried

Almost
Moderator
Donor
Nov 11, 2017
2,313
6,101
Code:
set "currentdir=%~dp0%"
if exist %1 set "currentdir=%~dp1%"
%~dp0% is the directory of the file or .lnk the batch is called up from.
%1 is the first parameter passed to or a file dropped on the batch on call up.
%~dp1% is the path to the file dropped on a .lnk or the actual batch file.

Code:
if exist %currentdir%lib for /f "tokens=4" %%A in ('dir %currentdir%lib\*windows* ^|find "windows"') do set "pythondir=%currentdir%lib\%%A\"
grabs the python directory ignoring all that py2 py3 i386 x86_64 mumbojumbo

if exist %currentdir%lib
when "lib" is found

for /f "tokens=4" %%Z in ('dir %currentdir%lib\*windows* ^|find "windows"')
runs "dir %currentdir%lib\*windows*" | find "windows"
passes the 4th token of the find result, the directory name returned by dir, to the temp_variable_A

do set "pythondir=%currentdir%lib\%%A\"
sets pythondir to %currentdfir%lib\temp_variable_A\

that stack of attempts at locating the renpy.exe infuriated me with the prior iterations of unren the most, and if they add yet another variant in the future, it gets even more convoluted.

Code:
set "currentdir=%~dp0%"
if exist %1 set "currentdir=%~dp1%"
if exist" %currentdir%renpy" set "renpydir=%currentdir%renpy\"
if exist "%currentdir%game" set "gamedir=%currentdir%game\"
if exist "%currentdir%lib" for /f "tokens=4" %%A in ('dir "%currentdir%lib\*windows*" ^|find "windows"') do set "pythondir=%currentdir%lib\%%A\"
final block. easy (somewhat). clean!
Thanks, I'll take this into consideration for an upcoming cleanup release.

At the moment, it's obviously more brute force than elegance - but, if you look at the latest code (i.e., v1.0.7) there is a reason: I am breaking out every form of Python directories found in Ren'Py testing thus far - the decompiler is highly sensitive to Ren'Py's (somewhat neutered) Python version and I'm currently carrying three versions of UNRPYC (two of them slightly modified by me) to attempt maintaining backwards compatibilty as we continue moving with Ren'Py 8 + Python 3.x.
 

fulcrum

Engaged Member
Feb 2, 2018
3,495
2,034
Thanks, I'll take this into consideration for an upcoming cleanup release.

At the moment, it's obviously more brute force than elegance - but, if you look at the latest code (i.e., v1.0.7) there is a reason: I am breaking out every form of Python directories found in Ren'Py testing thus far - the decompiler is highly sensitive to Ren'Py's (somewhat neutered) Python version and I'm currently carrying three versions of UNRPYC (two of them slightly modified by me) to attempt maintaining backwards compatibilty as we continue moving with Ren'Py 8 + Python 3.x.
the version i have is OOOOOLD, 0.91 gideonmod .5 because I cba to keep editing this change in (mainly the drag and drop mod) and as far as i am concerned, it works. I mainly use it to drop the console, menu, save and rollback files and only in rare cases when i need to see what the game is doing (or want to look at the pretty pictures) i use the decompilers. so far i havent had any issues with my relic.

anyway,

You don't have permission to view the spoiler content. Log in or register now.

also, i'd like to request with this code cleanup that unren doesnt force quit if /game and /renpy exist since some games take an age or three to unpack and lib/<pythondirs> are much too often the last in the list to unpack when /game is a real superheavy mama.

i have changed some paths in here since i dont get why you keep switching back and forth with \..\
 
Last edited:
  • Thinking Face
Reactions: fried

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,385
the version i have is OOOOOLD, 0.91 gideonmod .5 because I cba to keep editing this change in (mainly the drag and drop mod) and as far as i am concerned, it works. I mainly use it to drop the console, menu, save and rollback files and only in rare cases when i need to see what the game is doing (or want to look at the pretty pictures) i use the decompilers. so far i havent had any issues with my relic.

anyway,

You don't have permission to view the spoiler content. Log in or register now.

also, i'd like to request with this code cleanup that unren doesnt force quit if /game and /renpy exist since some games take an age or three to unpack and lib/<pythondirs> are much too often the last in the list to unpack when /game is a real superheavy mama.

i have changed some paths in here since i dont get why you keep switching back and forth with \..\
So you run UnRen even before you unpack the whole game? why? is it so difficult to wait for the full unpacking of the game and only then run the script?:unsure:
 

loloshek

New Member
Jun 3, 2022
2
1
Hi. Sorry for the stupid question, I'm new to this. I get rpy files from rpyc. But when starting the game, there is always an "indentation mismatch" error in different files. What to do with it? Manually edit all files? Or am I doing something wrong?
 

fried

Almost
Moderator
Donor
Nov 11, 2017
2,313
6,101
the version i have is OOOOOLD, 0.91 gideonmod .5 because I cba to keep editing this change in (mainly the drag and drop mod) and as far as i am concerned, it works. I mainly use it to drop the console, menu, save and rollback files and only in rare cases when i need to see what the game is doing (or want to look at the pretty pictures) i use the decompilers. so far i havent had any issues with my relic.

anyway,

You don't have permission to view the spoiler content. Log in or register now.

also, i'd like to request with this code cleanup that unren doesnt force quit if /game and /renpy exist since some games take an age or three to unpack and lib/<pythondirs> are much too often the last in the list to unpack when /game is a real superheavy mama.

i have changed some paths in here since i dont get why you keep switching back and forth with \..\
I honestly rewrote the entire directory handling section today and it is somewhat as you laid out, but not quite. I decided to run everything in the main directory going forward (regardless of where you place UnRen.bat) so needed to change things up. So, if you want to feedback on anything for code optimization, then v1.0.8+ is probably best to try out.
 

fried

Almost
Moderator
Donor
Nov 11, 2017
2,313
6,101
Hi. Sorry for the stupid question, I'm new to this. I get rpy files from rpyc. But when starting the game, there is always an "indentation mismatch" error in different files. What to do with it? Manually edit all files? Or am I doing something wrong?
Hi, are you saying that "indentation mismatch" occurs after decompiling the .rpyc to .rpy and then running the game with those .rpy files still in under the main folder heirarchy?

If so, perhaps offer which game this is affecting and we'll try to determine what might be happening. Ren'Py / Python are very sensitive to relative indentation, as a whole.
 

fulcrum

Engaged Member
Feb 2, 2018
3,495
2,034
I honestly rewrote the entire directory handling section today and it is somewhat as you laid out, but not quite. I decided to run everything in the main directory going forward (regardless of where you place UnRen.bat) so needed to change things up. So, if you want to feedback on anything for code optimization, then v1.0.8+ is probably best to try out.
I've read it and I don't get the point of fumbling around to indirectly test for the python version (exist windows no set py2_windows > exist py2_windows no set py3_windows > exist py3_windows). such incremental spaghetti construction is hostile logic, at best meant to make it harder to read and follow the code.
I guess it comes down to one's own style of doing specific things, i haven't had the need to fight with other's code like that yet.

:)
 

loloshek

New Member
Jun 3, 2022
2
1
Hi, are you saying that "indentation mismatch" occurs after decompiling the .rpyc to .rpy and then running the game with those .rpy files still in under the main folder heirarchy?

If so, perhaps offer which game this is affecting and we'll try to determine what might be happening. Ren'Py / Python are very sensitive to relative indentation, as a whole.
Hi
Game: https://f95zone.to/threads/another-chance-v1-23-timewizardstudios.43304/
I usually use the old version 1.22. Now there is a new 1.23. I don't know if there is a problem in new version
Here is the version I used:

Actually the problem was only in one file.
After decompiling .rpyc to .rpy one file was incorrectly indented. After fixing the issue was resolved.
The order of my actions:
1) unren 1.0.8 put in the main directory to the .exe file
2) I start functions 1 and 2 in unren
3) After decompiling, I launch the .exe game and see an error
Code:
File "game/1000_base_game/game/characters/isabelle/q_isabelle_piano.rpy", line 24: indentation mismatch.
4) I look at this file and see this piece of code
You don't have permission to view the spoiler content. Log in or register now.
5) I edit the code and after that everything works
You don't have permission to view the spoiler content. Log in or register now.

I do not know if the problem is in the game or in the work of unren. Maybe my information will help you. Thanks
 
  • Like
Reactions: Target1K/m

ptttah

New Member
Mar 21, 2019
10
9
Version 1.0.8 - Bug

Symptom
"Error: Cannot locate python.exe, unable to continue."
UnRen is in the same folder as game executable.

Problem
Looking at the code:
If my OS is 64 bit Windows, and the game has only a 32-bit version of python, unren will will not find python.exe.
It seems like once it detects I'm running x64 it doesn't bother looking for a 32-bit version of python.

Workaround
Changed line 142 to default to i686 instead of x86_64 to get it running. It did just fine.

Thank you for keeping this open-source. <3

UPDATE: This bug was fixed in version 1.0.9
 
Last edited:

diras2010

Member
Nov 4, 2017
325
420
Version 1.0.8 - Bug

Symptom
"Error: Cannot locate python.exe, unable to continue."
UnRen is in the same folder as game executable.

Problem
Looking at the code:
If my OS is 64 bit Windows, and the game has only a 32-bit version of python, unren will will not find python.exe.
It seems like once it detects I'm running x64 it doesn't bother looking for a 32-bit version of python.

Workaround
Changed line 142 to default to i686 instead of x86_64 to get it running. It did just fine.


Thank you for keeping this open-source. <3

Thanks, this fixed it for me
 

Greslux

Member
Apr 24, 2022
261
401
Hi.
1. Please tell me if it is possible to pack RPY files into one RPA file ?
The information says that UnRen.bat can decompile RPYC files. Why RPYC and not RPY ?
I have a mod and the way to install it is to delete the native RPA file and install the "scripts" folder (with RPY files only, no RPYC ) instead of RPA. It might be more convenient for people if I pack the folder with RPY scripts into one RPA file, and suggest they replace the RPA file, but I don't know how to do that. Is there any way to pack the RPY folder separately from the game without putting it in the game folder, like if you wanted to pack some off files in RAR
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,385
Hi.
1. Please tell me if it is possible to pack RPY files into one RPA file ?
The information says that UnRen.bat can decompile RPYC files. Why RPYC and not RPY ?
I have a mod and the way to install it is to delete the native RPA file and install the "scripts" folder (with RPY files only, no RPYC ) instead of RPA. It might be more convenient for people if I pack the folder with RPY scripts into one RPA file, and suggest they replace the RPA file, but I don't know how to do that. Is there any way to pack the RPY folder separately from the game without putting it in the game folder, like if you wanted to pack some off files in RAR
Because RPYC is the compiled code of the game, and RPA is the archives of the game. These are two different types of files. At the expense of packing several files, this can be done using the rpatool, for this you need to be able to use python.
 
  • Like
Reactions: Greslux

Greslux

Member
Apr 24, 2022
261
401
Because RPYC is the compiled code of the game, and RPA is the archives of the game. These are two different types of files. At the expense of packing several files, this can be done using the rpatool, for this you need to be able to use python.
So to get the RPA file I need to run the game (to make it create RPYC files), then delete the RPYC files and use RPYC to create the RPA?
Thanks for the info about rpatool, I'll look for some guide.
Thanks for the reply.
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,385
So to get the RPA file I need to run the game (to make it create RPYC files), then delete the RPYC files and use RPYC to create the RPA?
Thanks for the info about rpatool, I'll look for some guide.
Thanks for the reply.
No, you don't need to run the game. It is necessary to specify in RPAtool which files you want to add to the archive. I will not say more precisely, it is necessary to read the instructions for the tool. But, in my opinion, it's easier to use the game engine itself. Download it, add the necessary files to its folder and create all the necessary archives in it.
 
  • Like
Reactions: Greslux
5.00 star(s) 9 Votes