Skip to content

Commit

Permalink
Don't patch AppleHDA
Browse files Browse the repository at this point in the history
Signed-off-by: Visual Ehrmanntraut <[email protected]>
  • Loading branch information
VisualEhrmanntraut committed Nov 17, 2023
1 parent c14646a commit 957505c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
14 changes: 0 additions & 14 deletions NootedRed/HDMI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,15 @@
#include <Headers/kern_api.hpp>

static const char *pathAppleGFXHDA = "/System/Library/Extensions/AppleGFXHDA.kext/Contents/MacOS/AppleGFXHDA";
static const char *pathAppleHDA = "/System/Library/Extensions/AppleHDA.kext/Contents/MacOS/AppleHDA";

static KernelPatcher::KextInfo kextAppleGFXHDA {"com.apple.driver.AppleGFXHDA", &pathAppleGFXHDA, 1, {true}, {},
KernelPatcher::KextInfo::Unloaded};
static KernelPatcher::KextInfo kextAppleHDA {"com.apple.driver.AppleHDA", &pathAppleHDA, 1, {true}, {},
KernelPatcher::KextInfo::Unloaded};

HDMI *HDMI::callback = nullptr;

void HDMI::init() {
callback = this;
lilu.onKextLoadForce(&kextAppleGFXHDA);
lilu.onKextLoadForce(&kextAppleHDA);
}

bool HDMI::processKext(KernelPatcher &patcher, size_t id, mach_vm_address_t slide, size_t size) {
Expand Down Expand Up @@ -54,16 +50,6 @@ bool HDMI::processKext(KernelPatcher &patcher, size_t id, mach_vm_address_t slid
PANIC_COND(!LookupPatchPlus::applyAll(patcher, patches, slide, size), "AGFXHDA", "Failed to apply patches");
}

return true;
} else if (kextAppleHDA.loadIndex == id) {
LookupPatchPlus patches[] = {
{&kextAppleHDA, kAHDACreate1Original, kAHDACreate1Patched, 2},
{&kextAppleHDA, kAHDACreate2Original, kAHDACreate2OriginalMask, kAHDACreate2Patched,
kAHDACreate2PatchedMask, 2},
{&kextAppleHDA, kAHDACreate3Original, kAHDACreate3Mask, kAHDACreate3Patched, 2},
};
PANIC_COND(!LookupPatchPlus::applyAll(patcher, patches, slide, size), "AHDA", "Failed to apply patches");

return true;
}

Expand Down
15 changes: 0 additions & 15 deletions NootedRed/HDMI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,3 @@ static const UInt8 kCreateAppleHDA2Original[] = {0x3D, 0xF8, 0xA0, 0x00, 0x00, 0
static const UInt8 kCreateAppleHDA2OriginalMask[] = {0xFF, 0xFF, 0xF0, 0xFF, 0xFF, 0xFF, 0x00};
static const UInt8 kCreateAppleHDA2Patched[] = {0x66, 0x90, 0x66, 0x90, 0x90, 0xEB, 0x00};
static const UInt8 kCreateAppleHDA2PatchedMask[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00};

//! TODO: Provide an explanation here.
static const UInt8 kAHDACreate1Original[] = {0x87, 0xAA, 0x00, 0x00, 0x0F, 0x8F};
static const UInt8 kAHDACreate1Patched[] = {0x66, 0x90, 0x66, 0x90, 0x48, 0xE9};

//! TODO: Provide an explanation here.
static const UInt8 kAHDACreate2Original[] = {0x83, 0x00, 0x38, 0x77, 0x00, 0xB0};
static const UInt8 kAHDACreate2OriginalMask[] = {0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xF0};
static const UInt8 kAHDACreate2Patched[] = {0x66, 0x90, 0x90, 0xEB, 0x00, 0x00};
static const UInt8 kAHDACreate2PatchedMask[] = {0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00};

//! TODO: Provide an explanation here.
static const UInt8 kAHDACreate3Original[] = {0xD8, 0xAA, 0x00, 0x00, 0x75, 0x00};
static const UInt8 kAHDACreate3Mask[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00};
static const UInt8 kAHDACreate3Patched[] = {0x66, 0x90, 0x66, 0x90, 0x66, 0x90};

0 comments on commit 957505c

Please sign in to comment.