proton: Limit CPU count for some games.

CW-Bug-Id: #22223
This commit is contained in:
Paul Gofman 2024-03-26 16:07:17 -06:00
parent 44d95e0df2
commit 6ceb2e8d30

17
proton
View file

@ -1147,6 +1147,19 @@ def default_compat_config():
return ret return ret
default_cpu_limit = {
"19900" : 16, # Far Cry 2
"298110" : 16, # Far Cry 4
"20920" : 16, # The Witcher 2: Assassins of Kings Enchanced Edition
"35130" : 16, # Lara Croft and the Guardian of Light
"55150" : 16, # Warhammer 40,000: Space Marine
"15620" : 8, # Warhammer 40,000: Dawn of War II
"20570" : 8, # Warhammer 40,000: Dawn of War II - Chaos Rising
"56400" : 8, # Warhammer 40,000: Dawn of War II - Retribution
"618970" : 4, # Outcast - Second Contact
"10150" : 8, # Prototype
}
class Session: class Session:
def __init__(self): def __init__(self):
self.log_file = None self.log_file = None
@ -1184,6 +1197,10 @@ class Session:
if not "noforcelgadd" in self.compat_config: if not "noforcelgadd" in self.compat_config:
self.compat_config.add("forcelgadd") self.compat_config.add("forcelgadd")
appid = os.environ.get("SteamGameId", 0)
if not "WINE_CPU_TOPOLOGY" in self.env and appid in default_cpu_limit:
self.env["WINE_CPU_TOPOLOGY"] = str(default_cpu_limit[appid])
def init_wine(self): def init_wine(self):
if "HOST_LC_ALL" in self.env and len(self.env["HOST_LC_ALL"]) > 0: if "HOST_LC_ALL" in self.env and len(self.env["HOST_LC_ALL"]) > 0:
#steam sets LC_ALL=C to help some games, but Wine requires the real value #steam sets LC_ALL=C to help some games, but Wine requires the real value