Add Beta Blur config menu

This commit is contained in:
Mykola Grymalyuk
2022-01-19 10:23:50 -07:00
parent b924e427e2
commit 80644bfbd4
5 changed files with 139 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
# -*- mode: python ; coding: utf-8 -*-
import sys, os
import sys, os, time
sys.path.append(os.path.abspath(os.getcwd()))
from resources import constants
block_cipher = None
@@ -50,4 +50,5 @@ app = BUNDLE(exe,
"LSMinimumSystemVersion": "10.10.0",
"NSRequiresAquaSystemAppearance": False,
"NSHighResolutionCapable": True,
"Build Date": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),
})

View File

@@ -4,10 +4,10 @@ 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-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)
* [GUI (Graphical Based App)](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-wxpython/main/OpenCore-Patcher.app%20%28GUI%29.zip)
* [GUI (Graphical Based App) - Offline Variant](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-wxpython-offline/main/OpenCore-Patcher.app%20%28GUI%20Offline%29.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)
* [TUI (Text Based App) - Offline Variant](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-offline/main/OpenCore-Patcher-TUI.app%20%28Offline%29.zip)
**Warning**: These binaries should not be used without first consulting the [CHANGELOG](./CHANGELOG.md). Do not distribute these links in forums, instead direct to this file.

View File

