Outils pour utilisateurs

Outils du site


lokigames:sof

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
lokigames:sof [2024/04/01 17:52] twolifelokigames:sof [2024/04/03 08:46] (Version actuelle) twolife
Ligne 1: Ligne 1:
 +====== Soldier of Fortune ======
  
 +===== Install & patch the game =====
 +
 +To install the required utils :
 +<code>
 +# apt-get install xxd
 +</code>
 +
 +To install the game, mount your CD & run the installer with ''linux32'' from the ''util-linux'' package :
 +<code>
 +# mount /dev/cdrom /media/cdrom
 +$ linux32 bash /media/cdrom/setup.sh
 +</code>
 +
 +Apply the the last released [[https://ftp.lokigames.twolife.be/pub/updates/sof/sof-1.06a-cdrom-x86.run|patch]] :
 +<code>
 +$ linux32 bash sof-1.06a-cdrom-x86.run
 +</code>
 +
 +===== Video crash =====
 +''./sof'' greets you with //"Fatal signal: Segmentation Fault (SDL Parachute Deployed)"// 
 +
 +The //ref_gl.so// library wants to print a list of OpenGL extensions available in your graphic driver.
 +What's happening is that the buffer with the extensions is too large for the 8192 bytes allocated text-string use by vsprintf. The program crash after overwriting instruction memory with text data.
 +The most simple way to fix this, is to never let vsprintf write the buffer. It's only a message console, it's never used for anything useful in the game!
 +
 +You can do it graphically, using an hex editor, find "GL_EXTENSIONS: %s" and replace "%s" by 2 spaces.
 +Or you can do it in with ''xxd'' :
 +<code>
 +$ cp ref_gl.so ref_gl.so.orig
 +$ echo -n "2020" | xxd -r -p -seek 0x50245 - ref_gl.so
 +</code>
 +
 +===== Audio crash =====
 +<code>
 +====== Soldier of Fortune Initialized ======
 +
 +Fatal signal: Segmentation Fault (SDL Parachute Deployed)
 +Segmentation fault
 +</code>
 +
 +This one is a little bit more complicated...
 +
 +''sof-bin'' use symbols from ''libX11.so.6'', itself linked to ''libXdmcp.so.6''. In modern Linux distribution, ''libXdmcp.so.6'' is linked to ''libbsd0''. Current //libbsd// (version >= 0.7 to be precise) provide the symbol //'sl_add'//.
 +
 +But the ''liboasnd.so'' file (provided and used by the game) also has a symbol named //'sl_add'//. When ''liboasnd.so'' calls 'his' //'sl_add'//, it use in fact the libbsd provided //'sl_add'// function, and the game crash.
 +
 +=== Option 1 ====
 +Use a libxdmcp6 package from [[https://snapshot.debian.org/archive/debian/20160121T041313Z/pool/main/libx/libxdmcp/libxdmcp6_1.1.2-1.1_i386.deb|before the added dependency]] to libbsd0. 
 +
 +=== Option 2 ====
 +Use [[https://github.com/cjacker/elfhash|elfhash]] to rename ''liboasnd.so'' 's //sl_add// symbol
 +
 +<code>
 +$ cp liboasnd.so liboasnd.so.orig
 +$ elfhash -f sl_add -t sl_adx liboasnd.so
 +</code>
 +
 +=== Option 3 ====
 +I used a Python script to rename ''liboasnd.so'' 's //sl_add// symbol:
 +<code>
 +# apt-get install virtualenv python3-pip
 +$ virtualenv venv-pip
 +$ . venv-pip/bin/activate
 +$ pip install lief
 +$ cp liboasnd.so liboasnd.so.orig
 +</code>
 +
 +<code>
 +import lief
 +liboasnd = lief.parse("liboasnd.so")
 +for idx, lsym in enumerate(filter(lambda e : e.exported, liboasnd.dynamic_symbols)):
 +    if lsym.name == "sl_add":
 +        print(f"rename symbol {idx} {lsym.name} to 'sl_adx'")
 +        lsym.name = "sl_adx"
 +liboasnd.write(liboasnd.name)
 +</code>
 +
 +
 +===== Optional: use sdl12-compat instead of bundled SDL-1.1 =====
 +<code>
 +$ mv libSDL-1.1.so.0 libSDL-1.1.so.0.orig
 +$ ln -s /usr/lib/i386-linux-gnu/libSDL-1.2.so.0 libSDL-1.1.so.0
 +</code>
 +
 +Now you can start the game, but when you try to walk forward you will get extreme stuttering and a flashing ethernet icon.
 +
 +This is cause by the combinaison of broken game logic & framerate over 120 (ie: you have a much more powerful computer than what was available when the game was released). The easiest way to fix this is to force VSYNC at the SDL level. This works for my hardware (it locks framerate at ~60), but I know there is already 360hz and higher monitors on the market, so it may not works for you.
 +
 +<code>
 +$ LD_PRELOAD=libX11.so.6 SDL12COMPAT_SYNC_TO_VBLANK=1 ./sof
 +</code>
lokigames/sof.txt · Dernière modification : 2024/04/03 08:46 de twolife

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki