Created
September 15, 2015 19:57
-
-
Save gammy/49fdfbace8c551f99b9a to your computer and use it in GitHub Desktop.
Generate a Warcraft II mixed-mode CD from mp3 and data files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Gammies attempt to reconstruct the original | |
| # Warcraft II - Tides Of Darkness DOS/WIN95 CD. | |
| # | |
| # The copy I obtained from myabandonware.com had | |
| # been incorrectly ripped, with the audio tracks being | |
| # garbage (verified by converting the bin to wav). | |
| # | |
| # What you need: | |
| # - The original game files | |
| # - mp3 versions of the original 16 audio tracks (2-17) | |
| # Plase the game files in files/game, and the mp3's in | |
| # files/audio_mp3/ | |
| path_src=files | |
| path_dst=tracks | |
| path_data="${path_src}/game" | |
| path_mp3="${path_src}/audio_mp3" | |
| path_wav="${path_dst}" | |
| path_iso="${path_dst}/01.iso" | |
| if [ "$(ls -1 "${path_data}/" | wc -l)" = "0" ] | |
| then | |
| echo "${path_data}/: No game files" | |
| exit 1 | |
| fi | |
| if [ "$(ls -1 "${path_mp3}/" | wc -l)" = "0" ] | |
| then | |
| echo "${path_mp3}/: No mp3 files" | |
| exit 1 | |
| fi | |
| decoder_tool=mpg123 | |
| which $decoder_tool > /dev/null || decoder_tool=mpg321 | |
| which $decoder_tool > /dev/null || exit $? | |
| which cdrecord > /dev/null || exit $? | |
| which mkisofs > /dev/null || exit $? | |
| echo "Using decoder: $decoder_tool" | |
| #echo "Clearing work area" | |
| #rm --interactive=always -r "${path_dst}/" | |
| mkdir -vp "$path_dst" "$path_wav" | |
| echo "Generating WAV files from mp3's in \"${path_src}/\"" | |
| cwd="$(pwd)" | |
| tracklist= | |
| for track in $(seq -w 2 17) | |
| do | |
| mp3=$(ls "${path_mp3}/$track-"*) | |
| wav="${path_wav}/${track}.wav" | |
| if [ ! -e "$wav" ] | |
| then | |
| echo eval $decoder_tool -w "$wav" "$mp3" | |
| eval $decoder_tool -w "${path_wav}/${track}.wav" "$mp3" | |
| else | |
| echo "$wav: already exists" | |
| fi | |
| tracklist="$tracklist $wav" | |
| done | |
| echo "Building \"$path_iso\" from \"$path_data\"/" | |
| mkisofs -output-charset cp437 \ | |
| -iso-level 1 \ | |
| -o "$path_iso" "$path_data/" || exit $? | |
| if ! find "$path_iso" -size +100M | grep "$path_iso" | |
| then | |
| echo "$path_iso: Seems to be too small; bailing" | |
| exit 1 | |
| fi | |
| echo "About to write: $path_iso $tracklist" | |
| cdrecord speed=4 fs=4m -v -eject -data "${path_iso}" -audio $tracklist | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment