mirror of
https://github.com/outbackdingo/OpCore-Simplify.git
synced 2026-08-25 14:53:06 +00:00
Fix ACPI table identification with proper null byte padding
This commit is contained in:
+17
-6
@@ -13,6 +13,8 @@ import binascii
|
|||||||
import re
|
import re
|
||||||
import tempfile
|
import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
|
import plistlib
|
||||||
|
|
||||||
class ACPIGuru:
|
class ACPIGuru:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -1444,6 +1446,14 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "EC", 0x00001000)
|
|||||||
"Patch": patches
|
"Patch": patches
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def get_data(self, data, pad_to=0):
|
||||||
|
if sys.version_info >= (3, 0):
|
||||||
|
if not isinstance(data,bytes):
|
||||||
|
data = data.encode()
|
||||||
|
return data+b"\x00"*(max(pad_to-len(data),0))
|
||||||
|
else:
|
||||||
|
return plistlib.Data(data+b"\x00"*(max(pad_to-len(data),0)))
|
||||||
|
|
||||||
def write_ssdt(self, ssdt_name, ssdt_content, compile=True):
|
def write_ssdt(self, ssdt_name, ssdt_content, compile=True):
|
||||||
dsl_path = os.path.join(self.acpi_directory, ssdt_name + ".dsl")
|
dsl_path = os.path.join(self.acpi_directory, ssdt_name + ".dsl")
|
||||||
aml_path = os.path.join(self.acpi_directory, ssdt_name + ".aml")
|
aml_path = os.path.join(self.acpi_directory, ssdt_name + ".aml")
|
||||||
@@ -3012,7 +3022,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "SURFACE", 0x00001000)
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
"All": True,
|
"All": True,
|
||||||
"Comment": "Delete {}".format(signature or oemtableid),
|
"Comment": "Delete {}".format((signature or oemtableid).rstrip(b"\x00").decode()),
|
||||||
"Enabled": True,
|
"Enabled": True,
|
||||||
"OemTableId": self.utils.hex_to_bytes(binascii.hexlify(table_data.get("id")).decode()),
|
"OemTableId": self.utils.hex_to_bytes(binascii.hexlify(table_data.get("id")).decode()),
|
||||||
"TableLength": table_data.get("length"),
|
"TableLength": table_data.get("length"),
|
||||||
@@ -3188,13 +3198,14 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "WMIS", 0x00000000)
|
|||||||
}
|
}
|
||||||
|
|
||||||
def drop_cpu_tables(self):
|
def drop_cpu_tables(self):
|
||||||
|
cpu_tables = ["CpuPm", "Cpu0Ist"]
|
||||||
deletes = []
|
deletes = []
|
||||||
|
|
||||||
if self.dropping_the_table(oemtableid="CpuPm"):
|
for table_name in cpu_tables:
|
||||||
deletes.append(self.dropping_the_table(oemtableid="CpuPm"))
|
padded_table_id = self.get_data(table_name, pad_to=8)
|
||||||
|
table_entry = self.dropping_the_table(oemtableid=padded_table_id)
|
||||||
if self.dropping_the_table(oemtableid="Cpu0Ist"):
|
if table_entry:
|
||||||
deletes.append(self.dropping_the_table(oemtableid="Cpu0Ist"))
|
deletes.append(table_entry)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"Delete": deletes
|
"Delete": deletes
|
||||||
|
|||||||
Reference in New Issue
Block a user