mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-14 04:38:20 +10:00
device_probe.py: Add unspoof variable
This commit is contained in:
@@ -200,7 +200,7 @@ class build_graphics_audio:
|
||||
self.config["DeviceProperties"]["Add"][backlight_path] = {"shikigva": 128, "unfairgva": 1, "agdpmod": "pikera", "rebuild-device-tree": 1, "enable-gva-support": 1, "ATY,bin_image": binascii.unhexlify(video_bios_data.RX5500XT_64K) }
|
||||
logging.info(f"- Adding AMD RX5500XT boot-args")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " agdpmod=pikera applbkl=3"
|
||||
elif self.computer.dgpu.device_id == 0x6981:
|
||||
elif self.computer.dgpu.device_id_unspoofed == 0x6981:
|
||||
logging.info(f"- Adding AMD WX3200 device spoofing")
|
||||
self.config["DeviceProperties"]["Add"][backlight_path] = {"shikigva": 128, "unfairgva": 1, "agdpmod": "pikera", "rebuild-device-tree": 1, "enable-gva-support": 1, "model": "AMD Radeon Pro WX 3200", "device-id": binascii.unhexlify("FF67")}
|
||||
else:
|
||||
|
||||
@@ -22,6 +22,12 @@ class generate_defaults:
|
||||
self.constants.custom_serial_number = ""
|
||||
self.constants.custom_board_serial_number = ""
|
||||
|
||||
for gpu in self.constants.computer.gpus:
|
||||
if gpu.device_id_unspoofed == -1:
|
||||
gpu.device_id_unspoofed = gpu.device_id
|
||||
if gpu.vendor_id_unspoofed == -1:
|
||||
gpu.vendor_id_unspoofed = gpu.vendor_id
|
||||
|
||||
self.general_probe()
|
||||
self.nvram_probe()
|
||||
self.gpu_probe()
|
||||
|
||||
@@ -25,25 +25,41 @@ class CPU:
|
||||
class PCIDevice:
|
||||
VENDOR_ID: ClassVar[int] # Default vendor id, for subclasses.
|
||||
|
||||
vendor_id: int # The vendor ID of this PCI device
|
||||
device_id: int # The device ID of this PCI device
|
||||
vendor_id: int # The vendor ID of this PCI device
|
||||
device_id: int # The device ID of this PCI device
|
||||
class_code: int # The class code of this PCI device - https://pci-ids.ucw.cz/read/PD
|
||||
|
||||
name: Optional[str] = None # Name of IORegistryEntry
|
||||
model: Optional[str] = None # model property
|
||||
acpi_path: Optional[str] = None # ACPI Device Path
|
||||
pci_path: Optional[str] = None # PCI Device Path
|
||||
disable_metal: Optional[bool] = False # 'disable-metal' property
|
||||
force_compatible: Optional[bool] = False # 'force-compat' property
|
||||
name: Optional[str] = None # Name of IORegistryEntry
|
||||
model: Optional[str] = None # model property
|
||||
acpi_path: Optional[str] = None # ACPI Device Path
|
||||
pci_path: Optional[str] = None # PCI Device Path
|
||||
disable_metal: Optional[bool] = False # 'disable-metal' property
|
||||
force_compatible: Optional[bool] = False # 'force-compat' property
|
||||
vendor_id_unspoofed: Optional[int] = -1 # Unspoofed vendor ID of this PCI device
|
||||
device_id_unspoofed: Optional[int] = -1 # Unspoofed device ID of this PCI device
|
||||
|
||||
@classmethod
|
||||
def from_ioregistry(cls, entry: ioreg.io_registry_entry_t, anti_spoof=False):
|
||||
properties: dict = ioreg.corefoundation_to_native(ioreg.IORegistryEntryCreateCFProperties(entry, None, ioreg.kCFAllocatorDefault, ioreg.kNilOptions)[1]) # type: ignore
|
||||
if anti_spoof and "IOName" in properties:
|
||||
vendor_id, device_id = (int(i, 16) for i in properties["IOName"][3:].split(","))
|
||||
else:
|
||||
|
||||
vendor_id = None
|
||||
device_id = None
|
||||
vendor_id_unspoofed = None
|
||||
device_id_unspoofed = None
|
||||
|
||||
if "IOName" in properties and properties["IOName"].startswith("pci"):
|
||||
vendor_id_unspoofed, device_id_unspoofed = (int(i, 16) for i in properties["IOName"][3:].split(","))
|
||||
if anti_spoof:
|
||||
vendor_id = vendor_id_unspoofed
|
||||
device_id = device_id_unspoofed
|
||||
|
||||
if vendor_id is None and device_id is None:
|
||||
vendor_id, device_id = [int.from_bytes(properties[i][:4], byteorder="little") for i in ["vendor-id", "device-id"]]
|
||||
|
||||
if vendor_id_unspoofed is None and device_id_unspoofed is None:
|
||||
vendor_id_unspoofed = vendor_id
|
||||
device_id_unspoofed = device_id
|
||||
|
||||
device = cls(vendor_id, device_id, int.from_bytes(properties["class-code"][:6], byteorder="little"), name=ioreg.io_name_t_to_str(ioreg.IORegistryEntryGetName(entry, None)[1]))
|
||||
if "model" in properties:
|
||||
model = properties["model"]
|
||||
@@ -56,6 +72,9 @@ class PCIDevice:
|
||||
device.disable_metal = True
|
||||
if "force-compat" in properties:
|
||||
device.force_compatible = True
|
||||
|
||||
device.vendor_id_unspoofed = vendor_id_unspoofed
|
||||
device.device_id_unspoofed = device_id_unspoofed
|
||||
device.populate_pci_path(entry)
|
||||
return device
|
||||
|
||||
|
||||
Reference in New Issue
Block a user