CHAPTER 5 : AppleHDA BINARY PATCHING.
This post is a part of my AppleHDA Patching guide. However, this post alone can be used to Patch AppleHDA binary. I’m using the codec ALC887-VD as an example for explaining the process. The credit goes to RevoGirl (R.I.P), TimeWalker and others who contributed for discovering the binary patch details.
EmlyDinesh Post Found Here
Bcc9 Post Found Here
Rehabman Post Found Here
what we will try to do with binary patch is matching our codec ID with codec ID of Apple. By this way our codec gets enabled and work like an Apple codec. There are three Apple codecs from AppleHDA known to work very well for binary patching.
Easiest way to Binary Patching to Use bcc9 script Binary Patching Script ,This is a script created by bcc9 from InsanelyMac for this bin patching
If you want to do it manually follow the guide ::
- ADI 1984 [0x11d41984]
Hex Value for patching = “84 19 D4 11”
- ADI 1984B Analog [0x11d4198b]
Hex Value for patching = “8B 19 D4 11”
- ALC 885 [0x10ec0885]
Hex Value for patching = “85 08 EC 10”
Now, what we do is just replace the Vendor and Device id of our codec for any one of the above three Apple codec ID’s and zero out/patch some lines which does the comparison and prevents the codec getting enabled. This method works very well for many codecs so far, but it might not for some codecs.
There is a script created by bcc9 from InsanelyMac for this bin patching. So, if want to do this in a script way then follow this post: Binary Patch Script.
I’m going to use Apple codec ADI 1984 for the ALC 269 which works very well.
- Untouched AppleHDA from OSX 10.7 or greater
- Hex Fiend Application (For Patching binary)
- Codec dump from Linux (Read AppleHDA Complete guide for steps to get dump )
- Plist Editor (or) Xcode
Steps to patch AppleHDA binary: [ALC887 codec is used as an example]
1. Go to the folder “AppleHDA.kext/Contents/MacOS” inside AppleHDA kext
2. Copy the binary file “AppleHDA” inside the folder MacOS to Desktop
3. Open the binary file “AppleHDA” from the application “Hex fiend”
4. Press the shortcut keys “Command+F” in Hex fiend app to open Find and Replace boxes
For AppleHDA 10.8 or later:
Enter "8B 19 D4 11" in Find Box (Apple codec) and "87 08 EC 10" in replace box (use your ‘Vendor Id’ value from codec dump) Press "Replace All" button to replace
Note 1: For ADI 1984/1984B patch, if your codec device id value is less “884” then you need this additional patch.
If your codec device id is less than “884” then you need to clear a check in AppleHDA, otherwise it will try to skip this and will load ALC885 codec instead. .
Enter "84 08 EC 10" in Find box and "00 00 00 00" in replace box Press "Replace All" button to replace
Note 2: For ADI 1984B, you need this additional patch.
If you use Apple codec ADI 1984B to patch, then you have to clear ADI 1984 check for loading the codec ADI 1984B.
Enter "84 19 D4 11" in Find box and "00 00 00 00" in replace box Press "Replace All" button to replace
Note 3: For Safer Patch using full ‘CMPL’ instruction , you need this additional patch. just need to use 3D word before decimal-id of codec : for e.g. ALC887
Enter "3D 8B 19 D4 11" in Find box and "3D 87 08 EC 10" in replace box Press "Replace All" button to replace
Enter "3D84 19 D4 11" in Find box and " 3D 00 00 00 00" in replace box Press "Replace All" button to replace
Note : Using 3D in front of Codec id in decimal makes safer to patch Binary ..
For AppleHDA in 10.7:
In 10.7, we need the below additional patch along with the patches used in 10.8 or greater.
Enter "83 19 D4 11" in Find Box and "00 00 00 00" in replace box Press "Replace All" button to replace
5. After above replaces, save the file from File menu and copy the patched AppleHDA binary from desktop to back too “AppleHDA.kext/Contents/MacOS”.