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

5.00 star(s) 9 Votes

moskyx

Forum Fanatic
Jun 17, 2019
4,169
13,757
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. The RPA file is created by the game's dev when building their project with the Ren'Py SDK. It's an option they can choose, and it works as a storage folder in which they can throw any files they want: scripts, pics, videos, whatever they want. In this RPA they can include the RPYC scripts which are the ones that make the game run, but they can choose not to include them and leave them stored in the game folder instead.

Th RPYC files are automatically generated by Ren'Py as a compilation of the code written in the RPY scripts. Every time you run the game, you are actually using RPYC files. When you launch a game, Ren'Py checks if there's any RPY file: if they exist, and they were modified on a later date than their respective RPYC, these RPYC files are updated to include the most recent changes (that is, the changes made to the RPY scripts since the last time the game was launched). But in order to update an RPYC, Ren'Py needs some comparison points: the old version of the RPYC acts as a testimony of the previous versions and every element that has not been modified from one version to the next one is carried over with the same internal ID, and new IDs are assigned to new elements. When you delete the RPYC files, however, all those old references are lost and Ren'Py creates brand new RPYC files from the current RPY scripts, with totally new IDs as now they are assigned from the scratch, and probably won't match the older IDs. But, as they are now more recent than the ones included in the original RPA, Ren'Py will use these new RPYC files to run the game, and players can safely delete the RPA since it's now redundant.

