mirror of
https://github.com/outbackdingo/OpCore-Simplify.git
synced 2026-01-27 10:19:49 +00:00
Remove all f-strings due to some errors
This commit is contained in:
@@ -345,8 +345,8 @@ class ACPIGuru:
|
||||
return None
|
||||
|
||||
def write_ssdt(self, ssdt_name, ssdt_content, compile=True):
|
||||
dsl_path = os.path.join(self.acpi_directory, f"{ssdt_name}.dsl")
|
||||
aml_path = os.path.join(self.acpi_directory, f"{ssdt_name}.aml")
|
||||
dsl_path = os.path.join(self.acpi_directory, ssdt_name + ".dsl")
|
||||
aml_path = os.path.join(self.acpi_directory, ssdt_name + ".aml")
|
||||
|
||||
with open(dsl_path,"w") as f:
|
||||
f.write(ssdt_content)
|
||||
@@ -425,12 +425,11 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "IMEI", 0x00000000)
|
||||
imei_device = self.acpi.get_device_paths_with_hid("0x00160000", self.dsdt)
|
||||
|
||||
if not imei_device:
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def add_memory_controller_device(self, cpu_manufacturer, cpu_codename, smbios):
|
||||
if "Intel" not in cpu_manufacturer or "MacPro" in smbios and self.is_intel_hedt_cpu(cpu_codename):
|
||||
@@ -471,12 +470,11 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "MCHC", 0)
|
||||
pci_bus_device = ".".join(self.lpc_bus_device.split(".")[:2])
|
||||
ssdt_content = ssdt_content.replace("[[PCIName]]", pci_bus_device)
|
||||
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def add_system_management_bus_device(self, cpu_manufacturer, cpu_codename):
|
||||
if "Intel" not in cpu_manufacturer:
|
||||
@@ -488,10 +486,10 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "MCHC", 0)
|
||||
smbus_device_name = "SBUS"
|
||||
|
||||
pci_bus_device = ".".join(self.lpc_bus_device.split(".")[:2])
|
||||
smbus_device_path = f"{pci_bus_device}.{smbus_device_name}"
|
||||
smbus_device_path = "{}.{}".format(pci_bus_device, smbus_device_name)
|
||||
|
||||
comment = "Add a System Management Bus device to fix AppleSMBus issues"
|
||||
ssdt_name = f"SSDT-{smbus_device_name}"
|
||||
ssdt_name = "SSDT-{}".format(smbus_device_name)
|
||||
ssdt_content = """
|
||||
DefinitionBlock ("", "SSDT", 2, "ZPSS", "[[SMBUSName]]", 0)
|
||||
{
|
||||
@@ -518,12 +516,11 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "[[SMBUSName]]", 0)
|
||||
}
|
||||
}""".replace("[[SMBUSName]]", smbus_device_name).replace("[[SMBUSDevice]]", smbus_device_path)
|
||||
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def add_usb_power_properties(self, smbios):
|
||||
comment = "Creates an USBX device to inject USB power properties"
|
||||
@@ -597,12 +594,11 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "USBX", 0x00001000)
|
||||
"".join("\n \"{}\",\n {}{}".format(key, usb_power_properties[key], "," if index < len(usb_power_properties) else "")
|
||||
for index, key in enumerate(usb_power_properties, start=1))
|
||||
)
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def ambient_light_sensor(self, motherboard_name, platform, integrated_gpu):
|
||||
if "Laptop" not in platform or not integrated_gpu or "SURFACE" in motherboard_name:
|
||||
@@ -663,7 +659,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "ALS0", 0x00000000)
|
||||
if sta.get("patches"):
|
||||
self.result["Patch"].extend(sta.get("patches", []))
|
||||
|
||||
ssdt_name = f"SSDT-{als_device_name}"
|
||||
ssdt_name = "SSDT-{}".format(als_device_name)
|
||||
ssdt_content = """
|
||||
DefinitionBlock ("", "SSDT", 2, "ZPSS", "[[ALSName]]", 0x00000000)
|
||||
{
|
||||
@@ -690,12 +686,11 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "[[ALSName]]", 0x00000000)
|
||||
.replace("[[XSTA]]", "{}.XSTA{}".format(als_device," ()" if sta.get("sta_type","MethodObj") == "MethodObj" else "") if sta else "0x0F")
|
||||
|
||||
comment = "{} Ambient Light Sensor device for storing the current brightness/auto-brightness level".format("Fake" if not als_device else "Enable")
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def disable_rhub_devices(self):
|
||||
comment = "Disable RHUB/HUBN/URTH devices and rename PXSX, XHC1, EHC1, and EHC2 devices"
|
||||
@@ -812,12 +807,11 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "UsbReset", 0x00001000)
|
||||
""".replace("[[device]]", task["device"])
|
||||
ssdt_content += "\n}"
|
||||
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def disable_unsupported_device(self, unsupported_devices):
|
||||
for device in unsupported_devices:
|
||||
@@ -902,7 +896,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "[[DeviceType]]", 0)
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content, compile=False),
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def enable_backlight_controls(self, platform, cpu_codename, integrated_gpu):
|
||||
@@ -1098,12 +1092,11 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "PNLF", 0x00000000)
|
||||
# Perform the replacements
|
||||
ssdt_content = ssdt_content.replace("[[uid_value]]", str(uid_value)).replace("[[igpu_path]]",igpu)
|
||||
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def enable_cpu_power_management(self, cpu_codename):
|
||||
if self.utils.contains_any(cpu_data.IntelCPUGenerations, cpu_codename, end=2):
|
||||
@@ -1118,7 +1111,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "PNLF", 0x00000000)
|
||||
cpu_name = None
|
||||
|
||||
if cpu_name:
|
||||
ssdt = """
|
||||
ssdt_content = """
|
||||
// Resource: https://github.com/acidanthera/OpenCorePkg/blob/master/Docs/AcpiSamples/SSDT-PLUG.dsl
|
||||
|
||||
DefinitionBlock ("", "SSDT", 2, "ZPSS", "CpuPlug", 0x00003000)
|
||||
@@ -1165,7 +1158,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "CpuPlug", 0x00003000)
|
||||
pass
|
||||
if not proc_list:
|
||||
return
|
||||
ssdt = """
|
||||
ssdt_content = """
|
||||
// Resource: https://github.com/acidanthera/OpenCorePkg/blob/master/Docs/AcpiSamples/Source/SSDT-PLUG-ALT.dsl
|
||||
|
||||
DefinitionBlock ("", "SSDT", 2, "ZPSS", "CpuPlugA", 0x00003000)
|
||||
@@ -1179,7 +1172,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "CpuPlugA", 0x00003000)
|
||||
proc,uid = proc_uid
|
||||
adr = hex(i)[2:].upper()
|
||||
name = "CP00"[:-len(adr)]+adr
|
||||
ssdt += """
|
||||
ssdt_content += """
|
||||
Processor ([[name]], [[uid]], 0x00000510, 0x06)
|
||||
{
|
||||
// [[proc]]
|
||||
@@ -1197,7 +1190,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "CpuPlugA", 0x00003000)
|
||||
}
|
||||
}""".replace("[[name]]",name).replace("[[uid]]",uid).replace("[[proc]]",proc)
|
||||
if i == 0: # Got the first, add plugin-type as well
|
||||
ssdt += """
|
||||
ssdt_content += """
|
||||
Method (_DSM, 4, NotSerialized)
|
||||
{
|
||||
If (LNot (Arg2)) {
|
||||
@@ -1211,18 +1204,17 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "CpuPlugA", 0x00003000)
|
||||
})
|
||||
}"""
|
||||
# Close up the SSDT
|
||||
ssdt += """
|
||||
ssdt_content += """
|
||||
}"""
|
||||
ssdt += """
|
||||
ssdt_content += """
|
||||
}
|
||||
}"""
|
||||
|
||||
if self.write_ssdt(ssdt_name, ssdt):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def enable_gpio_device(self, platform, cpu_manufacturer, touchpad_communication):
|
||||
if "Laptop" not in platform or "Intel" not in cpu_manufacturer or not "I2C" in touchpad_communication:
|
||||
@@ -1267,12 +1259,11 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "GPI0", 0x00000000)
|
||||
.replace("[[STAType]]", sta.get("sta_type","MethodObj")) \
|
||||
.replace("[[XSTA]]", "{}.XSTA{}".format(gpio_device," ()" if sta.get("sta_type","MethodObj") == "MethodObj" else "") if sta else "0x0F")
|
||||
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def enable_nvram_support(self, motherboard_chipset):
|
||||
if not self.utils.contains_any(["H310", "H370", "B360", "B365", "Z390"], motherboard_chipset) or not self.lpc_bus_device:
|
||||
@@ -1338,12 +1329,11 @@ DefinitionBlock ("", "SSDT", 2, "ACDT", "PMCR", 0x00001000)
|
||||
}
|
||||
}""".replace("[[LPCPath]]", self.lpc_bus_device)
|
||||
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def fake_embedded_controller(self, platform):
|
||||
comment = "Add a fake EC to ensure macOS compatibility"
|
||||
@@ -1456,24 +1446,24 @@ DefinitionBlock ("", "SSDT", 2, "ACDT", "PMCR", 0x00001000)
|
||||
#oc = {"Comment":comment,"Enabled":True,"Path":"SSDT-EC.aml"}
|
||||
#self.make_plist(oc, "SSDT-EC.aml", patches, replace=True)
|
||||
#print("Creating SSDT-EC...")
|
||||
ssdt = """
|
||||
ssdt_content = """
|
||||
DefinitionBlock ("", "SSDT", 2, "CORP ", "SsdtEC", 0x00001000)
|
||||
{
|
||||
External ([[LPCName]], DeviceObj)
|
||||
""".replace("[[LPCName]]",self.lpc_bus_device)
|
||||
for x in ec_to_patch:
|
||||
ssdt += " External ({}, DeviceObj)\n".format(x)
|
||||
ssdt_content += " External ({}, DeviceObj)\n".format(x)
|
||||
if x in ec_sta:
|
||||
ssdt += " External ({}.XSTA, {})\n".format(x,ec_sta[x].get("sta_type","MethodObj"))
|
||||
ssdt_content += " External ({}.XSTA, {})\n".format(x,ec_sta[x].get("sta_type","MethodObj"))
|
||||
# Walk the ECs to enable
|
||||
for x in ec_to_enable:
|
||||
ssdt += " External ({}, DeviceObj)\n".format(x)
|
||||
ssdt_content += " External ({}, DeviceObj)\n".format(x)
|
||||
if x in ec_enable_sta:
|
||||
# Add the _STA and XSTA refs as the patch may not be enabled
|
||||
ssdt += " External ({0}._STA, {1})\n External ({0}.XSTA, {1})\n".format(x,ec_enable_sta[x].get("sta_type","MethodObj"))
|
||||
ssdt_content += " External ({0}._STA, {1})\n External ({0}.XSTA, {1})\n".format(x,ec_enable_sta[x].get("sta_type","MethodObj"))
|
||||
# Walk them again and add the _STAs
|
||||
for x in ec_to_patch:
|
||||
ssdt += """
|
||||
ssdt_content += """
|
||||
Scope ([[ECName]])
|
||||
{
|
||||
Method (_STA, 0, NotSerialized) // _STA: Status
|
||||
@@ -1492,7 +1482,7 @@ DefinitionBlock ("", "SSDT", 2, "CORP ", "SsdtEC", 0x00001000)
|
||||
.replace("[[XSTA]]","{}.XSTA{}".format(x," ()" if ec_sta[x].get("sta_type","MethodObj")=="MethodObj" else "") if x in ec_sta else "0x0F")
|
||||
# Walk them yet again - and force enable as needed
|
||||
for x in ec_to_enable:
|
||||
ssdt += """
|
||||
ssdt_content += """
|
||||
If (LAnd (CondRefOf ([[ECName]].XSTA), LNot (CondRefOf ([[ECName]]._STA))))
|
||||
{
|
||||
Scope ([[ECName]])
|
||||
@@ -1514,7 +1504,7 @@ DefinitionBlock ("", "SSDT", 2, "CORP ", "SsdtEC", 0x00001000)
|
||||
.replace("[[XSTA]]","{}.XSTA{}".format(x," ()" if ec_enable_sta[x].get("sta_type","MethodObj")=="MethodObj" else "") if x in ec_enable_sta else "Zero")
|
||||
# Create the faked EC
|
||||
if not laptop or not named_ec:
|
||||
ssdt += """
|
||||
ssdt_content += """
|
||||
Scope ([[LPCName]])
|
||||
{
|
||||
Device (EC)
|
||||
@@ -1534,15 +1524,15 @@ DefinitionBlock ("", "SSDT", 2, "CORP ", "SsdtEC", 0x00001000)
|
||||
}
|
||||
}""".replace("[[LPCName]]", self.lpc_bus_device)
|
||||
# Close the SSDT scope
|
||||
ssdt += """
|
||||
ssdt_content += """
|
||||
}"""
|
||||
|
||||
if self.write_ssdt(ssdt_name, ssdt):
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result.get("Patch").extend(patches)
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def fix_hp_005_post_error(self, motherboard_name):
|
||||
@@ -1623,12 +1613,11 @@ DefinitionBlock("", "SSDT", 2, "ZPSS", "RMNE", 0x00001000)
|
||||
}
|
||||
}""".replace("[[MACAddress]]", mac_address_byte)
|
||||
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def is_intel_hedt_cpu(self, cpu_codename):
|
||||
return "-E" in cpu_codename and not self.utils.contains_any(cpu_data.IntelCPUGenerations, cpu_codename, end=4) is None or \
|
||||
@@ -2017,12 +2006,11 @@ DefinitionBlock ("", "SSDT", 2, "CORP", "HPET", 0x00000000)
|
||||
}
|
||||
}"""
|
||||
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def fix_system_clock_awac(self, motherboard_chipset):
|
||||
if not self.utils.contains_any(chipset_data.IntelChipsets, motherboard_chipset, start=85):
|
||||
@@ -2132,7 +2120,7 @@ DefinitionBlock ("", "SSDT", 2, "CORP", "HPET", 0x00000000)
|
||||
# 3. Fake RTC if needed
|
||||
|
||||
ssdt_name = "SSDT-RTCAWAC"
|
||||
ssdt = """//
|
||||
ssdt_content = """//
|
||||
// Original sources from Acidanthera:
|
||||
// - https://github.com/acidanthera/OpenCorePkg/blob/master/Docs/AcpiSamples/SSDT-AWAC.dsl
|
||||
// - https://github.com/acidanthera/OpenCorePkg/blob/master/Docs/AcpiSamples/SSDT-RTC0.dsl
|
||||
@@ -2142,7 +2130,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "RTCAWAC", 0x00000000)
|
||||
{
|
||||
"""
|
||||
if any(x.get("has_var") for x in (awac_dict,rtc_dict)):
|
||||
ssdt += """ External (STAS, IntObj)
|
||||
ssdt_content += """ External (STAS, IntObj)
|
||||
Scope (\\)
|
||||
{
|
||||
Method (_INI, 0, NotSerialized) // _INI: Initialize
|
||||
@@ -2160,7 +2148,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "RTCAWAC", 0x00000000)
|
||||
# have an _STA (which would be renamed)
|
||||
macos,original = ("Zero","0x0F") if x.get("dev_hid") == "ACPI000E" else ("0x0F","Zero")
|
||||
if x.get("sta"):
|
||||
ssdt += """ External ([[DevPath]], DeviceObj)
|
||||
ssdt_content += """ External ([[DevPath]], DeviceObj)
|
||||
External ([[DevPath]].XSTA, [[sta_type]])
|
||||
Scope ([[DevPath]])
|
||||
{
|
||||
@@ -2182,7 +2170,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "RTCAWAC", 0x00000000)
|
||||
""".replace("[[DevPath]]",x["device"][0]).replace("[[Original]]",original).replace("[[macOS]]",macos).replace("[[sta_type]]",x["sta_type"]).replace("[[called]]"," ()" if x["sta_type"]=="MethodObj" else "")
|
||||
elif x.get("dev_hid") == "ACPI000E":
|
||||
# AWAC device with no STAS, and no _STA - let's just add one
|
||||
ssdt += """ External ([[DevPath]], DeviceObj)
|
||||
ssdt_content += """ External ([[DevPath]], DeviceObj)
|
||||
Scope ([[DevPath]])
|
||||
{
|
||||
Method (_STA, 0, NotSerialized) // _STA: Status
|
||||
@@ -2200,7 +2188,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "RTCAWAC", 0x00000000)
|
||||
""".replace("[[DevPath]]",x["device"][0])
|
||||
# Check if we need to setup an RTC range correction
|
||||
if rtc_range_needed and rtc_crs_type.lower() == "buffobj" and crs_lines and rtc_dict.get("valid"):
|
||||
ssdt += """ External ([[DevPath]], DeviceObj)
|
||||
ssdt_content += """ External ([[DevPath]], DeviceObj)
|
||||
External ([[DevPath]].XCRS, [[type]])
|
||||
Scope ([[DevPath]])
|
||||
{
|
||||
@@ -2227,7 +2215,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "RTCAWAC", 0x00000000)
|
||||
.replace("[[NewCRS]]","\n".join([(" "*8)+x for x in crs_lines]))
|
||||
# Check if we do not have an RTC device at all
|
||||
if not rtc_dict.get("valid") and lpc_name:
|
||||
ssdt += """ External ([[LPCName]], DeviceObj) // (from opcode)
|
||||
ssdt_content += """ External ([[LPCName]], DeviceObj) // (from opcode)
|
||||
Scope ([[LPCName]])
|
||||
{
|
||||
Device (RTC0)
|
||||
@@ -2258,14 +2246,14 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "RTCAWAC", 0x00000000)
|
||||
}
|
||||
}
|
||||
""".replace("[[LPCName]]",lpc_name)
|
||||
ssdt += "}"
|
||||
ssdt_content += "}"
|
||||
|
||||
if self.write_ssdt(ssdt_name, ssdt):
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result.get("Patch").extend(rtc_dict["patches"])
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def fix_system_clock_hedt(self, motherboard_chipset, macos_version):
|
||||
@@ -2389,12 +2377,11 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "RtcRange", 0x00000000)
|
||||
}"""
|
||||
|
||||
ssdt_content = ssdt_content.replace("[[LPCPath]]", self.lpc_bus_device).replace("[[RTCName]]", rtc_device_name)
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def instant_wake_fix(self):
|
||||
comment = "Fix sleep state values in _PRW methods to prevent immediate wake in macOS"
|
||||
@@ -2431,9 +2418,9 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "_PRW", 0x00000000)
|
||||
if binascii.unhexlify(gprw_method[2:]) in self.dsdt.get("raw"):
|
||||
ssdt_content += """\n External(XPRW, MethodObj)"""
|
||||
if uswe_object:
|
||||
ssdt_content += f"\n External (USWE, FieldUnitObj)"
|
||||
ssdt_content += "\n External (USWE, FieldUnitObj)"
|
||||
if wole_object:
|
||||
ssdt_content += f"\n External (WOLE, FieldUnitObj)"
|
||||
ssdt_content += "\n External (WOLE, FieldUnitObj)"
|
||||
if uswe_object or wole_object:
|
||||
ssdt_content += """\n
|
||||
Scope (\\)
|
||||
@@ -2441,9 +2428,9 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "_PRW", 0x00000000)
|
||||
If (_OSI ("Darwin"))
|
||||
{"""
|
||||
if uswe_object:
|
||||
ssdt_content += f"\n USWE = Zero"
|
||||
ssdt_content += "\n USWE = Zero"
|
||||
if wole_object:
|
||||
ssdt_content += f"\n WOLE = Zero"
|
||||
ssdt_content += "\n WOLE = Zero"
|
||||
ssdt_content += """ }
|
||||
}"""
|
||||
if binascii.unhexlify(gprw_method) in self.dsdt.get("raw"):
|
||||
@@ -2499,12 +2486,11 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "_PRW", 0x00000000)
|
||||
Return (XPRW (Arg0, Arg1))
|
||||
}"""
|
||||
ssdt_content += "\n}"
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def fix_uncore_bridge(self, motherboard_chipset, macos_version):
|
||||
if macos_version < 20 or not self.utils.contains_any(["X79", "C602", "Patsburg", "C612", "X99", "Wellsburg"], motherboard_chipset):
|
||||
@@ -2553,12 +2539,11 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "UNC", 0x00000000)
|
||||
}
|
||||
}"""
|
||||
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def operating_system_patch(self, platform):
|
||||
if not "Laptop" in platform:
|
||||
@@ -2590,7 +2575,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "XOSI", 0x00001000)
|
||||
Return (_OSI (Arg0))
|
||||
}
|
||||
}
|
||||
}""".replace("[[OSIStrings]]", "\n,".join([f" \"{osi_string}\"" for target_os, osi_string in self.osi_strings.items() if osi_string in self.dsdt.get("table")]))
|
||||
}""".replace("[[OSIStrings]]", "\n,".join([" \"{}\"".format(osi_string) for target_os, osi_string in self.osi_strings.items() if osi_string in self.dsdt.get("table")]))
|
||||
|
||||
osid = self.acpi.get_method_paths("OSID")
|
||||
if osid:
|
||||
@@ -2614,12 +2599,11 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "XOSI", 0x00001000)
|
||||
"Replace": "584F5349"
|
||||
})
|
||||
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def surface_laptop_special_patch(self, motherboard_name, platform):
|
||||
if "Surface".upper() not in motherboard_name or "Laptop" not in platform:
|
||||
@@ -2744,12 +2728,11 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "Surface", 0x00001000)
|
||||
}
|
||||
}"""
|
||||
|
||||
if self.write_ssdt(ssdt_name, ssdt_content):
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": True,
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
})
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def battery_status_check(self, platform):
|
||||
if "Laptop" not in platform:
|
||||
@@ -2782,7 +2765,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "Surface", 0x00001000)
|
||||
self.utils.head("Select ACPI Tables")
|
||||
print("")
|
||||
if sys.platform == "win32":
|
||||
print("To manually dump ACPI tables, open Command Prompt and enter the following\ncommands in sequence:")
|
||||
print("To manually dump ACPI tables, open Command Prompt and enter the following commands in sequence:")
|
||||
print("")
|
||||
print(" > cd \"{}\"".format(results_path.replace("/", "\\")))
|
||||
print(" > mkdir ACPITables")
|
||||
@@ -2850,7 +2833,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "DTGP", 0x00001000)
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content),
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def spoof_discrete_gpu(self, discrete_gpu):
|
||||
@@ -2904,7 +2887,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "GPUSPOOF", 0x00001000)
|
||||
self.result["Add"].append({
|
||||
"Comment": comment,
|
||||
"Enabled": self.write_ssdt(ssdt_name, ssdt_content, compile=False),
|
||||
"Path": f"{ssdt_name}.aml"
|
||||
"Path": ssdt_name + ".aml"
|
||||
})
|
||||
|
||||
def initialize_patches(self, motherboard_name, motherboard_chipset, platform, cpu_manufacturer, cpu_codename, integrated_gpu, discrete_gpu, ethernet_pci, touchpad_communication, smbios, intel_mei, unsupported_devices, macos_version, acpi_directory):
|
||||
|
||||
@@ -16,7 +16,7 @@ class AIDA64:
|
||||
return file.read()
|
||||
except UnicodeDecodeError:
|
||||
continue
|
||||
raise UnicodeDecodeError(f"Unable to decode file {file_path} with given encodings")
|
||||
raise UnicodeDecodeError("Unable to decode file {} with given encodings".format(file_path))
|
||||
|
||||
def hardware_id(self, hardware_id):
|
||||
if "VEN" in hardware_id:
|
||||
@@ -212,7 +212,7 @@ class AIDA64:
|
||||
if bus_type.endswith("AUDIO") or bus_type.endswith("USB"):
|
||||
if device_props.get("Device ID", "Unknown") not in audio_device_ids:
|
||||
occurrences = self.count_keys(audio_devices_info, device_name)
|
||||
unique_device_name = f"{device_name}_#{occurrences}" if occurrences > 0 else device_name
|
||||
unique_device_name = "{}_#{}".format(device_name, occurrences) if occurrences > 0 else device_name
|
||||
audio_devices_info[unique_device_name] = {
|
||||
"Bus Type": bus_type,
|
||||
"{} ID".format("USB" if bus_type.endswith("USB") else "Codec"): device_props.get("Device ID", "Unknown")
|
||||
@@ -301,7 +301,7 @@ class AIDA64:
|
||||
device_props = device_data.get("Device Properties", {})
|
||||
manufacturer = device_props.get("Manufacturer", None)
|
||||
product = device_props.get("Product", None)
|
||||
device_description = f"{manufacturer} {product}" if manufacturer and product else product if product else None
|
||||
device_description = "{} {}".format(manufacturer, product) if manufacturer and product else product if product else None
|
||||
|
||||
if not device_description:
|
||||
device_id = device_props.get("Device ID", None)
|
||||
@@ -314,7 +314,7 @@ class AIDA64:
|
||||
device_description = self.utils.search_dict_iter(windows_devices, hardware_id).get("Driver Description", device_name)
|
||||
|
||||
occurrences = self.count_keys(usb_info["USB Devices"], device_description)
|
||||
device_description = f"{device_description}_#{occurrences}" if occurrences > 0 else device_description
|
||||
device_description = "{}_#{}".format(device_description, occurrences) if occurrences > 0 else device_description
|
||||
|
||||
if "Hub" not in device_description and "Billboard" not in device_description and not "0000-0000" in device_props.get("Device ID"):
|
||||
usb_info["USB Devices"][device_description] = {
|
||||
@@ -361,7 +361,7 @@ class AIDA64:
|
||||
device_props = device_data.get("Device Properties", device_data)
|
||||
device_class = device_props.get("Device Class", "Unknown")
|
||||
|
||||
if self.utils.contains_any(["SD Host Controller", "Card Reader", "SDHC", "SDXC", "SDUC", " SD ", "MMC"], f"{device_name} {device_class}"):
|
||||
if self.utils.contains_any(["SD Host Controller", "Card Reader", "SDHC", "SDXC", "SDUC", " SD ", "MMC"], device_name + " " + device_class):
|
||||
hardware["SD Controller"] = {
|
||||
"Device Description": device_name,
|
||||
"Bus Type": "PCI" if device_props.get("Bus Type", "Unknown").startswith("PCI") else "USB",
|
||||
@@ -453,11 +453,11 @@ class AIDA64:
|
||||
device_name = full_key[category_idx + 3:]
|
||||
|
||||
if not category_name:
|
||||
parsed_dmi[f"{full_key}{occurrence_suffix}"] = item_value
|
||||
parsed_dmi["{}{}".format(full_key, occurrence_suffix)] = item_value
|
||||
else:
|
||||
if category_name not in parsed_dmi:
|
||||
parsed_dmi[category_name] = {}
|
||||
parsed_dmi[category_name][f"{device_name}{occurrence_suffix}"] = item_value
|
||||
parsed_dmi[category_name]["{}{}".format(device_name, occurrence_suffix)] = item_value
|
||||
|
||||
return parsed_dmi
|
||||
|
||||
@@ -483,7 +483,7 @@ class AIDA64:
|
||||
|
||||
# Count occurrences of device name within category
|
||||
occurrences = self.count_keys(parsed_windows_devices[category_name], device_name)
|
||||
device_name = f"{device_name}_#{occurrences}" if occurrences > 0 else device_name
|
||||
device_name = "{}_#{}".format(device_name, occurrences) if occurrences > 0 else device_name
|
||||
|
||||
# Add device to category dictionary
|
||||
parsed_windows_devices[category_name][device_name] = device_props
|
||||
@@ -560,7 +560,7 @@ class AIDA64:
|
||||
# Add the new key-value pair
|
||||
current_dict = stack[-1][0]
|
||||
occurrences = self.count_keys(current_dict, key)
|
||||
key = f"{key}_#{occurrences}" if occurrences > 0 else key
|
||||
key = "{}_#{}".format(key, occurrences) if occurrences > 0 else key
|
||||
|
||||
if value is None:
|
||||
new_dict = {}
|
||||
|
||||
@@ -43,14 +43,14 @@ class CodecLayouts:
|
||||
|
||||
if not vendor_id:
|
||||
# Skip if vendor ID is not found
|
||||
print(f"Unknown vendor for codec: {codec_folder_name}")
|
||||
print("Unknown vendor for codec: {}".format(codec_folder_name))
|
||||
continue
|
||||
|
||||
# Extract vendor name from vendor information
|
||||
vendor_name = self.vendors[vendor_id][-1]
|
||||
|
||||
# Build the raw URL for the Info.plist file
|
||||
raw_url = f"https://raw.githubusercontent.com/acidanthera/AppleALC/master/Resources/{codec_folder_name}/Info.plist"
|
||||
raw_url = "https://raw.githubusercontent.com/acidanthera/AppleALC/master/Resources/{}/Info.plist".format(codec_folder_name)
|
||||
|
||||
# Retrieve content from the Info.plist file and parse as plist
|
||||
info = self.fetcher.fetch_and_parse_content(raw_url, "json")
|
||||
@@ -59,7 +59,7 @@ class CodecLayouts:
|
||||
codec_id_hex = self.utils.int_to_hex(info["CodecID"]).zfill(4)
|
||||
formatted_codec_name = "{} {}".format(vendor_name, info["CodecName"])
|
||||
layout_ids = sorted([int(layouts["Id"]) for layouts in info["Files"]["Layouts"]])
|
||||
pci_id = f"{vendor_id}-{codec_id_hex}".upper()
|
||||
pci_id = "{}-{}".format(vendor_id, codec_id_hex).upper()
|
||||
|
||||
sound_codec_info[pci_id] = layout_ids
|
||||
|
||||
@@ -83,7 +83,7 @@ class CodecLayouts:
|
||||
hda_config_defaults = plist_data.get("IOKitPersonalities", {}).get("as.vit9696.AppleALC", {}).get("HDAConfigDefault", [])
|
||||
for layout in hda_config_defaults:
|
||||
codec_id_hex = self.utils.int_to_hex(layout.get("CodecID", 0)).zfill(8)
|
||||
formatted_codec_id = f"{codec_id_hex[:4]}-{codec_id_hex[-4:]}"
|
||||
formatted_codec_id = "{}-{}".format(codec_id_hex[:4], codec_id_hex[-4:])
|
||||
layout_id = layout.get("LayoutID")
|
||||
if layout_id is not None:
|
||||
if formatted_codec_id not in codec_layouts:
|
||||
|
||||
@@ -14,7 +14,7 @@ class CompatibilityChecker:
|
||||
def check_cpu_compatibility(self, processor_name, instruction_set):
|
||||
if "x86-64" not in instruction_set or "SSE4" not in instruction_set:
|
||||
self.max_supported_macos_version = self.min_supported_macos_version = -1
|
||||
self.unsupported_devices.append(f"CPU: {processor_name}")
|
||||
self.unsupported_devices.append("CPU: {}".format(processor_name))
|
||||
return
|
||||
|
||||
if "SSE4.2" not in instruction_set:
|
||||
@@ -101,7 +101,7 @@ class CompatibilityChecker:
|
||||
is_supported_discrete_gpu = is_supported_gpu = False
|
||||
|
||||
if not is_supported_gpu:
|
||||
self.unsupported_devices.append(f"{device_type}: {gpu_name}")
|
||||
self.unsupported_devices.append("{}: {}".format(device_type, gpu_name))
|
||||
else:
|
||||
supported_gpus[gpu_name] = gpu_props
|
||||
|
||||
@@ -124,7 +124,7 @@ class CompatibilityChecker:
|
||||
else:
|
||||
if "Audio Endpoints" in audio_props:
|
||||
audio_endpoint = ",".join(audio_props.get("Audio Endpoints"))
|
||||
self.unsupported_devices.append("Audio: {}{}".format(audio_device, "" if not audio_endpoint else f" ({audio_endpoint})"))
|
||||
self.unsupported_devices.append("Audio: {}{}".format(audio_device, "" if not audio_endpoint else " ({})".format(audio_endpoint)))
|
||||
|
||||
return supported_audio
|
||||
|
||||
@@ -132,7 +132,7 @@ class CompatibilityChecker:
|
||||
biometric = hardware.get("Biometric", {})
|
||||
if biometric:
|
||||
for biometric_device, biometric_props in biometric.items():
|
||||
self.unsupported_devices.append(f"Biometric: {biometric_device}")
|
||||
self.unsupported_devices.append("Biometric: {}".format(biometric_device))
|
||||
|
||||
del hardware["Biometric"]
|
||||
|
||||
@@ -150,7 +150,7 @@ class CompatibilityChecker:
|
||||
self.min_supported_macos_version = 19
|
||||
|
||||
if not is_device_supported:
|
||||
self.unsupported_devices.append(f"{connection_name}: {device_name}")
|
||||
self.unsupported_devices.append("{}: {}".format(connection_name, device_name))
|
||||
else:
|
||||
supported_network[device_name] = device_props
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ class builder:
|
||||
os.remove(path)
|
||||
except Exception as e:
|
||||
error = True
|
||||
print(f"\nFailed to remove file: {e}", end="")
|
||||
print("\nFailed to remove file: {}".format(e), end="")
|
||||
continue
|
||||
|
||||
if error:
|
||||
@@ -377,7 +377,7 @@ class builder:
|
||||
self.utils.mkdirs(efi_directory)
|
||||
|
||||
if not os.path.exists(self.kext.ock_files_dir):
|
||||
raise Exception(f"Directory '{self.kext.ock_files_dir}' does not exist.")
|
||||
raise Exception("Directory '{}' does not exist.".format(self.kext.ock_files_dir))
|
||||
|
||||
source_efi_dir = os.path.join(self.kext.ock_files_dir, "OpenCore")
|
||||
shutil.copytree(source_efi_dir, efi_directory, dirs_exist_ok=True)
|
||||
@@ -498,7 +498,7 @@ class builder:
|
||||
config_data = self.utils.read_file(config_file)
|
||||
|
||||
if not config_data:
|
||||
raise Exception(f"Error: The file {config_file} does not exist.")
|
||||
raise Exception("Error: The file {} does not exist.".format(config_file))
|
||||
|
||||
self.config.genarate(hardware_shorc, efi_option, config_data)
|
||||
self.utils.write_file(config_file, config_data)
|
||||
|
||||
@@ -13,7 +13,7 @@ class gatheringFiles:
|
||||
self.github = github.Github()
|
||||
self.fetcher = resource_fetcher.ResourceFetcher(self.github.headers)
|
||||
self.dortania_builds_url = "https://raw.githubusercontent.com/dortania/build-repo/builds/latest.json"
|
||||
self.amd_vanilla_patches_url = f"https://raw.githubusercontent.com/AMD-OSX/AMD_Vanilla/beta/patches.plist"
|
||||
self.amd_vanilla_patches_url = "https://raw.githubusercontent.com/AMD-OSX/AMD_Vanilla/beta/patches.plist"
|
||||
self.temporary_dir = tempfile.mkdtemp()
|
||||
self.ock_files_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "OCK_Files")
|
||||
self.download_history_file = os.path.join(self.ock_files_dir, "history.json")
|
||||
@@ -220,7 +220,7 @@ class gatheringFiles:
|
||||
|
||||
def move_bootloader_kexts_to_product_directory(self, product_name):
|
||||
if not os.path.exists(self.temporary_dir):
|
||||
raise FileNotFoundError(f"The directory {self.temporary_dir} does not exist.")
|
||||
raise FileNotFoundError("The directory {} does not exist.".format(self.temporary_dir))
|
||||
|
||||
if not "OpenCore" in product_name:
|
||||
kext_paths = self.utils.find_matching_paths(os.path.join(self.temporary_dir, product_name), ".kext")
|
||||
@@ -306,7 +306,7 @@ class gatheringFiles:
|
||||
self.utils.head("Gathering Files")
|
||||
print("")
|
||||
print("Please wait for download AMD Vanilla Patches")
|
||||
print(f"from {self.amd_vanilla_patches_url}")
|
||||
print("from " + self.amd_vanilla_patches_url)
|
||||
print("")
|
||||
|
||||
try:
|
||||
|
||||
@@ -13,7 +13,7 @@ class Github:
|
||||
# Set the headers for GitHub API requests
|
||||
self.headers = {
|
||||
"Accept": "application/vnd.github+json",
|
||||
"#Authorization": f"token {self.github_token}",
|
||||
"#Authorization": "token {}".format(self.github_token),
|
||||
"X-GitHub-Api-Version": "2022-11-28",
|
||||
}
|
||||
self.fetcher = resource_fetcher.ResourceFetcher(self.headers)
|
||||
@@ -28,7 +28,7 @@ class Github:
|
||||
def get_list_branches(self, owner, repo):
|
||||
self.check_ratelimit()
|
||||
|
||||
url = f"https://api.github.com/repos/{owner}/{repo}/branches"
|
||||
url = "https://api.github.com/repos/{}/{}/branches".format(owner, repo)
|
||||
|
||||
response = self.fetcher.fetch_and_parse_content(url, "json")
|
||||
|
||||
@@ -42,7 +42,7 @@ class Github:
|
||||
|
||||
self.check_ratelimit()
|
||||
|
||||
url = f"https://api.github.com/repos/{owner}/{repo}/actions/artifacts?per_page=1"
|
||||
url = "https://api.github.com/repos/{}/{}/actions/artifacts?per_page=1".format(owner, repo)
|
||||
|
||||
response = self.fetcher.fetch_and_parse_content(url, "json")
|
||||
|
||||
@@ -61,7 +61,7 @@ class Github:
|
||||
|
||||
self.check_ratelimit()
|
||||
|
||||
url = f"https://api.github.com/repos/{owner}/{repo}/releases?per_page=1"
|
||||
url = "https://api.github.com/repos/{}/{}/releases?per_page=1".format(owner, repo)
|
||||
|
||||
response = self.fetcher.fetch_and_parse_content(url, "json")
|
||||
|
||||
|
||||
@@ -563,23 +563,23 @@ class KextMaestro:
|
||||
for pci_id in pci_list:
|
||||
vendor_id = pci_id[-4:]
|
||||
device_id = pci_id[2:6]
|
||||
pci_ids.append(f"{vendor_id}-{device_id}".upper())
|
||||
pci_ids.append("{}-{}".format(vendor_id, device_id).upper())
|
||||
elif match_key == "IONameMatch":
|
||||
# Process IONameMatch keys
|
||||
for pci_id in properties[match_key]:
|
||||
vendor_id = pci_id[3:7]
|
||||
device_id = pci_id[-4:]
|
||||
pci_ids.append(f"{vendor_id}-{device_id}".upper())
|
||||
pci_ids.append("{}-{}".format(vendor_id, device_id).upper())
|
||||
elif match_key == "idProduct":
|
||||
# Process idProduct and idVendor
|
||||
vendor_id = self.utils.int_to_hex(properties["idVendor"]).zfill(4)
|
||||
device_id = self.utils.int_to_hex(properties["idProduct"]).zfill(4)
|
||||
pci_ids.append(f"{vendor_id}-{device_id}".upper())
|
||||
pci_ids.append("{}-{}".format(vendor_id, device_id).upper())
|
||||
elif match_key == "HDAConfigDefault":
|
||||
# Handle AppleALC configurations
|
||||
for codec_layout in properties[match_key]:
|
||||
codec_id = self.utils.int_to_hex(codec_layout.get("CodecID")).zfill(8)
|
||||
pci_ids.append(f"{codec_id[:4]}-{codec_id[-4:]}")
|
||||
pci_ids.append("{}-{}".format(codec_id[:4], codec_id[-4:]))
|
||||
pci_ids = sorted(list(set(pci_ids)))
|
||||
|
||||
return pci_ids
|
||||
@@ -708,7 +708,7 @@ class KextMaestro:
|
||||
def install_kexts_to_efi(self, kexts, macos_version, kexts_directory):
|
||||
for kext_name in kexts:
|
||||
if "AirportItlwm" in kext_name:
|
||||
kext_name = f"{kext_name}{macos_version}"
|
||||
kext_name = "{}{}".format(kext_name, macos_version)
|
||||
elif "BlueToolFixup" in kext_name or "BrcmPatchRAM" in kext_name:
|
||||
kext_name = "BrcmPatchRAM"
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class ResourceFetcher:
|
||||
cafile = certifi.where()
|
||||
ssl_context = ssl.create_default_context(cafile=cafile)
|
||||
except Exception as e:
|
||||
print(f"SSL Context Creation Error: {e}")
|
||||
print("SSL Context Creation Error: {}".format(e))
|
||||
ssl_context = ssl._create_unverified_context()
|
||||
return ssl_context
|
||||
|
||||
@@ -43,7 +43,7 @@ class ResourceFetcher:
|
||||
|
||||
bytes_downloaded = 0
|
||||
|
||||
print(f"Download from {resource_url}")
|
||||
print("Download from {}".format(resource_url))
|
||||
|
||||
with open(destination_path, 'wb') as file_writer:
|
||||
while True:
|
||||
@@ -53,4 +53,4 @@ class ResourceFetcher:
|
||||
file_writer.write(chunk)
|
||||
bytes_downloaded += len(chunk)
|
||||
if total_size != -1:
|
||||
print(f"Downloaded {bytes_downloaded / (1024 * 1024):.2f} MB of {total_size / (1024 * 1024):.2f} MB", end='\r')
|
||||
print("Downloaded {:.2f} MB of {:.2f} MB".format(bytes_downloaded / (1024 * 1024), total_size / (1024 * 1024)), end='\r')
|
||||
@@ -28,7 +28,7 @@ class SMBIOS:
|
||||
self.utils.write_file(self.g.download_history_file, download_history)
|
||||
|
||||
if quit:
|
||||
raise Exception(f"{macserial_name} not found. Please reopen the program to download it")
|
||||
raise Exception("{} not found. Please reopen the program to download it".format(macserial_name))
|
||||
else:
|
||||
return macserial_path
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class Utils:
|
||||
found_paths = []
|
||||
|
||||
if not os.path.exists(directory):
|
||||
print(f"Error: The directory {directory} does not exist.")
|
||||
print("Error: The directory {} does not exist.".format(directory))
|
||||
return found_paths
|
||||
|
||||
for root, dirs, files in os.walk(directory):
|
||||
@@ -197,12 +197,12 @@ class Utils:
|
||||
if text == None:
|
||||
text = self.script_name
|
||||
separator = "#" * width
|
||||
title = f" {text} "
|
||||
title = " {} ".format(text)
|
||||
if len(title) > width - 2:
|
||||
title = title[:width-4] + "..."
|
||||
title = title.center(width - 2) # Center the title within the width minus 2 for the '#' characters
|
||||
|
||||
print(f"{separator}\n#{title}#\n{separator}")
|
||||
print("{}\n#{}#\n{}".format(separator, title, separator))
|
||||
|
||||
def adjust_window_size(self, content=""):
|
||||
lines = content.splitlines()
|
||||
@@ -227,7 +227,7 @@ class Utils:
|
||||
else:
|
||||
color_code = RESET
|
||||
|
||||
return f"{color_code}{text}{RESET}"
|
||||
return "{}{}{}".format(color_code, text, RESET)
|
||||
|
||||
def exit_program(self, custom_content=""):
|
||||
self.head()
|
||||
|
||||
Reference in New Issue
Block a user