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
Had the same problem on Linux. Fixed this by changing line 61 in UnRen.command file to this
Bash:
unrpyc=$(realpath `dirname "$0"`"/UnRen Tools/unrpyc.py")
Where did you put UnRen to require realpath?

unrpyc=`dirname "$0"`"/UnRen Tools/unrpyc.py"

SHOULD always work.
 

enigma9999

aka enigma
Donor
May 20, 2018
29
121
Where did you put UnRen to require realpath?

unrpyc=`dirname "$0"`"/UnRen Tools/unrpyc.py"

SHOULD always work.
Both the Unren tools directory and the executable script file are at the same level as the 'game', 'lib' and 'renpy' directories:

1573839869917.png

And this is the error message when executing any of the tools (unrpyc or rpatool)

1573840290252.png

This is on Linux (Ubuntu)
 

enigma9999

aka enigma
Donor
May 20, 2018
29
121
Ok I decided to debug the issue at my end, so that I can provide you better info.

Bash:
function extract
{
    pushd "$game" > /dev/null
    files=(*.rpa)
    if [ -e ${files[0]} ]; then
        echo "Extracting RPA packages"
        for f in *.rpa; do
            echo "extracting $f"
            $python "$rpatool" -x "$f"
        done
    else
        echo "No RPA packages found"
    fi
    popd > /dev/null
}
The problem with dirname (at least in Linux, I cannot speak for MacOS) is that it can return relative path.
So the $rpatool in my case is "./UnRen Tools/rpatool". But in the extract function above, a pushd is performed into the game directory and then python "$rpatool" is invoked which will not find the rpatool script (since it's correct location now is ../UnRen Tools/rpatool).
 

cold_arctus

Devoted Member
Sep 25, 2018
8,945
10,817
I am on 18.04.3 LTS (Bionic Beaver)
Ok I decided to debug the issue at my end, so that I can provide you better info.

Bash:
function extract
{
    pushd "$game" > /dev/null
    files=(*.rpa)
    if [ -e ${files[0]} ]; then
        echo "Extracting RPA packages"
        for f in *.rpa; do
            echo "extracting $f"
            $python "$rpatool" -x "$f"
        done
    else
        echo "No RPA packages found"
    fi
    popd > /dev/null
}
The problem with dirname (at least in Linux, I cannot speak for MacOS) is that it can return relative path.
So the $rpatool in my case is "./UnRen Tools/rpatool". But in the extract function above, a pushd is performed into the game directory and then python "$rpatool" is invoked which will not find the rpatool script (since it's correct location now is ../UnRen Tools/rpatool).
I'm on Ubuntu 16.04.6 LTS and do not have this problem.
 

goobdoob

Conversation Conqueror
Modder
Respected User
Dec 17, 2017
7,425
9,680
Ok I decided to debug the issue at my end, so that I can provide you better info.

Bash:
function extract
{
    pushd "$game" > /dev/null
    files=(*.rpa)
    if [ -e ${files[0]} ]; then
        echo "Extracting RPA packages"
        for f in *.rpa; do
            echo "extracting $f"
            $python "$rpatool" -x "$f"
        done
    else
        echo "No RPA packages found"
    fi
    popd > /dev/null
}
The problem with dirname (at least in Linux, I cannot speak for MacOS) is that it can return relative path.
So the $rpatool in my case is "./UnRen Tools/rpatool". But in the extract function above, a pushd is performed into the game directory and then python "$rpatool" is invoked which will not find the rpatool script (since it's correct location now is ../UnRen Tools/rpatool).
Suggestion - don't copy UnRen to the game's directory. Install it in one place and run it from there.

When you do run it from the game's directory, how do you tell UnRen where to find the game? Just type "."?

Ignore cold_arctus when he says to do that. He's having flashbacks to the Windows version! :p
 
  • Thinking Face
Reactions: cold_arctus

enigma9999

aka enigma
Donor
May 20, 2018
29
121
Suggestion - don't copy UnRen to the game's directory. Install it in one place and run it from there.

When you do run it from the game's directory, how do you tell UnRen where to find the game? Just type "."?

Ignore cold_arctus when he says to do that. He's having flashbacks to the Windows version! :p
Yes you got it right. I just type "." (sorry I am lazy :p). But even when giving the full path, it is still the same to `dirname` so I had to wrap it inside `realpath` to make it work.

Thanks for the tip goobdoob about keeping the UnRen folder separate.
 

goobdoob

Conversation Conqueror
Modder
Respected User
Dec 17, 2017
7,425
9,680
Yes you got it right. I just type "." (sorry I am lazy :p). But even when giving the full path, it is still the same to `dirname` so I had to wrap it inside `realpath` to make it work.

Thanks for the tip goobdoob about keeping the UnRen folder separate.
When I run it, I double click the script, then drag the app/folder to that window. I don't know if it works that way on various flavors of Linux. No typing here!

I've also tested pasting the path in - just full path, not relative.
 

Talish

New Member
Jul 25, 2018
3
0
I am getting a error on linux that says cant open game directory. Exiting now. Please help
 

Madeddy

Active Member
Dec 17, 2017
809
463
cold_arctus && goobdoob && enigma9999
Should work, doesn't mean it does...

Code:
olli@tty0*blue $ ./UnRen.command /home/olli/.alt/tmp/RPG/Personal_Trainer/Personal_Trainer-0.40-pc
./UnRen Tools/rpatool
./UnRen Tools/unrpyc.py
UnRen for Mac and Linux v0.8
by goobdoob @ www.f95zone.to
based on the original version by jimmy5 @ www.f95zone.to
and UnRen.bat by sam @ www.f95zone.to
Python is installed, detected
Working with directory /home/olli/.alt/tmp/RPG/Personal_Trainer/Personal_Trainer-0.40-pc

What would you like to do?
  1) Extract RPA packages
  2) Decompile rpyc files
  3) Decompile rpyc files, overwriting existing rpy files
  4) Enable Console and Developer Menu
  5) Enable Quick Save and Quick Load
  6) Force enable skipping of unseen content
  7) Force enable rollback (scroll wheel)
  8) Open game directory

  99) Options 1-7 (no overwrite)

  q) quit UnRen

1
Extracting RPA packages
extracting archive.rpa
python: can't open file './UnRen Tools/rpatool': [Errno 2] No such file or directory
Some evidence:

Screenshot_20191126_063023.png

Note: Script and game path are very different. Used game is a random choice.
At first i thought i has some thing to do with the whitespace in .../UnRen Tools/... but then realized that's a dumb idea. Shell deals with this.

The code IMO cannot work. At least not on linux. Possible mac does some path stuff different. What happens there?

Code:
function decompile {
pushd "$game" > /dev/null  # Switch to game dir, means: -> /long/abs_path/stuff/game/
$python "$unrpyc" "."  # execute THERE the app in the variable, means: python2 "./UnRen Tools/unrpyc.py" "."
popd > /dev/null  # unimportant, line before did already a BANG!
}
Basicly he trys to do : python2 "/long/abs_path/stuff/game./UnRen Tools/unrpyc.py" "."

What works is simply...like this:

Code:
function decompile {
$python "$unrpyc" "$game"
}
The code change for the rpa function will be a little bit more complicated. And a suggestion: A erase old rpyc-files function would be useful i think.
 
Last edited:

goobdoob

Conversation Conqueror
Modder
Respected User
Dec 17, 2017
7,425
9,680
cold_arctus && goobdoob && enigma9999
Should work, doesn't mean it does...

Code:
olli@tty0*blue $ ./UnRen.command /home/olli/.alt/tmp/RPG/Personal_Trainer/Personal_Trainer-0.40-pc
./UnRen Tools/rpatool
./UnRen Tools/unrpyc.py
UnRen for Mac and Linux v0.8
by goobdoob @ www.f95zone.to
based on the original version by jimmy5 @ www.f95zone.to
and UnRen.bat by sam @ www.f95zone.to
Python is installed, detected
Working with directory /home/olli/.alt/tmp/RPG/Personal_Trainer/Personal_Trainer-0.40-pc