So, 'thanks' to the way you create your patches, including only the RPY scripts and not the RPYC files (which forces Ren'Py to create a brand new compilation), chances are that players can't use old saves from an unmodded game, or translations may stop working, and maybe even the whole mod doesn't work at all unless the RPA is deleted to avoid interferences.

Tl;dr: please learn a bit more about how Ren'Py actually works before creating any mod, and always include in your patch the RPYC files you have on your PC, as most likely they still respect the original IDs and they will prevent some undesired issues with your mod.
 

fried

Almost
Moderator
Donor
Nov 11, 2017
2,313
6,093
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
That was brand new logic to favor 64-bit but still fall back to 32-bit if needed, I didn't test on 32-bit only versions here. Thanks for your report - v1.0.9 will be up shortly with a fix.
 
Last edited:

fried

Almost
Moderator
Donor
Nov 11, 2017
2,313
6,093
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
Glad you were able to fix the issue, which was relatively straightforward to resolve as you noted.

Still, it's an interesting point you raise: there is actually no guarantee that the decompiled files will meet the original format, primarily because comments are stripped by the current decompilers UnRen is using. So, the case you described possibly involved such a case and Python really didn't like that extra space where the comment used to be (again, that's my guess as to what may have happened in this case) - if I get the time, I'll check out if there are other options we might consider here.

Thanks for your report.
 

moskyx

Forum Fanatic
Jun 17, 2019
4,169
13,757
Glad you were able to fix the issue, which was relatively straightforward to resolve as you noted.

Still, it's an interesting point you raise: there is actually no guarantee that the decompiled files will meet the original format, primarily because comments are stripped by the current decompilers UnRen is using. So, the case you described possibly involved such a case and Python really didn't like that extra space where the comment used to be (again, that's my guess as to what may have happened in this case) - if I get the time, I'll check out if there are other options we might consider here.

Thanks for your report.
Last week someone contacted me with that exact issue in that exact game, and another guy found a similar error in another game he didn't mention but again after an at transform: command. Maybe those are related, maybe not, but I find it funny that it happened twice in such a short time span and after the same command; however, it should be noted that there are several others at transform: lines in both scripts that were decompiled perfectly fine. So maybe the comments are indeed to blame, but it's weird that two different games included a comment in those at transform: lines (and it's not a piece of code they got from the same source because the transform attributes are different). Well, the mysteries of Ren'Py
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,384
Last week someone contacted me with that exact issue in that exact game, and another guy found a similar error in another game he didn't mention but again after an at transform: command. Maybe those are related, maybe not, but I find it funny that it happened twice in such a short time span and after the same command; however, it should be noted that there are several others at transform: lines in both scripts that were decompiled perfectly fine. So maybe the comments are indeed to blame, but it's weird that two different games included a comment in those at transform: lines (and it's not a piece of code they got from the same source because the transform attributes are different). Well, the mysteries of Ren'Py
"at transform" may contain custom code that cannot be decompiled just like that, each such case has to be considered separately and some options cannot be solved.
 

GAB

Salty Montrealer
Donor
May 10, 2017
2,402
18,130
I see a lot of frequent update, I started using unren v0.8 or 0.9 and tried updating whenever there was an update.

I took a look at the changelog but don't really get it. I saw the large amount of pages and posts and I can't keep track with the matter discussed but it seems like this is why unren has been updated a lot recently.

I struggle to keep up with the discussion but I'd still like to ask:
In broad terms, what has been updated on unren from 0.8 to 1.0.9?
Also, to be more specific, who (or what) do these updates cater mostly? A certain audience or special version of a game engine?
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,384
I see a lot of frequent update, I started using unren v0.8 or 0.9 and tried updating whenever there was an update.

I took a look at the changelog but don't really get it. I saw the large amount of pages and posts and I can't keep track with the matter discussed but it seems like this is why unren has been updated a lot recently.

I struggle to keep up with the discussion but I'd still like to ask:
In broad terms, what has been updated on unren from 0.8 to 1.0.9?
Also, to be more specific, who (or what) do these updates cater mostly? A certain audience or special version of a game engine?
Engine version. Basically, it supports all possible versions of the engine.
 

GAB

Salty Montrealer
Donor
May 10, 2017
2,402
18,130
Engine version. Basically, it supports all possible versions of the engine.
renpy engine version?
could you give an example of a renpy game that didn't work between 0.8 and 1.0.9 and needed an update from unren?
 

fried

Almost
Moderator
Donor
Nov 11, 2017
2,313
6,093
renpy engine version?
could you give an example of a renpy game that didn't work between 0.8 and 1.0.9 and needed an update from unren?
Ren'Py continues to evolve in various ways, so the latest updates have been an iterative process towards accommodating the latest + trying to shore up backwards compatibility. The many recent updates are due to it being worked in a somewhat Agile manner, honestly - regression testing has been improved as more situations and user cases have been identified (plus, bugs have been fixed, etc.)

Among other things, any game which comes with Python 3 won't work with 0.9: Obscure Affairs, Ravager, Max's Life, etc. It's likely other games will upgrade over time. On top of that. Ren'Py v8.x needed some attention, too. Some Python 2 and older games also gave 0.9 problems and - at least for the cases we've seen - have been fixed.

The command prompt UI also got a slight tweak (not as cool as VepsrP's Windows GUI variant, admittedly.)
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,384
renpy engine version?
could you give an example of a renpy game that didn't work between 0.8 and 1.0.9 and needed an update from unren?
Games on the 7.5+ engine will no longer work with UnRen 0.9, and I am generally silent about the 8.0+ engine. But even the 1.0.9 version will not be able to work with all games. Some developers are shamanizing with game archives, changing the rules for working with them (calculating indexes and all that), which is why an independent unpacking tool will not be able to do anything with these archives. So frequent updates are normal, at least at this time.
 
  • Like
Reactions: fried and GAB

FiRo:)

New Member
Mar 11, 2021
9
7
Good night, could you please advise me when extracting rpa files with the batton unren version 1.09, unren 8.0.0, unren-ultrahack, etc., then pops up this error: Fatal Python error: inint_fs_encoding: failed to get the Python codec of the file system coding. Python runtime state: core initialized. ModuleNotFoundError: No module named "encodings" and then the error, can someone tell me how to fix it?
Checked on several batons and all exactly the same error pops up the error.
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,384
Good night, could you please advise me when extracting rpa files with the batton unren version 1.09, unren 8.0.0, unren-ultrahack, etc., then pops up this error: Fatal Python error: inint_fs_encoding: failed to get the Python codec of the file system coding. Python runtime state: core initialized. ModuleNotFoundError: No module named "encodings" and then the error, can someone tell me how to fix it?
Checked on several batons and all exactly the same error pops up the error.
Does this apply to all games or any specific ones?
 

FiRo:)

New Member
Mar 11, 2021
9
7
Does this apply to all games or any specific ones?
Good afternoon to all the games that have been released recently. Tested on 7 games, and every time this error. Batnik version 7.4. never had this error, and unpacked normally in older games. And now this...
 

VepsrP

Well-Known Member
Modder
Dec 13, 2017
1,387
1,384
Good afternoon to all the games that have been released recently. Tested on 7 games, and every time this error. Batnik version 7.4. never had this error, and unpacked normally in older games. And now this...
If the game is on the 7.3 engine, then you need UnRen-old, since in older versions of the engine, Python scripts are divided into two folders and require running through a special key. And in newer versions, especially 8.0+, this key, on the contrary, interferes.
 
5.00 star(s) 9 Votes