Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issues affecting Loki port of Soldier of Fortune #322

Open
twolife opened this issue Oct 26, 2023 · 12 comments
Open

issues affecting Loki port of Soldier of Fortune #322

twolife opened this issue Oct 26, 2023 · 12 comments
Assignees
Milestone

Comments

@twolife
Copy link
Contributor

twolife commented Oct 26, 2023

I know there are some issues to get this game to even run on a modern system (it being an ancient SDL 1.1 game), but it is possible, with a real SDL 1.2 or the supplied SDL 1.1.
But unfortunately the game is unplayable with sdl12-compat :'(

I noticed 2 problems (they may be related, or not...)

  1. Once you starts a new game, a red icon starts to flickers very quickly in the top left corner & when you move the character it's completely sluggish. It sometime get fast for 5 second before slowing down again. It's horrible.
    sof

  2. If you persist to play (despite the big n°1 problem), the floor sometimes gets instantaneously full of blood, and if you take 2 steps ahead it' gets back to normal
    sof_blood
    sof_noblood

I don't know if this is a lost cause or if you can pull off some magic, but at least this is now documented ^^

@icculus icculus self-assigned this Oct 27, 2023
@icculus icculus added this to the 1.2.72 milestone Oct 27, 2023
@OlegAckbar
Copy link

Red icon and sluggish movement are caused by high refresh rate, limiting in-game fps to 60 fixes the issue.
I can't reproduce bug with red floor
изображение

@icculus
Copy link
Collaborator

icculus commented Mar 31, 2024

Hmm...@twolife, can you verify?

We could maybe add a quirk to force vsync or just make SDL_GL_SwapBuffers stall to keep to ~60fps.

@OlegAckbar
Copy link

OlegAckbar commented Mar 31, 2024

@icculus locking framerate to 60 wouldn't be necessary since game can run without issues even at 165 fps. I think best case would be to determine critical framerate for this game since there are 360hz and higher monitors on the market already and forcing vsync could exceed framerate threshold.
изображение

@icculus
Copy link
Collaborator

icculus commented Mar 31, 2024

We should probably do both, vsync and also wait, so it looks smoother and also doesn't iterate too quickly if the refresh rate is too high. But maybe that's silly, I don't know yet.

@twolife
Copy link
Contributor Author

twolife commented Apr 1, 2024

ho wow, SDL12COMPAT_SYNC_TO_VBLANK=1 fixed the walking problem & did make the blood problem disappear.
thanks a lot 😃

@darkstar252
Copy link

I had the same loki game but apart from the game crashing with :
------- Loading ./ref_gl.so -------
Fatal signal: Segmentation Fault (SDL Parachute Deployed)

@icculus
Copy link
Collaborator

icculus commented Mar 2, 2025

There's a lot of reasons it might crash besides potential sdl12-compat bugs, being an ancient binary; please make sure it runs with a real SDL 1.2, or with whatever SDL it shipped with originally, first. If it works there and not with sdl12-compat, we'll try to help.

@twolife
Copy link
Contributor Author

twolife commented Mar 3, 2025

SoF is a little bit difficult to run on modern Linux system, but nothing impossible.

I had the same loki game but apart from the game crashing with :
------- Loading ./ref_gl.so -------
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.
The driver returns a list that is much larger than the 8192 bytes allocated text-string.
The program crash after overwriting instruction memory with text data.

One way to prevent this is to ask the driver to pretend you live in the past, the extensions list will be much smaller :

$ export MESA_EXTENSION_MAX_YEAR=2002       # Mesa
$ export __GL_ExtensionStringVersion=17700  # Nvidia

That crash is only the first you will encounter, the next one will occurs in the liboasnd.so library and it 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 from 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, which has a different signature, and the game crash.

My workaround is to use elfhash to rename the sl_add symbol from liboasnd.so:
elfhash -f sl_add -t sl_adx liboasnd.so

@darkstar252
Copy link

darkstar252 commented Mar 3, 2025

One way to prevent this is to ask the driver to pretend you live in the past, the extensions list will be much smaller :

$ export MESA_EXTENSION_MAX_YEAR=2002 # Mesa
$ export __GL_ExtensionStringVersion=17700 # Nvidia

It seems to not work for me using manjaro linux and an amd radeon R9 380.

Made a script runme.sh

#!/bin/bash
export MESA_EXTENSION_MAX_YEAR=2002 # Mesa
export __GL_ExtensionStringVersion=17700 # Nvidia
./sof

running it the same thing.
[darkstar@wopr sof]$ ./runme.sh
execing default.cfg
execing default_sound.cfg
execing configs/default_keys.cfg
execing default_misc.cfg
execing default_video.cfg
execing menus/reset.cfg
execing config.cfg
----------- Cpu info -----------
Processor : AMD
Type : Original OEM processor
Speed : -1 MHz
MMX instructions supported
RDTSC instruction supported

Using default memory value--use +set cpu_memory to change
65MB of physical memory
Hostname: wopr
IP #1: 127.0.1.1
=== Server Initalization ===
Console initialized.
------- Loading ./ref_gl.so -------
ref_gl version: GL 0.01
Initialzing OpenGL display
... setting mode 3: 640 480 FS
Fatal signal: Segmentation Fault (SDL Parachute Deployed)

Maybe it's something that i am doing wrong??

@icculus
Copy link
Collaborator

icculus commented Mar 5, 2025

------- Loading ./ref_gl.so -------
ref_gl version: GL 0.01
Initialzing OpenGL display
... setting mode 3: 640 480 FS
Fatal signal: Segmentation Fault (SDL Parachute Deployed)

Maybe it's something that i am doing wrong??

Strictly speaking, you got further than last time, where the ------- Loading ./ref_gl.so ------- was the last line before the crash.

You probably need to try the rest of @twolife's advice now.

@darkstar252
Copy link

darkstar252 commented Mar 5, 2025

I tried it i made the elfhash thing and all of the things que said. Even including a patch o ref_gl.so with no avail.

The page about the patches is this:

https://dusted.dk/pages/sof-resolution/

But... As I said . No avail it was failing like crazy. I don't know if putting some new ref_gl.so of yamagi quake2 or darkplaces solve those issues.
I have added the patch with elfhash on liboasound.o

@darkstar252
Copy link

It seems like export __GL_ExtensionStringVersion=17700 is for propietary nvidia drivers i am using radeon drivers any idea on this ?? I am looking at all mesa variables here , because this enviroment variable does not work for me there is another one to use instead..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants