-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgames.py
31 lines (23 loc) · 898 Bytes
/
games.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
games.py - List of all the games this patcher supports.
"""
import os
from typing import Tuple, List, Optional, TypedDict
from collections import namedtuple
# cSpell: words TESV, skse, nvse, fose
Game = namedtuple("Game", ["exe", "se_exe"])
FALLOUT_4 = Game("Fallout4", "f4se")
SKYRIM = Game("TESV", "skse")
FALLOUT_NEW_VEGAS = Game("FalloutNV", "nvse")
FALLOUT_3 = Game("Fallout3", "fose")
def detect_game(path: Optional[str] = None) -> Optional[Game]:
"""Search the current directory for a supported game."""
if path is None:
path = os.getcwd()
for game in (FALLOUT_4, SKYRIM, FALLOUT_NEW_VEGAS, FALLOUT_3):
if os.path.isfile(os.path.join(path, "{}.exe".format(game.exe))):
return game
return None
def patched_game_name(game: Game) -> str:
"""Get the name of the game executable after patching."""
return ".{}.exe".format(game.exe)