MangoHud icon indicating copy to clipboard operation
MangoHud copied to clipboard

Unreadable HUD output in GOG's Star Trek Elite Force 1 using Wine-6.0.1 or Proton (OpenGL, 32-bit)

Open TheMarfy opened this issue 3 years ago • 7 comments

Hello There!

I just bought Star Trek Elite Force 1 on Good Old Games new offerings for Star Trek classic games. I run Elite Force primary through WineHQ wine-6.0.1. I also tested running it in the Steam client using various Proton versions, again resulting in corrupted output. After installing the 32bit shared object and binaries packaged here at GitHub I got MangoHUD sort of running using the command line: mangohud --dlsym wine stvoy.exe

The game starts and everything looks awesome at first. mangohud_working_in_sequences

After the intro sequence and while loading the main menu the MangoHUD becomes completely unreadable: mangohud_corrupted_ingame Bildschirmfoto vom 2021-09-10 23-55-32

During loading screens and "render" sequences it become readable again until the game starts.

I checked 2 systems, both Ubuntu 21.04, Xorg Display Server session and Wayland sessions. And Wine 4.0.1 as well. The main system uses a Radeon RX Vega 56 and the other one is a laptop using Intel Core i5 6200U with HD Graphics 520. The laptop uses graphics driver Mesa Intel HD Graphics 520 (SKL GT2). For the main system I attached the following outputs:

I already tested the documented Workarounds to put in the config file:

gl_size_query="viewport"/"scissorbox"/disabled
gl_bind_framebuffer=0/1/.. up to 10
gl_dont_flip=1

Is this a known bug? Are there other options to get around the display issue?

I'm thankful for any further advise! Thanks!

PS: In the meantime I will use GALLIUM_HUD what seems to work fine. But MangoHUD is much nicer.

TheMarfy avatar Sep 11 '21 09:09 TheMarfy

It's probably the same "bug" where game overwrites font texture for some reason. You can test by setting different font size to force reupload of font texture. If you can, post a apitrace just in case.

jackun avatar Sep 11 '21 09:09 jackun

Thanks for the fast response! I will try!

TheMarfy avatar Sep 11 '21 10:09 TheMarfy

Hello jackun,

The apitrace utility seems to have issues capturing any calls through Wine. I tried out this guide from the apitrace GitHub repo: https://github.com/apitrace/apitrace/wiki/WINE#windows-native but it didn't work. Also the native linux apitrace is unable to capture anything during the wine execution even its OpenGL calls.

However, you are spot right with the font size overwrites! Everytime MangoHUDs output gets corrupted, I change the parameter font_size=24.00 to font_size=24.01 or the other way around. After saving the MangoHUDs config file the text is restored and readable. It stays readable until some random point or I open the game menu.

Is it a good idea to write a little Python script that changes the font_size value every 10 seconds to auto restore the HUD font? I have concerns it will be a big performance hit.

Thanks again for your advise! :-)

TheMarfy avatar Sep 11 '21 11:09 TheMarfy

Ok, it probably wouldn't have shown up in trace anyway actually. At least another game to test with.

jackun avatar Sep 11 '21 11:09 jackun

Thanks again jackun,

I pasted hasty a Python script together what every 10 seconds alters the font_size by 0.01 back and forward. It isn't pretty but its an immediate workaround. For those who really need something to get it running, here are the Python script:

#! /usr/bin/python3
import os
import re
import time

regex = re.compile(r".*font_size=(?P<font_size>\d\d*\.{0,1}\d+).*")
homedir = os.getenv("HOME")
mangoHudConfPath = homedir + "/.config/MangoHud/MangoHud.conf"

while True:
    interval = os.getenv("MANGOHUD_FONT_REFRESH")
    if interval is None:
        interval = 10.0 
    else:
        interval = float(interval)
    confFile = open( mangoHudConfPath , "r")
    text = confFile.read()

    matchings = re.search(regex, text)
    if matchings is not None:
        fontSize = matchings.group('font_size')
        print(fontSize)
        if re.match(r"\d\d*",fontSize)  :
            #covers initial case
            replacement = 'font_size='+fontSize+".01"
        if re.match(r"\d\d*\.\d1",fontSize):
            #covers toggle back to user_font_size.00
            replacement = 'font_size='+fontSize.split(".")[0]+".00"
        elif re.match(r"\d\d*\.\d0",fontSize):
            #covers toggle to user_font_size.01
            replacement = 'font_size='+fontSize.split(".")[0]+".01"
        
        print("replacement string is: " + replacement)
        text = re.sub(regex, replacement, text)
    else:
        print("no font_size parameter found in " + mangoHudConfPath)
    writeHandle = open(mangoHudConfPath, "w")
    writeHandle.write(text)
    confFile.close()
    writeHandle.close()
    time.sleep(interval)
    processes = os.system("ps -elf | grep -i stvoy.exe | grep -v grep")
    print(processes)
    if processes == 256:
        exit(0)

The script can be put into Lutris pre-start script mechanism. The script monitors for a process binary containing "stvoy.exe". If the games is terminated the script will also exit. The script can configured how often the font_size is alter by using the ENVIRONMENT variable MANGOHUD_FONT_REFRESH. By default is it 10 seconds. A to low value will introduce micro hitches.

I notices no performance penalty but in rare cases some textures may glitch out.

TheMarfy avatar Sep 11 '21 16:09 TheMarfy

@TheMarfy can you check if this patch fixes the issue for you? font.txt

gort818 avatar Jan 13 '22 03:01 gort818

@gort818 Thanks for the patch! I will test it as soon I have time! :-)

TheMarfy avatar Jan 14 '22 14:01 TheMarfy

reopen if still an issue

flightlessmango avatar Jul 24 '23 08:07 flightlessmango