What would you like to do?
  1) Extract RPA packages
  2) Decompile rpyc files
  3) Decompile rpyc files, overwriting existing rpy files
  4) Enable Console and Developer Menu
  5) Enable Quick Save and Quick Load
  6) Force enable skipping of unseen content
  7) Force enable rollback (scroll wheel)
  8) Open game directory

  99) Options 1-7 (no overwrite)

  q) quit UnRen

1
Extracting RPA packages
extracting archive.rpa
python: can't open file './UnRen Tools/rpatool': [Errno 2] No such file or directory
Some evidence:

View attachment 470495

Note: Script and game path are very different. Used game is a random choice.
At first i thought i has some thing to do with the whitespace in .../UnRen Tools/... but then realized that's a dumb idea. Shell deals with this.

The code IMO cannot work. At least not on linux. Possible mac does some path stuff different. What happens there?

Code:
function decompile {
pushd "$game" > /dev/null  # Switch to game dir, means: -> /long/abs_path/stuff/game/
$python "$unrpyc" "."  # execute THERE the app in the variable, means: python2 "./UnRen Tools/unrpyc.py" "."
popd > /dev/null  # unimportant, line before did already a BANG!
}
Basicly he trys to do : python2 "/long/abs_path/stuff/game./UnRen Tools/unrpyc.py" "."

What works is simply...like this:

Code:
function decompile {
$python "$unrpyc" "$game"
}
The code change for the rpa function will be a little bit more complicated. And a suggestion: A erase old rpyc-files function would be useful i think.
Try using an absolute path for the game instead of a relative path.
 

Madeddy

Active Member
Dec 17, 2017
809
463
:rolleyes:

Did you a TL;DR with my post by chance?
I use absolute paths for the target directory. Clearly to see.

Anyway, i discovered another way beside the on i described up there. Calling the script with absolut path:
Code:
/home/olli/Development/shell/tools/Unren_lx/UnRen.command /home/olli/Development/shell/UnRen/pt
...
3
Decompiling rpyc files, overwriting existing rpy files
Decompiling ./game_events.rpyc to ./game_events.rpy...
Decompiling ./gallery_events.rpyc to ./gallery_events.rpy...
Decompiling ./calendar_entries.rpyc to ./calendar_entries.rpy...
Decompiling ./game_images.rpyc to ./game_images.rpy...
Decompiling ./interactions_events.rpyc to ./interactions_events.rpy...
Decompiling ./screens.rpyc to ./screens.rpy...
...
---cut---
This was to expect after did take another look at the code of the unren script.
 
Last edited:

goobdoob

Conversation Conqueror
Modder
Respected User
Dec 17, 2017
7,425
9,680
:rolleyes:

Did you a TL;DR with my post by chance?
I use absolute paths for the target directory. Clearly to see.

Anyway, i discovered another way beside the on i described up there. Calling the script with absolut path:
Code:
/home/olli/Development/shell/tools/Unren_lx/UnRen.command /home/olli/Development/shell/UnRen/pt
...
3
Decompiling rpyc files, overwriting existing rpy files
Decompiling ./game_events.rpyc to ./game_events.rpy...
Decompiling ./gallery_events.rpyc to ./gallery_events.rpy...
Decompiling ./calendar_entries.rpyc to ./calendar_entries.rpy...
Decompiling ./game_images.rpyc to ./game_images.rpy...
Decompiling ./interactions_events.rpyc to ./interactions_events.rpy...
Decompiling ./screens.rpyc to ./screens.rpy...
...
---cut---
This was to expect after did take another look at the code of the unren script.
Run it with a relative path, and dirname $0 gives a relative path. Then it does a pushd to easily get the relevant files, and the relative path that dirname gave is not correct anymore.

This was reported here: https://f95zone.to/threads/unren-for-macos-and-linux-v0-8.16887/post-2652759 . For some reason when saying to use an absolute path, I mixed up script and game. Sorry about that.
 

Madeddy

Active Member
Dec 17, 2017
809
463
Just a thought:
How about putting it alongside sam9's Win Unren on github? You and others could use a fork to contribute. Or make a own git for this.
I have already some changes in a fork slated for the win Unren and for the lx version i got some ideas.
:geek:
 
5.00 star(s) 1 Vote