lokigames:kingpin

Kingpin: Life of Crime

There wasn't a retail Linux version of this game, instead the developers provided a downloadable tarball with Linux binaries to use with the Windows CD :

To install the Kingpin files, you will need to install Kingpin under win32,
and then mount the installation folder under linux, and copy the installed
files across.

Rest assured, you won't need to do that ;-)

To install the required utils :

# apt-get install unshield xxd

Next, let's say you want to install the game in $HOME/kingpin :

# mount /dev/cdrom /media/cdrom

$ mkdir $HOME/kingpin
$ unshield -d $HOME/kingpin -L x /media/cdrom/kingpin/data1.cab
$ cd $HOME/kingpin
$ rsync -a common_files/ mature_files/ program_executable_files/ ./
$ rm -rf common_files/ low_violence_files/ mature_files/ program_executable_files/ us_specific_files/ *.exe *.dll main/gamex86.dll

$ cd main/models/actors/runt/
$ ln -s r_pstl.mdx R_pstl.mdx
$ ln -s l_pstl.mdx L_pstl.mdx
$ cd -

$ cd main/models/actors/thug/
$ ln -s r_pstl.mdx R_pstl.mdx
$ ln -s l_pstl.mdx L_pstl.mdx
$ cd -

Download kingpin-1.20_glibc-i386-linux2.0.tar.gz from https://downloads.kingpin.info/index.php?dir=kingpin/patches/official/linux/

$ tar xzf kingpin-1.20_glibc-i386-linux2.0.tar.gz -C $HOME/kingpin
$ cd $HOME/kingpin
$ rm lib3dfxgl.so libGL.so libMesaGL* libTNTgl.so
$ mv kingpin kingpin.x86
$ echo $HOME/kingpin > kingpin.conf
$ cp ref_glx.so ref_glx.so.orig
$ echo -n "2020" | xxd -r -p -seek 0x46EA6 - ref_glx.so
$ echo -n "2020" | xxd -r -p -seek 0x47076 - ref_glx.so

Download kphack and extract it in your installation directory.

kphack can be traced back to this unofficial installer, but I never found the source code :-(

Kingpin is a weird game that doesn't use the SDL and does everything by himself.

It does mmap() on /dev/dsp.

This is not supported by osspd. This is bad :'(

The only solution is to stop osspd and use the primitive OSS emulation provided by ALSA in the Linux kernel.

# systemctl stop osspd
# modprobe snd-pcm-oss
# echo 'kingpin.x86 0 0 direct' > /proc/asound/card0/pcm0p/oss
#!/bin/sh
#
# Kingpin: Life of Crime startup script
#

# The user preferences directory
KINGPIN_PREFS="${HOME}/.kingpin"

# KPHack options
export KPHACK_DGAMOUSE=1 KPHACK_FULLSCREEN=1 KPHACK_WHEEL=0

# Function to find the real directory a program resides in.
# Feb. 17, 2000 - Sam Lantinga, Loki Entertainment Software
FindPath()
{
    fullpath="`echo $1 | grep /`"
    if [ "$fullpath" = "" ]; then
        oIFS="$IFS"
        IFS=:
        for path in $PATH
        do if [ -x "$path/$1" ]; then
               if [ "$path" = "" ]; then
                   path="."
               fi
               fullpath="$path/$1"
               break
           fi
        done
        IFS="$oIFS"
    fi
    if [ "$fullpath" = "" ]; then
        fullpath="$1"
    fi
    # Is the awk/ls magic portable?
    if [ -L "$fullpath" ]; then
        fullpath="`ls -l "$fullpath" | awk '{print $11}'`"
    fi
    dirname $fullpath
}

# Set the home if not already set.
if [ "${KINGPIN_DATA_PATH}" = "" ]; then
    KINGPIN_DATA_PATH="`FindPath $0`"
fi

LD_LIBRARY_PATH=.:${KINGPIN_DATA_PATH}:${LD_LIBRARY_PATH}

export LD_LIBRARY_PATH
export KINGPIN_DATA_PATH
export LD_PRELOAD="${KINGPIN_DATA_PATH}/kphack.so:$LD_PRELOAD"

create_prefpath()
{
    path="${KINGPIN_PREFS}"
    if [ ! -d "$path" ]; then
        echo "Creating directory $path"
        mkdir "$path"
    fi
}

copy_if_needed()
{
    dist="${KINGPIN_DATA_PATH}/kingpin.conf"
    file="${KINGPIN_PREFS}/kingpin.conf"
    if [ ! -f "$file" ]; then
        echo "Installing default $file"
        cp "$dist" "$file"
    fi
}

# KPHack doesn't play nicely with $HOME/.kingpin when starting a new game
# when saves already exist in main/save/current/

fix_current_saves()
{
if [ -e ${KINGPIN_PREFS}/main/save/current/game.ssv ]
then
	rm ${KINGPIN_PREFS}/main/save/current/*
fi
}

# Hey, it's fun time!
if [ ! -d ${KINGPIN_PREFS} ]
then
    echo "Creating preferences directory..."
    create_prefpath
    copy_if_needed
fi

# Let's boogie!
if [ -x "${KINGPIN_DATA_PATH}/kingpin.x86" ]
then
	fix_current_saves
	cd "${KINGPIN_DATA_PATH}/"
	exec "./kingpin.x86" +set vid_ref glx \
	+set gl_driver libGL.so.1 "$@" +set _windowed_mouse 1 $*
fi
echo "Couldn't run Kingpin: Life of Crime (kingpin.x86). Is KINGPIN_DATA_PATH set?"
exit 1
  • lokigames/kingpin.txt
  • Dernière modification : 2024/05/30 17:05
  • de twolife