Home » PLAYER'S HQ 1.13 » JA2 Complete Mods & Sequels » Stracciatella Project (Platform Independent JA2) » [Mod] Recruit Maria using the Playable Characters Mod
Re: [Mod] Recruit Maria using the Playable Characters Mod[message #318100] Sat, 27 April 2013 19:04 Go to previous messageGo to previous message
mgl is currently offline mgl

 
Messages:255
Registered:December 2007
Location: France
First part: Make the data files from the PCM pack compatible with straciatella.

A pain to write.

First you need to download a Playable Characters Mod (PCM) pack and uncompress it. I got mine from kermi's archive *looking for a link*. I don't remember which one I downloaded, there are several of them.

Then this shell script below will fetch the files about Maria from the PCM pack, convert them to lower case and convert the sound files to a format compatible with what stracciatella can play, using the sox package, and put them in the "data" folder where the game is installed. So you need SoX on your computer, its soxi program more precisely.

fetch_maria.sh:
#! /bin/sh
#
# This script uses sox

$(which soxi > /dev/null)
if [ $? -ne 0 ]; then
	echo "Error: this script requires the sox program to work."
	exit 2
fi

if [ $# -ne 2 ]; then
	echo Usage:
	echo $0 source_data_root_dir dest_data_root_dir
	echo Copy files from the PCM mod pack and convert them to lower case
	echo "source_data_root_dir = case-sensitive path to the data folder in the mod pack E.g /tmp/PCM/data"
	echo "dest_data_root_dir = path to the data folder on your system e.g \$HOME/ja2/data"
	exit 1
fi

# Path to the root folders (remove trailing '/')
src_data=$(echo $1 | sed -e 's#/$##')
dst_data=$(echo $2 | sed -e 's#/$##')

# Exit if the source root dir doesn't exist
if (! test -d $src_data); then
	echo "Error: Source data tree \"$src_data\" doesn't exist."
	exit 2
fi

# Exit if the destination root dir doesn't exist
# It should be where the game data is installed system-wide
# or the user's root dir for ja2
if (! test -d $dst_data); then
	echo "Error: destination root tree \"$dst_data\" doesn't exist."
	exit 2
fi

audio_count=0
ms_count=0

for src_file in $(find $src_data -iname '*88*'); do
	# Build the destination file name
	# And convert it to lower case
	tmp=$(echo $src_file | sed -e s#$src_data#$dst_data#)
	dst_file=$(echo $tmp | tr [:upper] [:lower])

	# Create the destination folder if it doesn't exist
	dst_dir=$(dirname $dst_file)	
	(! test -d $dst_dir) && (mkdir --parents $dst_dir || exit 2)

	# Copy the file
	#
	
	encoding=$(soxi -V0 -e $src_file)
	if test $? -ne 0; then
		# the file is not a sound file. Copy it
		cp -a --force $src_file $dst_file || exit 2
		echo $dst_file
	else
		# Sound file.
		audio_count=$(expr $audio_count + 1)
		# Convert it to IMA ADPCM if it is a MS ADPCM encoding
		if test "$encoding" = "MS ADPCM"; then
			ms_count=$(expr $ms_count + 1)
			sox -V0 $src_file -e ima-adpcm $dst_file || exit 2
			echo "$dst_file converted to ima-adpcm encoding"
		else
			# copy it
			cp -a --force $src_file $dst_file || exit 2
			echo $dst_file
		fi
	fi
done


echo "
Success"
echo "$ms_count / $audio_count audio files were converted from Microsoft ADPCM encoding."


Give this scrip execution rights
$ chmod +x fetch_maria.sh


Run it with the right parameters.
It needs the case-sensitive path to the "data" folder in the PCM pack.
And the case-sensitive path to the "data" folder where you installed your ja2 data files.
In my case I downloaded the PCM pack to "$HOME/ja2/mods/PCM" and it unpacked a "pcm/data" folder there.
And my destination folder is "$HOME/ja2/install/data". It's the folder you put in your "ja2.ini" file needed to play stracciatella with "data" appended to it.
$ ./fetch_maria.sh $HOME/games/ja2/mods/PCM/pcm/data $HOME/games/ja2/install/data


The script should give you an output like:
Success
56 / 64 audio files were converted from Microsoft ADPCM encoding.


Then the data is ready to be used by stracciatella.

Report message to a moderator

Master Sergeant
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: High resolutions support added
Next Topic: JA2-Stracciatella Q&A
Goto Forum:
  


Current Time: Mon Jan 13 14:00:13 GMT+2 2025

Total time taken to generate the page: 0.00996 seconds