Floris497 / mac-pixel-clock-patch-V2

993 stars 221 forks source link

Patch for High Sierra? #211

Open scottsanett opened 7 years ago

scottsanett commented 7 years ago

I could be doing it wrong but the core display patch does not seem to be working for High Sierra. Will there be any update/fix for this?

Floris497 commented 7 years ago

Could you try and force the latest version? (CoreDisplay.command patch v2)

scottsanett commented 7 years ago

That doesn't seem to work. The brightness change is noticeable but then I'm just stuck before the Apple logo splash screen appears.

Floris497 commented 7 years ago

Hm, so you are not able to boot into Mac OS anymore?

scottsanett commented 7 years ago

Doesn't seem I can. I also deleted 0x12345678 from clover like I did with 10.12.

scottsanett commented 7 years ago

Just a side note, the patch returns something with a similar idea that something is the same (can't remember what that something was). I can't remember the exact wording of it but I hope you understand why I mean.

Floris497 commented 7 years ago

Hm, so did it tell you the patch was probably successful or that the new file is still the same so that the patch didn't work. I will quickly test it..

scottsanett commented 7 years ago

Seems like I got the latter one.

Floris497 commented 7 years ago

Yep the patch has changed I can see.. I need to calculate a new one.. (also my mistake the last version is v3 not v2 but that does not change the difference that I need to make a v4) give me some time and I'll return with an update :)

scottsanett commented 7 years ago

Actually I forced it with v3 right after I opened the issue before I saw your reply and no surprise that didn't work either... Anyhow, looking forward to your update!

Floris497 commented 7 years ago

That was noticeable more difficult than previous times big changes in CoreDisplay and they removed almost all the naming in the executible.. (I thought I would not be able to find it..) I added a v4 to the script you can use it manually. please use with care.. because I have no idea if it will work as intended :)

scottsanett commented 7 years ago

I patched it with v4 and got "The code is still the same.. Patch did seem to run, but was probbably from the wrong version" again. I'm posting the md5 here just in case.

otool CoreDisplay: 961f97847f5234ea98cf97acb545be54 otool CoreDisplay.bak: 961f97847f5234ea98cf97acb545be54 CoreDisplay: 14f13ac79120596e4f0ac1a43fe8d4b1 CoreDisplay.bak: b869a07a5efef0a1feff93c58fa476e6

Floris497 commented 7 years ago

Uhg.. let me have a look when I get to my PC.. first some breakfast :)

scottsanett commented 7 years ago

I wonder if there is any tutorial/manual explaining the rationale of the perl script? I was just reading the instructions to patch later versions of Core Display from the original mac-pixel-clock-patch repo and tried it myself and that didn't work.

Floris497 commented 7 years ago

Yes, exactly the IOKit thing is exactly the same.. but since now the code has changed a lot.. (maybe they are porting to Swift.. this removes most of the naming that was still available.. making it quite difficult to find the part of assembly that needs to be changed..) I will quickly test what I did wrong and come back to you.. sorry I kinda forgot to look at it..

Floris497 commented 7 years ago

Also it seems I'm not on the latest version of 10.13.. I'm on beta 5 so I will update to 7 now

Floris497 commented 7 years ago

Oh my bad.. I didn't fully enable v4 patch... and it looks like that the new patch does not work on beta 7.. let the search start again..

Floris497 commented 7 years ago

It should now be working for 10.13 Beta 7

scottsanett commented 7 years ago

The code did seem to run. I diff'ed the two disassembled files and could see the changes. But after I cleared the field under ig-platform-id I was still stuck at the black screen.

Floris497 commented 7 years ago

Wait but it does work without the patch?

Floris497 commented 7 years ago

Btw, tell me what hardware you are running exactly and your platform id

scottsanett commented 7 years ago

Oops I was going to say I cleared the field under IntelGFX, not the ig-platform-id. I'm running Intel 6829hq with HD530 graphics. The platform-id I was using is 0x191b0000, but now I'm gonna give 0x19120000 a shot (which is what I use for 10.12) I will update as soon as I finish the test.

Floris497 commented 7 years ago

Hm. I see, I have never played around with the ig-platform-id on my hack.. what time zone are you in?

scottsanett commented 7 years ago

So after I changed the platform id to 0x19120000 the black screen full of white characters was cleared and I was stuck at a fully black screen (with a slightly lighter hue) instead.

Does it work without the patch?

It doesn't seem so... I'm either stuck at a black screen with white characters, or the scenario described above (due to different platform ids), or a white block on the top-left corner of the black screen after it's cleared.

I'm in China Standard.

Floris497 commented 7 years ago

So it looks like your problem isn't my patch :) this is good then :) have other people attempted 10.13 with the same build? (And what do you see when you remote in to your computer when it's black screened?)

scottsanett commented 7 years ago

That seems to be the case. The patch is doing what it's supposed to do (redirecting the code to 0x1255a). I don't think many have tried installing high sierra on 4K laptops yet. Will try remoting later. This has been a lot harder than I expected.

grigorovich commented 7 years ago

MacOS 10.13 Beta (17A360a) . Public Beta 8 (not DB) So. What "patch v#" I can to try ?

scottsanett commented 7 years ago

@grigorovich Turns out the patch for HS is the same for Sierra. Try apply this manually in your terminal:

sudo perl -i.bak -pe 's|\xB8\x01\x00\x00\x00\xF6\xC1\x01\x0F\x85|\x33\xC0\x90\x90\x90\x90\x90\x90\x90\xE9|sg' /System/Library/Frameworks/CoreDisplay.framework/Versions/Current/CoreDisplay
sudo codesign -f -s - /System/Library/Frameworks/CoreDisplay.framework/Versions/Current/CoreDisplay

