Tool Ren'Py UnRen for MacOS and Linux v0.8.2

5.00 star(s) 1 Vote

goobdoob

Conversation Conqueror
Modder
Respected User
Dec 17, 2017
7,425
9,680
unren.png

UnRen is a script that makes it easy to do interesting things to Ren'Py games. This version, for MacOS and Linux, is based off of by @Sam . UnRen.command is a bash shell script that calls python commands to do some of the work.

The original version was created by @jimmy5 , but he's passed ownership to me.

The current version is 0.8.2, available here.

Features:
  • Extract RPA packages, using .
  • Decompile rpyc files, using .
  • Enable Console and Developer Menu
  • Enable Quick Save and Quick Load
  • Force enable skipping of unseen content
  • Force enable rollback (scroll wheel)
  • Open game directory

Installation:

Download and unzip the script. Place it where you like. There are 2 ways to run it:
  1. Double click on UnRen.command. This will open a Terminal window that will allow you to drag (or type the path to) the app you want to work on.
  2. Run UnRen.command from the command line. You can provide the path to the app on the command line, or type it in when UnRen asks for it.
  3. UnRen runs in bash. Other shells may or may not work. Do NOT run UnRen with "sh UnRen.command" if your sh is not bash. Instead, if you run it from the command line, run it with a full path, or "./UnRen.command".

Known Issues:
  • None
You don't have permission to view the spoiler content. Log in or register now.
You don't have permission to view the spoiler content. Log in or register now.
You don't have permission to view the spoiler content. Log in or register now.
You don't have permission to view the spoiler content. Log in or register now.
You don't have permission to view the spoiler content. Log in or register now.
 
Last edited:

TCMS

Quote my posts if you want an answer
Donor
Former Staff
Aug 5, 2016
5,797
30,024
jokes on you, i fixed that before you replied on here.
Piss off Jimmy I was the one that told you the file was missing :FeelsBadMan:
 

goobdoob

Conversation Conqueror
Modder
Respected User
Dec 17, 2017
7,425
9,680
Thanks @bossapplesauce for telling me about this. Thanks @jimmy5 for making it (since I'm to lazy to do it myself! :) ).


Some comments:

You're assuming the user's default shell is /bin/sh. That's not always the case. Add this line to the top of the script:

#! /bin/sh

---------------

You should let the user specify the app directory on the command line. Something like:
if [ "$#" -ne 1 ]; then
read appdir
else
appdir = $1
fi

---------------

The main menu doesn't have an exit command.

---------------

In function extract, this code:
for f in $game/*.rpa; do
python "/tmp/rpatool.txt" -x "$f" -o ${f%".rpa"}
done

will extract the files in archive.rpa into the folder "archive", for example. But this gives 2 locations for the scripts - one in game/archive.rpa and one in game/archive/, which will cause errors when the game is launched. Remove the -o option and have rpatool extract in place.

That's what unren 0.7 does:
for %%f in (*.rpa) do (
echo + Unpacking "%%~nf%%~xf" - %%~zf bytes
"%pythondir%python.exe" -O "%rpatool%" -x "%%f"
)

---------------

Extracting packages can take a long time. You should print out something like "Extracting <package>" as you extract each package, so the user isn't staring at a blank screen. See the previous code from unren 0.7 - it prints the package as it extracts it.

---------------

The decompile option installs a decompiler. Instead of that, how about doing the same thing the rpa extract does, and run the decompile now? I use unrpyc from to do that when I want to look at script sources.

Again, that's what unren 0.7 does:

for /r %%f in (*.rpyc) do (
if not %%~nf == un (
echo + Decompiling "%%~nf%%~xf" - %%~zf bytes
"%pythondir%python.exe" -O "%unrpycpy%" "%%f"
)

The game won't launch for me with the decompiler installed. It immediately quits. Also, I can't decompile un.rpyc. If you stick with a decompiler, you should install the .rpy instead of the .rpyc.

---------------

Function finish has this code:
"2")
osascript -e 'tell application "Terminal" to close (every window whose name contains "UnRen Mac v0.1")' & exit
;;

If I'm running from the command line I don't want to close my terminal window!
 
  • Like
Reactions: WaveOfPig and bas

Julio

Member
Modder
Uploader
F95Zone Dev
Aug 26, 2017
120
291
Yeah, I made this a day or whatever before Sam updated his to decompile directly from the script vs. having to run Ren'py. I reinstalled Windows, and don't really have access to MacOS anymore, if you want it, you can have this to reupload with your suggestions added.
 
  • Like
Reactions: WaveOfPig

WaveOfPig

Active Member
May 12, 2017
616
250
Why is this happening to me when I try to extract the RPAs? Screen Shot 2018-08-21 at 10.39.39 PM.png

Edit: Does the game have to be the Mac version?
 

Julio

Member
Modder
Uploader
F95Zone Dev
Aug 26, 2017
120
291
Yeah has to be the Mac version because the directories are different for windows games.
 
  • Like
Reactions: WaveOfPig

WaveOfPig

Active Member
May 12, 2017
616
250
Is it even possible to create an equivalent program that can detect the windows directories? (because the windows versions are way more common and most mac users utilize wine anyways)
 

Julio

Member
Modder
Uploader
F95Zone Dev
Aug 26, 2017
120
291
Yes. Open UnRen.command, change line 35 to
Code:
game=$appdir/game
and line 36 to
Code:
renpy=$appdir/renpy
 
  • Like
Reactions: WaveOfPig

goobdoob

Conversation Conqueror
Modder
Respected User
Dec 17, 2017
7,425
9,680
I've taken UnRen v.01 and updated it with my suggestions, and cleaned it up a bit. I also implemented @waveofpig 's suggestion to have it look in the PC game folder if it can't find the Mac one.

BTW, I disagree that PC versions of Ren'Py games are more common, and most Mac users use Wine, but it was easy to do, so I figured I might as well do it.

Attached is the updated script. Here's the change log:
# v0.2:
# Added line to force script to run in bash.
# Allow user to specify game directory on the command line.
# Extract packages in place instead of in a subfolder, which caused games to crash with
# double definitions.
# Print names of rpa packages being extracted.
# Changed script decompile to use unrpyc under python instead of un.rpyc inside the game.
# Removed options to uninstall un.rpyc and remove extracted packages.
# Added option to quit from main menu.
# Fixed handling of games with spaces in their names.
# Simplified code by removing some recursion and putting main menu in a loop.
# Check for pc game folder if the script can't find it in the Mac location.

@TCMS how do we move this thread over to me, like @jimmy5 said?
 
  • Like
Reactions: Ōba and WaveOfPig

Julio

Member
Modder
Uploader
F95Zone Dev
Aug 26, 2017
120
291
You can use the official webp viewer made by Google , however, it is used by the terminal, I'm sure that you can probably set the default program to open .webp to the webp viewer. If you don't want the complications, then try .
 
  • Like
Reactions: bas

FranceToast

Active Member
Donor
Jul 31, 2018
562
894
During the decompiling process, I did briefly see one error about one file not being able to be decompiled for Dreams of Desire, but it looks like it worked overall. To test this, I downloaded @KinneyX23's excellent DoD mod, which I could only use on my PC because of the UnRen requirement, and it seems to work fine on the Mac version using your utility, so thanks!!
 
  • Like
Reactions: KinneyX23

randomname42

Member
May 30, 2017
131
311
Suggestion: when de-compiling, it should do so for files in subdirectories of /game as well, as there may be files (such as translations) which are in .rpyc format.
 
5.00 star(s) 1 Vote