Skip to content

Commit

Permalink
Fix for latest master changes (BasicModDataChecker)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZashIn committed Sep 28, 2023
1 parent dbf2587 commit f449050
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions games/game_cyberpunk2077.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import mobase

from ..basic_features import BasicModDataChecker
from ..basic_features import BasicModDataChecker, GlobPatterns
from ..basic_features.basic_save_game_info import (
BasicGameSaveGame,
BasicGameSaveGameInfo,
Expand All @@ -22,21 +22,24 @@


class CyberpunkModDataChecker(BasicModDataChecker):
default_file_patterns = {
"valid": ["root", "archive", "mods"],
"move": {
# archive and ArchiveXL
"*.archive": "archive/pc/mod",
"*.xl": "archive/pc/mod",
"bin": "root/", # CET, red4ext
# redscript
"engine": "root/",
"r6": "root/",
"red4ext": "root/",
# redmod
# "*": "mods",
},
}
def __init__(self):
super().__init__(
GlobPatterns(
valid=["root", "archive", "mods"],
move={
# archive and ArchiveXL
"*.archive": "archive/pc/mod",
"*.xl": "archive/pc/mod",
"bin": "root/", # CET, red4ext
# redscript
"engine": "root/",
"r6": "root/",
"red4ext": "root/",
# redmod
# "*": "mods",
},
)
)

def dataLooksValid(
self, filetree: mobase.IFileTree
Expand All @@ -52,11 +55,11 @@ def dataLooksValid(
return self.CheckReturn.FIXABLE
return res

def fix(self, filetree: mobase.IFileTree) -> mobase.IFileTree | None:
def fix(self, filetree: mobase.IFileTree) -> mobase.IFileTree:
# Check for correct redmod format
tree = super().fix(filetree) or filetree
for entry in tree:
if not self._regex["valid"].match(
if not self._regex_patterns.valid.match(
entry.name().casefold()
) and self._valid_redmod(entry):
tree.move(entry, "mods/")
Expand Down Expand Up @@ -127,7 +130,7 @@ def init(self, organizer: mobase.IOrganizer) -> bool:
)
self._featureMap[mobase.ModDataChecker] = CyberpunkModDataChecker()

def ui_init(window):
def ui_init(window: QMainWindow):
self._qwindow = window
self._set_root_builder_settings()

Expand Down Expand Up @@ -254,7 +257,7 @@ def executables(self) -> list[mobase.ExecutableInfo]:
else ""
)
redmod_installed = self._is_redmod_installed()
execs = []
execs: list[mobase.ExecutableInfo] = []
if redmod_installed:
# Game with redmod
execs.append(
Expand Down

0 comments on commit f449050

Please sign in to comment.