Beware, this patch breaks copy and paste and does not go well with iTunes.

grigorovich commented 7 years ago

@scottsanett Patch works well. But what happened with "copy/paste" ?

scottsanett commented 7 years ago

Not sure if it is only me but i can't copy/paste after the patch is applied. iTunes also crashes whenever I open it.

grigorovich commented 7 years ago

@scottsanett Right. Me too. I tried vanila coredisplay.framework (and rebuilt cache) and copy/past works... So it could be help for somebody

scottsanett commented 7 years ago

@grigorovich but then the patch is gone isn't it?

Floris497 commented 7 years ago

Well, there is a patch v4 that should work with the Beta's

Floris497 commented 7 years ago

@scottsanett older patched can always be accessed by patch.command patch vX for example: CoreDisplay-patcher.command patch v3

grigorovich commented 7 years ago

@scottsanett 2560x1080 display works in 1920x1080 right now. CoreDisplay not patched and i will wait for release bcoz "copy/paste" much more important for me than resolution

@Floris497 patch v3 works but "copy/paste" around all macos system stop work. I think @scottsanett caught that "feature" of new security method of "kernel/kext cache" specially for 10.13 ... Its just my opinion

scottsanett commented 7 years ago

@grigorovich Have you had any problem with iTunes with a patched CoreDisplay?

grigorovich commented 7 years ago

@scottsanett yes. But it crashed not always... Like randomly 50/50 and i just try to play only aac.. I have not patched coredisplay and all works stable right now (except resolution of second display)

scottsanett commented 7 years ago

@grigorovich iTunes crashes pretty much all the time here... But I do think the crashes and the patch are at least somewhat related.

grigorovich commented 7 years ago

In "Copy/Paste" problem i saw that in log: process: pboard *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** initialization method -initWithFormat:locale:arguments: cannot be sent to an abstract object of class NSString: Create a concrete instance!' *** First throw call stack: ( 0 CoreFoundation 0x00007fff4cc170fb __exceptionPreprocess + 171 1 libobjc.A.dylib 0x00007fff734c5c76 objc_exception_throw + 48 2 CoreFoundation 0x00007fff4cca8bfd +[NSException raise:format:] + 205 3 Foundation 0x0000000106605608 -[NSString initWithFormat:locale:arguments:] + 14 4 Foundation 0x00000001064181ad +[NSString stringWithFormat:] + 169 5 Foundation 0x0000000106433827 -[NSArray(NSArray) encodeWithCoder:] + 816 6 Foundation 0x00007fff4ec0493e -[NSXPCEncoder _encodeObject:] + 578 7 UserActivity 0x00007fff701d349d -[UASharedPasteboard<…>

and then plenty apps (WiFiAgent, Finder, AppleShell,Safari... 20+) reports about pboard like : Connection to 'pboard' server had an error: <error: 0x7fffad7b6c40> { count = 1, transaction: 0, voucher = 0x0, contents = "XPCErrorDescription" => <string: 0x7fffad7b6fb0> { length = 22, contents = "Connection interrupted" } }

So i think its common problem outside of 'pixel clock patch' ...

scottsanett commented 7 years ago

@grigorovich But pboard doesn't crash without the patch, no?

grigorovich commented 7 years ago

@scottsanett doesn't. i think its kernel/security issue bcoz pboard works fine on macbook with macos PB8 w/o patched coredisplay.

scottsanett commented 6 years ago

@grigorovich I replaced the patch with CoreDisplayFixup.kext and Lilu.kext (and unpatched CoreDisplay). Copy and paste now works. iTunes still crashes though.

gothickitty93 commented 6 years ago

@Floris497 CoreDisplay for High Sierra GM should have accidentally found it's way to your email.

Floris497 commented 6 years ago

I'll start testing tomorrow.. I just finished another project :)

TheTrollCaptain commented 6 years ago

I finally got patchv4 to run and it said that it was applied successfully. However, macOS didn't boot... So I rebuilt the CoreDisplay Framework Manually on another Mac (Replaced new with .bak). It started to boot again.

I decided to try and patch it one last time before I confirmed it as an issue. Patched it with v4 again, rebooted in verbose. It leaves me hanging on: _IOConsoleUsers: getIOScreenLockState3, hs 0, bs 0, now 0, sm 0x0

Before upgrading to 10.13 tonight, I had the patch working on 10.12.6. Of course, updating broke it so I repatched it with patch v4. So am I doing something wrong? I think this might just be a compatibility issue, but just want to make sure.

macOS 10.13 (Build 17A365) Intel HD 4400 ig-platform id = 0x0d220003 IntelGFX = 0x04128086

Floris497 commented 6 years ago

Ehm.. Patch 4 isn't ready.. it's at least breaking copy paste.. some fix might be in the issues but I had no time figuring it out already

cbjerg commented 6 years ago

Tried v4 and it broke the core display. It didn’t create a backup. Anybody want to send me CoreDisplay from fresh High Sierra

Floris497 commented 6 years ago

There is a backup in the same location replace it with mv file.bak file

cbjerg commented 6 years ago

There was no Bak file created. I am looking for it now in the CoreDisplay.framework/Versions/A/ location

Floris497 commented 6 years ago

Hm.. let me check.. (you can just reinstall macOS, probably fastest way to fix it)

cbjerg commented 6 years ago

There was a bak file. Just not visible to "ls -la" I ran the command and got back in. Thank you. Waiting for patch to be updated then