|
1 | | -import mobase |
2 | | -from PyQt6.QtCore import QDir, QFileInfo |
3 | | - |
4 | | -from ..basic_features import BasicLocalSavegames |
5 | | -from ..basic_game import BasicGame |
6 | | -from ..steam_utils import find_steam_path |
7 | | - |
8 | | - |
9 | | -# Lifted from https://github.com/ModOrganizer2/modorganizer-basic_games/blob/71dbb8c557d43cba9d290674a332e7ecd1650261/games/game_darkestdungeon.py |
10 | | -class ArkhamCityModDataChecker(mobase.ModDataChecker): |
11 | | - def __init__(self): |
12 | | - super().__init__() |
13 | | - self.validDirNames = [ |
14 | | - "config", |
15 | | - "cookedpcconsole", |
16 | | - "localization", |
17 | | - "movies", |
18 | | - "moviesstereo", |
19 | | - "splash", |
20 | | - ] |
21 | | - |
22 | | - def dataLooksValid( |
23 | | - self, filetree: mobase.IFileTree |
24 | | - ) -> mobase.ModDataChecker.CheckReturn: |
25 | | - for entry in filetree: |
26 | | - if not entry.isDir(): |
27 | | - continue |
28 | | - if entry.name().casefold() in self.validDirNames: |
29 | | - return mobase.ModDataChecker.VALID |
30 | | - return mobase.ModDataChecker.INVALID |
31 | | - |
32 | | - |
33 | | -class ArkhamCityGame(BasicGame): |
34 | | - Name = "Batman: Arkham City Plugin" |
35 | | - Author = "Paynamia" |
36 | | - Version = "0.5.3" |
37 | | - |
38 | | - GameName = "Batman: Arkham City" |
39 | | - GameShortName = "batmanarkhamcity" |
40 | | - GameNexusId = 372 |
41 | | - GameSteamId = 200260 |
42 | | - GameGogId = 1260066469 |
43 | | - GameEpicId = "Egret" |
44 | | - GameBinary = "Binaries/Win32/BatmanAC.exe" |
45 | | - GameLauncher = "Binaries/Win32/BmLauncher.exe" |
46 | | - GameDataPath = "BmGame" |
47 | | - GameDocumentsDirectory = ( |
48 | | - "%DOCUMENTS%/WB Games/Batman Arkham City GOTY/BmGame/Config" |
49 | | - ) |
50 | | - GameIniFiles = ["UserEngine.ini", "UserGame.ini", "UserInput.ini"] |
51 | | - GameSaveExtension = "sgd" |
52 | | - |
53 | | - # This will only detect saves from the earliest-created Steam profile on the user's PC. |
54 | | - def savesDirectory(self) -> QDir: |
55 | | - docSaves = QDir(self.documentsDirectory().cleanPath("../../SaveData")) |
56 | | - if self.is_steam(): |
57 | | - if (steamDir := find_steam_path()) is None: |
58 | | - return docSaves |
59 | | - for child in steamDir.joinpath("userdata").iterdir(): |
60 | | - if not child.is_dir() or child.name == "0": |
61 | | - continue |
62 | | - steamSaves = child.joinpath("200260", "remote") |
63 | | - if steamSaves.is_dir(): |
64 | | - return QDir(str(steamSaves)) |
65 | | - else: |
66 | | - return docSaves |
67 | | - else: |
68 | | - return docSaves |
69 | | - |
70 | | - def init(self, organizer: mobase.IOrganizer) -> bool: |
71 | | - super().init(organizer) |
72 | | - self._register_feature(ArkhamCityModDataChecker()) |
73 | | - self._register_feature(BasicLocalSavegames(self.savesDirectory())) |
74 | | - return True |
75 | | - |
76 | | - def executables(self): |
77 | | - return [ |
78 | | - mobase.ExecutableInfo( |
79 | | - "Batman: Arkham City", |
80 | | - QFileInfo(self.gameDirectory(), "Binaries/Win32/BatmanAC.exe"), |
81 | | - ), |
82 | | - mobase.ExecutableInfo( |
83 | | - "Arkham City Launcher", |
84 | | - QFileInfo(self.gameDirectory(), "Binaries/Win32/BmLauncher.exe"), |
85 | | - ), |
86 | | - ] |
| 1 | +from PyQt6.QtCore import QDir, QFileInfo |
| 2 | + |
| 3 | +import mobase |
| 4 | + |
| 5 | +from ..basic_features import BasicLocalSavegames |
| 6 | +from ..basic_game import BasicGame |
| 7 | +from ..steam_utils import find_steam_path |
| 8 | + |
| 9 | + |
| 10 | +# Lifted from https://github.com/ModOrganizer2/modorganizer-basic_games/blob/71dbb8c557d43cba9d290674a332e7ecd1650261/games/game_darkestdungeon.py |
| 11 | +class ArkhamCityModDataChecker(mobase.ModDataChecker): |
| 12 | + def __init__(self): |
| 13 | + super().__init__() |
| 14 | + self.validDirNames = [ |
| 15 | + "config", |
| 16 | + "cookedpcconsole", |
| 17 | + "localization", |
| 18 | + "movies", |
| 19 | + "moviesstereo", |
| 20 | + "splash", |
| 21 | + ] |
| 22 | + |
| 23 | + def dataLooksValid( |
| 24 | + self, filetree: mobase.IFileTree |
| 25 | + ) -> mobase.ModDataChecker.CheckReturn: |
| 26 | + for entry in filetree: |
| 27 | + if not entry.isDir(): |
| 28 | + continue |
| 29 | + if entry.name().casefold() in self.validDirNames: |
| 30 | + return mobase.ModDataChecker.VALID |
| 31 | + return mobase.ModDataChecker.INVALID |
| 32 | + |
| 33 | + |
| 34 | +class ArkhamCityGame(BasicGame): |
| 35 | + Name = "Batman: Arkham City Plugin" |
| 36 | + Author = "Paynamia" |
| 37 | + Version = "0.5.3" |
| 38 | + |
| 39 | + GameName = "Batman: Arkham City" |
| 40 | + GameShortName = "batmanarkhamcity" |
| 41 | + GameNexusId = 372 |
| 42 | + GameSteamId = 200260 |
| 43 | + GameGogId = 1260066469 |
| 44 | + GameEpicId = "Egret" |
| 45 | + GameBinary = "Binaries/Win32/BatmanAC.exe" |
| 46 | + GameLauncher = "Binaries/Win32/BmLauncher.exe" |
| 47 | + GameDataPath = "BmGame" |
| 48 | + GameDocumentsDirectory = ( |
| 49 | + "%DOCUMENTS%/WB Games/Batman Arkham City GOTY/BmGame/Config" |
| 50 | + ) |
| 51 | + GameIniFiles = ["UserEngine.ini", "UserGame.ini", "UserInput.ini"] |
| 52 | + GameSaveExtension = "sgd" |
| 53 | + |
| 54 | + # This will only detect saves from the earliest-created Steam profile on the user's PC. |
| 55 | + def savesDirectory(self) -> QDir: |
| 56 | + docSaves = QDir(self.documentsDirectory().cleanPath("../../SaveData")) |
| 57 | + if self.is_steam(): |
| 58 | + if (steamDir := find_steam_path()) is None: |
| 59 | + return docSaves |
| 60 | + for child in steamDir.joinpath("userdata").iterdir(): |
| 61 | + if not child.is_dir() or child.name == "0": |
| 62 | + continue |
| 63 | + steamSaves = child.joinpath("200260", "remote") |
| 64 | + if steamSaves.is_dir(): |
| 65 | + return QDir(str(steamSaves)) |
| 66 | + else: |
| 67 | + return docSaves |
| 68 | + else: |
| 69 | + return docSaves |
| 70 | + |
| 71 | + def init(self, organizer: mobase.IOrganizer) -> bool: |
| 72 | + super().init(organizer) |
| 73 | + self._register_feature(ArkhamCityModDataChecker()) |
| 74 | + self._register_feature(BasicLocalSavegames(self.savesDirectory())) |
| 75 | + return True |
| 76 | + |
| 77 | + def executables(self): |
| 78 | + return [ |
| 79 | + mobase.ExecutableInfo( |
| 80 | + "Batman: Arkham City", |
| 81 | + QFileInfo(self.gameDirectory(), "Binaries/Win32/BatmanAC.exe"), |
| 82 | + ), |
| 83 | + mobase.ExecutableInfo( |
| 84 | + "Arkham City Launcher", |
| 85 | + QFileInfo(self.gameDirectory(), "Binaries/Win32/BmLauncher.exe"), |
| 86 | + ), |
| 87 | + ] |
0 commit comments