Allow looking for multiple executable names
This commit is contained in:
parent
b9fc712534
commit
94582f1547
@ -134,8 +134,12 @@ class BaldursGate3Game(ProtonGame):
|
|||||||
return overlays
|
return overlays
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def game_executable(self) -> Path:
|
def game_executables(self) -> list[Path]:
|
||||||
return self.installation_path / "bin" / "bg3_dx11.exe"
|
# Handle both the Dx11 version and the Vulkan version.
|
||||||
|
return [
|
||||||
|
self.installation_path / "bin" / "bg3_dx11.exe",
|
||||||
|
self.installation_path / "bin" / "bg3.exe",
|
||||||
|
]
|
||||||
|
|
||||||
def to_dict(self) -> dict[str, Any]:
|
def to_dict(self) -> dict[str, Any]:
|
||||||
return {
|
return {
|
||||||
|
@ -91,7 +91,7 @@ class ProtonGame(Game, abc.ABC):
|
|||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def game_executable(self) -> Path:
|
def game_executables(self) -> list[Path]:
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -101,9 +101,10 @@ class ProtonGame(Game, abc.ABC):
|
|||||||
def wait(self):
|
def wait(self):
|
||||||
# Wait until we started the game.
|
# Wait until we started the game.
|
||||||
proc = Path("/proc")
|
proc = Path("/proc")
|
||||||
windows_path = str(self.game_executable).replace("/", "\\")
|
windows_paths = [str(executable).replace("/", "\\") for executable in self.game_executables]
|
||||||
wine_exe_path = f"Z:{windows_path}"
|
wine_exe_paths = [f"Z:{windows_path}" for windows_path in windows_paths]
|
||||||
print(wine_exe_path)
|
executables = [str(exe) for exe in self.game_executables]
|
||||||
|
print(wine_exe_paths)
|
||||||
print("Polling for game process...")
|
print("Polling for game process...")
|
||||||
while True:
|
while True:
|
||||||
for dir in os.listdir(proc):
|
for dir in os.listdir(proc):
|
||||||
@ -127,9 +128,9 @@ class ProtonGame(Game, abc.ABC):
|
|||||||
abs_cmdline = os.path.abspath(cmdline).replace("\x00", "")
|
abs_cmdline = os.path.abspath(cmdline).replace("\x00", "")
|
||||||
|
|
||||||
if (
|
if (
|
||||||
cmdline.startswith(wine_exe_path)
|
any(cmdline.startswith(wine_exe_path) for wine_exe_path in wine_exe_paths)
|
||||||
or abs_cmdline == str(self.game_executable)
|
or abs_cmdline in executables
|
||||||
or abs_cmdline.startswith(str(self.game_executable))
|
or any(abs_cmdline.startswith(exe) for exe in executables)
|
||||||
):
|
):
|
||||||
self._pid = dir
|
self._pid = dir
|
||||||
break
|
break
|
||||||
|
@ -35,8 +35,10 @@ class LethalCompanyGame(ProtonGame):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def game_executable(self) -> Path:
|
def game_executables(self) -> list[Path]:
|
||||||
return self.installation_path / "Lethal Company.exe"
|
return [
|
||||||
|
self.installation_path / "Lethal Company.exe",
|
||||||
|
]
|
||||||
|
|
||||||
def prepare_overlays(
|
def prepare_overlays(
|
||||||
self, profile: LethalCompanyProfile
|
self, profile: LethalCompanyProfile
|
||||||
|
@ -35,8 +35,10 @@ class ProjectDivaMegaMixGame(ProtonGame):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def game_executable(self) -> Path:
|
def game_executables(self) -> list[Path]:
|
||||||
return self.installation_path / "DivaMegaMix.exe"
|
return [
|
||||||
|
self.installation_path / "DivaMegaMix.exe",
|
||||||
|
]
|
||||||
|
|
||||||
def prepare_overlays(
|
def prepare_overlays(
|
||||||
self, profile: ProjectDivaMegaMixProfile
|
self, profile: ProjectDivaMegaMixProfile
|
||||||
|
@ -46,8 +46,10 @@ class ReadyOrNotGame(ProtonGame):
|
|||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def game_executable(self) -> Path:
|
def game_executables(self) -> list[Path]:
|
||||||
return self.installation_path / "ReadyOrNot.exe"
|
return [
|
||||||
|
self.installation_path / "ReadyOrNot.exe",
|
||||||
|
]
|
||||||
|
|
||||||
def to_dict(self) -> dict[str, Any]:
|
def to_dict(self) -> dict[str, Any]:
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user