mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-13 20:28:21 +10:00
Merge pull request #844 from dortania/wxPython-demo
Implement wxPython Based GUI
This commit is contained in:
10
.github/workflows/build-app-offline.yml
vendored
10
.github/workflows/build-app-offline.yml
vendored
@@ -16,18 +16,20 @@ jobs:
|
||||
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher.spec
|
||||
- run: ./after_pyinstaller.sh
|
||||
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
||||
- run: cd dist; zip -r ../OpenCore-Patcher-TUI-Offline.app.zip OpenCore-Patcher.app
|
||||
- run: cd dist; zip -r ../OpenCore-Patcher-TUI.app.zip OpenCore-Patcher.app
|
||||
- run: ./../sign-tui.sh
|
||||
- name: Upload App to Artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: OpenCore-Patcher-TUI-Offline.app
|
||||
path: OpenCore-Patcher-TUI-Offline.app.zip
|
||||
name: OpenCore-Patcher-TUI.app (Offline)
|
||||
path: OpenCore-Patcher-TUI.app.zip
|
||||
|
||||
- name: Upload to Release
|
||||
if: github.event_name == 'release'
|
||||
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: OpenCore-Patcher-TUI-Offline.app.zip
|
||||
asset_name: OpenCore-Patcher-TUI.app (Offline)
|
||||
file: OpenCore-Patcher-TUI.app.zip
|
||||
tag: ${{ github.ref }}
|
||||
file_glob: true
|
||||
|
||||
35
.github/workflows/build-app-wxpython-offline.yml
vendored
Normal file
35
.github/workflows/build-app-wxpython-offline.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: CI - Build wxPython Offline
|
||||
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build wxPython Offline
|
||||
runs-on: x86_64_mojave
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: python3 create_offline_build.py
|
||||
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher-GUI.spec
|
||||
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
||||
- run: cd dist; zip -r ../OpenCore-Patcher-wxPython.app.zip OpenCore-Patcher.app
|
||||
- run: ./../sign-wxpython.sh
|
||||
- name: Upload App to Artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: OpenCore-Patcher.app (GUI Offline)
|
||||
path: OpenCore-Patcher-wxPython.app.zip
|
||||
- name: Upload to Release
|
||||
if: github.event_name == 'release'
|
||||
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: OpenCore-Patcher-wxPython.app.zip
|
||||
tag: ${{ github.ref }}
|
||||
file_glob: true
|
||||
asset_name: OpenCore-Patcher.app (GUI Offline)
|
||||
- name: Validate OpenCore
|
||||
run: ./dist/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher --validate
|
||||
33
.github/workflows/build-app-wxpython.yml
vendored
Normal file
33
.github/workflows/build-app-wxpython.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: CI - Build wxPython
|
||||
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build wxPython
|
||||
runs-on: x86_64_mojave
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher-GUI.spec
|
||||
- run: python3 ./payloads/binary.py
|
||||
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
||||
- run: cd dist; zip -r ../OpenCore-Patcher-wxPython.app.zip OpenCore-Patcher.app
|
||||
- run: ./../sign-wxpython.sh
|
||||
- name: Upload App to Artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: OpenCore-Patcher.app (GUI)
|
||||
path: OpenCore-Patcher-wxPython.app.zip
|
||||
- name: Upload to Release
|
||||
if: github.event_name == 'release'
|
||||
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: OpenCore-Patcher-wxPython.app.zip
|
||||
tag: ${{ github.ref }}
|
||||
file_glob: true
|
||||
asset_name: OpenCore-Patcher.app (GUI)
|
||||
52
.github/workflows/build-gui.yml
vendored
52
.github/workflows/build-gui.yml
vendored
@@ -1,52 +0,0 @@
|
||||
name: CI - Build GUI
|
||||
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build GUI
|
||||
runs-on: x86_64_mojave
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher.spec
|
||||
- run: cd dist; cp OpenCore-Patcher ../; cd ..; mv OpenCore-Patcher OCLP-CLI
|
||||
- name: Download latest nightly OCLP-GUI
|
||||
run: curl -S -L https://nightly.link/dortania/OCLP-GUI/workflows/build-app/master/OpenCore-Patcher-GUI.app.zip --output ./OpenCore-Patcher-GUI.app.zip --insecure
|
||||
- run: unzip -o OpenCore-Patcher-GUI.app.zip
|
||||
- run: unzip OpenCore-Patcher-GUI.app.zip; rm OpenCore-Patcher-GUI.app.zip
|
||||
- name: Merge new GUI
|
||||
run: cp OCLP-CLI OpenCore\ Patcher.app/Contents/Resources/
|
||||
- run: python3 merge_gui.py
|
||||
- name: Code Sign Binaries
|
||||
run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "OpenCore Patcher.app/Contents/Resources/OCLP-CLI"'
|
||||
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "OpenCore Patcher.app/Contents/Resources/oclpd"'
|
||||
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "OpenCore Patcher.app"'
|
||||
- run: ditto -c -k --sequesterRsrc --keepParent OpenCore\ Patcher.app OpenCore-Patcher-GUI.app.zip
|
||||
- name: Notarize Binaries for release
|
||||
if: github.event_name == 'release'
|
||||
run: ./../sign-gui.sh
|
||||
- name: Upload GUI to Artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: OpenCore-Patcher-GUI.app
|
||||
path: OpenCore-Patcher-GUI.app.zip
|
||||
- name: Upload CLI to Artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: OCLP-CLI
|
||||
path: OCLP-CLI
|
||||
- name: Upload to Release
|
||||
if: github.event_name == 'release'
|
||||
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: OpenCore-Patcher-GUI.app.zip
|
||||
tag: ${{ github.ref }}
|
||||
file_glob: true
|
||||
- name: Validate OpenCore
|
||||
run: ./OCLP-CLI --validate
|
||||
6
OpenCore-Patcher-GUI.command
Executable file
6
OpenCore-Patcher-GUI.command
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||
from resources import main
|
||||
|
||||
if __name__ == '__main__':
|
||||
main.OpenCoreLegacyPatcher(True)
|
||||
53
OpenCore-Patcher-GUI.spec
Normal file
53
OpenCore-Patcher-GUI.spec
Normal file
@@ -0,0 +1,53 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
import sys, os
|
||||
sys.path.append(os.path.abspath(os.getcwd()))
|
||||
from resources import constants
|
||||
block_cipher = None
|
||||
|
||||
|
||||
a = Analysis(['OpenCore-Patcher-GUI.command'],
|
||||
pathex=['resources', 'data', 'gui'],
|
||||
binaries=[],
|
||||
datas=[('payloads', 'payloads')],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=block_cipher,
|
||||
noarchive=False)
|
||||
pyz = PYZ(a.pure, a.zipped_data,
|
||||
cipher=block_cipher)
|
||||
|
||||
exe = EXE(pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[],
|
||||
name='OpenCore-Patcher',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=False,
|
||||
disable_windowed_traceback=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None )
|
||||
app = BUNDLE(exe,
|
||||
name='OpenCore-Patcher.app',
|
||||
icon="payloads/OC-Patcher.icns",
|
||||
bundle_identifier=None,
|
||||
info_plist={
|
||||
"CFBundleShortVersionString": constants.Constants().patcher_version,
|
||||
"NSHumanReadableCopyright": "Copyright 2020-2022 Dortania",
|
||||
"LSMinimumSystemVersion": "10.10.0",
|
||||
"NSRequiresAquaSystemAppearance": False,
|
||||
"NSHighResolutionCapable": True,
|
||||
})
|
||||
@@ -12,7 +12,7 @@ a = Analysis(['OpenCore-Patcher.command'],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
excludes=['wxPython', 'wxpython'],
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=block_cipher,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<h1>OpenCore Legacy Patcher</h1>
|
||||
</div>
|
||||
|
||||
A python program with an [Objective-C GUI](https://github.com/dortania/OCLP-GUI) for building and booting [OpenCore](https://github.com/acidanthera/OpenCorePkg) on both legacy and modern Macs, see our in-depth [Guide](https://dortania.github.io/OpenCore-Legacy-Patcher/) for more information.
|
||||
A python program for building and booting [OpenCore](https://github.com/acidanthera/OpenCorePkg) on both legacy and modern Macs, see our in-depth [Guide](https://dortania.github.io/OpenCore-Legacy-Patcher/) for more information.
|
||||
|
||||
Supported features:
|
||||
|
||||
|
||||
39
SOURCE.md
39
SOURCE.md
@@ -4,7 +4,8 @@ OpenCore Legacy Patcher at its core is a python-based TUI/CLI based application.
|
||||
|
||||
For developers wishing to validate mainline changes, you may use these nightly links:
|
||||
|
||||
* [GUI (Graphical Based App)](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-gui/main/OpenCore-Patcher-GUI.app.zip)
|
||||
* [GUI (Graphical Based App)](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-wxpython/main/OpenCore-Patcher-GUI.app.zip)
|
||||
* [GUI (Graphical Based App) - Offline Variant](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-wxpython-offline/main/OpenCore-Patcher-GUI.app.zip)
|
||||
* [TUI (Text Based App)](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app/main/OpenCore-Patcher-TUI.app.zip)
|
||||
* [TUI (Text Based App) - Offline Variant](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app/main/OpenCore-Patcher-TUI-Offline.app.zip)
|
||||
|
||||
@@ -36,12 +37,19 @@ pip3 install -r requirements.txt
|
||||
To run the project from source, simply invoke via python3:
|
||||
|
||||
```sh
|
||||
# Launch TUI
|
||||
python3 OpenCore-Patcher.command
|
||||
```
|
||||
|
||||
```sh
|
||||
# Launch GUI
|
||||
python3 OpenCore-Patcher-GUI.command
|
||||
```
|
||||
|
||||
Note that the OpenCore-Patcher.command file can be run as both a TUI and a CLI utility for other programs to call. If no core arguments are passed, the TUI is initialized. Otherwise the CLI will start:
|
||||
|
||||
```sh
|
||||
# Launch CLI
|
||||
python3 OpenCore-Patcher.command --build --model iMac12,2 --verbose
|
||||
```
|
||||
|
||||
@@ -49,7 +57,7 @@ See `-h`/`--help` for more information on supported CLI arguments.
|
||||
|
||||
## Generating prebuilt binaries
|
||||
|
||||
The main goal of generating prebuilt binaries is to strip the requirement of a local python installation for users. For developers, there's very little benefit besides for usage with the project's GUI ([Generating the GUI](#generating-the-gui)). For development, simply use the OpenCore-Patcher.command file with a python3 installation.
|
||||
The main goal of generating prebuilt binaries is to strip the requirement of a local python installation for users. For developers, there's very little benefit besides enabling dark mode support in the GUI. For development, simply use the OpenCore-Patcher.command file with a python3 installation.
|
||||
|
||||
* Note that due to PyInstaller's linking mechanism, binaries generated on Catalina and newer are not compatible with High Sierra and older
|
||||
* To ensure the largest compatibility, generate binaries on macOS Mojave. These binaries will be compatible with macOS 10.9 to macOS 12.
|
||||
@@ -60,9 +68,9 @@ The main goal of generating prebuilt binaries is to strip the requirement of a l
|
||||
pip3 install pyinstaller
|
||||
# Move into project directory
|
||||
cd ~/Developer/OpenCore-Legacy-Patcher/
|
||||
# Create the pyinstaller based Application
|
||||
# Create the pyinstaller based Application (replace OpenCore-Patcher.spec with OpenCore-Patcher-GUI.spec for GUI binary)
|
||||
pyinstaller OpenCore-Patcher.spec
|
||||
# Post PyInstaller clean up
|
||||
# Post PyInstaller clean up (only for the TUI)
|
||||
./after_pyinstaller.sh
|
||||
# Open build folder
|
||||
open ./dist/
|
||||
@@ -70,25 +78,4 @@ open ./dist/
|
||||
|
||||
Once done, you'll find the application generated at `./dist/OpenCore-Patcher.app`:
|
||||
|
||||

|
||||
|
||||
## Generating the GUI
|
||||
|
||||
To generate a GUI, you will have need a core `OpenCore-Patcher` binary generated during the above stage([Generating prebuilt binaries](#generating-prebuilt-binaries)).
|
||||
|
||||
Once conditions are met, you'll be able to work with the GUI portion. The source of which is found at [dortania/OCLP-GUI](https://github.com/dortania/OCLP-GUI).
|
||||
|
||||
```sh
|
||||
# Move into a directory to store the project
|
||||
cd ~/Developer
|
||||
# Clone project
|
||||
git clone https://github.com/dortania/OCLP-GUI
|
||||
# Update the OpenCore-Patcher binary from the core project
|
||||
cp ./OpenCore-Legacy-Patcher/dist/OpenCore-Patcher ./OCLP-GUI/OpenCore\ Patcher/OpenCore\ Patcher/
|
||||
# Rename binary to OCLP-CLI
|
||||
mv ./OCLP-GUI/OpenCore\ Patcher/OpenCore\ Patcher/OCLP-GUI/OpenCore-Patcher ./OCLP-GUI/OpenCore\ Patcher/OpenCore\ Patcher/OCLP-GUI/OCLP-CLI
|
||||
# Build project
|
||||
cd ./OCLP-GUI/OpenCore\ Patcher; xcodebuild; cd ../../
|
||||
# Open build folder
|
||||
open ./OCLP-GUI/OpenCore\ Patcher/build/Release/
|
||||
```
|
||||

|
||||
@@ -1,3 +1,4 @@
|
||||
from data import os_data
|
||||
class system_integrity_protection:
|
||||
csr_values = {
|
||||
# Source: macOS 11.4 (XNU's csr.h)
|
||||
@@ -17,6 +18,101 @@ class system_integrity_protection:
|
||||
"CSR_ALLOW_UNAUTHENTICATED_ROOT": False, # 0x800 - Allow Root Volume Mounting - Introduced in Big Sur # noqa: E241
|
||||
}
|
||||
|
||||
csr_values_extended = {
|
||||
"CSR_ALLOW_UNTRUSTED_KEXTS": {
|
||||
"name": "CSR_ALLOW_UNTRUSTED_KEXTS",
|
||||
"description": "Allows Unsigned Kexts",
|
||||
"introduced": os_data.os_data.el_capitan.value,
|
||||
"introduced_friendly": "El Capitan",
|
||||
"value": 0x1,
|
||||
},
|
||||
"CSR_ALLOW_UNRESTRICTED_FS": {
|
||||
"name": "CSR_ALLOW_UNRESTRICTED_FS",
|
||||
"description": "File System Access",
|
||||
"introduced": os_data.os_data.el_capitan.value,
|
||||
"introduced_friendly": "El Capitan",
|
||||
"value": 0x2,
|
||||
},
|
||||
"CSR_ALLOW_TASK_FOR_PID": {
|
||||
"name": "CSR_ALLOW_TASK_FOR_PID",
|
||||
"description": "Unrestricted task_for_pid()",
|
||||
"introduced": os_data.os_data.el_capitan.value,
|
||||
"introduced_friendly": "El Capitan",
|
||||
"value": 0x4,
|
||||
},
|
||||
"CSR_ALLOW_KERNEL_DEBUGGER": {
|
||||
"name": "CSR_ALLOW_KERNEL_DEBUGGER",
|
||||
"description": "Allow Kernel Debugger",
|
||||
"introduced": os_data.os_data.el_capitan.value,
|
||||
"introduced_friendly": "El Capitan",
|
||||
"value": 0x8,
|
||||
},
|
||||
"CSR_ALLOW_APPLE_INTERNAL": {
|
||||
"name": "CSR_ALLOW_APPLE_INTERNAL",
|
||||
"description": "Set AppleInternal Features",
|
||||
"introduced": os_data.os_data.el_capitan.value,
|
||||
"introduced_friendly": "El Capitan",
|
||||
"value": 0x10,
|
||||
},
|
||||
# "CSR_ALLOW_DESTRUCTIVE_DTRACE": {
|
||||
# "name": "CSR_ALLOW_DESTRUCTIVE_DTRACE",
|
||||
# "description": "Allow destructive DTrace",
|
||||
# "deprecated": True,
|
||||
# "introduced": os_data.os_data.el_capitan.value,
|
||||
# "introduced_friendly": "El Capitan",
|
||||
# "value": 0x20,
|
||||
# },
|
||||
"CSR_ALLOW_UNRESTRICTED_DTRACE": {
|
||||
"name": "CSR_ALLOW_UNRESTRICTED_DTRACE",
|
||||
"description": "Unrestricted DTrace usage",
|
||||
"introduced": os_data.os_data.el_capitan.value,
|
||||
"introduced_friendly": "El Capitan",
|
||||
"value": 0x20,
|
||||
},
|
||||
"CSR_ALLOW_UNRESTRICTED_NVRAM": {
|
||||
"name": "CSR_ALLOW_UNRESTRICTED_NVRAM",
|
||||
"description": "Unrestricted NVRAM write",
|
||||
"introduced": os_data.os_data.el_capitan.value,
|
||||
"introduced_friendly": "El Capitan",
|
||||
"value": 0x40,
|
||||
},
|
||||
"CSR_ALLOW_DEVICE_CONFIGURATION": {
|
||||
"name": "CSR_ALLOW_DEVICE_CONFIGURATION",
|
||||
"description": "Allow custom DeviceTree (iOS)",
|
||||
"introduced": os_data.os_data.el_capitan.value,
|
||||
"introduced_friendly": "El Capitan",
|
||||
"value": 0x80,
|
||||
},
|
||||
"CSR_ALLOW_ANY_RECOVERY_OS": {
|
||||
"name": "CSR_ALLOW_ANY_RECOVERY_OS",
|
||||
"description": "Skip BaseSystem Verification",
|
||||
"introduced": os_data.os_data.sierra.value,
|
||||
"introduced_friendly": "Sierra",
|
||||
"value": 0x100,
|
||||
},
|
||||
"CSR_ALLOW_UNAPPROVED_KEXTS": {
|
||||
"name": "CSR_ALLOW_UNAPPROVED_KEXTS",
|
||||
"description": "Allow Unnotarized Kexts",
|
||||
"introduced": os_data.os_data.high_sierra.value,
|
||||
"introduced_friendly": "High Sierra",
|
||||
"value": 0x200,
|
||||
},
|
||||
"CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE": {
|
||||
"name": "CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE",
|
||||
"description": "Override Executable Policy",
|
||||
"introduced": os_data.os_data.mojave.value,
|
||||
"introduced_friendly": "Mojave",
|
||||
"value": 0x400,
|
||||
},
|
||||
"CSR_ALLOW_UNAUTHENTICATED_ROOT": {
|
||||
"name": "CSR_ALLOW_UNAUTHENTICATED_ROOT",
|
||||
"description": "Allow Root Volume Mounting",
|
||||
"introduced": os_data.os_data.big_sur.value,
|
||||
"introduced_friendly": "Big Sur",
|
||||
"value": 0x800,
|
||||
},
|
||||
}
|
||||
|
||||
root_patch_sip_mojave = [
|
||||
# Variables required to root patch in Mojave and Catalina
|
||||
"CSR_ALLOW_UNTRUSTED_KEXTS", # 0x1
|
||||
|
||||
2146
gui/gui_main.py
Normal file
2146
gui/gui_main.py
Normal file
File diff suppressed because it is too large
Load Diff
43
gui/menu_redirect.py
Normal file
43
gui/menu_redirect.py
Normal file
@@ -0,0 +1,43 @@
|
||||
import wx
|
||||
import time
|
||||
|
||||
class RedirectText(object):
|
||||
def __init__(self,aWxTextCtrl, sleep):
|
||||
self.out=aWxTextCtrl
|
||||
self.sleep = sleep
|
||||
|
||||
def write(self,string):
|
||||
self.out.WriteText(string)
|
||||
wx.GetApp().Yield()
|
||||
if self.sleep:
|
||||
time.sleep(0.01)
|
||||
|
||||
def fileno(self):
|
||||
return 1
|
||||
|
||||
def flush(self):
|
||||
pass
|
||||
|
||||
class RedirectLabel(object):
|
||||
def __init__(self,aWxTextCtrl):
|
||||
self.out=aWxTextCtrl
|
||||
|
||||
def write(self,string):
|
||||
if string.endswith("MB/s"):
|
||||
self.out.SetLabel(string)
|
||||
self.out.Centre(wx.HORIZONTAL)
|
||||
wx.GetApp().Yield()
|
||||
time.sleep(0.01)
|
||||
|
||||
def flush(self):
|
||||
pass
|
||||
|
||||
class RedirectLabelAll(object):
|
||||
def __init__(self,aWxTextCtrl):
|
||||
self.out=aWxTextCtrl
|
||||
|
||||
def write(self,string):
|
||||
self.out.SetLabel(string)
|
||||
self.out.Centre(wx.HORIZONTAL)
|
||||
wx.GetApp().Yield()
|
||||
time.sleep(0.01)
|
||||
10
merge_gui.py
10
merge_gui.py
@@ -1,10 +0,0 @@
|
||||
# Updates build version in OCLP-GUI during CI builds
|
||||
# Copyright (C) 2021-2022 Mykola Grymalyuk
|
||||
import plistlib
|
||||
from pathlib import Path
|
||||
from resources import constants
|
||||
|
||||
app_path = Path.cwd() / Path ("OpenCore Patcher.app/Contents/Info.plist")
|
||||
info = plistlib.load(Path(app_path).open("rb"))
|
||||
info["CFBundleShortVersionString"] = constants.Constants().patcher_version
|
||||
plistlib.dump(info, Path(app_path).open("wb"), sort_keys=True)
|
||||
10
payloads/binary.py
Normal file
10
payloads/binary.py
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
path = './dist/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher'
|
||||
find = b'\x00\x0D\x0A\x00'
|
||||
replace = b'\x00\x0A\x0A\x00'
|
||||
# Open file in binary mode
|
||||
with open(path, 'rb') as f:
|
||||
data = f.read()
|
||||
data = data.replace(find, replace)
|
||||
with open(path, 'wb') as f:
|
||||
f.write(data)
|
||||
@@ -1,2 +1,3 @@
|
||||
requests
|
||||
pyobjc
|
||||
pyobjc
|
||||
wxpython
|
||||
@@ -478,20 +478,8 @@ class BuildOpenCore:
|
||||
# Used to enable Audio support for non-standard dGPUs
|
||||
self.enable_kext("AppleALC.kext", self.constants.applealc_version, self.constants.applealc_path)
|
||||
|
||||
def check_firewire(model):
|
||||
# MacBooks never supported FireWire
|
||||
# Pre-Thunderbolt MacBook Airs as well
|
||||
if model.startswith("MacBookPro"):
|
||||
return True
|
||||
elif model.startswith("MacBookAir"):
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.sandy_bridge.value:
|
||||
return False
|
||||
elif model.startswith("MacBook"):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
if self.constants.firewire_boot is True and check_firewire(self.model) is True:
|
||||
if self.constants.firewire_boot is True and generate_smbios.check_firewire(self.model) is True:
|
||||
# Enable FireWire Boot Support
|
||||
# Applicable for both native FireWire and Thunderbolt to FireWire adapters
|
||||
print("- Enabling FireWire Boot Support")
|
||||
|
||||
@@ -880,12 +880,13 @@ Supported Options:
|
||||
change_menu = input("Set FeatreUnlock (ie. 1): ")
|
||||
if change_menu == "1":
|
||||
self.constants.fu_status = True
|
||||
self.constants.fu_arguments = ""
|
||||
self.constants.fu_arguments = None
|
||||
elif change_menu == "2":
|
||||
self.constants.fu_status = True
|
||||
self.constants.fu_arguments = " -disable_sidecar_mac"
|
||||
elif change_menu == "3":
|
||||
self.constants.fu_status = False
|
||||
self.constants.fu_arguments = None
|
||||
else:
|
||||
print("Invalid input, returning to previous menu")
|
||||
self.set_fu_settings()
|
||||
@@ -1189,11 +1190,14 @@ B. Exit
|
||||
self.download_macOS()
|
||||
|
||||
def download_install_assistant(self, link):
|
||||
installer.download_install_assistant(self.constants.payload_path, link)
|
||||
installer.install_macOS_installer(self.constants.payload_path)
|
||||
input("Press any key to continue...")
|
||||
# To avoid selecting the wrong installer by mistake, let user select the correct one
|
||||
self.find_local_installer()
|
||||
if installer.download_install_assistant(self.constants.payload_path, link):
|
||||
installer.install_macOS_installer(self.constants.payload_path)
|
||||
input("Press any key to continue...")
|
||||
# To avoid selecting the wrong installer by mistake, let user select the correct one
|
||||
self.find_local_installer()
|
||||
else:
|
||||
print("Failed to start download")
|
||||
input("Press any key to continue...")
|
||||
|
||||
|
||||
def download_macOS_installer(self):
|
||||
|
||||
@@ -124,8 +124,8 @@ class Constants:
|
||||
self.override_smbios = "Default" # Set SMBIOS model used
|
||||
|
||||
## FeatureUnlock Settings
|
||||
self.fu_status = True # Enable FeatureUnlock
|
||||
self.fu_arguments = "" # Set FeatureUnlock arguments
|
||||
self.fu_status = True # Enable FeatureUnlock
|
||||
self.fu_arguments = None # Set FeatureUnlock arguments
|
||||
|
||||
## Latebloom Settings
|
||||
self.latebloom_status = False # Latebloom Enabled
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from data import smbios_data, os_data
|
||||
from data import smbios_data, os_data, cpu_data
|
||||
from resources import utilities
|
||||
|
||||
|
||||
@@ -98,3 +98,16 @@ def find_model_off_board(board):
|
||||
key = "MacPro5,1"
|
||||
return key
|
||||
return None
|
||||
|
||||
def check_firewire(model):
|
||||
# MacBooks never supported FireWire
|
||||
# Pre-Thunderbolt MacBook Airs as well
|
||||
if model.startswith("MacBookPro"):
|
||||
return True
|
||||
elif model.startswith("MacBookAir"):
|
||||
if smbios_data.smbios_dictionary[model]["CPU Generation"] < cpu_data.cpu_data.sandy_bridge.value:
|
||||
return False
|
||||
elif model.startswith("MacBook"):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
@@ -54,7 +54,9 @@ def create_installer(installer_path, volume_name):
|
||||
|
||||
def download_install_assistant(download_path, ia_link):
|
||||
# Downloads InstallAssistant.pkg
|
||||
utilities.download_file(ia_link, (Path(download_path) / Path("InstallAssistant.pkg")))
|
||||
if utilities.download_file(ia_link, (Path(download_path) / Path("InstallAssistant.pkg"))):
|
||||
return True
|
||||
return False
|
||||
|
||||
def install_macOS_installer(download_path):
|
||||
args = [
|
||||
@@ -85,41 +87,41 @@ def list_downloadable_macOS_installers(download_path, catalog):
|
||||
link = "https://swscan.apple.com/content/catalogs/others/index-12customerseed-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz"
|
||||
|
||||
# Download and unzip the catalog
|
||||
utilities.download_file(link, (Path(download_path) / Path("seed.sucatalog.gz")))
|
||||
subprocess.run(["gunzip", "-d", "-f", Path(download_path) / Path("seed.sucatalog.gz")])
|
||||
catalog_plist = plistlib.load((Path(download_path) / Path("seed.sucatalog")).open("rb"))
|
||||
if utilities.download_file(link, (Path(download_path) / Path("seed.sucatalog.gz"))):
|
||||
subprocess.run(["gunzip", "-d", "-f", Path(download_path) / Path("seed.sucatalog.gz")])
|
||||
catalog_plist = plistlib.load((Path(download_path) / Path("seed.sucatalog")).open("rb"))
|
||||
|
||||
for item in catalog_plist["Products"]:
|
||||
try:
|
||||
# Check if entry has SharedSupport and BuildManifest
|
||||
# Ensures only Big Sur and newer Installers are listed
|
||||
catalog_plist["Products"][item]["ExtendedMetaInfo"]["InstallAssistantPackageIdentifiers"]["SharedSupport"]
|
||||
catalog_plist["Products"][item]["ExtendedMetaInfo"]["InstallAssistantPackageIdentifiers"]["BuildManifest"]
|
||||
for item in catalog_plist["Products"]:
|
||||
try:
|
||||
# Check if entry has SharedSupport and BuildManifest
|
||||
# Ensures only Big Sur and newer Installers are listed
|
||||
catalog_plist["Products"][item]["ExtendedMetaInfo"]["InstallAssistantPackageIdentifiers"]["SharedSupport"]
|
||||
catalog_plist["Products"][item]["ExtendedMetaInfo"]["InstallAssistantPackageIdentifiers"]["BuildManifest"]
|
||||
|
||||
for bm_package in catalog_plist["Products"][item]["Packages"]:
|
||||
if "BuildManifest.plist" in bm_package["URL"]:
|
||||
utilities.download_file(bm_package["URL"], (Path(download_path) / Path("BuildManifest.plist")))
|
||||
build_plist = plistlib.load((Path(download_path) / Path("BuildManifest.plist")).open("rb"))
|
||||
version = build_plist["ProductVersion"]
|
||||
build = build_plist["ProductBuildVersion"]
|
||||
for ia_package in catalog_plist["Products"][item]["Packages"]:
|
||||
if "InstallAssistant.pkg" in ia_package["URL"]:
|
||||
download_link = ia_package["URL"]
|
||||
size = ia_package["Size"]
|
||||
integrity = ia_package["IntegrityDataURL"]
|
||||
for bm_package in catalog_plist["Products"][item]["Packages"]:
|
||||
if "BuildManifest.plist" in bm_package["URL"]:
|
||||
utilities.download_file(bm_package["URL"], (Path(download_path) / Path("BuildManifest.plist")))
|
||||
build_plist = plistlib.load((Path(download_path) / Path("BuildManifest.plist")).open("rb"))
|
||||
version = build_plist["ProductVersion"]
|
||||
build = build_plist["ProductBuildVersion"]
|
||||
for ia_package in catalog_plist["Products"][item]["Packages"]:
|
||||
if "InstallAssistant.pkg" in ia_package["URL"]:
|
||||
download_link = ia_package["URL"]
|
||||
size = ia_package["Size"]
|
||||
integrity = ia_package["IntegrityDataURL"]
|
||||
|
||||
avalible_apps.update({
|
||||
item: {
|
||||
"Version": version,
|
||||
"Build": build,
|
||||
"Link": download_link,
|
||||
"Size": size,
|
||||
"integrity": integrity,
|
||||
"Source": "Apple Inc.",
|
||||
}
|
||||
})
|
||||
except KeyError:
|
||||
pass
|
||||
avalible_apps.update({
|
||||
item: {
|
||||
"Version": version,
|
||||
"Build": build,
|
||||
"Link": download_link,
|
||||
"Size": size,
|
||||
"integrity": integrity,
|
||||
"Source": "Apple Inc.",
|
||||
}
|
||||
})
|
||||
except KeyError:
|
||||
pass
|
||||
return avalible_apps
|
||||
|
||||
def format_drive(disk_id):
|
||||
@@ -245,8 +247,9 @@ def generate_installer_creation_script(script_location, installer_path, disk):
|
||||
|
||||
with script_location.open("w") as script:
|
||||
script.write(f'''#!/bin/bash
|
||||
diskutil eraseDisk HFS+ OCLP-Installer {disk}
|
||||
"{createinstallmedia_path}" --volume /Volumes/OCLP-Installer --nointeraction
|
||||
earse_disk='diskutil eraseDisk HFS+ OCLP-Installer {disk}'
|
||||
if $earse_disk; then
|
||||
"{createinstallmedia_path}" --volume /Volumes/OCLP-Installer --nointeraction
|
||||
fi
|
||||
''')
|
||||
|
||||
return True
|
||||
@@ -33,6 +33,8 @@ class OpenCoreLegacyPatcher:
|
||||
if "python" in launcher_binary:
|
||||
# We're running from source
|
||||
launcher_script = __file__
|
||||
if "main.py" in launcher_script:
|
||||
launcher_script = launcher_script.replace("/resources/main.py", "/OpenCore-Patcher-GUI.command")
|
||||
self.constants.launcher_binary = launcher_binary
|
||||
self.constants.launcher_script = launcher_script
|
||||
defaults.generate_defaults.probe(self.computer.real_model, True, self.constants)
|
||||
|
||||
155
resources/run.py
Normal file
155
resources/run.py
Normal file
@@ -0,0 +1,155 @@
|
||||
# Module for running processes with real time output
|
||||
# Written by CorpNewt
|
||||
# Source: https://github.com/corpnewt/pymodules/blob/884c3de15b6a2570afde52fe8a14a3e946ffb18a/run.py
|
||||
|
||||
import sys, subprocess, time, threading, shlex
|
||||
try:
|
||||
from Queue import Queue, Empty
|
||||
except:
|
||||
from queue import Queue, Empty
|
||||
|
||||
ON_POSIX = 'posix' in sys.builtin_module_names
|
||||
|
||||
class Run:
|
||||
|
||||
def __init__(self):
|
||||
return
|
||||
|
||||
def _read_output(self, pipe, q):
|
||||
try:
|
||||
for line in iter(lambda: pipe.read(1), b''):
|
||||
q.put(line)
|
||||
except ValueError:
|
||||
pass
|
||||
pipe.close()
|
||||
|
||||
def _create_thread(self, output):
|
||||
# Creates a new queue and thread object to watch based on the output pipe sent
|
||||
q = Queue()
|
||||
t = threading.Thread(target=self._read_output, args=(output, q))
|
||||
t.daemon = True
|
||||
return (q,t)
|
||||
|
||||
def _stream_output(self, comm, shell = False):
|
||||
output = error = ""
|
||||
p = None
|
||||
try:
|
||||
if shell and type(comm) is list:
|
||||
comm = " ".join(shlex.quote(x) for x in comm)
|
||||
if not shell and type(comm) is str:
|
||||
comm = shlex.split(comm)
|
||||
p = subprocess.Popen(comm, shell=shell, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0, universal_newlines=True, close_fds=ON_POSIX)
|
||||
# Setup the stdout thread/queue
|
||||
q,t = self._create_thread(p.stdout)
|
||||
qe,te = self._create_thread(p.stderr)
|
||||
# Start both threads
|
||||
t.start()
|
||||
te.start()
|
||||
|
||||
while True:
|
||||
c = z = ""
|
||||
try: c = q.get_nowait()
|
||||
except Empty: pass
|
||||
else:
|
||||
sys.stdout.write(c)
|
||||
output += c
|
||||
sys.stdout.flush()
|
||||
try: z = qe.get_nowait()
|
||||
except Empty: pass
|
||||
else:
|
||||
sys.stderr.write(z)
|
||||
error += z
|
||||
sys.stderr.flush()
|
||||
if not c==z=="": continue # Keep going until empty
|
||||
# No output - see if still running
|
||||
p.poll()
|
||||
if p.returncode != None:
|
||||
# Subprocess ended
|
||||
break
|
||||
# No output, but subprocess still running - stall for 20ms
|
||||
time.sleep(0.02)
|
||||
|
||||
o, e = p.communicate()
|
||||
return (output+o, error+e, p.returncode)
|
||||
except:
|
||||
if p:
|
||||
try: o, e = p.communicate()
|
||||
except: o = e = ""
|
||||
return (output+o, error+e, p.returncode)
|
||||
return ("", "Command not found!", 1)
|
||||
|
||||
def _decode(self, value, encoding="utf-8", errors="ignore"):
|
||||
# Helper method to only decode if bytes type
|
||||
if sys.version_info >= (3,0) and isinstance(value, bytes):
|
||||
return value.decode(encoding,errors)
|
||||
return value
|
||||
|
||||
def _run_command(self, comm, shell = False):
|
||||
c = None
|
||||
try:
|
||||
if shell and type(comm) is list:
|
||||
comm = " ".join(shlex.quote(x) for x in comm)
|
||||
if not shell and type(comm) is str:
|
||||
comm = shlex.split(comm)
|
||||
p = subprocess.Popen(comm, shell=shell, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
c = p.communicate()
|
||||
except:
|
||||
if c == None:
|
||||
return ("", "Command not found!", 1)
|
||||
return (self._decode(c[0]), self._decode(c[1]), p.returncode)
|
||||
|
||||
def run(self, command_list, leave_on_fail = False):
|
||||
# Command list should be an array of dicts
|
||||
if type(command_list) is dict:
|
||||
# We only have one command
|
||||
command_list = [command_list]
|
||||
output_list = []
|
||||
for comm in command_list:
|
||||
args = comm.get("args", [])
|
||||
shell = comm.get("shell", False)
|
||||
stream = comm.get("stream", False)
|
||||
sudo = comm.get("sudo", False)
|
||||
stdout = comm.get("stdout", False)
|
||||
stderr = comm.get("stderr", False)
|
||||
mess = comm.get("message", None)
|
||||
show = comm.get("show", False)
|
||||
|
||||
if not mess == None:
|
||||
print(mess)
|
||||
|
||||
if not len(args):
|
||||
# nothing to process
|
||||
continue
|
||||
if sudo:
|
||||
# Check if we have sudo
|
||||
out = self._run_command(["which", "sudo"])
|
||||
if "sudo" in out[0]:
|
||||
# Can sudo
|
||||
if type(args) is list:
|
||||
args.insert(0, out[0].replace("\n", "")) # add to start of list
|
||||
elif type(args) is str:
|
||||
args = out[0].replace("\n", "") + " " + args # add to start of string
|
||||
|
||||
if show:
|
||||
print(" ".join(args))
|
||||
|
||||
if stream:
|
||||
# Stream it!
|
||||
out = self._stream_output(args, shell)
|
||||
else:
|
||||
# Just run and gather output
|
||||
out = self._run_command(args, shell)
|
||||
if stdout and len(out[0]):
|
||||
print(out[0])
|
||||
if stderr and len(out[1]):
|
||||
print(out[1])
|
||||
# Append output
|
||||
output_list.append(out)
|
||||
# Check for errors
|
||||
if leave_on_fail and out[2] != 0:
|
||||
# Got an error - leave
|
||||
break
|
||||
if len(output_list) == 1:
|
||||
# We only ran one command - just return that output
|
||||
return output_list[0]
|
||||
return output_list
|
||||
@@ -85,7 +85,9 @@ class PatchSysVolume:
|
||||
else:
|
||||
if self.constants.detected_os > os_data.os_data.catalina:
|
||||
print("- Mounting APFS Snapshot as writable")
|
||||
utilities.elevated(["mount", "-o", "nobrowse", "-t", "apfs", f"/dev/{self.root_mount_path}", self.mount_location], stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
result = utilities.elevated(["mount", "-o", "nobrowse", "-t", "apfs", f"/dev/{self.root_mount_path}", self.mount_location], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
if result.returncode == 0:
|
||||
print(f"- Mounted APFS Snapshot as writable at: {self.mount_location}")
|
||||
if Path(self.mount_extensions).exists():
|
||||
print("- Successfully mounted the Root Volume")
|
||||
if patch is True:
|
||||
@@ -272,7 +274,7 @@ class PatchSysVolume:
|
||||
print(bless.stdout.decode())
|
||||
if "Can't use last-sealed-snapshot or create-snapshot on non system volume" in bless.stdout.decode():
|
||||
print("- This is an APFS bug with Monterey! Perform a clean installation to ensure your APFS volume is built correctly")
|
||||
sys.exit(1)
|
||||
return
|
||||
else:
|
||||
self.unmount_drive()
|
||||
else:
|
||||
@@ -954,7 +956,7 @@ set million colour before rebooting"""
|
||||
# Entry Function
|
||||
def start_patch(self):
|
||||
print("- Starting Patch Process")
|
||||
print(f"- Determinging Required Patch set for Darwin {self.constants.detected_os}")
|
||||
print(f"- Determining Required Patch set for Darwin {self.constants.detected_os}")
|
||||
self.detect_patch_set()
|
||||
if self.no_patch is True:
|
||||
change_menu = None
|
||||
|
||||
166
resources/sys_patch_detect.py
Normal file
166
resources/sys_patch_detect.py
Normal file
@@ -0,0 +1,166 @@
|
||||
from resources import constants, device_probe, utilities
|
||||
from data import model_array, os_data, smbios_data, cpu_data
|
||||
|
||||
class detect_root_patch:
|
||||
def __init__(self, model, versions):
|
||||
self.model = model
|
||||
self.constants: constants.Constants() = versions
|
||||
self.computer = self.constants.computer
|
||||
|
||||
# GPU Patch Detection
|
||||
self.nvidia_legacy= False
|
||||
self.kepler_gpu= False
|
||||
self.amd_ts1= False
|
||||
self.amd_ts2= False
|
||||
self.iron_gpu= False
|
||||
self.sandy_gpu= False
|
||||
self.ivy_gpu= False
|
||||
|
||||
# Misc Patch Detection
|
||||
self.brightness_legacy= False
|
||||
self.legacy_audio= False
|
||||
self.legacy_wifi= False
|
||||
self.legacy_gmux= False
|
||||
self.legacy_keyboard_backlight= False
|
||||
|
||||
# Patch Requirements
|
||||
self.amfi_must_disable= False
|
||||
self.check_board_id= False
|
||||
self.supports_metal= False
|
||||
|
||||
|
||||
def detect_gpus(self):
|
||||
gpus = self.constants.computer.gpus
|
||||
if self.constants.moj_cat_accel is True:
|
||||
non_metal_os = os_data.os_data.high_sierra
|
||||
else:
|
||||
non_metal_os = os_data.os_data.catalina
|
||||
for i, gpu in enumerate(gpus):
|
||||
if gpu.class_code and gpu.class_code != 0xFFFFFFFF:
|
||||
print(f"- Found GPU ({i}): {utilities.friendly_hex(gpu.vendor_id)}:{utilities.friendly_hex(gpu.device_id)}")
|
||||
if gpu.arch in [device_probe.NVIDIA.Archs.Tesla, device_probe.NVIDIA.Archs.Fermi]:
|
||||
if self.constants.detected_os > non_metal_os:
|
||||
self.nvidia_legacy = True
|
||||
self.amfi_must_disable = True
|
||||
# self.legacy_keyboard_backlight = self.check_legacy_keyboard_backlight()
|
||||
elif gpu.arch == device_probe.NVIDIA.Archs.Kepler:
|
||||
if self.constants.detected_os > os_data.os_data.big_sur:
|
||||
# Kepler drivers were dropped with Beta 7
|
||||
# 12.0 Beta 5: 21.0.0 - 21A5304g
|
||||
# 12.0 Beta 6: 21.1.0 - 21A5506j
|
||||
# 12.0 Beta 7: 21.1.0 - 21A5522h
|
||||
if self.constants.detected_os == os_data.os_data.monterey and self.constants.detected_os_minor > 0:
|
||||
if "21A5506j" not in self.constants.detected_os_build:
|
||||
self.kepler_gpu = True
|
||||
self.supports_metal = True
|
||||
elif gpu.arch == device_probe.AMD.Archs.TeraScale_1:
|
||||
if self.constants.detected_os > non_metal_os:
|
||||
self.amd_ts1 = True
|
||||
self.amfi_must_disable = True
|
||||
elif gpu.arch == device_probe.AMD.Archs.TeraScale_2:
|
||||
if self.constants.detected_os > non_metal_os:
|
||||
self.amd_ts2 = True
|
||||
self.amfi_must_disable = True
|
||||
elif gpu.arch == device_probe.Intel.Archs.Iron_Lake:
|
||||
if self.constants.detected_os > non_metal_os:
|
||||
self.iron_gpu = True
|
||||
self.amfi_must_disable = True
|
||||
elif gpu.arch == device_probe.Intel.Archs.Sandy_Bridge:
|
||||
if self.constants.detected_os > non_metal_os:
|
||||
self.sandy_gpu = True
|
||||
self.amfi_must_disable = True
|
||||
self.check_board_id = True
|
||||
elif gpu.arch == device_probe.Intel.Archs.Ivy_Bridge:
|
||||
if self.constants.detected_os > os_data.os_data.big_sur:
|
||||
self.ivy_gpu = True
|
||||
self.supports_metal = True
|
||||
if self.supports_metal is True:
|
||||
# Avoid patching Metal and non-Metal GPUs if both present, prioritize Metal GPU
|
||||
# Main concerns are for iMac12,x with Sandy iGPU and Kepler dGPU
|
||||
self.nvidia_legacy = False
|
||||
self.amd_ts1 = False
|
||||
self.amd_ts2 = False
|
||||
self.iron_gpu = False
|
||||
self.sandy_gpu = False
|
||||
|
||||
def check_dgpu_status(self):
|
||||
dgpu = self.constants.computer.dgpu
|
||||
if dgpu:
|
||||
if dgpu.class_code and dgpu.class_code == 0xFFFFFFFF:
|
||||
# If dGPU is disabled via class-codes, assume demuxed
|
||||
return False
|
||||
return True
|
||||
return False
|
||||
|
||||
def detect_demux(self):
|
||||
# If GFX0 is missing, assume machine was demuxed
|
||||
# -wegnoegpu would also trigger this, so ensure arg is not present
|
||||
if not "-wegnoegpu" in (utilities.get_nvram("boot-args") or ""):
|
||||
igpu = self.constants.computer.igpu
|
||||
dgpu = self.check_dgpu_status()
|
||||
if igpu and not dgpu:
|
||||
return True
|
||||
return False
|
||||
|
||||
def check_legacy_keyboard_backlight(self):
|
||||
# With Big Sur and newer, Skylight patch set unfortunately breaks native keyboard backlight
|
||||
# Penryn Macs are able to re-enable the keyboard backlight by simply running '/usr/libexec/TouchBarServer'
|
||||
# For Arrendale and newer, this has no effect.
|
||||
if self.model.startswith("MacBookPro") or self.model.startswith("MacBookAir"):
|
||||
# non-Metal MacBooks never had keyboard backlight
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value:
|
||||
if self.constants.detected_os > os_data.os_data.catalina:
|
||||
return True
|
||||
return False
|
||||
|
||||
def detect_patch_set(self):
|
||||
self.detect_gpus()
|
||||
if self.model in model_array.LegacyBrightness:
|
||||
if self.constants.detected_os > os_data.os_data.catalina:
|
||||
self.brightness_legacy = True
|
||||
|
||||
if self.model in ["iMac7,1", "iMac8,1"] or (self.model in model_array.LegacyAudio and utilities.check_kext_loaded("AppleALC", self.constants.detected_os) is False):
|
||||
# Special hack for systems with botched GOPs
|
||||
# TL;DR: No Boot Screen breaks Lilu, therefore breaking audio
|
||||
if self.constants.detected_os > os_data.os_data.catalina:
|
||||
self.legacy_audio = True
|
||||
|
||||
if (
|
||||
isinstance(self.constants.computer.wifi, device_probe.Broadcom)
|
||||
and self.constants.computer.wifi.chipset in [device_probe.Broadcom.Chipsets.AirPortBrcm4331, device_probe.Broadcom.Chipsets.AirPortBrcm43224]
|
||||
) or (isinstance(self.constants.computer.wifi, device_probe.Atheros) and self.constants.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40):
|
||||
if self.constants.detected_os > os_data.os_data.big_sur:
|
||||
self.legacy_wifi = True
|
||||
|
||||
# if self.model in ["MacBookPro5,1", "MacBookPro5,2", "MacBookPro5,3", "MacBookPro8,2", "MacBookPro8,3"]:
|
||||
if self.model in ["MacBookPro8,2", "MacBookPro8,3"]:
|
||||
# Sierra uses a legacy GMUX control method needed for dGPU switching on MacBookPro5,x
|
||||
# Same method is also used for demuxed machines
|
||||
# Note that MacBookPro5,x machines are extremely unstable with this patch set, so disabled until investigated further
|
||||
# Ref: https://github.com/dortania/OpenCore-Legacy-Patcher/files/7360909/KP-b10-030.txt
|
||||
if self.constants.detected_os > os_data.os_data.high_sierra:
|
||||
if self.model in ["MacBookPro8,2", "MacBookPro8,3"]:
|
||||
# Ref: https://doslabelectronics.com/Demux.html
|
||||
if self.detect_demux() is True:
|
||||
self.legacy_gmux = True
|
||||
else:
|
||||
self.legacy_gmux = True
|
||||
|
||||
self.root_patch_dict = {
|
||||
"Graphics: Nvidia Tesla": self.nvidia_legacy,
|
||||
"Graphics: Nvidia Kepler": self.kepler_gpu,
|
||||
"Graphics: AMD TeraScale 1": self.amd_ts1,
|
||||
"Graphics: AMD TeraScale 2": self.amd_ts2,
|
||||
"Graphics: Intel Ironlake": self.iron_gpu,
|
||||
"Graphics: Intel Sandy Bridge": self.sandy_gpu,
|
||||
"Graphics: Intel Ivy Bridge": self.ivy_gpu,
|
||||
"Brightness: Legacy Backlight Control": self.brightness_legacy,
|
||||
"Audio: Legacy Realtek": self.legacy_audio,
|
||||
"Networking: Legacy Wireless": self.legacy_wifi,
|
||||
"Miscellaneous: Legacy GMUX": self.legacy_gmux,
|
||||
"Miscellaneous: Legacy Keyboard Backlight": self.legacy_keyboard_backlight,
|
||||
"Settings: Requires AMFI exemption": self.amfi_must_disable,
|
||||
"Settings: Requires Board ID validation": self.check_board_id,
|
||||
}
|
||||
|
||||
return self.root_patch_dict
|
||||
@@ -373,7 +373,7 @@ def download_file(link, location, is_gui=None):
|
||||
print(f"https://github.com/dortania/OpenCore-Legacy-Patcher/releases/download/{constants.Constants().patcher_version}/OpenCore-Patcher-TUI-Offline.app.zip")
|
||||
else:
|
||||
print(link)
|
||||
sys.exit()
|
||||
return None
|
||||
|
||||
def elevated(*args, **kwargs) -> subprocess.CompletedProcess:
|
||||
# When runnign through our GUI, we run as root, however we do not get uid 0
|
||||
|
||||
Reference in New Issue
Block a user