Jump to content

Discussion: Porting WeiDU Mods to Mac OS X

Recommended Posts

edit: this thread was started as a request for a Mac port tutorial request. Now the tutorial is written but I don't feel like locking it so it's now a comment thread. :D


I know there are many folks here who play BG2 on the Mac side. Not having a Mac around to test mods on, I was hoping we could get someone to help with some Mac-friendly tips. The two items I do know:


* EXE files won't execute on a Mac (of course) so self-extracting exe installers are out. I know StuffIt is a popular compression format for Macs and zip files also work. Not sure about other formats--rar, ace, etc.

* File paths in the tp2 should not be delimited with \. Use / instead as it works on both Mac and Windows.


Can anyone help?

Link to comment

Lo folks,


Scar was kind enough to post some pointers over at the Spa and Grill. I've already asked for a copy of Mac WeiDU v154 so we can use BUT_ONLY_IF_IT_CHANGES. (Best. WeiDU. Flag. Ever.) Also, I requested a little bit more info on #6 for the ogg -> wav conversion on OS X.


Normally a WeiDU mod for Windows works fine on a Mac with little to no changes. Yet, a few basic rules:


1. Use / instead of \ in paths.

2. For regexps \ is fine and necessary [1].

3. Don't use EXE installers. RAR and ZIP work fine (even the self extracting versions).

4. A setup-xyz.exe for Windows doesn't help much. Either include a Mac version or leave it out completely.

5. The latest WeiDU readily available for Mac is v148 [2].

6. For distribution of OGG audio files, you need a little CLI tool called sox and a proper shell script.

7. Speaking of shell scripts, WeiDU requires Mac OS X (if you wanna post system requirements).

8. Some installation instructions would be handy [3].

9. Last but not least, use VIEW instead of notepad to display a ReadMe at exit.


[1] If you're using regexps, put big fat warnings everywhere not to use Mod Organizer (that's a little GUI app that calls WeiDU with the proper arguments and replaces any \ with / (in any TP2 in the BG 2 folder!), which is BAD for regexps).


[2] Yet, compiling the newest version on your own is not difficult. I've got one handy (v154), so, if anybody wants to distribute it with his mod, give me a call and I'll mail it over...


[3] Well, 3 steps:

- Copy the mod folder and TP2 into the BG 2 folder.

- Start Mod Organizer (GUI) or WeiDU itself (CLI).

- Follow WeiDU's instructions on screen.


Mod Organizer is quite easy to handle, but not the best bet, given it's problems with regexps. The safe way would be to start WeiDU via a Terminal Window, but we are Mac users, remember, and easily intimidated by a CLI . Now, if someone could whip up a doubleclickable shell script doing all the typing, that would be nifty... (doubleclicking an aptly named weidu.app doesn't work, since it starts out with the user's 'home' as working dir ).



Link to comment

I'd compile during install, it's generally easier because you only have to deal with the one file. ie Just the baf, not the baf and the bcs.


EDIT: Clarifcation

Edited by Idobek
Link to comment

First of all, thanks to CamDawg for compiling this tutorial and for helping to make all the G3 mods Mac-friendly! All four of us that download and use them are extremely appreciative! :)


Second, I'd like to give a (hopefully) better solution for listing all the .ogg files in the .command script. I'm going to assume that the reasoning behind listing the files in the ogg_files variable is for two reasons: expansion of wildcards doesn't work with sox (as stated in the tutorial) and that you only want to affect the .ogg files used by this particular mod (not all .oggs by any mod). While listing all the oggs will work, there is a much simpler way of doing it that will save on potential install issues from spelling errors.



ogg_files=`ls path/to/audio/folder | grep '.ogg'`

for file in $ogg_files; do
 echo Converting $file...
 path/to/sox path/to/audio/folder/$file override/${file%.ogg}.wav


Notice the backquotes used in the ogg_files variable (same key as the tilde). They tell the script to use the output of this unix command. This will simply make a listing of all the files in your mod's audio folder that have .ogg in the filename, thus eliminating the need to manually type each one. For uninstalling the wavs, you will need a slightly modified version:



wav_files=`ls path/to/audio/folder | grep '.ogg' | sed s/.ogg/.wav/g`

for file in $wav_files; do
 if [ -e override/$file ]; then
   echo Removing $file...
   rm -f override/$file


This time, the script took the list from the audio folder and substituted the .wav suffix (instead of .ogg). Then, it checked for the existence of the file in the override folder before deleting each one.


Finally, I have run into a problem with early versions of OSX that makes the script choke. The problem comes from the fact that it runs as if located at the root of the system (which isn't where BG2 is!). To compensate for this problem, you can simply add this snippet to the top of the script:



cd "$command_path"

# rest of the script below...


I use this in all my scripts that must affect files relative to the script's location (such as installing the mod/ogg/tiz, etc). It simply assigns the absolute path of this script's location to the $command_path variable, then cd's to it. Makes life easier for the tech support people... :)

Link to comment

A quick note: to copy wav or tis files to the override, you should probably use COPY_LARGE (which is slightly faster and won't choke on TIZ files that are > 16 Mb), rather than usual COPY.


EDIT: also, for the sake of Linux-porting, you should run the .bat file if WEIDU_OS STRING_COMPARE_CASE ~WIN32~ = 0, since Linux would use the same .sh file and has x86 as WEIDU_ARCH as well.

Edited by the bigg
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...