| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
MD5_VANILLA="7d96ffd6da21cc3f419e42f7227642fd" |
| 4 |
MD5_FIRST63="50374bed7f84c51bdcdcefd6300ddb84" |
| 5 |
MD5_LAST32="c5e46781d21cd4414e92d91502512500" |
| 6 |
|
| 7 |
echo "Welcome to the Oni 2 (Angel Studios) Layout Patch Tool." |
| 8 |
|
| 9 |
if [ -z "$1" ]; then |
| 10 |
echo "You need to pass me the path to your ISO of Oni 2. Exiting." |
| 11 |
exit |
| 12 |
fi |
| 13 |
|
| 14 |
if [ ! -f "$1" ]; then |
| 15 |
echo "Hmm, there doesn't seem to be any file at the path you passed me. Exiting." |
| 16 |
exit |
| 17 |
fi |
| 18 |
|
| 19 |
echo "Verifying checksum...." |
| 20 |
|
| 21 |
MD5_INPUT=$(md5 "$1") |
| 22 |
MD5_INPUT=${MD5_INPUT#*= } |
| 23 |
|
| 24 |
if [ $MD5_INPUT != $MD5_VANILLA ]; then |
| 25 |
if [ $MD5_INPUT == $MD5_FIRST63 ]; then |
| 26 |
echo "This version is already patched to enabled the first 63 layouts! You should see them in the Load Game menu." |
| 27 |
elif [ $MD5_INPUT == $MD5_LAST32 ]; then |
| 28 |
echo "This version is already patched to enabled the last 32 layouts! You should see them in the Load Game menu." |
| 29 |
else |
| 30 |
echo "Unknown checksum! Sorry, this ISO isn't what I expected." |
| 31 |
fi |
| 32 |
|
| 33 |
echo "Exiting." |
| 34 |
exit |
| 35 |
fi |
| 36 |
|
| 37 |
echo "You have supplied an unmodified ISO of Oni 2. Do you wish to create a patched copy that enables the first 63 layouts or the last 32? Enter a number from this menu:" | fmt -w 80 |
| 38 |
echo "(1) First 63." |
| 39 |
echo "(2) Last 32." |
| 40 |
echo "(anything else) I changed my mind, please exit." |
| 41 |
read the_answer |
| 42 |
if [ -z "$the_answer" ]; then |
| 43 |
echo "No answer given, so I assume you changed your mind. Exiting." |
| 44 |
exit |
| 45 |
elif [ "$the_answer" == "1" ]; then |
| 46 |
echo "Creating patched version..." |
| 47 |
./xdelta3mac.exe -ds "$1" patchFromVanTo63.xd3 ./oni2dev_ps2_first63layouts.iso |
| 48 |
echo "Verifying checksum...." |
| 49 |
MD5_OUTPUT=$(md5 ./oni2dev_ps2_first63layouts.iso) |
| 50 |
MD5_OUTPUT=${MD5_OUTPUT#*= } |
| 51 |
if [ $MD5_OUTPUT != $MD5_FIRST63 ]; then |
| 52 |
echo "Uh-oh, something went wrong! Patch failed. Exiting." |
| 53 |
exit |
| 54 |
fi |
| 55 |
elif [ "$the_answer" == "2" ]; then |
| 56 |
echo "Creating patched version..." |
| 57 |
./xdelta3mac.exe -ds "$1" patchFromVanTo32.xd3 ./oni2dev_ps2_last32layouts.iso |
| 58 |
echo "Verifying checksum...." |
| 59 |
MD5_OUTPUT=$(md5 ./oni2dev_ps2_last32layouts.iso) |
| 60 |
MD5_OUTPUT=${MD5_OUTPUT#*= } |
| 61 |
if [ $MD5_OUTPUT != $MD5_LAST32 ]; then |
| 62 |
echo "Uh-oh, something went wrong! Patch failed. Exiting." |
| 63 |
exit |
| 64 |
fi |
| 65 |
fi |
| 66 |
|
| 67 |
echo "Goodbye." |