@@ -1528,9 +1528,15 @@ class wx_python_gui:
self.misc_button.Bind(wx.EVT_BUTTON, self.misc_settings_menu)
self.misc_button.Center(wx.HORIZONTAL)
# Button: non-Metal Settings
self.nonmetal_button = wx.Button(self.frame, label="Non-Metal Settings", size=(155,30))
self.nonmetal_button.SetPosition(wx.Point(self.misc_button.GetPosition().x , self.misc_button.GetPosition().y + self.misc_button.GetSize().height))
self.nonmetal_button.Bind(wx.EVT_BUTTON, self.non_metal_config_menu)
self.nonmetal_button.Center(wx.HORIZONTAL)
# Button: Developer Settings
self.miscellaneous_button = wx.Button(self.frame, label="Developer Settings", size=(155,30))
self.miscellaneous_button.SetPosition(wx.Point(self.misc_button.GetPosition().x , self.misc_button.GetPosition().y + self.misc_button.GetSize().height))
self.miscellaneous_button.SetPosition(wx.Point(self.nonmetal_button.GetPosition().x , self.nonmetal_button.GetPosition().y + self.nonmetal_button.GetSize().height))
self.miscellaneous_button.Bind(wx.EVT_BUTTON, self.dev_settings_menu)
self.miscellaneous_button.Centre(wx.HORIZONTAL)
@@ -2319,4 +2325,114 @@ OpenCore Legacy Patcher by default knows the most ideal
self.return_to_main_menu_button.Center(wx.HORIZONTAL)
# set frame size below return to main menu button
self.frame.SetSize(wx.Size(-1, self.return_to_main_menu_button.GetPosition().y + self.return_to_main_menu_button.GetSize().height + 40))
self.frame.SetSize(wx.Size(-1, self.return_to_main_menu_button.GetPosition().y + self.return_to_main_menu_button.GetSize().height + 40))
def non_metal_config_menu(self, event=None):
# Configures ASB's Blur settings
# Check Beta Blur:
# defaults read ASB_BlurBeta
# defaults write -g ASB_BlurBeta -bool true
# Check Blur Radius:
# defaults read ASB_BlurOverride
# defaults write -g ASB_BlurOverride -float 30
self.frame.DestroyChildren()
self.frame.SetSize(wx.Size(400, 300))
# Header 1: Configure non-Metal Settings
self.header_1 = wx.StaticText(self.frame, label="Configure non-Metal Settings")
self.header_1.SetFont(wx.Font(16, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
self.header_1.Centre(wx.HORIZONTAL)
self.subheader = wx.StaticText(self.frame, label="Below settings apply to systems that have installed")
self.subheader.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
self.subheader.SetPosition(wx.Point(0, self.header_1.GetPosition().y + self.header_1.GetSize().height + 5))
self.subheader.Centre(wx.HORIZONTAL)
self.subheader_2 = wx.StaticText(self.frame, label="non-metal acceleration patches.")
self.subheader_2.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
self.subheader_2.SetPosition(wx.Point(0, self.subheader.GetPosition().y + self.subheader.GetSize().height))
self.subheader_2.Centre(wx.HORIZONTAL)
# This menu will allow you to enable Beta Blur features resolving some of the UI distortions experienced with non-Metal
self.subheader2_1 = wx.StaticText(self.frame, label="This menu will allow you to enable Beta Blur features resolving")
self.subheader2_1.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
self.subheader2_1.SetPosition(wx.Point(0, self.subheader_2.GetPosition().y + self.subheader_2.GetSize().height + 5))
self.subheader2_1.Centre(wx.HORIZONTAL)
self.subheader2_2 = wx.StaticText(self.frame, label="some of the UI distortions experienced with non-metal GPUs.")
self.subheader2_2.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
self.subheader2_2.SetPosition(wx.Point(0, self.subheader2_1.GetPosition().y + self.subheader2_1.GetSize().height))
self.subheader2_2.Centre(wx.HORIZONTAL)
self.subheader_3 = wx.StaticText(self.frame, label="For new users, set Radius to 30px")
self.subheader_3.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
self.subheader_3.SetPosition(wx.Point(0, self.subheader2_2.GetPosition().y + self.subheader2_2.GetSize().height))
self.subheader_3.Centre(wx.HORIZONTAL)
self.subheader_4 = wx.StaticText(self.frame, label="Note: Only logout and login is required to apply these settings")
self.subheader_4.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
self.subheader_4.SetPosition(wx.Point(0, self.subheader_3.GetPosition().y + self.subheader_3.GetSize().height+ 5))
self.subheader_4.Centre(wx.HORIZONTAL)
is_blur_enabled = subprocess.run(["defaults", "read", "-g", "ASB_BlurBeta"], stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
if is_blur_enabled in ["1", "true"]:
is_blur_enabled = True
else:
is_blur_enabled = False
# Checkbox: Enable Beta Blur
self.enable_beta_blur_checkbox = wx.CheckBox(self.frame, label="Enable Beta Blur")
self.enable_beta_blur_checkbox.SetValue(is_blur_enabled)
self.enable_beta_blur_checkbox.Bind(wx.EVT_CHECKBOX, self.enable_beta_blur_click)
self.enable_beta_blur_checkbox.SetPosition(wx.Point(0, self.subheader_4.GetPosition().y + self.subheader_4.GetSize().height + 10))
self.enable_beta_blur_checkbox.Center(wx.HORIZONTAL)
# Text: Blur Radius
self.blur_radius_text = wx.StaticText(self.frame, label="Current Blur Radius: " + "px")
self.blur_radius_text.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
self.blur_radius_text.SetPosition(wx.Point(0, self.enable_beta_blur_checkbox.GetPosition().y + self.enable_beta_blur_checkbox.GetSize().height + 10))
self.blur_radius_text.Center(wx.HORIZONTAL)
# Scale: Blur Radius
self.blur_radius_scale = wx.Slider(self.frame, value=0, minValue=0, maxValue=48, style=wx.SL_HORIZONTAL)
self.blur_radius_scale.Bind(wx.EVT_SCROLL, self.blur_radius_scale_change)
self.blur_radius_scale.SetPosition(wx.Point(0, self.blur_radius_text.GetPosition().y + self.blur_radius_text.GetSize().height + 10))
self.blur_radius_scale.Center(wx.HORIZONTAL)
self.blur_radius_scale.SetTickFreq(1)
current_blur_radius = subprocess.run(["defaults", "read", "-g", "ASB_BlurOverride"], stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
try:
current_blur_radius = int(current_blur_radius)
except:
current_blur_radius = 30
subprocess.run(["defaults", "write", "-g", "ASB_BlurOverride", str(current_blur_radius)])
self.blur_radius_text.SetLabel("Current Blur Radius: " + str(current_blur_radius) + "px")
self.blur_radius_scale.SetValue(current_blur_radius)
# Button: Return to Settings
self.return_to_settings_button = wx.Button(self.frame, label="Return to Settings")
self.return_to_settings_button.Bind(wx.EVT_BUTTON, self.settings_menu)
self.return_to_settings_button.SetPosition(wx.Point(0, self.blur_radius_scale.GetPosition().y + self.blur_radius_scale.GetSize().height + 10))
self.return_to_settings_button.Center(wx.HORIZONTAL)
self.frame.SetSize(wx.Size(-1, self.return_to_settings_button.GetPosition().y + self.return_to_settings_button.GetSize().height + 40))
def enable_beta_blur_click(self, event=None):
if event.IsChecked():
subprocess.run(["defaults", "write", "-g", "ASB_BlurBeta", "-bool", "true"])
else:
subprocess.run(["defaults", "write", "-g", "ASB_BlurBeta", "-bool", "false"])
print("Beta Blur Enabled:", event.IsChecked())
def blur_radius_scale_change(self, event=None):
val = event.GetInt()
subprocess.run(["defaults", "write", "-g", "ASB_BlurOverride", "-float", str(val)])
print("Blur Radius:", val)
self.blur_radius_text.SetLabel("Current Blur Radius: " + str(val) + "px")
self.blur_radius_text.Center(wx.HORIZONTAL)

View File

@@ -1,8 +1,20 @@
# Patches LC_VERSION_MIN_MACOSX in Load Command to report 10.10
#
# By default Pyinstaller will create binaries supporting 10.13+
# However this limitation is entirely arbitrary for our libraries
# and instead we're able to support 10.10 without issues.
#
# To verify set version:
# otool -l ./dist/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher
#
# cmd LC_VERSION_MIN_MACOSX
# cmdsize 16
# version 10.13
# sdk 10.9
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
find = b'\x00\x0D\x0A\x00' # 10.13 (0xA0D)
replace = b'\x00\x0A\x0A\x00' # 10.10 (0xA0A)
with open(path, 'rb') as f:
data = f.read()
data = data.replace(find, replace)

View File

@@ -794,7 +794,7 @@ class BuildOpenCore:
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -v"
if self.constants.kext_debug is True:
print("- Enabling DEBUG Kexts")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -liludbgall"
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -liludbgall liludump=90"
# Disabled due to macOS Monterey crashing shortly after kernel init
# Use DebugEnhancer.kext instead
# self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " msgbuf=1048576"