Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 35 additions & 4 deletions games/game_cyberpunk2077.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def active_mod_paths(self, reverse: bool = False) -> Iterable[Path]:
class Cyberpunk2077Game(BasicGame):
Name = "Cyberpunk 2077 Support Plugin"
Author = "6788, Zash"
Version = "3.0.0"
Version = "3.0.1"

GameName = "Cyberpunk 2077"
GameShortName = "cyberpunk2077"
Expand Down Expand Up @@ -233,9 +233,6 @@ class Cyberpunk2077Game(BasicGame):

def init(self, organizer: mobase.IOrganizer) -> bool:
super().init(organizer)
print("init")
print(f"{self.gameDirectory().absolutePath()=}")
print(f"{self._gamePath=}")
self._register_feature(BasicLocalSavegames(self))
self._register_feature(
BasicGameSaveGameInfo(
Expand All @@ -259,6 +256,7 @@ def init(self, organizer: mobase.IOrganizer) -> bool:
),
)
organizer.onAboutToRun(self._onAboutToRun)
organizer.onFinishedRun(self._onFinishedRun)
organizer.onPluginSettingChanged(self._on_settings_changed)
organizer.modList().onModInstalled(self._check_disable_crashreporter)
organizer.onUserInterfaceInitialized(self._on_user_interface_initialized)
Expand Down Expand Up @@ -431,6 +429,11 @@ def settings(self) -> list[mobase.PluginSetting]:
),
True,
),
mobase.PluginSetting(
"crash_message",
("Show a crash message as replacement of disabled CrashReporter"),
True,
),
mobase.PluginSetting(
"show_rootbuilder_conversion",
(
Expand Down Expand Up @@ -524,6 +527,34 @@ def _onAboutToRun(self, app_path_str: str, wd: QDir, args: str) -> bool:
self._modlist_files.update_modlist("archive")
return True

def _onFinishedRun(self, path: str, exit_code: int) -> None:
if not self._get_setting("crash_message"):
return
if path.endswith(self.binaryName()) and exit_code > 0:
crash_message = QMessageBox(
QMessageBox.Icon.Critical,
"Cyberpunk Crashed",
textwrap.dedent(
f"""
Cyberpunk crashed. Tips:
- disable mods (create backup of modlist or use new profile)
- clear overwrite or delete at least overwrite/r6/cache (to keep mod settings)
- check log files of CET/redscript/RED4ext (in overwrite)
- read [FAQ & Troubleshooting]({self.GameSupportURL}#faq--troubleshooting)
"""
),
QMessageBox.StandardButton.Ok,
self._parentWidget,
)
crash_message.setTextFormat(Qt.TextFormat.MarkdownText)
hide_cb = QCheckBox("&Do not show again*", crash_message)
hide_cb.setToolTip(f"Settings/Plugins/{self.name()}/crash_message")
crash_message.setCheckBox(hide_cb)
crash_message.open( # type: ignore
lambda: hide_cb.isChecked()
and self._set_setting("crash_message", False)
)

def _check_redmod_result(self, result: tuple[bool, int]) -> bool:
if result == (True, 0):
return True
Expand Down