diff --git a/opencore_legacy_patcher/sys_patch/sys_patch.py b/opencore_legacy_patcher/sys_patch/sys_patch.py index 1a2899337..466f091eb 100644 --- a/opencore_legacy_patcher/sys_patch/sys_patch.py +++ b/opencore_legacy_patcher/sys_patch/sys_patch.py @@ -920,13 +920,16 @@ class PatchSysVolume: return logging.info("- Verifying whether Root Patching possible") - if sys_patch_detect.DetectRootPatch(self.computer.real_model, self.constants).verify_patch_allowed(print_errors=not self.constants.wxpython_variant) is True: - logging.info("- Patcher is capable of patching") - if self._check_files(): - if self._mount_root_vol() is True: - self._patch_root_vol() - else: - logging.info("- Recommend rebooting the machine and trying to patch again") + if sys_patch_detect.DetectRootPatch(self.computer.real_model, self.constants).verify_patch_allowed(print_errors=not self.constants.wxpython_variant) is False: + logging.error("- Cannot continue with patching!!!") + return + + logging.info("- Patcher is capable of patching") + if self._check_files(): + if self._mount_root_vol() is True: + self._patch_root_vol() + else: + logging.info("- Recommend rebooting the machine and trying to patch again") def start_unpatch(self) -> None: @@ -935,8 +938,11 @@ class PatchSysVolume: """ logging.info("- Starting Unpatch Process") - if sys_patch_detect.DetectRootPatch(self.computer.real_model, self.constants).verify_patch_allowed(print_errors=True) is True: - if self._mount_root_vol() is True: - self._unpatch_root_vol() - else: - logging.info("- Recommend rebooting the machine and trying to patch again") + if sys_patch_detect.DetectRootPatch(self.computer.real_model, self.constants).verify_patch_allowed(print_errors=True) is False: + logging.error("- Cannot continue with unpatching!!!") + return + + if self._mount_root_vol() is True: + self._unpatch_root_vol() + else: + logging.info("- Recommend rebooting the machine and trying to patch again") diff --git a/opencore_legacy_patcher/sys_patch/sys_patch_mount.py b/opencore_legacy_patcher/sys_patch/sys_patch_mount.py index b905c2b07..9c64e4e17 100644 --- a/opencore_legacy_patcher/sys_patch/sys_patch_mount.py +++ b/opencore_legacy_patcher/sys_patch/sys_patch_mount.py @@ -33,6 +33,9 @@ class SysPatchMount: If none, failed to mount. """ result = self._mount_root_volume() + if result is None: + logging.error("Failed to mount root volume") + return None if not Path(result).exists(): logging.error(f"Attempted to mount root volume, but failed: {result}") return None diff --git a/opencore_legacy_patcher/wx_gui/gui_sys_patch_display.py b/opencore_legacy_patcher/wx_gui/gui_sys_patch_display.py index 7d70eda11..cd1aabdd6 100644 --- a/opencore_legacy_patcher/wx_gui/gui_sys_patch_display.py +++ b/opencore_legacy_patcher/wx_gui/gui_sys_patch_display.py @@ -253,8 +253,11 @@ class SysPatchDisplayFrame(wx.Frame): global_constants=self.constants, patches=patches, ) + self.frame_modal.Hide() + self.frame_modal.Destroy() + self.frame.Hide() + self.frame.Destroy() frame.start_root_patching() - self.on_return_dismiss() if self.init_with_parent else self.on_return_to_main_menu() def on_revert_root_patching(self, patches: dict): @@ -264,8 +267,11 @@ class SysPatchDisplayFrame(wx.Frame): global_constants=self.constants, patches=patches, ) + self.frame_modal.Hide() + self.frame_modal.Destroy() + self.frame.Hide() + self.frame.Destroy() frame.revert_root_patching() - self.on_return_dismiss() if self.init_with_parent else self.on_return_to_main_menu() def on_return_to_main_menu(self, event: wx.Event = None):