Quickie: Using hdldump to transfer PS2 HDD games under Linux

The PS2 homebrew scene is an absolute mess, and whenever I try to find any information on any operation about it online, I find the following:

  • A truckload of conflicting information
  • A myriad of different guides spanning back 20 years
  • A bushel of different software tools, none of which are usually available on Linux
  • And a partridge in a pear tree

This time, all I needed to do was to figure out how to get my ISO and BIN/CUE PS2 backups onto an internal HDD for playing through Open PS2 Loader (OPL). All of the above points of note came into play, but after digging and sorting through it all for a bit, I found a reasonable way to do this without having to involve a Windows computer:

  1. HDL Dump Helper GUI includes a Linux x86 build of hdldump. Grab it from PSX-Place.
  2. Extract the rar, move hdld_2_3/files/hdl_dump_090 to /usr/bin/hdldump
  3. chmod +x /usr/bin/hdldump
  4. You now have hdldump for Linux CLI, hooray!

Every guide I looked at said that one of the downsides of hdldump is that it doesn't do batch operations. Who needs built-in batch operations when you have Bash?

/opt/scripts/batch_hdl.sh:

#!/bin/bash
shopt -s nullglob nocasematch

for i in *.iso
do
    gameName="${i%.*}"
    echo "Injecting ${gameName}..."
    hdldump inject_dvd "$1" "${gameName}" "${i}"
    echo "Finished injecting ${gameName}."
done

for i in *.cue
do
    gameName="${i%.*}"
    echo "Injecting ${gameName}..."
    hdldump inject_cd "$1" "${gameName}" "${i}"
    echo "Finished injecting ${gameName}."
done

Presto. Make the script executable (chmod +x batch_hdl.sh), cd to the directory with your games, then run the script with your PS2 HDD as the only argument.

For added pizzazz, put alias hdlbatch="/opt/scripts/batch_hdl.sh" in your ~/.bashrc or ~/.bash_aliases, then source ~/.bashrc/source ~/.bash_aliases. Now you can run the script from any directory using hdlbatch /dev/sdg to pump that HDD chock full of more games you'll never play.

$ hdlbatch /dev/sdg
Injecting Beyond Good & Evil...
Finished injecting Beyond Good & Evil.
Injecting Burnout 3 - Takedown...
Finished injecting Burnout 3 - Takedown
[...]