Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Up to date #9

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
64e9b8d
Added some 10.10 beta's
Floris497 Oct 6, 2014
bc45ac5
Added 10.10 Support
Floris497 Oct 18, 2014
5366c8b
Update README example with correct -endianness
jelliot Dec 22, 2014
32614fc
Merge pull request #1 from jelliot/patch-1
Floris497 Dec 22, 2014
80088fb
Added 10.10.2 support
Jan 30, 2015
8f09abb
10.10.3 support
Floris497 Apr 8, 2015
3d260ae
Added 10.10.4, Deleted comments
Floris497 Jul 1, 2015
25c0eef
Added 10.11 Beta 1,2,3,5,6 Support
Aug 7, 2015
1bafb66
Corrected little mistake
Floris497 Aug 8, 2015
acd80d4
Added support for 10.11 Beta 7
Aug 26, 2015
5492027
added el capitan beta 8
masakistan Sep 9, 2015
4b050e4
Merge pull request #6 from masakistan/master
Floris497 Sep 9, 2015
a1035b1
Added 10.11 support
Sep 10, 2015
f5137cd
Updated to reflect that this works on El Capitan
sammcj Sep 17, 2015
a50e67e
Merge pull request #9 from sammcj/patch-1
Floris497 Sep 17, 2015
a150b81
Support for newer Nvidia kext
Sep 30, 2015
39d9d42
Fixed support for 10.11
Oct 1, 2015
c08cf43
Added 10.11.1 support
Oct 1, 2015
a344a23
Added 10.11 support for nvidia
Oct 1, 2015
6497fea
Support for 10.11.1 (non beta)
Floris497 Oct 22, 2015
5dff97d
Added IOKit patch for OS X 10.11.2.
rasmi Dec 9, 2015
d01a0dc
Merge pull request #19 from rasmi/patch-1
Floris497 Dec 10, 2015
f7c2831
Updated 10.11.3 string no chance to script.
Floris497 Jan 20, 2016
f19d4d4
10.11.3 support and 10.11.4 Beta support
Floris497 Jan 24, 2016
ac1a3b2
Added some SIP instructions to the readme
Floris497 Jan 24, 2016
8174795
Added link to version 2 to read me
Floris497 Jan 24, 2016
32264c2
Update README.md
Floris497 Mar 26, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

.DS_Store
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
### There is a [Version 2](https://github.com/Floris497/mac-pixel-clock-patch-V2) of this patch availible that is made to replace this script in its intirety.. therefore this script is not being maintained anymore.

### for 10.11.4 support and up use Version 2 of this script.

Mac Pixel Clock Patcher
=====

Updated with Yosemite Beta support!
Updated with El Capitan support!

