..and a follow-up to close out the last few odds and ends. I now have more information on using sox and tisunpack for Mac installs.
Sox and tisunpackAKA what to do with those pesky ogg and tiz filesConverting ogg and tiz files is something typically handled by an external batch file for Windows installs using command-line programs. Since batch files will not execute on a Mac, we must use a shell script. Tispack and tisunpack do have OS X versions available, though we need to use a program called sox instead of the Windows-only oggdec.exe.
The first step is calling the shell script via tp2. This is one area where the tp2 will need to be different between the two versions. You can include everything you need and just comment out lines as appropriate. For example, for G3A:
// OS X version
AT_INTERACTIVE_EXIT ~sh G3Anniversary/install.sh~
AT_INTERACTIVE_UNINSTALL ~sh G3Anniversary/uninstall.sh~
// Windows version
// AT_INTERACTIVE_EXIT ~G3Anniversary/install.bat~
// AT_INTERACTIVE_UNINSTALL ~G3Anniversary/uninstall.bat~
Depending on the version, I just comment out the appropriate lines. The install script itself is as such (slightly generalized from G3 Anniversary):
#!/bin/sh
tiz_files="g3g12b.tiz"
ogg_files="G3G12B01.ogg G3G12B02.ogg G3G12B03.ogg g3scamha.ogg"
for file in $tiz_files; do
echo Converting $file
G3Anniversary/tisunpack -s -f -o override/${file%.tiz}.tis G3Anniversary/tiz/$file
done
for file in $ogg_files; do
echo Converting $file
G3Anniversary/sox G3Anniversary/ogg/$file override/${file%.ogg}.wav
done
A shell script is simply a text file, however
it must use Unix lie breaks (LF). If you're using ConTEXT, select Tools > Convert text to... > Unix (LF only).
The first line is known as a shebang line, and tells the OS what type of interpreter to use for the script. Do not change this line.
The next lines contain a list of tiz and ogg files that need to be decompressed into tis wav files, respectively. At first, it was believed we could use wildcards for the ogg files, such as G3*.ogg. However when using wildcards they get sent to sox on a single line, and it spits out errors since sox tries to interpret the additional file names as command-line arguments or flags for sox. Long story short--use individual filenames. I have not tested wildcards with tisunpack, though I suspect a similar issue may exist.
The next two blocks of code take the files from the two file lists and execute the decompression routines on them. You'll need to adjust them to the paths in your mod. In this case, sox and tisunpack are in the G3Anniversary folder, and ogg and tiz files are in subfolders named, oddly enough, ogg and tiz. For tisunpack, I have selected the -s flag (which makes it run without a lot of feedback, or 'silently'), -f (this forces an overwrite if the file already exists) and the -o file so that I can specify an output file.
UninstallingClean up after yourself!Since the tis and wav files are added by an external program, WeiDU does not know to uninstall them. Using an uninstall shell script will remove the files from the end-users machine and keep everyone happy. From the G3 Anniversary mod, yet again:
#!/bin/sh
del_files="G3G12B01.wav G3G12B02.wav G3G12B03.wav g3scamha.wav g3g12b.tis"
for file in $del_files; do
rm override/$file
done
Looking familiar? Unlike the install script, the tis and wav files can be lumped into one group since they're just being deleted.
One last note on the command fileOS X adds a hidden file in folders that a user views, called .DS_Store. These files are more ur less irrelevant, unless you use a batch compile command in your mod. For example, G3 Anniversary uses
COMPILE ~G3Anniversary/compile~
to compile an entire directory of dialogue and script files. If the .DS_Store file is present, then WeiDU will try to compile it as well and kill the install since it's not a valid file. Fortunatle, the DS_Store files can be remove without consequence, You delete the .DS_Store files via the .command file before executing WeiDU using this:
command_path=${0%/*}
cd "$command_path"
./Setup-G3Anniversary
ds=".DS_Store"
rem_ds="$ds G3Anniversary/compile/$ds"
for file in $rem_ds; do
if [ -e $file ]; then
rm -f $file
fi
done
The rem_ds= line will contain paths to the directories you will batch compile; in this case the G3Anniversary/compile folder. Please note this is only necessary if you're batch compiling.
Thanks and creditsI would not have been able to sort all this out without the help of many folks. In particular, thanks to Scar/Armin, whose shell scripts are the basis for the ones above and who helped with finding and fixing errors; thanks to Loriel for helping us out with various coding issues here and there; thanks to the community in general at the Spa & Grill; thanks to Idobek for finding all sorts of bugs for me to worry about; and thanks to JPS for letting me send him test after test after test to get this right.
For example in action, check out the OS X version of the G3 Anniversary mod. It uses both tisunpack, sox, and the DS_Store removal tricks.