Having multiple RTPs as symlinks in Linux

There are useful use cases to have several RTPs on the same PC. For example, you want to play games made with Don’s RTP 1.32 and KVlad’s RTP (which includes all the Don’s RTP), but develop games with Don’s RTP 1.0.

To reduce duplication, I’ve written a script which replaces all the RTP files with simlinks to “/some-path/unified/{$extension}/{$md5_hash}.{$extension}”. I’m adding it here in hope it can be useful for someone else.

#!/bin/bash

UNIFIED_RTP_PATH="$HOME/Soft/RM2k/RTPs/unified/"

dirs=`for x in *; do if [ -d "$x" ]; then echo -n "$x "; fi done`

for dir in $dirs; do
  cd "$dir"
  echo -n "Processing $dir... "
  i=0
  for fn in *; do
    if [ -f "$fn" -a ! -L "$fn" ]; then
      i=`expr $i + 1`
      extension="${fn#*.}"
      md5sum=`md5sum "${fn}"|cut -d' ' -f1,1`
      ext=`echo "$extension" | awk '{print tolower($0)}'`
      mkdir -p "$UNIFIED_RTP_PATH/${ext}/"
      mv "$fn" "$UNIFIED_RTP_PATH/${ext}/${md5sum}.${ext}"
      ln -s "$UNIFIED_RTP_PATH/${ext}/${md5sum}.${ext}" "$fn"
    fi
  done
  echo "$i files moved."
  cd ..

Replace UNIFIED_RTP_PATH with your target path, and run this script inside all the RTP folders (i.e. in a folder that contains Backdrop, CharSet, etc.).

This should teoretically work on game folders too, but I wouldn’t recommend it (there is no way to remove files for a specific game, so your UNIFIED_RTP_PATH will quickly become polluted).

MD5 hashes will be different if the files that were re-compressed. I don’t know if some RTPs distributed recompressed files, hopefully they didn’t.

1 Like

I am currently using don’s rtp (extras) + the japanese rtp and put them both in the environment variable RPG2K_RTP_PATH. There may be some duplicates, but having 20 mb here or there does not hurt.

I usually have from ~200 Mb to ~500 Mb free in my /home, and I have more RTPs, so this makes some difference for me. :smiley:

I’ve already written in the chat, but I’ll write here, too: I’ve found that chipsets are not the same in the current Japanese RTP2003 and in the translations. I think the translations are derived from an earlied version of the RTP. The differences are minor (third animated tile is shifted by 1px, and circular rails in Dungeon are redrawn).

Here are the hashes for translated versions:

78d87317afa786ff410fc3abfe96d503 ./ChipSet/기본.png ./ChipSet/main.png [translated 基本]
0efb1a3e90e534afacd4f6290c3e67fe ./ChipSet/외견.png ./ChipSet/town.png [外観]
98ef025b6f3aa86181b07cd01e0f1578 ./ChipSet/내부.png ./ChipSet/building.png [内装]
c56e84d6e0933e550add501ffb3cdd6f ./ChipSet/던젼.png ./ChipSet/dungeon.png [ダンジョン]
b65fe306679cb58d7d521de7322f6042 ./ChipSet/배.png ./ChipSet/ship.png [船; actually it’s from RTP2000]

Here are the hashes for the original versions:

a253e61b1198bebfb89e4ca0f828a598 ./ChipSet/基本.png
3bdbc5c0041c0ad013c06929302485b7 ./ChipSet/外観.png
0da73b801f6acbb8cff92f43c5cbeeef ./ChipSet/内装.png
ceb057ffa15a0d89d4b265c5ae1a145a ./ChipSet/ダンジョン.png
58c47527f068674ae912d4033c20a11a ./ChipSet/船.png

1 Like