====== Sim City 3000: Unlimited ======
SC3U is by far the most difficult of these old games to run on modern system.
===== Install & patch the game =====
To install the game, mount your CD & run the installer with ''linux32'' from the ''util-linux'' package :
# mount /dev/cdrom /media/cdrom
$ linux32 bash /media/cdrom/setup.sh
Apply the last released [[https://ftp.lokigames.twolife.be/pub/updates/sc3u/sc3u-2.0a-x86.run|patch]] :
$ linux32 bash sc3u-2.0a-x86.run
Patch the binaries to use (system provided) SDL1.2 instead of the bundled SDL1.1
cd
$ patchelf --replace-needed libSDL-1.1.so.0 libSDL-1.2.so.0 sc3u.dynamic
$ patchelf --replace-needed libSDL-1.1.so.0 libSDL-1.2.so.0 sc3bat.dynamic
===== Libs =====
# apt-get install libsmpeg0:i386
==== libopenal-0.0.so ====
The dynamically linked version of the binaries requires a //very// old ''libopenal-0.0.so'', with a specific ABI, released in 2000. I can't even find source code for a such ancien version.
All I could find is a binary version bundled at [[https://www.improbability.net/loki/loki_compat_libs-1.5.tar.bz2|https://www.improbability.net/loki/]]. This version cames from the original UT99 release.
LD_LIBRARY_PATH="./" ./sc3u.dynamic
==== undefined symbol ====
''./sc3u.dynamic'' greets you with //"undefined symbol: __ti9exception"//
It seems the game was developed using C++, but was compiled with ''gcc'' instead of ''g++''
The missing function can be found in a //very// old ''libstdc++'', you can use ''libstdc++-3-libc6.2-2-2.10.0.so'' from [[https://www.improbability.net/loki/loki_compat_libs-1.5.tar.bz2|https://www.improbability.net/loki/]]
===== Segmentation fault =====
Now that we have all the old libs required, you would think "OK let's run it!" and try:
LD_LIBRARY_PATH="./" LD_PRELOAD="./libstdc++-3-libc6.2-2-2.10.0.so" ./sc3u.dynamic
but all you will get is //“Segmentation fault”//
Very short story: the game need another serie of tricks to run with a modern glibc.
You need to use a little [[https://github.com/twolife/sc3u-nptl/|shim]] that hijack the //pthread_kill()// function and does some magic.
Now you can start the game:
LD_LIBRARY_PATH="./" LD_PRELOAD="./sc3u-nptl.so:./libstdc++-3-libc6.2-2-2.10.0.so" ./sc3u.dynamic
If you are interested by all the gory details, I encourage you to read the comments in the sourcecode https://github.com/twolife/sc3u-nptl/blob/main/sc3u-nptl.c