This will remove the 165 pixel clock limiter on your display driver to support 4k @ 30Hz over HDMI.
An [Active DisplayPort to HDMI adapter](http://www.amazon.com/gp/product/B00DOZHLAA/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B00DOZHLAA&linkCode=as2&tag=makeramencom-20&linkId=TR5RNZEM24Z7KP7N) is often needed for this to work.
An [Active DisplayPort to HDMI adapter](http://www.amazon.com/gp/product/B00DOZHLAA/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B00DOZHLAA&linkCode=as2&tag=makeramencom-20&linkId=TR5RNZEM24Z7KP7N) is sometimes needed for this to work.

Original forum thread [here](https://github.com/vinc3m1/mac-pixel-clock-patch).

Expand All @@ -16,6 +20,17 @@ Based on the [original](https://code.google.com/p/mac-pixel-clock-patch/wiki/Doc
How to install this patch
=====

#####MAKE SURE TO DISABLE SIP on 10.11 and newer.

First make sure SIP (System Integrity Protection) is turned off for this to work.
You can disable/enable this only when you boot into the recovery partition.
If you booted into the recovery partition and open the terminal you use ```csrutil disable``` to disable, ```csrutil enable``` to enable and ```csrutil status``` to check the status of SIP you can also check the status on your normal system.
the changes to SIP are only visible in the terminal after a reboot, so it will still notify you that SIP is on when you disable it and run ```csrutil status``` right after it.

SIP can safely be enabled after the patch of the IOKit, if you also want to use an Nvidia/AMD driver that has been patched you need to keep SIP disabled. this is because SIP will not allow you to run drivers which have a broken or no codesignature. by patching the driver we obviously break the codesignature.
kernal extensions are not signable by anyone but apple and trusted parties. so SIP needs to be off for them to load.
IOKit is not a kernel extension and therefore must be codesigned to run, this is done with the wildcard certificat, unique to everyone. even with SIP disabled the IOKit will not run without this new codesignature. the script takes care of the codesigning of the IOKit.

Download the `.command` file

Download it into your Downloads folder. Open Terminal and run:
Expand All @@ -35,7 +50,7 @@ Pay attention to the output - it should say it detected unpatched IOKit and NVID

Reboot your system.

After reboot, you should be able to get custom resolutions with over 165 MHz pixel clock to work using SwitchResX (not required after 10.9).
After reboot, you should be able to get custom resolutions with over 165 MHz pixel clock to work using SwitchResX.


Instructions for updating the command for newer versions of IOKit
Expand Down Expand Up @@ -126,8 +141,8 @@ offset 0x0000039D will be in the instruction stream as 0x9D 0x03 0x00 0x00
So, finally, the existing instruction is `JNE +925`, or `JNE +0x39D`, which is
encoded as:
```
(0F 85) JNE (9D 39 00 00) +925
0F 85 9D 39 00 00
(0F 85) JNE (9D 03 00 00) +925
0F 85 9D 03 00 00
```

The instructions we want to replace it with are `JMP +900`, `NOP`, or `JMP +0x384`,
Expand Down
226 changes: 217 additions & 9 deletions macPixelClockPatcher.command
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,29 @@ iokit_md5_10_8_4=233a4256b845b647b151739c87070695
iokit_md5_10_8_5_12F45=5d69bf9227997dfad5e48fa87bd14598
iokit_md5_10_9_1=d085445f30410008593a65ef4b5f9889
iokit_md5_10_9_2=9804392bbe8ba4b589175be56889c6c7
iokit_md5_10_10_beta=62195c9c8a2ddcf34b70d872afbd2835
iokit_md5_10_9_3=9a86b6708569360f3156b53cc4f205d9
iokit_md5_10_9_4=6105cc8f503b589f8b3ce2d3917ad150
iokit_md5_10_10_BETA_8=1fe4ef08632ca0e685beb622330ec027
iokit_md5_10_10_BETA_4A379a=440d2f2e11286ae1356e30d37cbd56c5
iokit_md5_10_10=2a8cbc2f6616d3f7a5e499bd2d5593ab
iokit_md5_10_10_2=a94dc8e1b6bb6491e5f610f0a3caf960
iokit_md5_10_10_3=29d7632362b2fa4993156717671a5642

iokit_md5_10_11_B1=2e32fac0525c7d93ddd38f1202515d99
iokit_md5_10_11_B2=516bea2790cd6bfcb41959aa66122623
iokit_md5_10_11_B3=15f9046ff25c807b7c76db8cdaf6ae4c
iokit_md5_10_11_B5=798a8e362e89e38e8f9cf6e59fda5184
iokit_md5_10_11_B6=fd1d5161af223a95452ee90f294eb8ba
iokit_md5_10_11_B7=c8b8830d495a2ba76e99f50e17b9f9ef
iokit_md5_10_11_B8=3b91046e15867c7db44b8d699db8a5cf
iokit_md5_10_11=131978134faf623c7803458c2a204d60
iokit_md5_10_11_1B=cd40217cd8d2ed8f16fa4ca513253109
iokit_md5_10_11_1=7359b413a4dca7a189b80da750ce43dd
iokit_md5_10_11_2=a7afb2dd9df1e4c48f12b4b52f7da212

iokit_md5_10_11_3=3cec8ae287ee52a3622082bfc049bb86
iokit_md5_10_11_4B_15E27e=af00c155d23f24d5058f06bdfedf1066


iokit_md5_10_7_4_patched=92eb38917f6ec4f341bff6fd1b6076ed
iokit_md5_10_7_5_patched=b5b15d1ed5a404962bc7de895a0df56a
Expand All @@ -19,17 +41,24 @@ iokit_md5_10_8_4_patched=8c70a0ca62bf65e9ffa8667e2871c287
iokit_md5_10_8_5_12F45_patched=de3ad8279077c675ae8093193deb253f
iokit_md5_10_9_1_patched=0962001659a2031c2425206d9239bda4
iokit_md5_10_9_2_patched=45d8fc0e1210f0672297a7716478990e
iokit_md5_10_10_beta_patched=a1f6bdb69ac043f8ed3e3c86415b9b20

# from 10.9.4 patched md5's can not be determined due to codesigning

nvda_md5_10_8_3=6a2d5017b6ddd3d19de2f4039d4c88ec
nvda_md5_10_8_4=b553fd25b25d2262317e9de758888d2b
nvda_md5_10_8_5_12F45=f84d891f1a67aa278453be59a6e1fece
nvda_md5_10_9_1=6de28959ec948513c239b1bf31205465
nvda_md5_10_10_5=9b584e820da1b7a0a32416d4c6e34886
nvda_md5_10_11=77ad2ec58403088bbe026dd2ada737c0
nvda_md5_10_11_1=1ecb016bc5b4ed7b7949d87e4f3f234a

nvda_md5_10_8_3_patched=7e8372fca35c5e7db90a229e70709d58
nvda_md5_10_8_4_patched=3c552ba24fa89b2ea892dd711088e8d5
nvda_md5_10_8_5_12F45_patched=5e65da83006468e8a69ef60a180ea08d
nvda_md5_10_9_1_patched=bbb0885323ea3221150839782fbd553f
nvda_md5_10_10_5_patched=8cc9299149c3ab99fe6def45366ecb40
nvda_md5_10_11_patched=334875e37ab36a1a9d6a4bde4dce78f5
nvda_md5_10_11_1_patched=b6babc8ca4f03bdb2552bb01c51770b1

amd_md5_10_9_1=693bffd29de3e5af0f49ae02f9d6a319

Expand Down Expand Up @@ -70,9 +99,7 @@ if [ "$iokit_md5_current" = "$iokit_md5_10_9_2_patched" ]; then
echo "Detected patched IOKit on 10.9.2, no action taken."
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_10_beta_patched" ]; then
echo "Detected patched IOKit on 10.10 beta, no action taken."
fi
# from 10.9.4 the patched md5 cannot be determined due to the codesigning

if [ "$nvda_md5_current" = "$nvda_md5_10_8_3_patched" ]; then
echo "Detected patched NVIDIA driver on 10.8.3, no action taken."
Expand All @@ -93,6 +120,18 @@ if [ "$nvda_md5_current" = "$nvda_md5_10_9_1_patched" ]; then
echo "Detected patched NVIDIA driver on 10.9.1, no action taken."
fi

if [ "$nvda_md5_current" = "$nvda_md5_10_10_5_patched" ]; then
echo "Detected patched NVIDIA driver on 10.10.5, no action taken."
fi

if [ "$nvda_md5_current" = "$nvda_md5_10_11_patched" ]; then
echo "Detected patched NVIDIA driver on 10.11, no action taken."
fi

if [ "$nvda_md5_current" = "$nvda_md5_10_11_1_patched" ]; then
echo "Detected patched NVIDIA driver on 10.11.1, no action taken."
fi


if [ "$amd_md5_current" = "$amd_md5_10_9_1_patched" ]; then
echo "Detected patched AMD Driver on 10.9.1, no action taken."
Expand Down Expand Up @@ -148,13 +187,166 @@ if [ "$iokit_md5_current" = "$iokit_md5_10_9_2" ]; then
fi


if [ "$iokit_md5_current" = "$iokit_md5_10_10_beta" ]; then
echo "Detected unpatched IOKit on 10.10 beta, patching."
sudo perl -i.bak -pe '$before = qr"\x0F\x85\x9E\x03\x00\x00"s;s/$before/\xE9\x83\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
if [ "$iokit_md5_current" = "$iokit_md5_10_9_3" ]; then
echo "Detected unpatched IOKit on 10.9.3, patching."
sudo perl -i.bak -pe '$before = qr"\x0F\x85\x9D\x03\x00\x00"s;s/$before/\xE9\x84\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
fi


if [ "$iokit_md5_current" = "$iokit_md5_10_9_4" ]; then
echo "Detected unpatched IOKit on 10.9.4, patching."
sudo perl -i.bak -pe '$before = qr"\x0F\x85\x9D\x03\x00\x00"s;s/$before/\xE9\x84\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_10_BETA_8" ]; then
echo "Detected unpatched IOKit on 10.10 Beta 8, patching."
sudo perl -i.bak -pe '$before = qr"\x0F\x85\x9E\x03\x00\x00"s;s/$before/\xE9\x83\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_10_BETA_4A379a" ]; then
echo "Detected unpatched IOKit on 10.10 Beta 4A379a, patching."
sudo perl -i.bak -pe '$before = qr"\x0F\x85\x9E\x03\x00\x00"s;s/$before/\xE9\x83\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_10" ]; then
echo "Detected unpatched IOKit on 10.10, patching."
sudo perl -i.bak -pe '$before = qr"\x0F\x85\x9E\x03\x00\x00"s;s/$before/\xE9\x83\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_10_2" ]; then
echo "Detected unpatched IOKit on 10.10.2, patching."
sudo perl -i.bak -pe '$before = qr"\x0F\x85\x9E\x03\x00\x00"s;s/$before/\xE9\x83\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_10_3" ]; then
echo "Detected unpatched IOKit on 10.10.3 or 10.10.4, patching."
sudo perl -i.bak -pe '$before = qr"\x0F\x85\x9E\x03\x00\x00"s;s/$before/\xE9\x83\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_11_B1" ]; then
echo "Detected unpatched IOKit on 10.11 BETA 1, patching."
sudo perl -i.bak -pe '$before = qr"\x0f\x85\x92\x03\x00\x00"s;s/$before/\xe9\x7a\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_11_B2" ]; then
echo "Detected unpatched IOKit on 10.11 BETA 2, patching."
sudo perl -i.bak -pe '$before = qr"\x0f\x85\x92\x03\x00\x00"s;s/$before/\xe9\x7a\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_11_B3" ]; then
echo "Detected unpatched IOKit on 10.11 BETA 3, patching."
sudo perl -i.bak -pe '$before = qr"\x0f\x85\x92\x03\x00\x00"s;s/$before/\xe9\x7a\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_11_B5" ]; then
echo "Detected unpatched IOKit on 10.11 BETA 5, patching."
sudo perl -i.bak -pe '$before = qr"\x0f\x85\x92\x03\x00\x00"s;s/$before/\xe9\x7a\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_11_B6" ]; then
echo "Detected unpatched IOKit on 10.11 BETA 6, patching."
sudo perl -i.bak -pe '$before = qr"\x0f\x85\x92\x03\x00\x00"s;s/$before/\xe9\x7a\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_11_B7" ]; then
echo "Detected unpatched IOKit on 10.11 BETA 7, patching."
sudo perl -i.bak -pe '$before = qr"\x0f\x85\x92\x03\x00\x00"s;s/$before/\xe9\x7a\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_11_B8" ]; then
echo "Detected unpatched IOKit on 10.11 BETA 8, patching."
sudo perl -i.bak -pe '$before = qr"\x0f\x85\x92\x03\x00\x00"s;s/$before/\xe9\x7a\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_11" ]; then
echo "Detected unpatched IOKit on 10.11, patching."
sudo perl -i.bak -pe '$before = qr"\x0f\x85\x92\x03\x00\x00"s;s/$before/\xe9\x7a\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_11_1B" ]; then
echo "Detected unpatched IOKit on 10.11.1 BETA, patching."
sudo perl -i.bak -pe '$before = qr"\x0f\x85\x92\x03\x00\x00"s;s/$before/\xe9\x7a\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_11_1" ]; then
echo "Detected unpatched IOKit on 10.11.1, patching."
sudo perl -i.bak -pe '$before = qr"\x0f\x85\x92\x03\x00\x00"s;s/$before/\xe9\x7a\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_11_2" ]; then
echo "Detected unpatched IOKit on 10.11.2, patching."
sudo perl -i.bak -pe '$before = qr"\x0f\x85\x92\x03\x00\x00"s;s/$before/\xe9\x7a\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_11_3" ]; then
echo "Detected unpatched IOKit on 10.11.3, patching."
sudo perl -i.bak -pe '$before = qr"\x0f\x85\x92\x03\x00\x00"s;s/$before/\xe9\x7a\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi

if [ "$iokit_md5_current" = "$iokit_md5_10_11_4B_15E27e" ]; then
echo "Detected unpatched IOKit on 10.11.4 Beta (15E27e), patching."
sudo perl -i.bak -pe '$before = qr"\x0f\x85\x92\x03\x00\x00"s;s/$before/\xe9\x7a\x03\x00\x00\x90/g' /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
sudo touch /System/Library/Extensions
# Now appears to require re-signing, despite not being in CodeResources
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
fi


if [ "$nvda_md5_current" = "$nvda_md5_10_8_3" ]; then
echo "Detected unpatched NVIDIA driver on 10.8.3, patching."
sudo perl -i.bak -pe '$oldLimit1 = qr"\xC7\x82\xC8\x00\x00\x00\x88\x84\x02\x00"s;$newLimit1 = "\xC7\x82\xC8\x00\x00\x00\x80\x1A\x06\x00";$oldLimit2 = qr"\xC7\x82\x10\x01\x00\x00\x88\x84\x02\x00"s;$newLimit2 = "\xC7\x82\x10\x01\x00\x00\x80\x1A\x06\x00";s/$oldLimit1/$newLimit1/g;s/$oldLimit2/$newLimit2/g' /System/Library/Extensions/NVDAGK100Hal.kext/Contents/MacOS/NVDAGK100Hal
Expand Down Expand Up @@ -182,10 +374,26 @@ if [ "$nvda_md5_current" = "$nvda_md5_10_9_1" ]; then
sudo touch /System/Library/Extensions
fi

if [ "$nvda_md5_current" = "$nvda_md5_10_10_5" ]; then
echo "Detected unpatched NVIDIA driver on 10.10.5, patching."
sudo perl -i.bak -pe '$oldLimit1 = qr"\xC7\x82\xD0\x00\x00\x00\x88\x84\x02\x00"s;$newLimit1 = "\xC7\x82\xD0\x00\x00\x00\x80\x1A\x06\x00";$oldLimit2 = qr"\xC7\x82\x20\x01\x00\x00\x88\x84\x02\x00"s;$newLimit2 = "\xC7\x82\x20\x01\x00\x00\x80\x1A\x06\x00";s/$oldLimit1/$newLimit1/g;s/$oldLimit2/$newLimit2/g' /System/Library/Extensions/NVDAGK100Hal.kext/Contents/MacOS/NVDAGK100Hal
sudo touch /System/Library/Extensions
fi

if [ "$nvda_md5_current" = "$nvda_md5_10_11_1" ]; then
echo "Detected unpatched NVIDIA driver on 10.11.1, patching."
sudo perl -i.bak -pe '$oldLimit1 = qr"\xC7\x82\xD0\x00\x00\x00\x88\x84\x02\x00"s;$newLimit1 = "\xC7\x82\xD0\x00\x00\x00\x80\x1A\x06\x00";$oldLimit2 = qr"\xC7\x82\x20\x01\x00\x00\x88\x84\x02\x00"s;$newLimit2 = "\xC7\x82\x20\x01\x00\x00\x80\x1A\x06\x00";s/$oldLimit1/$newLimit1/g;s/$oldLimit2/$newLimit2/g' /System/Library/Extensions/NVDAGK100Hal.kext/Contents/MacOS/NVDAGK100Hal
sudo touch /System/Library/Extensions
fi

if [ "$nvda_md5_current" = "$nvda_md5_10_11" ]; then
echo "Detected unpatched NVIDIA driver on 10.11, patching."
sudo perl -i.bak -pe '$oldLimit1 = qr"\xC7\x82\xD0\x00\x00\x00\x88\x84\x02\x00"s;$newLimit1 = "\xC7\x82\xD0\x00\x00\x00\x80\x1A\x06\x00";$oldLimit2 = qr"\xC7\x82\x20\x01\x00\x00\x88\x84\x02\x00"s;$newLimit2 = "\xC7\x82\x20\x01\x00\x00\x80\x1A\x06\x00";s/$oldLimit1/$newLimit1/g;s/$oldLimit2/$newLimit2/g' /System/Library/Extensions/NVDAGK100Hal.kext/Contents/MacOS/NVDAGK100Hal
sudo touch /System/Library/Extensions
fi

if [ "$amd_md5_current" = "$amd_md5_10_9_1" ]; then
echo "Detected unpatched AMD driver on 10.9.1, patching."
sudo perl -i.bak -pe '$oldLimit1 = qr"\x75\x0C\x49\x81\x7E\x28\x40\xB3\xD5\x09"s;$newLimit1 = "\x75\x0C\x49\x81\x7E\x28\x00\x84\xD7\x17";$oldLimit2 = qr"\xFF\xFF\x48\x81\x7D\x80\x41\xB3\xD5\x09"s;$newLimit2 = "\xFF\xFF\x48\x81\x7D\x80\x01\x84\xD7\x17";s/$oldLimit1/$newLimit1/g;s/$oldLimit2/$newLimit2/g' /System/Library/Extensions/AMDSupport.kext/Contents/MacOS/AMDSupport
sudo touch /System/Library/Extensions
fi